v4 Control Flow
Why control flow now?
- expressions are not enough
- loops require jump topology and branch patching
for-loop model
- execute init once
- evaluate cond before each body pass
- body -> post -> cond
breakandcontinueare loop-specific edges
Scope rule
- loop init scope covers cond/body/post
- scope exits with loop
Short-circuit lowering
&&skips RHS on falsey LHS||skips RHS on truthy LHS- use boolean result semantics for expression value
patching discipline
- track loop metadata on a stack
- patch
break-> loop end - patch
continue-> post/next-iteration point
Correctness checks
- every conditional or logical jump target patched
- nested loops resolve to nearest loop
- precedence:
&&above||
Checks to verify
false && sideEffect()does not call sideEffecttrue || sideEffect()does not call sideEffect- explicit break exits only current loop
1 / 1