@@ -4373,31 +4373,6 @@ impl Function {
43734373 } )
43744374 }
43754375
4376- fn load_ivar_from_fields ( & mut self , block : BlockId , recv : InsnId , is_embedded : bool , id : ID , ivar_index : attr_index_t ) -> InsnId {
4377- if is_embedded {
4378- return self . load_ivar_embedded ( block, recv, id, ivar_index) ;
4379- } else {
4380- return self . load_ivar_heap ( block, recv, id, ivar_index) ;
4381- }
4382- }
4383-
4384- /// This puts a guard that establishes the preconditon for [Self::load_ivar]
4385- fn load_ivar_guard_type ( & mut self , block : BlockId , recv : InsnId , recv_type : ProfiledType , state : InsnId ) -> InsnId {
4386- if recv_type. flags ( ) . is_t_class ( ) {
4387- // Check class first since `Class < Module`
4388- self . push_insn ( block, Insn :: GuardType { val : recv, guard_type : types:: Class , state, recompile : None } )
4389- } else if recv_type. flags ( ) . is_t_module ( ) {
4390- self . push_insn ( block, Insn :: GuardType { val : recv, guard_type : types:: Module , state, recompile : None } )
4391- } else if recv_type. flags ( ) . is_t_data ( ) {
4392- self . push_insn ( block, Insn :: GuardType { val : recv, guard_type : types:: TData , state, recompile : None } )
4393- } else {
4394- // HeapBasicObject is wider than T_OBJECT, but shapes for T_OBJECTs are in a pool of
4395- // its own and are guaranteed to be different from shapes of any other T_* types. So
4396- // the shape check that follows already covers checking for T_OBJECT.
4397- self . push_insn ( block, Insn :: GuardType { val : recv, guard_type : types:: HeapBasicObject , state, recompile : None } )
4398- }
4399- }
4400-
44014376 fn load_ivar ( & mut self , block : BlockId , self_val : InsnId , recv_type : ProfiledType , id : ID ) -> InsnId {
44024377 // Too-complex shapes use hash tables; rb_shape_get_iv_index doesn't support them.
44034378 // Callers must filter these out before calling load_ivar.
@@ -4425,10 +4400,14 @@ impl Function {
44254400 offset,
44264401 return_type : types:: RubyValue ,
44274402 } ) ;
4428- self . load_ivar_from_fields ( block, fields_obj, recv_type . flags ( ) . is_fields_embedded ( ) , id, ivar_index)
4403+ self . load_ivar_embedded ( block, fields_obj, id, ivar_index)
44294404 } ,
44304405 ShapeLayout :: RObject => {
4431- self . load_ivar_from_fields ( block, self_val, recv_type. flags ( ) . is_embedded ( ) , id, ivar_index)
4406+ if recv_type. flags ( ) . is_embedded ( ) {
4407+ self . load_ivar_embedded ( block, self_val, id, ivar_index)
4408+ } else {
4409+ self . load_ivar_heap ( block, self_val, id, ivar_index)
4410+ }
44324411 } ,
44334412 ShapeLayout :: Other => {
44344413 // Non-T_OBJECT, non-class/module, non-typed-data: fall back to C call
@@ -4470,7 +4449,7 @@ impl Function {
44704449 // need to wrap it again here.
44714450 self . push_insn_id ( block, insn_id) ; continue ;
44724451 }
4473- let self_val = self . load_ivar_guard_type ( block, self_val, recv_type , state) ;
4452+ let self_val = self . push_insn ( block, Insn :: GuardType { val : self_val, guard_type : types :: HeapBasicObject , state, recompile : None } ) ;
44744453 let shape = self . load_shape ( block, self_val) ;
44754454 self . guard_shape ( block, shape, recv_type. shape ( ) , state, Some ( Recompile :: ProfileSelf ) ) ;
44764455 let replacement = self . load_ivar ( block, self_val, recv_type, id) ;
@@ -4503,7 +4482,7 @@ impl Function {
45034482 // On the final version, keep the DefinedIvar fallback instead of another shape guard.
45044483 self . push_insn_id ( block, insn_id) ; continue ;
45054484 }
4506- let self_val = self . load_ivar_guard_type ( block, self_val, recv_type , state) ;
4485+ let self_val = self . push_insn ( block, Insn :: GuardType { val : self_val, guard_type : types :: HeapBasicObject , state, recompile : None } ) ;
45074486 let shape = self . load_shape ( block, self_val) ;
45084487 self . guard_shape ( block, shape, recv_type. shape ( ) , state, Some ( Recompile :: ProfileSelf ) ) ;
45094488 let mut ivar_index: attr_index_t = 0 ;
@@ -4581,7 +4560,7 @@ impl Function {
45814560 }
45824561 // Fall through to emitting the ivar write
45834562 }
4584- let self_val = self . load_ivar_guard_type ( block, self_val, recv_type , state) ;
4563+ let self_val = self . push_insn ( block, Insn :: GuardType { val : self_val, guard_type : types :: HeapBasicObject , state, recompile : None } ) ;
45854564 let shape = self . load_shape ( block, self_val) ;
45864565 // TODO: attr_writer SetIvar has a null inline cache and may target a receiver
45874566 // operand other than CFP self. Support it with a reprofile strategy that
0 commit comments