Skip to content

HowlFrame #90 Phase 3a: experimental defun and call bytecode - #58

Merged
howlcipher merged 1 commit into
mainfrom
cursor/hfir-defun-call-04e4
Sep 30, 2026
Merged

howlcipher merged 1 commit into
mainfrom
cursor/hfir-defun-call-04e4

Conversation

@howlcipher

Copy link
Copy Markdown
Owner

Summary

Phase 3a makes the experimental HFIR→bytecode path run defun and call. Production -compile-bc is unchanged. Issue #90 stays Partial.

  • LowerAST gives defun a name, ordered param edges, and body edges. type_hint, type_hints, type_param, and a return-type symbol between the parameter list and the body are erased, matching the AST bytecode compiler.
  • call stores the callee name and ordered arg edges. return has an optional value.
  • -compile-hfir-bc / hfir.LowerToBytecode registers a BCFunction and emits the existing CALL and RETURN opcodes. No new opcode and no new capability.
  • while is still HFIR_BYTECODE_UNSUPPORTED with no BCProgram. A defun whose body contains while fails the same way. ControlEdges stay empty.
  • The model-adapter transport still rejects kind defun, so #88 stays closed.
  • write_file and mkdir stay deferred. No Wasm, no module linker, and no production path flip.

Hosts for the new conformance case

tests/conformance/abi_v1/09_defun_call.howl (defun_call in tests/conformance/lowered_hfir_abi_v1.json):

Host Path
hfir_bytecode Experimental -compile-hfir-bc, then -run-bc
bytecode Production -compile-bc (AST bytecode after the gate), then -run-bc. Canonical result
interpreter, go, javascript Still the AST. Included because this fixture is already in their subset. JavaScript rewrites the root to web_app

Those hosts print 42 and phase3a.

How to test

go test ./internal/hfir/ ./internal/vm/ ./tools/difftest/ -count=1
go test -run TestCompileBcStaysASTWhileHfirBcRejectsWhile -count=1

TestLoweredHFIRABIConformance/defun_call is the shared case. go test ./... passed locally.

Manual:

go run howlframe.go -compile-hfir-bc tests/conformance/abi_v1/09_defun_call.howl -o /tmp/defun.hfbc
go run howlframe.go -run-bc /tmp/defun.hfbc

A while program still compiles and runs with -compile-bc, and -compile-hfir-bc rejects it without writing an artifact.

Journal: docs/journals/2026-09-30_lowered_hfir_abi_phase3a_defun_call.md.

This PR does not mark #90 Done and should not be squash-merged as a completion of that issue.

Open in Web Open in Cursor 

…code path

-compile-hfir-bc now emits existing CALL and RETURN opcodes for defun, call, and return. while still fails closed. Production -compile-bc stays AST bytecode after the gate. #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 3a looks clean on the fence.

Experimental -compile-hfir-bc gains defun / call / return on existing CALL/RETURN. Production -compile-bc still AST — locked by TestCompileBcStaysASTWhileHfirBcRejectsWhile. while still fail-closed (HFIR_BYTECODE_UNSUPPORTED, no artifact). ControlEdges empty. No new opcodes/caps, no Wasm, no linker/module smuggle, no path flip.

Conformance: 09_defun_call.howl / defun_call across hfir_bytecode + AST hosts. #88 transport still rejects defun. write_file/mkdir out of scope.

#90 stays Partial. CI build green on 6e82439. Hard nos clean — undraft when ready; do not squash-merge as #90 Done.

@howlcipher
howlcipher marked this pull request as ready for review September 30, 2026 04:54
@howlcipher
howlcipher merged commit f6df0ce 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