@@ -124,7 +124,9 @@ 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- unsafe { rb_gc_writebarrier ( profiler. iseq . into ( ) , ty. class ( ) ) } ;
127+ if !ty. class ( ) . special_const_p ( ) {
128+ unsafe { rb_gc_writebarrier ( profiler. iseq . into ( ) , ty. class ( ) ) } ;
129+ }
128130 profile_type. observe ( ty) ;
129131 }
130132}
@@ -138,7 +140,9 @@ fn profile_self(profiler: &mut Profiler, profile: &mut IseqProfile) {
138140 // TODO(max): Handle GC-hidden classes like Array, Hash, etc and make them look normal or
139141 // drop them or something
140142 let ty = ProfiledType :: new ( obj) ;
141- unsafe { rb_gc_writebarrier ( profiler. iseq . into ( ) , ty. class ( ) ) } ;
143+ if !ty. class ( ) . special_const_p ( ) {
144+ unsafe { rb_gc_writebarrier ( profiler. iseq . into ( ) , ty. class ( ) ) } ;
145+ }
142146 types[ 0 ] . observe ( ty) ;
143147}
144148
@@ -149,7 +153,9 @@ fn profile_block_handler(profiler: &mut Profiler, profile: &mut IseqProfile) {
149153 }
150154 let obj = profiler. peek_at_block_handler ( ) ;
151155 let ty = ProfiledType :: object ( obj) ;
152- unsafe { rb_gc_writebarrier ( profiler. iseq . into ( ) , ty. class ( ) ) } ;
156+ if !ty. class ( ) . special_const_p ( ) {
157+ unsafe { rb_gc_writebarrier ( profiler. iseq . into ( ) , ty. class ( ) ) } ;
158+ }
153159 types[ 0 ] . observe ( ty) ;
154160}
155161
0 commit comments