summaryrefslogtreecommitdiff
path: root/yjit_codegen.c
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2021-07-14 12:42:29 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:38 -0400
commit53079ca585161b882b37945b31802f6d477bbb1e (patch)
tree8ad1d5f0c796f53756511785bd33bee7397734bd /yjit_codegen.c
parentf4f940e5a63e542a59fc7510332efb38ccafc10f (diff)
Return if fixnums impossible
Diffstat (limited to 'yjit_codegen.c')
-rw-r--r--yjit_codegen.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/yjit_codegen.c b/yjit_codegen.c
index 5d05cce365..2512f9f52d 100644
--- a/yjit_codegen.c
+++ b/yjit_codegen.c
@@ -1667,6 +1667,26 @@ guard_two_fixnums(ctx_t* ctx, uint8_t* side_exit)
val_type_t arg1_type = ctx_get_opnd_type(ctx, OPND_STACK(0));
val_type_t arg0_type = ctx_get_opnd_type(ctx, OPND_STACK(1));
+ if (arg0_type.is_heap || arg1_type.is_heap) {
+ jmp_ptr(cb, side_exit);
+ return;
+ }
+
+ if (arg0_type.type != ETYPE_FIXNUM && arg0_type.type != ETYPE_UNKNOWN) {
+ jmp_ptr(cb, side_exit);
+ return;
+ }
+
+ if (arg1_type.type != ETYPE_FIXNUM && arg1_type.type != ETYPE_UNKNOWN) {
+ jmp_ptr(cb, side_exit);
+ return;
+ }
+
+ RUBY_ASSERT(!arg0_type.is_heap);
+ RUBY_ASSERT(!arg1_type.is_heap);
+ RUBY_ASSERT(arg0_type.type == ETYPE_FIXNUM || arg0_type.type == ETYPE_UNKNOWN);
+ RUBY_ASSERT(arg1_type.type == ETYPE_FIXNUM || arg1_type.type == ETYPE_UNKNOWN);
+
// Get stack operands without popping them
x86opnd_t arg1 = ctx_stack_opnd(ctx, 0);
x86opnd_t arg0 = ctx_stack_opnd(ctx, 1);