Skip to main content

Module structure

Module structure 

Source
Expand description

Control flow structuring: CFG of basic blocks → nested region tree.

Strategy:

  1. Iterative dominator computation (Cooper-Harvey-Kennedy).
  2. Exception ranges grouped by (start, end) span → try regions carved out first; bodies and handlers are structured recursively.
  3. Inside each flow scope, walk blocks from the entry:
    • loop header (back-edge target that dominates the source) → natural loop region,
    • conditional terminal → If region (branches structured up to the immediate post-dominator),
    • switch terminal → Switch region with per-case sub-scopes,
    • forward goto within scope → continue walking at the target,
    • edges that leave the scope → Goto nodes (resolved to break/continue/labels in the conversion pass).

Structs§

DomInfo
Structurer
TryGroup

Enums§

Region

Constants§

BUDGET_OVERRIDE
Per-method copy-budget override installed by the method size guard in classdec (pathological copy explosion retry); consumed by Structurer::with_diamonds at construction.
COPY_ALLOW_CONFLUENCE
Set while a SESE consumed-arrival copy runs: there the copy IS the arm’s only emission route (the consumed merge has no sibling owner part in this layout), so the shared-tail-confluence barrier must not truncate it (jdk11/17/26 Pattern.family: the else arm’s copy of the b13 merge tail came out stage-2-less — the bar excluded the 12-pred stage-2 switch head — and the method fell off its end, 缺少返回语句 ×3 trees). Walk-side copy sites never set this.

Functions§

can_reach_avoiding
True if to is reachable from from without stepping on avoid.
can_reach_cfg
Reachability from from to to via normal edges, with a work budget.
can_reach_cfg_barred
Reachability from from to to that never steps on barrier blocks (other than from itself). Follows normal AND exception successors (exc_succ), so a protected block whose normal exits all return/throw is still seen to loop back through its handler.
compute_dominators
group_exceptions
group_exceptions_with
immediate_postdom
Immediate post-dominator of entry within universe, approximated as the nearest reconvergence point: the block (other than entry) reachable from ALL of entry’s in-universe successors with the smallest total BFS distance. Blocks whose in-universe successors are empty are exits.
reachable_within
Blocks normally reachable from entry without entering stop.
reverse_postorder
set_budget_override
Install/clear the per-method copy-budget override (see BUDGET_OVERRIDE).