LLVM-AOT object mode + JIT-AOT test rail#3534
Merged
Merged
Conversation
aleksisch
force-pushed
the
llvm-aot-object
branch
7 times, most recently
from
July 21, 2026 14:46
9905425 to
954edbc
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an LLVM-backed “offline AOT object” emission mode to the dasLLVM JIT pipeline, enabling generation of self-registering native .o files for static linking into a host binary, and introduces an opt-in test_jit_aot harness to exercise the object-binding path.
Changes:
- Extend JIT CLI/policies to support
--aot-objectemission (portable/generic CPU by default, with--aot-object-generic=falsefor host-featured builds). - Add runtime plumbing to register LLVM-AOT objects into the AOT library and bind them as
SimNode_JitduringProgram::linkCppAot, plus a deferred “glob re-resolution” pass. - Add opt-in CMake targets and runners for
test_jit_aot/run_tests_jit_aot.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| utils/jit/main.das | Adds --aot-object flag wiring and output naming for .o emission. |
| tests/CMakeLists.txt | Adds run_tests_jit_aot opt-in target to run the new harness. |
| tests/aot/CMakeLists.txt | Defines LLVM-only test_jit_aot target and corpus selection/excludes. |
| src/builtin/module_jit.cpp | Adds LLVM-AOT helpers (makeAotJitNode, das_aot_get_func_by_mnh) and improves null-target diagnostics in JIT call helpers. |
| src/builtin/module_builtin_rtti.cpp | Exposes jit_emit_object in RTTI/bindings. |
| src/ast/ast.cpp | Adds process-global registration for LLVM-AOT objects and deferred globinit callbacks. |
| src/ast/ast_simulate.cpp | Extends linkCppAot to support LLVM-AOT partial binding and post-link glob re-resolution. |
| modules/dasLLVM/daslib/llvm_jit.das | Adds emit_aot_object flag and object-mode ctor emission (function registration + globinit registration). |
| modules/dasLLVM/daslib/llvm_jit_run.das | Implements object-emission path, target selection (aot_object_generic), and object-only teardown. |
| modules/dasLLVM/daslib/llvm_jit_common.das | Adds object-only emitter, and object-mode behavior for builtin-accessor/table globals. |
| modules/dasLLVM/daslib/llvm_jit_cli.das | Adds --aot-object-generic CLI option. |
| modules/dasLLVM/daslib/llvm_exe.das | Adds object-mode globinit constructor generation and host-context Func-value resolution path. |
| include/daScript/simulate/aot_library.h | Extends AotFactory to support JIT-backed AOT entries and declares LLVM-AOT helper hooks. |
| include/daScript/ast/ast.h | Adds jit_emit_object policy flag. |
| doc/source/stdlib/handmade/structure_annotation-rtti-CodeOfPolicies.rst | Documents the new JIT offline AOT object mode policy. |
| CMakeLists.txt | Adds DAS_JIT_AOT_LIB macro and includes notes about the new LLVM-only test harness. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+52
to
+56
| // Called from each object's static ctor (safe: just records the pointer). The | ||
| // callback runs later, from linkCppAot, with the linking Context. | ||
| extern "C" void das_aot_register_globinit ( void (*fn)(Context*) ) { | ||
| jitGlobInits().push_back(fn); | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
This global was removed at all
Comment on lines
+4174
to
+4178
| if ( fn.code->rtti_node_isJit() ) { | ||
| // LLVM-AOT: interpret the SimNode_Jit wrapper (aot=false), | ||
| // mirroring das_instrument_jit; it has no aotFunction. | ||
| fn.jit = true; | ||
| } else { |
Collaborator
Author
There was a problem hiding this comment.
There's no way it will be true.
aleksisch
force-pushed
the
llvm-aot-object
branch
20 times, most recently
from
July 23, 2026 21:12
749063b to
1b99d4e
Compare
aleksisch
force-pushed
the
llvm-aot-object
branch
4 times, most recently
from
July 23, 2026 21:37
a2c9db1 to
559875e
Compare
Replace the ~99 repeated line in tests/CMakeLists.txt with loops (two over uniform suites, one data-driven over the irregular ones). Loops skip empty file lists. Move each module's AOT-able source list into its own modules/<M>/CMakeLists.txt as a reusable <MODULE>_AOT_FILES var. tests/aot bridges those to the suite vars and drops the per-module IF guards on the module-lib rows (test-body rows keep theirs).
Trim STYLE014 (>3-line comment blocks) and STYLE015 (>1-line comments in private defs) throughout llvm_exe.das, and combine one adjacent-guard pair (STYLE016).
aleksisch
force-pushed
the
llvm-aot-object
branch
from
July 23, 2026 22:32
00aaac3 to
6b6927a
Compare
Emit a native .o over the whole used function set with a load ctor that registers each function into the AOT library via das_aot_register, for static linking into a host binary. Program::linkCppAot binds each as a SimNode_Jit and hard-errors on any miss -- same contract as C++ AOT (whole-program emission makes hard-error viable). Wire the run_tests_llvm_aot rail over tests/: whole-program per-test corpus (TEST_AOT_ALL_DAS + jit_tests), msl/metal lattice suites excluded (the LLVM JIT declines fp16/lattice arithmetic, so those interpret and emit no object). Rename DAS_JIT_AOT_LIB -> DAS_LLVM_AOT_LIB; ignore _llvm_aot_generated/.
aleksisch
force-pushed
the
llvm-aot-object
branch
from
July 24, 2026 09:25
6b6927a to
3847fdd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an LLVM-AOT object mode to the dasLLVM backend: the JIT emitter can now write self-registering native
.oobjects for static linking into a host binary, and a JIT-AOT test rail that binds those objects and runs the test bodies jitted.Commits
--aot-objectemits native objects that self-register into the host binary (incl. an empty object for fully-no_aotmodules). Adds the opt-in object-mode self-test target (not wired into CI).SimNode_Jitwithrun_jitno-op'd; adds thetest_jit_aotharness with AOT-object glob re-resolution, resolves Func-value and cross-module das call/ctor targets, and falls back to interpret-on-miss for anything unresolved. Bringstest_jit_aotto a green 286/286.Notes
test_jit_aot/run_tests_jit_aot, object-mode self-test) are opt-in, not wired into any CI lane.origin/master(0 commits behind).🤖 Generated with Claude Code