diff options
| -rw-r--r-- | zjit/src/gc.rs | 4 | ||||
| -rw-r--r-- | zjit/src/profile.rs | 12 |
2 files changed, 12 insertions, 4 deletions
diff --git a/zjit/src/gc.rs b/zjit/src/gc.rs index 48d841a104..0d2e1350a7 100644 --- a/zjit/src/gc.rs +++ b/zjit/src/gc.rs @@ -183,7 +183,9 @@ pub fn append_gc_offsets(iseq: IseqPtr, mut version: IseqVersionRef, offsets: &V let value_ptr = value_ptr as *const VALUE; unsafe { let object = value_ptr.read_unaligned(); - rb_gc_writebarrier(iseq.into(), object); + if !object.special_const_p() { + rb_gc_writebarrier(iseq.into(), object); + } } } } diff --git a/zjit/src/profile.rs b/zjit/src/profile.rs index e7efbcad34..a4b893b2d7 100644 --- a/zjit/src/profile.rs +++ b/zjit/src/profile.rs @@ -124,7 +124,9 @@ fn profile_operands(profiler: &mut Profiler, profile: &mut IseqProfile, n: usize // TODO(max): Handle GC-hidden classes like Array, Hash, etc and make them look normal or // drop them or something let ty = ProfiledType::new(obj); - unsafe { rb_gc_writebarrier(profiler.iseq.into(), ty.class()) }; + if !ty.class().special_const_p() { + unsafe { rb_gc_writebarrier(profiler.iseq.into(), ty.class()) }; + } profile_type.observe(ty); } } @@ -138,7 +140,9 @@ fn profile_self(profiler: &mut Profiler, profile: &mut IseqProfile) { // TODO(max): Handle GC-hidden classes like Array, Hash, etc and make them look normal or // drop them or something let ty = ProfiledType::new(obj); - unsafe { rb_gc_writebarrier(profiler.iseq.into(), ty.class()) }; + if !ty.class().special_const_p() { + unsafe { rb_gc_writebarrier(profiler.iseq.into(), ty.class()) }; + } types[0].observe(ty); } @@ -149,7 +153,9 @@ fn profile_block_handler(profiler: &mut Profiler, profile: &mut IseqProfile) { } let obj = profiler.peek_at_block_handler(); let ty = ProfiledType::object(obj); - unsafe { rb_gc_writebarrier(profiler.iseq.into(), ty.class()) }; + if !ty.class().special_const_p() { + unsafe { rb_gc_writebarrier(profiler.iseq.into(), ty.class()) }; + } types[0].observe(ty); } |
