@@ -511,6 +511,7 @@ pub enum SideExitReason {
511511 FixnumModByZero ,
512512 FixnumDivByZero ,
513513 BoxFixnumOverflow ,
514+ WriteBarrierRequired ,
514515}
515516
516517#[ derive( Debug , Clone , Copy ) ]
@@ -846,7 +847,7 @@ pub enum Insn {
846847 /// Get the block parameter as a Proc.
847848 GetBlockParam { level : u32 , ep_offset : u32 , state : InsnId } ,
848849 /// Set a local variable in a higher scope or the heap
849- SetLocal { level : u32 , ep_offset : u32 , val : InsnId } ,
850+ SetLocal { level : u32 , ep_offset : u32 , val : InsnId , state : InsnId } ,
850851 GetSpecialSymbol { symbol_type : SpecialBackrefSymbol , state : InsnId } ,
851852 GetSpecialNumber { nth : u64 , state : InsnId } ,
852853
@@ -1622,7 +1623,7 @@ impl<'a> std::fmt::Display for InsnPrinter<'a> {
16221623 & Insn :: IsBlockParamModified { level } => {
16231624 write ! ( f, "IsBlockParamModified l{level}" )
16241625 } ,
1625- & Insn :: SetLocal { val, level, ep_offset } => {
1626+ & Insn :: SetLocal { val, level, ep_offset, .. } => {
16261627 let name = get_local_var_name_for_printer ( self . iseq , level, ep_offset) . map_or ( String :: new ( ) , |x| format ! ( "{x}, " ) ) ;
16271628 write ! ( f, "SetLocal {name}l{level}, EP@{ep_offset}, {val}" )
16281629 } ,
@@ -2360,7 +2361,7 @@ impl Function {
23602361 & SetIvar { self_val, id, ic, val, state } => SetIvar { self_val : find ! ( self_val) , id, ic, val : find ! ( val) , state } ,
23612362 & GetClassVar { id, ic, state } => GetClassVar { id, ic, state } ,
23622363 & SetClassVar { id, val, ic, state } => SetClassVar { id, val : find ! ( val) , ic, state } ,
2363- & SetLocal { val, ep_offset, level } => SetLocal { val : find ! ( val) , ep_offset, level } ,
2364+ & SetLocal { val, ep_offset, level, state } => SetLocal { val : find ! ( val) , ep_offset, level, state } ,
23642365 & GetSpecialSymbol { symbol_type, state } => GetSpecialSymbol { symbol_type, state } ,
23652366 & GetSpecialNumber { nth, state } => GetSpecialNumber { nth, state } ,
23662367 & ToArray { val, state } => ToArray { val : find ! ( val) , state } ,
@@ -6478,7 +6479,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
64786479 let val = state. stack_pop ( ) ?;
64796480 if ep_escaped || has_blockiseq { // TODO: figure out how to drop has_blockiseq here
64806481 // Write the local using EP
6481- fun. push_insn ( block, Insn :: SetLocal { val, ep_offset, level : 0 } ) ;
6482+ fun. push_insn ( block, Insn :: SetLocal { val, ep_offset, level : 0 , state : exit_id } ) ;
64826483 } else if local_inval {
64836484 // If there has been any non-leaf call since JIT entry or the last patch point,
64846485 // add a patch point to make sure locals have not been escaped.
@@ -6495,7 +6496,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
64956496 }
64966497 YARVINSN_setlocal_WC_1 => {
64976498 let ep_offset = get_arg ( pc, 0 ) . as_u32 ( ) ;
6498- fun. push_insn ( block, Insn :: SetLocal { val : state. stack_pop ( ) ?, ep_offset, level : 1 } ) ;
6499+ fun. push_insn ( block, Insn :: SetLocal { val : state. stack_pop ( ) ?, ep_offset, level : 1 , state : exit_id } ) ;
64996500 }
65006501 YARVINSN_getlocal => {
65016502 let ep_offset = get_arg ( pc, 0 ) . as_u32 ( ) ;
@@ -6505,7 +6506,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
65056506 YARVINSN_setlocal => {
65066507 let ep_offset = get_arg ( pc, 0 ) . as_u32 ( ) ;
65076508 let level = get_arg ( pc, 1 ) . as_u32 ( ) ;
6508- fun. push_insn ( block, Insn :: SetLocal { val : state. stack_pop ( ) ?, ep_offset, level } ) ;
6509+ fun. push_insn ( block, Insn :: SetLocal { val : state. stack_pop ( ) ?, ep_offset, level, state : exit_id } ) ;
65096510 }
65106511 YARVINSN_getblockparamproxy => {
65116512 let level = get_arg ( pc, 1 ) . as_u32 ( ) ;
0 commit comments