Skip to content

Commit 44d0b01

Browse files
committed
Don't require to set PC before allocating hidden object
ZJIT doesn't set PC before rb_set_ivar(), and that allocates a managed ID table. Was a false positive from gc_validate_pc().
1 parent de92dd9 commit 44d0b01

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,9 +974,12 @@ static inline void
974974
gc_validate_pc(VALUE obj)
975975
{
976976
#if RUBY_DEBUG
977+
// IMEMOs and objects without a class (e.g managed id table) are not traceable
978+
if (RB_TYPE_P(obj, T_IMEMO) || !CLASS_OF(obj)) return;
979+
977980
rb_execution_context_t *ec = GET_EC();
978981
const rb_control_frame_t *cfp = ec->cfp;
979-
if (!RB_TYPE_P(obj, T_IMEMO) && cfp && VM_FRAME_RUBYFRAME_P(cfp) && cfp->pc) {
982+
if (cfp && VM_FRAME_RUBYFRAME_P(cfp) && cfp->pc) {
980983
const VALUE *iseq_encoded = ISEQ_BODY(cfp->iseq)->iseq_encoded;
981984
const VALUE *iseq_encoded_end = iseq_encoded + ISEQ_BODY(cfp->iseq)->iseq_size;
982985
RUBY_ASSERT(cfp->pc >= iseq_encoded, "PC not set when allocating, breaking tracing");

0 commit comments

Comments
 (0)