@@ -4491,17 +4491,6 @@ impl Function {
44914491 self . push_insn ( block, Insn :: PatchPoint { invariant : Invariant :: MethodRedefined { klass : recv_class, method : method_id, cme } , state } ) ;
44924492 }
44934493
4494- /// Side exit back to the state after a block-backed send.
4495- /// Using the pre-send snapshot would re-execute the send in the interpreter.
4496- fn gen_post_send_no_ep_escape_patch_point ( & mut self , block : BlockId , state : & FrameState , insn_idx : u32 ) {
4497- let iseq = state. iseq ;
4498- let mut reload_state = state. clone ( ) ;
4499- reload_state. insn_idx = insn_idx as usize ;
4500- reload_state. pc = unsafe { rb_iseq_pc_at_idx ( iseq, insn_idx) } ;
4501- let reload_exit_id = self . push_insn ( block, Insn :: Snapshot { state : reload_state. without_locals ( ) } ) ;
4502- self . push_insn ( block, Insn :: PatchPoint { invariant : Invariant :: NoEPEscape ( iseq) , state : reload_exit_id } ) ;
4503- }
4504-
45054494 fn count_not_inlined_cfunc ( & mut self , block : BlockId , cme : * const rb_callable_method_entry_t ) {
45064495 let owner = unsafe { ( * cme) . owner } ;
45074496 let called_id = unsafe { ( * cme) . called_id } ;
@@ -6567,14 +6556,6 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
65676556 compile_jit_entry_block ( & mut fun, jit_entry_idx, target_block) ;
65686557 }
65696558
6570- // Check if the EP is escaped for the ISEQ from the beginning. We give up
6571- // optimizing locals in that case because they're shared with other frames.
6572- let ep_starts_escaped = iseq_escapes_ep ( iseq) ;
6573- // Check if the EP has been escaped at some point in the ISEQ. If it has, then we assume that
6574- // its EP is shared with other frames.
6575- let ep_has_been_escaped = crate :: invariants:: iseq_escapes_ep ( iseq) ;
6576- let ep_escaped = ep_starts_escaped || ep_has_been_escaped;
6577-
65786559 // Iteratively fill out basic blocks using a queue.
65796560 // TODO(max): Basic block arguments at edges
65806561 let mut queue = VecDeque :: new ( ) ;
@@ -7718,31 +7699,6 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
77187699 } ;
77197700 let send = fun. push_insn ( block, Insn :: Send { recv, cd, block : block_handler, args, state : exit_id, reason : Uncategorized ( opcode) } ) ;
77207701 state. stack_push ( send) ;
7721-
7722- if let Some ( BlockHandler :: BlockIseq ( _) ) = block_handler {
7723- // Reload locals that may have been modified by the blockiseq.
7724- // TODO: Avoid reloading locals that are not referenced by the blockiseq
7725- // or not used after this. Max thinks we could eventually DCE them.
7726- if !ep_escaped && !state. locals . is_empty ( ) {
7727- fun. gen_post_send_no_ep_escape_patch_point ( block, & state, insn_idx) ;
7728- }
7729- let mut base: Option < InsnId > = None ;
7730- for local_idx in 0 ..state. locals . len ( ) {
7731- let ep_offset = local_idx_to_ep_offset ( iseq, local_idx) ;
7732- let ep_offset_u32 = u32:: try_from ( ep_offset)
7733- . unwrap_or_else ( |_| panic ! ( "Could not convert ep_offset {ep_offset} to u32" ) ) ;
7734- let recv = * base. get_or_insert_with ( || {
7735- let base_insn = if !ep_escaped { Insn :: LoadSP } else { Insn :: GetEP { level : 0 } } ;
7736- fun. push_insn ( block, base_insn)
7737- } ) ;
7738- let val = if !ep_escaped {
7739- fun. get_local_from_sp ( block, recv, ep_offset_u32, types:: BasicObject )
7740- } else {
7741- fun. get_local_from_ep ( block, recv, ep_offset_u32, 0 , types:: BasicObject )
7742- } ;
7743- state. setlocal ( ep_offset_u32, val) ;
7744- }
7745- }
77467702 }
77477703 YARVINSN_sendforward => {
77487704 let cd: * const rb_call_data = get_arg ( pc, 0 ) . as_ptr ( ) ;
@@ -7766,29 +7722,6 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
77667722 let recv = state. stack_pop ( ) ?;
77677723 let send_forward = fun. push_insn ( block, Insn :: SendForward { recv, cd, blockiseq, args, state : exit_id, reason : SendForwardNotSpecialized } ) ;
77687724 state. stack_push ( send_forward) ;
7769-
7770- if !blockiseq. is_null ( ) {
7771- // Reload locals that may have been modified by the blockiseq.
7772- if !ep_escaped && !state. locals . is_empty ( ) {
7773- fun. gen_post_send_no_ep_escape_patch_point ( block, & state, insn_idx) ;
7774- }
7775- let mut base: Option < InsnId > = None ;
7776- for local_idx in 0 ..state. locals . len ( ) {
7777- let ep_offset = local_idx_to_ep_offset ( iseq, local_idx) ;
7778- let ep_offset_u32 = u32:: try_from ( ep_offset)
7779- . unwrap_or_else ( |_| panic ! ( "Could not convert ep_offset {ep_offset} to u32" ) ) ;
7780- let recv = * base. get_or_insert_with ( || {
7781- let base_insn = if !ep_escaped { Insn :: LoadSP } else { Insn :: GetEP { level : 0 } } ;
7782- fun. push_insn ( block, base_insn)
7783- } ) ;
7784- let val = if !ep_escaped {
7785- fun. get_local_from_sp ( block, recv, ep_offset_u32, types:: BasicObject )
7786- } else {
7787- fun. get_local_from_ep ( block, recv, ep_offset_u32, 0 , types:: BasicObject )
7788- } ;
7789- state. setlocal ( ep_offset_u32, val) ;
7790- }
7791- }
77927725 }
77937726 YARVINSN_invokesuper => {
77947727 let cd: * const rb_call_data = get_arg ( pc, 0 ) . as_ptr ( ) ;
@@ -7811,31 +7744,6 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
78117744 let blockiseq: IseqPtr = get_arg ( pc, 1 ) . as_ptr ( ) ;
78127745 let result = fun. push_insn ( block, Insn :: InvokeSuper { recv, cd, blockiseq, args, state : exit_id, reason : Uncategorized ( opcode) } ) ;
78137746 state. stack_push ( result) ;
7814-
7815- if !blockiseq. is_null ( ) {
7816- // Reload locals that may have been modified by the blockiseq.
7817- // TODO: Avoid reloading locals that are not referenced by the blockiseq
7818- // or not used after this. Max thinks we could eventually DCE them.
7819- if !ep_escaped && !state. locals . is_empty ( ) {
7820- fun. gen_post_send_no_ep_escape_patch_point ( block, & state, insn_idx) ;
7821- }
7822- let mut base: Option < InsnId > = None ;
7823- for local_idx in 0 ..state. locals . len ( ) {
7824- let ep_offset = local_idx_to_ep_offset ( iseq, local_idx) ;
7825- let ep_offset_u32 = u32:: try_from ( ep_offset)
7826- . unwrap_or_else ( |_| panic ! ( "Could not convert ep_offset {ep_offset} to u32" ) ) ;
7827- let recv = * base. get_or_insert_with ( || {
7828- let base_insn = if !ep_escaped { Insn :: LoadSP } else { Insn :: GetEP { level : 0 } } ;
7829- fun. push_insn ( block, base_insn)
7830- } ) ;
7831- let val = if !ep_escaped {
7832- fun. get_local_from_sp ( block, recv, ep_offset_u32, types:: BasicObject )
7833- } else {
7834- fun. get_local_from_ep ( block, recv, ep_offset_u32, 0 , types:: BasicObject )
7835- } ;
7836- state. setlocal ( ep_offset_u32, val) ;
7837- }
7838- }
78397747 }
78407748 YARVINSN_invokesuperforward => {
78417749 let cd: * const rb_call_data = get_arg ( pc, 0 ) . as_ptr ( ) ;
@@ -7858,31 +7766,6 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
78587766 let recv = state. stack_pop ( ) ?;
78597767 let result = fun. push_insn ( block, Insn :: InvokeSuperForward { recv, cd, blockiseq, args, state : exit_id, reason : InvokeSuperForwardNotSpecialized } ) ;
78607768 state. stack_push ( result) ;
7861-
7862- if !blockiseq. is_null ( ) {
7863- // Reload locals that may have been modified by the blockiseq.
7864- // TODO: Avoid reloading locals that are not referenced by the blockiseq
7865- // or not used after this. Max thinks we could eventually DCE them.
7866- if !ep_escaped && !state. locals . is_empty ( ) {
7867- fun. gen_post_send_no_ep_escape_patch_point ( block, & state, insn_idx) ;
7868- }
7869- let mut base: Option < InsnId > = None ;
7870- for local_idx in 0 ..state. locals . len ( ) {
7871- let ep_offset = local_idx_to_ep_offset ( iseq, local_idx) ;
7872- let ep_offset_u32 = u32:: try_from ( ep_offset)
7873- . unwrap_or_else ( |_| panic ! ( "Could not convert ep_offset {ep_offset} to u32" ) ) ;
7874- let recv = * base. get_or_insert_with ( || {
7875- let base_insn = if !ep_escaped { Insn :: LoadSP } else { Insn :: GetEP { level : 0 } } ;
7876- fun. push_insn ( block, base_insn)
7877- } ) ;
7878- let val = if !ep_escaped {
7879- fun. get_local_from_sp ( block, recv, ep_offset_u32, types:: BasicObject )
7880- } else {
7881- fun. get_local_from_ep ( block, recv, ep_offset_u32, 0 , types:: BasicObject )
7882- } ;
7883- state. setlocal ( ep_offset_u32, val) ;
7884- }
7885- }
78867769 }
78877770 YARVINSN_invokeblock => {
78887771 let cd: * const rb_call_data = get_arg ( pc, 0 ) . as_ptr ( ) ;
0 commit comments