@@ -4251,6 +4251,14 @@ impl Function {
42514251 } )
42524252 }
42534253
4254+ fn load_ivar_from_fields ( & mut self , block : BlockId , recv : InsnId , is_embedded : bool , id : ID , ivar_index : u16 ) -> InsnId {
4255+ if is_embedded {
4256+ return self . load_ivar_embedded ( block, recv, id, ivar_index) ;
4257+ } else {
4258+ return self . load_ivar_heap ( block, recv, id, ivar_index) ;
4259+ }
4260+ }
4261+
42544262 fn load_ivar ( & mut self , block : BlockId , self_val : InsnId , recv_type : ProfiledType , id : ID , state : InsnId ) -> InsnId {
42554263 let mut ivar_index: u16 = 0 ;
42564264 if ! unsafe { rb_shape_get_iv_index ( recv_type. shape ( ) . 0 , id, & mut ivar_index) } {
@@ -4273,11 +4281,7 @@ impl Function {
42734281 offset : RCLASS_OFFSET_PRIME_FIELDS_OBJ as i32 ,
42744282 return_type : types:: RubyValue ,
42754283 } ) ;
4276- if recv_type. flags ( ) . is_fields_embedded ( ) {
4277- return self . load_ivar_embedded ( block, fields_obj, id, ivar_index) ;
4278- } else {
4279- return self . load_ivar_heap ( block, fields_obj, id, ivar_index) ;
4280- }
4284+ return self . load_ivar_from_fields ( block, fields_obj, recv_type. flags ( ) . is_fields_embedded ( ) , id, ivar_index) ;
42814285 }
42824286 if recv_type. flags ( ) . is_typed_data ( ) {
42834287 // Typed T_DATA: load from fields_obj at fixed offset in RTypedData
@@ -4286,18 +4290,10 @@ impl Function {
42864290 offset : RTYPEDDATA_OFFSET_FIELDS_OBJ as i32 ,
42874291 return_type : types:: RubyValue ,
42884292 } ) ;
4289- if recv_type. flags ( ) . is_fields_embedded ( ) {
4290- return self . load_ivar_embedded ( block, fields_obj, id, ivar_index) ;
4291- } else {
4292- return self . load_ivar_heap ( block, fields_obj, id, ivar_index) ;
4293- }
4293+ return self . load_ivar_from_fields ( block, fields_obj, recv_type. flags ( ) . is_fields_embedded ( ) , id, ivar_index) ;
42944294 }
42954295 if recv_type. flags ( ) . is_t_object ( ) {
4296- if recv_type. flags ( ) . is_embedded ( ) {
4297- return self . load_ivar_embedded ( block, self_val, id, ivar_index) ;
4298- } else {
4299- return self . load_ivar_heap ( block, self_val, id, ivar_index) ;
4300- }
4296+ return self . load_ivar_from_fields ( block, self_val, recv_type. flags ( ) . is_embedded ( ) , id, ivar_index) ;
43014297 }
43024298 // Non-T_OBJECT, non-class/module, non-typed-data: fall back to C call
43034299 // NOTE: it's fine to use rb_ivar_get_at_no_ractor_check because
0 commit comments