Repository navigation
Conversation
…r contract Meta-annotate both markers @PerfContract and switch them to CLASS retention, so @SuppressPerfContract can cite them. @BackgroundOnly's Javadoc gains a checker contract: foreground code must not directly call background-only code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eground Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
SimpleUtf8Cache and GenerationalUtf8Cache trade extra CPU for less allocation, which only pays off on a serializer thread. Every production caller (TraceMapperV0_4, OtlpCommonProto) already runs on one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
More details
The annotation contracts and foreground/background review rule are consistent with the inspected cache callers. The completed static review found no actionable defect; executable cache behavior is unchanged.
🤖 Bits Code Review · Commit e8985fd
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
ByteBuddy inlines @Advice.OnMethodEnter/OnMethodExit bodies into the instrumented application method, so they run on the application thread by construction. A call from advice into @BackgroundOnly code is now flag-with-confidence rather than flag-as-measure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What Does This Do
Adds an AI-review check for
@BackgroundOnlycode called from the foreground, and gives the@ForegroundSafe/@BackgroundOnlymarkers the contract that check reads.@BackgroundOnlychecker contract (Javadoc): foreground code must not directly call background-only code. Foreground code is a method marked@ForegroundSafe, a method of a@ForegroundSafetype without a method-level@BackgroundOnly, or an advice method (@Advice.OnMethodEnter/@Advice.OnMethodExit), which ByteBuddy inlines into the application method. Background-only code is defined the same way in reverse. Handing work to a background thread, such as enqueueing it, is not a trigger. Calls that go through unmarked intermediate methods are out of scope for now.@PerfContractwithCLASSretention, like@NoEscapeand@StaticLifetime. That lets@SuppressPerfContract(value = BackgroundOnly.class, reason = "...")mark a deliberate exception.checks.md:@ForegroundSafeor is advice, since both ends are declared;Motivation
The markers landed in #12471, but nothing checked them: their Javadoc said the rule was "not yet enforced" until a static checker (APMLP-1645). Like
@NoEscapeand@StaticLifetime, the AI reviewer can apply the rule now, from a contract written to be checked from the diff.This replaces draft #12606. #12606's description said the checker rule was dropped and deferred to "APMLP-1645 and, if useful, to the
/perf-reviewskill"; this PR is that follow-up.Additional Notes
SimpleUtf8CacheandGenerationalUtf8Cacheare now@BackgroundOnly. Both trade extra CPU for less allocation, which only pays off on a serializer thread, and every production caller (TraceMapperV0_4,OtlpCommonProtovia the OTLP writer's worker) already runs on one. Add @ForegroundSafe/@BackgroundOnly declared-contract annotations #12606 also markedDDCache,FixedSizeCacheand theEncodingCacheinterface; those can follow separately once their foreground/background split is checked.SOURCEtoCLASShas no runtime effect. It only makes the markers visible to class-file tools, as@PerfContractexpects.Contributor Checklist
:internal-api:compileJava,:internal-api:javadoc,:communication:compileJava,:communication:javadoc,spotlessApplyJira ticket
APMLP-1645
🤖 Generated with Claude Code