Skip to content

HowlFrame #90 Phase 3c: experimental if bytecode - #60

Merged
howlcipher merged 1 commit into
mainfrom
cursor/hfir-if-controledges-1cea
Sep 30, 2026
Merged

howlcipher merged 1 commit into
mainfrom
cursor/hfir-if-controledges-1cea

Conversation

@howlcipher

Copy link
Copy Markdown
Owner

Summary

Phase 3c teaches experimental -compile-hfir-bc to compile and run a small if by filling ControlEdges and emitting the existing JUMP_IF_FALSE and JUMP opcodes, the same pattern Phase 3b used for while.

LowerAST stores an if as a condition, a then-branch, and an optional else, and writes ControlEdges in that order. LowerToBytecode follows those successors. The relative jump offsets match the AST bytecode compiler. A then-only if emits JUMP_IF_FALSE and no JUMP. Missing or swapped control edges fail closed with one HFIR_BYTECODE_UNSUPPORTED diagnostic and no BCProgram.

Production -compile-bc is still runHFIRGate and then bytecode.CompileToBytecode on the AST. sleep still compiles on that flag and is still rejected by -compile-hfir-bc without an artifact. for does not gain control edges and still uses FOR_INIT / FOR_NEXT. while and defun keep the Phase 3a and Phase 3b behavior. There is no new opcode, capability, Wasm target, or module linker.

The model-adapter transport still rejects while and defun, so #88 stays closed. if stays a Phase-1 transport kind. The schema still has no control-edge field; decoding an if derives the successors from the validated roles. A payload that names control_edges is rejected. Localization publishes an if relation only when those successors match, and the published roles stay then and else.

tests/conformance/abi_v1/11_if.howl is the shared if_control case. hfir_bytecode, production bytecode, the interpreter, Go, and JavaScript print else, then, greater, and only. The false branches do not print.

#90 stays Partial. Journal: docs/journals/2026-09-30_lowered_hfir_abi_phase3c_if.md.

Test plan

  • gofmt -l . is clean
  • go vet ./...
  • go test ./... (includes internal/hfir, the VM equivalence cases, the CLI lock that -compile-bc stays the AST, and tools/difftest if_control)
Open in Web Open in Cursor 

Lower if through ControlEdges and the existing JUMP_IF_FALSE and JUMP opcodes on -compile-hfir-bc. Missing or swapped edges fail closed. Production -compile-bc stays the AST path, and #90 stays Partial.

Co-authored-by: William Elias <wylelias.123@gmail.com>

@howlcipher howlcipher left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phase 3c looks clean on the fence.

Experimental -compile-hfir-bc gets if through ControlEdges (condition / then / optional else) on the existing JUMP_IF_FALSE / JUMP path. Production -compile-bc stays AST (runHFIRGate → CompileToBytecode); the sleep lock in TestCompileBcStaysASTWhileHfirBcRunsIf is the right guard. for stays empty. No new opcode, no new cap, no Wasm, no linker/module work. #88 stays closed (while/defun still off transport; no control_edges field). #90 stays Partial.

Hard nos clean. CI build green on d241e3f.

Okabe: undraft + squash-merge when ready. Don’t flip #90 to Done on merge.

@howlcipher
howlcipher marked this pull request as ready for review September 30, 2026 05:34
@howlcipher
howlcipher merged commit 0a2afbc into main Sep 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants