Skip to content

Reduce bootstrap object-store dispatch to five indy bindings - #181

Merged
mcculls merged 1 commit into
mainfrom
mcculls/prune-dispatch-bindings
Dec 4, 2026
Merged

mcculls merged 1 commit into
mainfrom
mcculls/prune-dispatch-bindings

Conversation

@mcculls

@mcculls mcculls commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

What Does This Do

Reduce bootstrap object-store dispatch from eight to five invokedynamic fallback sites. get and put share the sites in weakGet and weakPut, and static cleanup stays on the original global store.

Keys implementing KeyWithValue use injected accessors. Other keys take the operation's fallback. An accessor also falls back when it has no field for the requested storeId.

The five remaining sites route to the original GlobalObjectStore:

         get fallback ─┐
        accessor read ─┴─> weakGet ──indy──> GlobalObjectStore.get

         put fallback ─┐
       accessor write ─┴─> weakPut ──indy──> GlobalObjectStore.put

    getOrPut fallback ───────────────indy──> GlobalObjectStore.getOrPut
getOrCompute fallback ───────────────indy──> GlobalObjectStore.getOrCompute
      remove fallback ───────────────indy──> GlobalObjectStore.remove

Each indy arrow is one call site. get and put reach their shared sites through static calls to weakGet and weakPut. The weak methods skip the accessor check, preventing recursion.

For injected keys, compound operations use double-checked locking around accessor reads and writes, including any weak fallbacks. For other keys, each compound operation calls its own site directly. Static cleanup calls the original global store directly.

initialize receives a lookup scoped to the original GlobalObjectStore and prelinks all five sites as ConstantCallSites. This binds bootstrap glue to the original store even though its class is not visible to the bootstrap loader; subsequent calls use those bound targets.

Generate local and bootstrap glue through shared emitters with explicit call strategies and final name remapping, replacing bytecode readback and visitor rewrites. Stack frames are computed during generation.

Motivation

Avoid duplicate fallback bindings and simplify glue generation while preserving injected field access and fallback to the original global store.

Additional Notes

  • Extend dispatch benchmarks across uninjected, injected, and weak-fallback keys, including an indyShared variant. Direct-baseline cleanup explicitly sweeps its relocated store.
  • Add coverage for transformed ObjectStore operations, initialization cleanup, failure after partial linkage, and concurrent removal through local and bootstrap dispatch.

Validation:

  • ./gradlew :field-inject:check :field-inject:jmhJar --no-configuration-cache passed, including SpotBugs and formatting checks.
  • All 87 field-inject tests passed on each of JDK 8, 11, 17, 21, and 25.
  • getHit benchmark smoke tests passed for all 12 dispatch/storage combinations with two threads. These runs validate setup and execution, not performance.

Contributor Checklist

  • Tests and static analysis pass locally.
  • Opened as a draft against main.

Jira ticket: Not provided.

@mcculls
mcculls marked this pull request as ready for review December 4, 2026 12:31
@mcculls
mcculls requested a review from a team as a code owner December 4, 2026 12:31
@mcculls
mcculls requested review from mhlidd and removed request for a team December 4, 2026 12:31
@mcculls
mcculls force-pushed the mcculls/prune-dispatch-bindings branch 3 times, most recently from cff0bf9 to 2c4461f Compare December 4, 2026 13:01
Share get/put fallbacks through weakGet/weakPut, remove cleanup from
generated dispatch, and prelink the five remaining sites.

Generate local and bootstrap glue with shared emitters and explicit call
strategies. Apply name remapping last, removing bytecode readback and
visitor rewrites. Compute frames at build time while preserving existing
frames and stack limits in runtime transformers.

Align generator structure with DefineClass conventions, name dispatch
argument slots, and separate initialization from bootstrap method
emission.

Expand benchmarks across storage paths and test ObjectStore redirection
through local and bootstrap dispatch.
@mcculls
mcculls force-pushed the mcculls/prune-dispatch-bindings branch from 2c4461f to 9d8fa9b Compare December 4, 2026 13:30
@mcculls
mcculls merged commit 74a2581 into main Dec 4, 2026
6 checks passed
@mcculls
mcculls deleted the mcculls/prune-dispatch-bindings branch December 4, 2026 22:41
@github-actions github-actions Bot added this to the 0.1.0 milestone Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants