Skip to content

ZJIT: Monomorphic getivar loses inline shape specialization on recompile #984

@k0kubun

Description

@k0kubun

When an ISEQ is recompiled after a guard_shape_failure (policy.no_side_exits == true), optimize_getivar skips shape specialization on the assumption that iseq_to_hir already emitted polymorphic branches with a GetIvar fallback.

That's only true for sites whose profile is Polymorphic / SkewedPolymorphic. For monomorphic sites, polymorphic_summary returns None, and iseq_to_hir emits a bare Insn::GetIvar expecting optimize_getivar to specialize it. On the recompiled version that never happens, so every monomorphic getivar in the ISEQ degrades to a rb_vm_getinstancevariable C call with no inline shape fast path — even sites that never failed a guard.

Possible fix

Under no_side_exits, still specialize monomorphic sites, but emit the side-exit-free IsBitEqual + IfTrue + GetIvar fallback pattern instead of the usual GuardBitEquals.

This should fix a regression in Optcarrot introduced by ruby#16589.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions