feat(agent): ClassFile API backend ordinary args + AnyType[] + review-nit cleanup - #948
Draft
jbachorik wants to merge 5 commits into
Draft
feat(agent): ClassFile API backend ordinary args + AnyType[] + review-nit cleanup#948jbachorik wants to merge 5 commits into
jbachorik wants to merge 5 commits into
Conversation
…I backend ENTRY/RETURN handlers declaring ordinary enclosing-method arguments (typed or AnyType[]) were silently skipped by the ClassFile API backend, and CALL AnyType[] aggregate packaging was missing. - Thread methodArgTypes (from methodDesc) into emitProbeCall via new ENTRY/RETURN convenience overloads. - Typed ordinary method args loaded from fixed local slots (methodArgSlot). - AnyType[] aggregate packaging: anewarray + per-element load/box/arrayStore, mirroring ASM AnyTypeArgProvider; detected via the pre-replace descriptor. - AnyType[] short-circuit in canEmitCallProbe (sameStackType otherwise rejected the Object[] aggregate and the probe was silently skipped). - Drop an unread staticCall local in canEmitCallProbe. 7 new unit tests each assert the JVM verifier accepts the instrumented bytes (defineClass via an isolated ClassLoader), plus invokedynamic descriptor and anewarray presence for the aggregate cases.
ClassCache.getInstance() uses the holder idiom (static final in a nested class), so the cache is never null under normal JLS class-init semantics. Fold the JLS-dead 'if (cache == null)' guard into the 'ci == null' conservative no-match path.
…oke test The handler params (value, array, lock, key, set, exception) drove instrumentation but were unused in the body, tripping code-quality 'useless parameter' findings. Reference each via BTraceUtils.str() (Object params) / array.length so the smoke test also asserts the captured value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change do?
Follow-up to #843 (the ClassFile API backend parity work, squash-merged into
developas9f39a250). Closes the parity gaps #843 left open and sweeps the open code-quality review findings:AnyType[]) were silently skipped by the ClassFile API backend. Added fixed-local-slot loading (methodArgSlot) threaded via new ENTRY/RETURNemitProbeCalloverloads.AnyType[]aggregate packaging (ENTRY/RETURN/CALL) — addedemitAnyTypeArray(anewarray+ per-element load/box/arrayStore, mirroring ASMAnyTypeArgProvider), detected via the pre-replacement descriptor; plus anAnyType[]short-circuit incanEmitCallProbe(without itsameStackTyperejected theObject[]aggregate and the probe was silently skipped).ClassFilter.isSubTypeOf— folded the JLS-deadif (cache == null)guard into theci == nullconservative no-match path (ClassCache.getInstance()uses the holder idiom, never null under normal class-init semantics).ClassFileApiFeatureSmokeTest— referenced each previously-unused captured probe param viaBTraceUtils.str()/array.length, clearing the "useless parameter" findings and strengthening the smoke assertions.canEmitCallProbe— removed an unreadstaticCalllocal.docs/superpowers/plans/2026-07-06-classfileapi-remaining-gaps.mddocumenting the gaps, the ASM parity references, and per-task status.Related issue
N/A — follow-up to #843.
Scope and compatibility
Compatibility or migration notes: None. ClassFile API backend changes only affect Java 26+ (class-file major ≥ 70) instrumentation; the ASM backend path is untouched. No API/CLI/protocol/packaging change.
Testing
spotlessCheckCommands and results:
Documentation and release impact
Release notes / follow-up work: No user-facing behavior change beyond fixing silently-skipped probes on Java 26+. Known out-of-scope edge case: sub-int (
byte/short/char/boolean)AnyType[]elements box via the existingboxPrimitiveReturn(consistent with the@Returnboxing and the JVMS verifier's int-collapse); not exercised by tests (ASMAnytypeArgslikewise covers onlyString/long/String[]/int[]). A deferred Phase-1 shared-validation refactor (thecanEmit*duplication) is intentionally NOT included — pure refactor, no functional gain, integration just proved the current code works.Final checklist
This change is