Repository navigation
Conversation
aleksisch
force-pushed
the
aleksisch/alias-handle-init
branch
from
November 22, 2026 19:05
06b2dc6 to
09daa2b
Compare
A make assigned to anything but a plain local was an alias whenever its value read a reference, a global, a container element or a call. Under no_aliasing that made common ECS code an error although nothing there could overlap: a handled type built from constants, a struct built from a reference of an unrelated type, a value computed by a das function with no side effects. A read now counts only when its type can hold the destination type, or the destination type can hold it; this is the type model the function result check already uses. A das function with known side effects that reads no global, no pointer, no argument by reference and invokes nothing is a pure call, as a builtin with no side effects was. A struct's field defaults go through the same check, and a handled type's initializer reads no das memory. The default value of any other type, an empty array or table included, reads nothing, and an operator with no function behind it, as ?:, reads only its operands. The check is one visitor, DestinationReads, behind mayReadDestination(value, dest) in ast_derive_alias.h.
jit_lib_run_in_frame pushed the library's frame without a prologue, so the stack walk in heap_collect read garbage sizes and never ended. With the header in place, each call runs collectHeapIfMostlyFree first: a persistent-heap library with gc frees what earlier calls left behind once the heap grows past its budget, and the host has nothing to call. dasllama_lib turns on persistent_heap and gc.
Auto-inline was off to match a runtime that turned it off under no_aliasing. Since 7ad93e5 the runtime inlines with no_aliasing too, so the driver inlined less, its hashes differed from the runtime's and those functions ran interpreted.
aleksisch
force-pushed
the
aleksisch/alias-handle-init
branch
2 times, most recently
from
November 23, 2026 15:35
c7b3c83 to
8710a7e
Compare
An AOT object called every builtin through a slot the host filled at load, so neither the optimizer nor the host's LTO link saw the callee. It now calls the builtin's link name, as a static -exe does. The AOT compiler binds host functions to stubs, so the name it saw was the stub's, which the host does not define. Host functions, methods and properties are now bound through one wrapper per function (das_host_call, CallPropertyStubbed) with the same symbol in both builds: its body is a stub in the AOT compiler and the real call in the host, so the compiler links without host code and records the host's symbol. addExternHost binds a host function that way, and the DAS_ADD_FUN_BIND / DAS_ADD_METHOD_BIND macros are now thin calls to it. It also marks the function noFolding: a constant call folded in the AOT compiler would run the stub, and folding in only one of the two builds would give them different AOT hashes.
A jitted function takes its context last, after its arguments, and a block after its arguments and its block pointer. ExprFakeContext read parameter 0, which is the first argument whenever there is one, so a builtin that takes the context got that argument instead.
aleksisch
force-pushed
the
aleksisch/alias-handle-init
branch
2 times, most recently
from
November 23, 2026 18:51
79f239d to
8225f27
Compare
An AOT object held machine code, so a host that links with LTO could not inline across the das and C++ code, even with direct builtin calls. With DAS_JIT_AOT_LTO the object holds the module's IR, with the triple, data layout and cpu attributes the target machine would have used, and the host's linker optimizes it with the rest of the program. The split exe's LTO partitions and the AOT object now write their bitcode through one helper, write_lto_bitcode.
is_linkable_symbol read every L<digit> in a mangled name as the marker of an internal-linkage name. An enum value used as a template argument mangles the same way (L8PhysType1E), so builtins and properties of types templated on an enum lost their link names and stayed slot calls in AOT objects. A literal is now told apart by the value and E that follow its type name.
An AOT object reached the new, delete, at, each and clone hooks of a handled type, and every interop builtin, constructor and using, through a slot the host filled at load, so no call there could inline. Each hook now returns a JitTarget, the function's address and its link name, from the one virtual it already had; the hook functions are named, and these builtins record their link names. With direct builtins the object calls them by symbol. float3x4[i] alone was the largest share of indirect calls.
aleksisch
force-pushed
the
aleksisch/alias-handle-init
branch
from
November 23, 2026 19:45
8225f27 to
a6ec2fd
Compare
The table at, find and erase helpers, and the string-key at with a precomputed hash, were reached through slots in AOT objects. They report their link names now, so with direct builtins the object calls them by symbol.
A float3x4() constructor had an address but no link name, and the clock casts had internal linkage, so an AOT object reached them through slots. They report a link name now.
The parallel emit looked LLVM up as the plain file LLVM.dll, while the bindings load it as llvm=LLVM.dll. With DAS_EXTERN_LIB_LLVM set, the two names could resolve to different libraries, or the lookup could fail although the bindings loaded fine. __dasbind_get_library now takes a bare alias and returns the library the [extern] bindings of that alias already loaded, and the split emit asks for "llvm".
A lowering that emits a loop wrote the blocks, the phi and the back edge by hand, and ir_dsl could only fill a function of its own in g_mod, not the one the JIT is emitting or the module it belongs to. ir_loop runs a body for i = 0..count-1, if_value joins two branches in a phi, return_if can return a value, call calls a function of the module, and Ir gets * and !. offset and ptr_slot can be inbounds, as the JIT's own address arithmetic is, so the optimizer drops null checks on them. ir_at builds at the insertion point of an existing builder, ir_function takes the module to define into, and it keeps the state it found, so it can be called inside ir_at. The emitted code of this branch changed, so LLVM_JIT_CODEGEN_VERSION moves and the emitter pin follows.
aleksisch
force-pushed
the
aleksisch/alias-handle-init
branch
from
November 23, 2026 20:21
a6ec2fd to
b0c2e94
Compare
This branch has not been deployed
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.
A make assigned to anything but a plain local was an alias whenever its value read a reference, a global, a container element or a call. Under
no_aliasingthat made common ECS code an error although nothing there could overlap.What changes
collectAliasing).DestinationReads, behindmayReadDestination(value, dest)insrc/ast/ast_derive_alias.h: one typedpreVisitper expression kind, each ending in oneread(type, through)decision.Examples that were errors under no_aliasing and now compile
req.usage = ResourceUsage(access = Access.READ_WRITE)- a handled type built from constants.reqs.depth = SubRef(nameId = id, mip = attachment.mip)withattachmentof an unrelated struct type.s = Scaled(a = half(x), b = x)withhalfa das function without side effects.Reads that can still overlap stay errors, e.g. a
float2&read while building a struct that has afloat2field.Tests
tests/language/uncategorized_no_aliasing.das:test_store_handle,test_store_other_type,test_store_pure_call- each fails to compile without this change.failed_aliasing.das,failed_aliasing_construction.das,in_place_build_aliasing.das(including the inlined make that reads its own destination) still pass.tests/language2250/2250,tests/jit_tests444 passed 7 skipped. Lint and line-length clean.