[ 
https://issues.apache.org/jira/browse/GROOVY-12161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18095931#comment-18095931
 ] 

ASF GitHub Bot commented on GROOVY-12161:
-----------------------------------------

github-actions[bot] commented on PR #2706:
URL: https://github.com/apache/groovy/pull/2706#issuecomment-4959673646

   ### JMH summary — classic (commit `5dfdfba`)
   
   Speedup vs trailing 90-day baseline on gh-pages. Higher = faster.
   `1.00` = in line with history. Per-benchmark ratio, geomean within group.
   Time-per-op units inverted so direction is consistent. The *calibrated*
   column divides out this runner's speed vs the baseline hardware, as
   measured by Groovy-independent pure-Java ruler benchmarks.
   
   | Group  | Speedup | Calibrated | n |
   |--------|---------|------------|---|
   | bench | 0.969 × | 0.990 × | 84 |
   | core | 1.123 × | 0.947 × | 77 |
   | grails | 0.970 × | 0.878 × | 80 |
   
   > ⚠️ Runner speed differs ≥15% from the historical baseline hardware for: 
core-hz. Raw speedups are not meaningful for those parts — use the calibrated 
column.
   
   <sub>Runner calibration (this run vs baseline hardware): bench 0.98× (26 
rulers) · core-ag 0.96× (3 rulers) · core-hz 1.50× (3 rulers) · grails-ad 1.07× 
(3 rulers) · grails-ez 1.13× (3 rulers)</sub>
   
   <sub>Baseline: <code>dev/bench/jmh/&lt;part&gt;/classic/data.js</code> on 
gh-pages, trailing 90 days. <a 
href="https://apache.github.io/groovy/dev/bench/jmh/summary.html";>Daily 
dashboard</a> · <a 
href="https://apache.github.io/groovy/dev/bench/jmh/";>Per-suite raw 
data</a></sub>
   
   <!

> Omit identity catch-all for try/catch without finally and slim exception 
> bytecode
> ---------------------------------------------------------------------------------
>
>                 Key: GROOVY-12161
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12161
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Daniel Sun
>            Priority: Major
>
> h2. Summary
> {{StatementWriter.writeTryCatchFinally}} currently emits a catch-all identity 
> rethrow ({{astore}} / {{aload}} / {{athrow}}) and an empty shared-finally 
> path for *every* try/catch, including plain try/catch with no finally. That 
> diverges from javac, bloats the exception table, and adds avoidable 
> control-flow noise that is less JIT-friendly.
> h2. Problem
> For a plain try/catch (empty finally), the generator still:
> * registers a catch-all handler that only stores and rethrows the throwable
> * routes normal fall-through through an empty "finally" block and a second 
> {{GOTO}} past the catch-all
> * always creates a catch-side {{BlockRecorder}} even when there are no catch 
> clauses
> On abrupt exits ({{return}} / {{break}} / {{continue}}), 
> {{CompileStack.applyBlockRecorder}} also emits a trailing {{NOP}} after 
> inlined finally/synchronized guards, which is unnecessary once the restarted 
> range can bind to the next real instruction.
> Non-empty finally must keep a real catch-all so uncaught exceptions still run 
> finally then rethrow. Nested try/catch inside try/finally must keep 
> {{BlockRecorder}} range splitting so an enclosing finally inlined on 
> {{return}} is *not* covered by an inner typed handler (regression risk for 
> GROOVY-8229). Stack-map casts for assignments inside try (GROOVY-9805) 
> continue to depend on an active {{BlockRecorder}}.
> h2. Proposed approach
> * Keep a {{BlockRecorder}} on try/catch regions always (empty finally ⇒ no-op 
> excluded statement) so range splits, nested finally semantics, and 
> GROOVY-9805 casts stay correct.
> * When finally is empty: omit the catch-all identity rethrow and the empty 
> shared-finally block; fall-through jumps straight to a join label after the 
> handlers.
> * When finally is non-empty: keep typed handlers first, then catch-all + 
> shared fall-through finally (existing semantics).
> * Only push a catch-side {{BlockRecorder}} when there is at least one 
> {{catch}}.
> * In {{applyBlockRecorder}}, keep a leading {{NOP}} so abrupt-exit-only try 
> ranges stay non-empty (illegal empty exception ranges), but drop the trailing 
> {{NOP}}.
> h2. Expected bytecode shape (illustrative)
> Plain try/catch after change — typed handlers only, no catch-all:
> {code:java}
> int m(int x) {
>     try {
>         return x
>     } catch (RuntimeException e) {
>         return -1
>     }
> }
> {code}
> Exception table should list only {{RuntimeException}} (possibly multiple 
> ranges after return-path range splits), not a {{null}}/any handler, and must 
> not contain an adjacent {{ASTORE}}/{{ALOAD}}/{{ATHROW}} identity rethrow.
> Try/finally must still have a catch-all any-handler so finally runs for 
> uncaught exceptions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to