Repository navigation
emitc 983 - #2812
Merged
Merged
emitc 983#2812
Conversation
added 5 commits
October 29, 2026 12:03
… retain (D111) `a ++ a` over a List[List[str]] appended the inner Lists by their bits: two holders of each inner buffer with no count, freed twice (debug allocator: DOUBLE FREE origin=List, first and second drop both __drop_struct_760). mir_emit_list_extend_from now runs the element copy glue over the appended range when the element has glue and is not a str (the runtime's extend retains strs).
The C backend emitted every drop as a comment, copied every value by its bits and never blanked a move's source, so a C program ran no Drop impl and freed nothing. It now follows the LLVM backend shape for shape: - per-type drop and copy glue (__with_drop_<tid>, __with_copy_<tid>), declared before every body: a type's Drop impl then its fields in reverse, an enum's live payloads, Box, Rc/Arc, List, HashMap/HashSet, SlotMap, channel endpoints, closure cells; members guarded by the reset-on-move sentinel (§2.5.1) - `drop(place)` and DropAndGoto call the glue, guarded when the local was ever moved (§2.5.2); the reset blank is a memset (padding included) - MIR's operand holds (D111): a retained copy takes the copy glue, a taken copy hands the value over and blanks the source - a Drop.drop receiver is the owner's place (FnAbi owned_place) - a struct's hidden liveness byte is set when it is built (D72) - make-unique copies take element glue (D120); clear, an overwriting insert, map remove and clear, ListSlot set drop what they end; ListSlot get and a map slot read take a hold; `++` holds its elements Found on the way: List.remove's result was never written (typed as returning nothing), `a ++ b`'s result was never stored, and the map slot read's dead-slot panic was overwritten by the read. The emit-C harness runs a fixture with an `//! expect-debug-alloc:` line under the debug allocator; six new fixtures do, each at leak count=0. Fixes #983
The C backend had no lowering for the generic `new` an `Atomic.new(v)` call is, and typed its result by another type's `new` (StringBuilder). #985 made std.random's state an Atomic in a global's initializer, so emit-c-test (the compiler emitted as C) stopped emitting: "emit-c does not support generic intrinsic new" in __with_init_global_rng_state.
…rts (#2180) The C backend refused every map key but an integer, a bool, a pointer and a str, so the compiler itself could not be emitted (Sema keeps a HashMap[(i32, i32), _]). Per key type it now generates the hash and the equality the runtime map calls (with_hashmap_new_keyed kind 2), part by part in the LLVM backend's order (mir_emit_hash_ptrs, mir_emit_eq_ptrs): tuples, arrays, structs, enums and Options by variant, Lists, Boxes, str; a type with its own eq (derived or written) compares by it. A key projection is refused, not compared by its parts. The glue's two `insert(…, name)` then `name` sites are routed through an observing helper, seed-bound: every pinned seed returns the blank a last-use take left (fixed in this stack's MIR layer).
…not a failure The stub generator scanned LlvmBridge.w and ClangBridge.w for `pub fn wl_*` and failed with "found no bridge exports" when there were none. The D100 pub sweep (#2463) made every bridge function package-internal: the emitted unit defines each wl_* itself. The scan now reports whether it read and parsed every source, apart from what it found, and an empty list writes a header and stubs that declare nothing.
Contributor
Author
|
Seed-driven battery GREEN on the stack top 99d6360fe ( |
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.
Stack created with GitHub Stacks CLI • Give Feedback 💬