@@ -124,9 +124,7 @@ fn profile_operands(profiler: &mut Profiler, profile: &mut IseqProfile, n: usize
124124 // TODO(max): Handle GC-hidden classes like Array, Hash, etc and make them look normal or
125125 // drop them or something
126126 let ty = ProfiledType :: new ( obj) ;
127- if !ty. class ( ) . special_const_p ( ) {
128- unsafe { rb_gc_writebarrier ( profiler. iseq . into ( ) , ty. class ( ) ) } ;
129- }
127+ VALUE :: from ( profiler. iseq ) . write_barrier ( ty. class ( ) ) ;
130128 profile_type. observe ( ty) ;
131129 }
132130}
@@ -140,9 +138,7 @@ fn profile_self(profiler: &mut Profiler, profile: &mut IseqProfile) {
140138 // TODO(max): Handle GC-hidden classes like Array, Hash, etc and make them look normal or
141139 // drop them or something
142140 let ty = ProfiledType :: new ( obj) ;
143- if !ty. class ( ) . special_const_p ( ) {
144- unsafe { rb_gc_writebarrier ( profiler. iseq . into ( ) , ty. class ( ) ) } ;
145- }
141+ VALUE :: from ( profiler. iseq ) . write_barrier ( ty. class ( ) ) ;
146142 types[ 0 ] . observe ( ty) ;
147143}
148144
@@ -153,9 +149,7 @@ fn profile_block_handler(profiler: &mut Profiler, profile: &mut IseqProfile) {
153149 }
154150 let obj = profiler. peek_at_block_handler ( ) ;
155151 let ty = ProfiledType :: object ( obj) ;
156- if !ty. class ( ) . special_const_p ( ) {
157- unsafe { rb_gc_writebarrier ( profiler. iseq . into ( ) , ty. class ( ) ) } ;
158- }
152+ VALUE :: from ( profiler. iseq ) . write_barrier ( ty. class ( ) ) ;
159153 types[ 0 ] . observe ( ty) ;
160154}
161155
0 commit comments