Skip to content

Perf: retain prepared literal shapes in object-allocation plans #85

Description

@chrisbbreuer

Problem

The fixed-shape object-allocation quick plan persists for the lifetime of its bytecode Chunk, but every safepoint-bounded re-entry repeats three literal inline-cache transition lookups and prepareInlineLiteralShape validation. object_churn re-enters roughly every 16 iterations to preserve exact 1024-step safepoints, so this immutable work recurs throughout the hot loop.

A current symbolized profile still shows prepareInlineLiteralShape after #74. The prepared descriptor is already documented as valid for the owning Context lifetime because Shape parent, name, and slot metadata never mutate.

Parent: #62

Proposed slice

  • Store one prepared literal descriptor and its root-shape key in QuickObjectAllocationLoop.
  • Reuse it only in isolated execution and only when the current root shape matches.
  • On a different realm root, rerun all current IC and chain validation before replacing the cache.
  • Keep shared or escaped execution on the existing fallback path.

Acceptance criteria

  • A test-only preparation counter proves a multi-safepoint object loop prepares once, while existing exact-step and guarded-fallback assertions remain green.
  • Order-balanced fresh-process object_churn A/B preserves checksum 1030552128 and shows a repeatable improvement.
  • Full units and benchmark harness pass before a small conventional commit is pushed to main.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions