forked from rue-language/rue
-
Notifications
You must be signed in to change notification settings - Fork 0
Implement runtime heap with bump allocator (rue-n50n) #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
steveklabnik
wants to merge
11
commits into
trunk
Choose a base branch
from
steveklabnik/push-qksuzlmvpxon
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
The parser had identical select! blocks for parsing primitive type keywords (i8, i16, i32, i64, u8, u16, u32, u64, bool) in two places: type_parser() and the intrinsic argument parser. Extract this into a shared primitive_type_parser() function that both can reuse. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Introduces a TempLinkDir struct that encapsulates temporary directory management for external linker invocations. This uses RAII (Drop trait) to ensure cleanup happens in all code paths, fixing potential resource leaks in error cases where manual cleanup could be missed. Fixes rue-a38t 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add tests verifying that try_get returns None for invalid Symbols, and that get panics as documented. This ensures the interner's Option-returning API is properly tested. Fixes rue-627f
Add 8 tests covering move semantics for struct return values, which was specified (3.8:7) but lacked test coverage: - Basic return from function - Chained returns through multiple functions - Returning function parameters - Use-after-move errors for returned values 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Replace the panic in register allocation (when a virtual register is not allocated) with a proper InternalCodegenError that propagates through the compilation pipeline. This allows the error to be reported to users rather than crashing the compiler. Changes both x86_64 and aarch64 backends to return CompileResult from allocate(), allocate_with_spills(), and related functions. Fixes rue-8osd 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Design document for destructor support in Rue. Destructors are needed for heap-allocated types like mutable strings where free() must be called when values go out of scope. Key decisions: - Drop runs when value's owning binding goes out of scope (not moved) - Drop order is reverse declaration order (LIFO) - Trivially droppable types (primitives, @copy) have no destructor - Provisional `drop fn TypeName(self)` syntax for user-defined destructors - Copy types cannot have destructors (would cause double-free) Implementation phases follow spec-first, test-driven development: 1. Spec and infrastructure (rue-wjha.7) 2. Drop elaboration (rue-wjha.8) 3. Codegen (rue-wjha.9) 4. User-defined destructors (rue-wjha.10) 5. Integration with built-in types (rue-wjha.11) - deferred Also adds `destructors` preview feature flag. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Design document for implementing a custom bump allocator in the Rue runtime. Uses mmap/munmap syscalls directly (no libc dependency) to provide __rue_alloc, __rue_realloc, and __rue_free functions. This enables heap-allocated types like String, Vec, and Box. Epic: rue-n50n 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Implement Phase 1 of ADR-0009 (struct methods):
- Add `impl` and `self` keywords to lexer
- Parse `impl Type { fn... }` blocks with Method AST nodes
- Parse method calls (`.method()`) as distinct from field access
- Add ImplDecl and MethodCall to RIR with placeholder sema handling
- Add preview tests (gated on `methods` feature flag)
Methods currently return Unit type as placeholders - actual type checking
and code generation are in Phase 3 and Phase 4 respectively.
Related to rue-qs3z
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
Adds RIR instructions and generation for method calls and associated function calls: - Add AssocFnCall RIR instruction for Type::fn() syntax - Parse associated function calls in the parser - Generate RIR for method calls and associated function calls - Add placeholder handling in sema and inference for Phase 3 Phase 3 (type checking) will implement method resolution and self parameter binding. Closes rue-qs3z.2 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Implements Phase 1 (rue-wjha.7) of the destructors epic: Specification: - Add destructor chapter to specification (section 3.9) - Define drop semantics (scope exit, not moved) - Define drop order (reverse declaration order) - Define trivially droppable types (primitives, enums, @copy structs) - Define types with destructors (structs with non-trivial fields) Tests: - Add spec tests with preview = "destructors" flag - Cover drop semantics, drop order, trivially droppable types - Placeholder tests for types with destructors (skipped until String lands) - Achieve 100% normative coverage in traceability report Infrastructure: - Add Drop instruction to AIR (rue-air) - Add Drop instruction to CFG (rue-cfg) - Add type_needs_drop() method to CfgBuilder (requires struct/array definitions) - Add Drop handling to CFG builder (no-op for trivially droppable) - Add Drop handling to x86_64 and aarch64 codegen backends Most destructor tests pass (trivially droppable types work correctly). Three placeholder tests are skipped pending mutable String implementation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add a thread-safe bump allocator with arena-based allocation: - Uses mmap syscalls for memory allocation (64KB arenas) - Atomic pointer operations for thread safety - Implements alloc_init, arena_alloc, arena_free intrinsics - Includes memory intrinsics (memcpy, memmove, memset, memcmp) Fixes linker issues: - Handle GOT relocations (GOT relaxation for static linking) - Skip R_*_NONE and null symbol relocations - Skip relocations to unhandled sections 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
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
Linker Fixes
Build Fixes
__aarch64_have_lse_atomicssymbol dependencyTest plan
🤖 Generated with Claude Code