2. Native boundaries and performance evidence
An external function declaration is an ABI contract. Match calling convention, integer width, layout, ownership, and failure behavior exactly. Wrap it in a small Flecha module so the rest of the application uses ordinary typed values. Keep native build inputs explicit and qualify every supported target.
For performance work, start with a representative workload and stable output. Measure optimized native builds, inspect LLVM for bounds and overflow checks, and profile allocation before changing code. Constant or provably safe indices may let LLVM remove checks; variable indices must keep the language’s safety contract. Never weaken a check to win a microbenchmark.
Read external functions, LLVM code generation, and the v0.3 performance baseline for current evidence.
Tested example
Keep the workload and exit status fixed before inspecting optimized native or LLVM output.
File: curriculum/main-evidence/single/llvm_poc.fl
i32 add(i32 left, i32 right) { return left + right;}
i32 main() { x := 20; y := 22; return add(x, y);}The block above is the complete file executed by the commands below.
The small deterministic workload provides a stable exit status before LLVM or native output is inspected. It is evidence for code-generation inspection, not a performance conclusion by itself.
Commands
flecha check curriculum/main-evidence/single/llvm_poc.flflecha build curriculum/main-evidence/single/llvm_poc.fl -o build/llvm_pocbuild/llvm_pocExpected output
(empty stdout)exit status: 42Related reference: /examples/llvm_poc/.