• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

KarpelesLab / goro / 26350583292

24 May 2026 03:16AM UTC coverage: 12.394% (-0.03%) from 12.423%
26350583292

push

github

MagicalTux
vm: lower try-with-finally natively (OP_FINALLY_END + pending control)

try { ... } finally { ... } previously forced a whole-function fallback
to the AST tree-walker: emitStmt short-circuited the TryNode to
OP_TRY_FINALLY (generic AST delegation) before reaching emitTry, which
itself returned unsupportedf for the finally branch. Both gates are gone.

The native lowering:

  * Extends TryHandler with HasFinally / FinallyPC / FinallyEnd. The
    finally-protected region is [Start, FinallyPC) — wider than the try
    body so a throw originating inside a catch routes through finally.
  * Frame gains a single-slot pendingControl register tagging a deferred
    return or throw, plus findEnclosingFinally(pc) for the runtime PC
    scan over TryHandlers (innermost-first via emit order).
  * OpRet / OpRetNull check for an enclosing finally and park the value
    in pending before jumping to FinallyPC; OP_FINALLY_END inspects
    pending and either falls through (none), chains the return into an
    outer finally (return), or re-raises the held PhpThrow (throw).
  * dispatchTryHandler routes uncaught throws (and throws originating
    inside catch bodies) to the finally with pending=throw, clearing
    stale pending when a fresh catch matches. The bug53511 destructor-
    during-catch-binding path now also routes through finally when one
    is present.
  * emitTry emits finally body after the catches at FinallyPC=AfterCatch
    so normal completion from try/catch falls through with pending=none.
    Cross-finally break/continue (target loop sits below the active
    finally's emit-time depth) is detected at emit time and falls back
    via unsupportedf — this rare case keeps using the AST until a
    pending-aware jump opcode lands.
  * The slot-unsafe gate on try+finally in dispatch.go is removed; the
    recursive GetChildren walk already covers try body, catches, and
    finally for the per-construct slot-safety probe.

Smoke tests covering all exit paths ... (continued)

83 of 129 new or added lines in 5 files covered. (64.34%)

76 existing lines in 6 files now uncovered.

14599 of 117793 relevant lines covered (12.39%)

2582.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

4.92
/core/phpv/error.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc