From b9f25b100f801a0f1d00dfa7afcd450eab58b411 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Mon, 12 Feb 2024 08:55:52 -0800 Subject: [PATCH] YJIT: Fix insufficient type guards (#9911) --- yjit/src/codegen.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index 322553cce13e98..ac8670fe407a5c 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -1658,7 +1658,7 @@ fn guard_object_is_array( asm.cmp(flags_opnd, (RUBY_T_ARRAY as u64).into()); asm.jne(Target::side_exit(counter)); - if Type::UnknownHeap.diff(object_type) != TypeDiff::Incompatible { + if Type::TArray.diff(object_type) != TypeDiff::Incompatible { asm.ctx.upgrade_opnd_type(object_opnd, Type::TArray); } } @@ -1690,7 +1690,7 @@ fn guard_object_is_hash( asm.cmp(flags_opnd, (RUBY_T_HASH as u64).into()); asm.jne(Target::side_exit(counter)); - if Type::UnknownHeap.diff(object_type) != TypeDiff::Incompatible { + if Type::THash.diff(object_type) != TypeDiff::Incompatible { asm.ctx.upgrade_opnd_type(object_opnd, Type::THash); } } @@ -1722,7 +1722,7 @@ fn guard_object_is_string( asm.cmp(flags_reg, Opnd::UImm(RUBY_T_STRING as u64)); asm.jne(Target::side_exit(counter)); - if Type::UnknownHeap.diff(object_type) != TypeDiff::Incompatible { + if Type::TString.diff(object_type) != TypeDiff::Incompatible { asm.ctx.upgrade_opnd_type(object_opnd, Type::TString); } }