Conversation
There was a problem hiding this comment.
Pull request overview
This pull request implements a garbage collection system for the VM, replacing manual memory management with an automated mark-and-sweep garbage collector. The changes introduce a MemoryManager class that handles object allocation, deallocation, and garbage collection, along with reference scanning infrastructure to track object relationships.
Key changes:
- Added mark-and-sweep garbage collector with reference scanning support
- Replaced direct allocator usage with centralized
MemoryManagerthroughout the codebase - Introduced reference scanner abstractions for different object types (empty, default, and array scanners)
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/runtime/gc/IGarbageCollector.hpp | Defines garbage collector interface with Collect method |
| lib/runtime/gc/MarkAndSweepGC.hpp | Declares mark-and-sweep GC implementation |
| lib/runtime/gc/MarkAndSweepGC.cpp | Implements mark-and-sweep algorithm with mark/sweep phases and root scanning |
| lib/runtime/gc/reference_scanners/IReferenceScanner.hpp | Defines interface for scanning object references |
| lib/runtime/gc/reference_scanners/EmptyReferenceScanner.hpp | Scanner for objects without references |
| lib/runtime/gc/reference_scanners/DefaultReferenceScanner.hpp | Scanner for regular objects with fields |
| lib/runtime/gc/reference_scanners/ArrayReferenceScanner.hpp | Template scanner for array objects |
| lib/runtime/MemoryManager.hpp | Declares central memory management class |
| lib/runtime/MemoryManager.cpp | Implements allocation, deallocation, GC triggering, and cleanup |
| lib/runtime/VirtualTable.hpp | Adds reference scanning methods to VirtualTable |
| lib/runtime/VirtualTable.cpp | Implements reference scanning and field inspection methods |
| lib/runtime/VirtualTableRepository.cpp | Removes unused variable declaration |
| lib/runtime/ObjectDescriptor.hpp | Adds repo_index field for tracking objects in repository |
| lib/runtime/IVariableAccessor.hpp | Adds IsReferenceType method to interface |
| lib/runtime/VariableAccessor.hpp | Implements IsReferenceType to identify pointer types |
| lib/runtime/CMakeLists.txt | Adds new GC and MemoryManager source files to build |
| lib/runtime/ByteArray.cpp | Formatting improvements (whitespace) |
| lib/runtime/StackFrame.hpp | Formatting improvement (whitespace) |
| lib/execution_tree/PassedExecutionData.hpp | Replaces allocator with memory_manager reference |
| lib/execution_tree/BytecodeCommands.cpp | Updates allocation calls to use memory_manager and removes unused includes |
| lib/executor/builtin_factory.cpp | Assigns appropriate reference scanners to builtin types |
| lib/executor/Executor.cpp | Updates object allocation to use memory_manager |
| lib/executor/BuiltinFunctions.cpp | Updates object allocation to use memory_manager |
| lib/vm_ui/vm_ui_functions.cpp | Simplifies cleanup by delegating to memory_manager.Clear() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a95b9b902c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 30 changed files in this pull request and generated 14 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…r handling in Sweep
…clean up unused includes in BuiltinFunctions.hpp
… ArrayReferenceScanner and DefaultReferenceScanner for improved memory management
…nner and enhancing DefaultReferenceScanner and ArrayReferenceScanner for better OOP
… BuiltinFactory and optimizing VirtualTableRepository's name lookup
…r stack manipulation
bialger
left a comment
There was a problem hiding this comment.
Thank you for your amazing work!
No description provided.