@@ -2848,24 +2848,12 @@ fn gen_get_ivar(
2848
2848
recv : Opnd ,
2849
2849
recv_opnd : YARVOpnd ,
2850
2850
) -> Option < CodegenStatus > {
2851
- let comptime_val_klass = comptime_receiver. class_of ( ) ;
2852
-
2853
2851
// If recv isn't already a register, load it.
2854
2852
let recv = match recv {
2855
2853
Opnd :: InsnOut { .. } => recv,
2856
2854
_ => asm. load ( recv) ,
2857
2855
} ;
2858
2856
2859
- // Check if the comptime class uses a custom allocator
2860
- let custom_allocator = unsafe { rb_get_alloc_func ( comptime_val_klass) } ;
2861
- let uses_custom_allocator = match custom_allocator {
2862
- Some ( alloc_fun) => {
2863
- let allocate_instance = rb_class_allocate_instance as * const u8 ;
2864
- alloc_fun as * const u8 != allocate_instance
2865
- }
2866
- None => false ,
2867
- } ;
2868
-
2869
2857
// Check if the comptime receiver is a T_OBJECT
2870
2858
let receiver_t_object = unsafe { RB_TYPE_P ( comptime_receiver, RUBY_T_OBJECT ) } ;
2871
2859
// Use a general C call at the last chain to avoid exits on megamorphic shapes
@@ -2874,12 +2862,9 @@ fn gen_get_ivar(
2874
2862
gen_counter_incr ( jit, asm, Counter :: num_getivar_megamorphic) ;
2875
2863
}
2876
2864
2877
- // If the class uses the default allocator, instances should all be T_OBJECT
2878
- // NOTE: This assumes nobody changes the allocator of the class after allocation.
2879
- // Eventually, we can encode whether an object is T_OBJECT or not
2880
- // inside object shapes.
2865
+ // NOTE: This assumes T_OBJECT can't ever have the same shape_id as any other type.
2881
2866
// too-complex shapes can't use index access, so we use rb_ivar_get for them too.
2882
- if !receiver_t_object || uses_custom_allocator || comptime_receiver. shape_too_complex ( ) || megamorphic {
2867
+ if !receiver_t_object || comptime_receiver. shape_too_complex ( ) || megamorphic {
2883
2868
// General case. Call rb_ivar_get().
2884
2869
// VALUE rb_ivar_get(VALUE obj, ID id)
2885
2870
asm_comment ! ( asm, "call rb_ivar_get()" ) ;
@@ -3073,8 +3058,6 @@ fn gen_set_ivar(
3073
3058
recv_opnd : YARVOpnd ,
3074
3059
ic : Option < * const iseq_inline_iv_cache_entry > ,
3075
3060
) -> Option < CodegenStatus > {
3076
- let comptime_val_klass = comptime_receiver. class_of ( ) ;
3077
-
3078
3061
// If the comptime receiver is frozen, writing an IV will raise an exception
3079
3062
// and we don't want to JIT code to deal with that situation.
3080
3063
if comptime_receiver. is_frozen ( ) {
@@ -3084,16 +3067,6 @@ fn gen_set_ivar(
3084
3067
3085
3068
let stack_type = asm. ctx . get_opnd_type ( StackOpnd ( 0 ) ) ;
3086
3069
3087
- // Check if the comptime class uses a custom allocator
3088
- let custom_allocator = unsafe { rb_get_alloc_func ( comptime_val_klass) } ;
3089
- let uses_custom_allocator = match custom_allocator {
3090
- Some ( alloc_fun) => {
3091
- let allocate_instance = rb_class_allocate_instance as * const u8 ;
3092
- alloc_fun as * const u8 != allocate_instance
3093
- }
3094
- None => false ,
3095
- } ;
3096
-
3097
3070
// Check if the comptime receiver is a T_OBJECT
3098
3071
let receiver_t_object = unsafe { RB_TYPE_P ( comptime_receiver, RUBY_T_OBJECT ) } ;
3099
3072
// Use a general C call at the last chain to avoid exits on megamorphic shapes
@@ -3149,10 +3122,9 @@ fn gen_set_ivar(
3149
3122
None
3150
3123
} ;
3151
3124
3152
- // If the receiver isn't a T_OBJECT, or uses a custom allocator,
3153
- // then just write out the IV write as a function call.
3125
+ // If the receiver isn't a T_OBJECT, then just write out the IV write as a function call.
3154
3126
// too-complex shapes can't use index access, so we use rb_ivar_get for them too.
3155
- if !receiver_t_object || uses_custom_allocator || shape_too_complex || new_shape_too_complex || megamorphic {
3127
+ if !receiver_t_object || shape_too_complex || new_shape_too_complex || megamorphic {
3156
3128
// The function could raise FrozenError.
3157
3129
// Note that this modifies REG_SP, which is why we do it first
3158
3130
jit_prepare_non_leaf_call ( jit, asm) ;
0 commit comments