@@ -3323,15 +3323,20 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
33233323 }
33243324 YARVINSN_getinstancevariable => {
33253325 let id = ID ( get_arg ( pc, 0 ) . as_u64 ( ) ) ;
3326+
33263327 // ic is in arg 1
33273328 let exit_id = fun. push_insn ( block, Insn :: Snapshot { state : exit_state } ) ;
3329+ // TODO: We only really need this if self_val is a class/module
3330+ fun. push_insn ( block, Insn :: PatchPoint { invariant : Invariant :: SingleRactorMode , state : exit_id } ) ;
33283331 let result = fun. push_insn ( block, Insn :: GetIvar { self_val : self_param, id, state : exit_id } ) ;
33293332 state. stack_push ( result) ;
33303333 }
33313334 YARVINSN_setinstancevariable => {
33323335 let id = ID ( get_arg ( pc, 0 ) . as_u64 ( ) ) ;
33333336 // ic is in arg 1
33343337 let exit_id = fun. push_insn ( block, Insn :: Snapshot { state : exit_state } ) ;
3338+ // TODO: We only really need this if self_val is a class/module
3339+ fun. push_insn ( block, Insn :: PatchPoint { invariant : Invariant :: SingleRactorMode , state : exit_id } ) ;
33353340 let val = state. stack_pop ( ) ?;
33363341 fun. push_insn ( block, Insn :: SetIvar { self_val : self_param, id, val, state : exit_id } ) ;
33373342 }
@@ -5044,9 +5049,10 @@ mod tests {
50445049 assert_snapshot ! ( hir_string( "test" ) , @r"
50455050 fn test@<compiled>:2:
50465051 bb0(v0:BasicObject):
5047- v3:BasicObject = GetIvar v0, :@foo
5052+ PatchPoint SingleRactorMode
5053+ v4:BasicObject = GetIvar v0, :@foo
50485054 CheckInterrupts
5049- Return v3
5055+ Return v4
50505056 " ) ;
50515057 }
50525058
@@ -5061,6 +5067,7 @@ mod tests {
50615067 fn test@<compiled>:2:
50625068 bb0(v0:BasicObject):
50635069 v2:Fixnum[1] = Const Value(1)
5070+ PatchPoint SingleRactorMode
50645071 SetIvar v0, :@foo, v2
50655072 CheckInterrupts
50665073 Return v2
@@ -5336,12 +5343,15 @@ mod tests {
53365343 v1:NilClass = Const Value(nil)
53375344 v2:NilClass = Const Value(nil)
53385345 v3:NilClass = Const Value(nil)
5339- v6:BasicObject = GetIvar v0, :@a
5340- v8:BasicObject = GetIvar v0, :@b
5341- v10:BasicObject = GetIvar v0, :@c
5342- v12:ArrayExact = NewArray v6, v8, v10
5346+ PatchPoint SingleRactorMode
5347+ v7:BasicObject = GetIvar v0, :@a
5348+ PatchPoint SingleRactorMode
5349+ v10:BasicObject = GetIvar v0, :@b
5350+ PatchPoint SingleRactorMode
5351+ v13:BasicObject = GetIvar v0, :@c
5352+ v15:ArrayExact = NewArray v7, v10, v13
53435353 CheckInterrupts
5344- Return v12
5354+ Return v15
53455355 " ) ;
53465356 assert_contains_opcode ( "reverse_even" , YARVINSN_opt_reverse ) ;
53475357 assert_snapshot ! ( hir_string( "reverse_even" ) , @r"
@@ -5351,13 +5361,17 @@ mod tests {
53515361 v2:NilClass = Const Value(nil)
53525362 v3:NilClass = Const Value(nil)
53535363 v4:NilClass = Const Value(nil)
5354- v7:BasicObject = GetIvar v0, :@a
5355- v9:BasicObject = GetIvar v0, :@b
5356- v11:BasicObject = GetIvar v0, :@c
5357- v13:BasicObject = GetIvar v0, :@d
5358- v15:ArrayExact = NewArray v7, v9, v11, v13
5364+ PatchPoint SingleRactorMode
5365+ v8:BasicObject = GetIvar v0, :@a
5366+ PatchPoint SingleRactorMode
5367+ v11:BasicObject = GetIvar v0, :@b
5368+ PatchPoint SingleRactorMode
5369+ v14:BasicObject = GetIvar v0, :@c
5370+ PatchPoint SingleRactorMode
5371+ v17:BasicObject = GetIvar v0, :@d
5372+ v19:ArrayExact = NewArray v8, v11, v14, v17
53595373 CheckInterrupts
5360- Return v15
5374+ Return v19
53615375 " ) ;
53625376 }
53635377
@@ -7421,9 +7435,10 @@ mod opt_tests {
74217435 assert_snapshot ! ( hir_string( "test" ) , @r"
74227436 fn test@<compiled>:2:
74237437 bb0(v0:BasicObject):
7424- v3:BasicObject = GetIvar v0, :@foo
7438+ PatchPoint SingleRactorMode
7439+ v4:BasicObject = GetIvar v0, :@foo
74257440 CheckInterrupts
7426- Return v3
7441+ Return v4
74277442 " ) ;
74287443 }
74297444
@@ -7436,6 +7451,7 @@ mod opt_tests {
74367451 fn test@<compiled>:2:
74377452 bb0(v0:BasicObject):
74387453 v2:Fixnum[1] = Const Value(1)
7454+ PatchPoint SingleRactorMode
74397455 SetIvar v0, :@foo, v2
74407456 CheckInterrupts
74417457 Return v2
0 commit comments