@@ -771,24 +771,23 @@ gen_set_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE compt
771
771
struct rb_iv_index_tbl_entry * ent ;
772
772
struct st_table * iv_index_tbl = ROBJECT_IV_INDEX_TBL (comptime_receiver );
773
773
774
- // Bail if this is a heap object, because this needs a write barrier
775
- ADD_COMMENT (cb , "guard value is immediate" );
776
- test (cb , REG1 , imm_opnd (RUBY_IMMEDIATE_MASK ));
777
- jz_ptr (cb , COUNTED_EXIT (side_exit , setivar_val_heapobject ));
778
-
779
774
// Lookup index for the ivar the instruction loads
780
775
if (iv_index_tbl && rb_iv_index_tbl_lookup (iv_index_tbl , id , & ent )) {
781
776
uint32_t ivar_index = ent -> index ;
782
777
783
778
x86opnd_t val_to_write = ctx_stack_pop (ctx , 1 );
784
779
mov (cb , REG1 , val_to_write );
785
780
786
- x86opnd_t flags_opnd = member_opnd (REG0 , struct RBasic , flags );
781
+ // Bail if the value to write is a heap object, because this needs a write barrier
782
+ ADD_COMMENT (cb , "guard value is immediate" );
783
+ test (cb , REG1 , imm_opnd (RUBY_IMMEDIATE_MASK ));
784
+ jz_ptr (cb , COUNTED_EXIT (side_exit , setivar_val_heapobject ));
787
785
788
786
// Bail if this object is frozen
789
787
ADD_COMMENT (cb , "guard self is not frozen" );
788
+ x86opnd_t flags_opnd = member_opnd (REG0 , struct RBasic , flags );
790
789
test (cb , flags_opnd , imm_opnd (RUBY_FL_FREEZE ));
791
- jz_ptr (cb , COUNTED_EXIT (side_exit , setivar_frozen ));
790
+ jnz_ptr (cb , COUNTED_EXIT (side_exit , setivar_frozen ));
792
791
793
792
// Pop receiver if it's on the temp stack
794
793
if (!reg0_opnd .is_self ) {
0 commit comments