Closed 0xF6 closed 9 months ago
## Walkthrough
The changes across the system primarily involve renaming the `VM` class to `VirtualMachine` and updating associated references. Memory management has been enhanced with the introduction of `SmartPointer` for safer pointer operations and a new allocator pool for efficient memory allocation. Conditional compilation has been used to define constants for different operating systems. The test suite has been updated to reflect these changes, and new tests have been added to ensure the robustness of memory-related functionalities.
## Changes
| File(s) | Summary |
| --- | --- |
| `Directory.Build.props` | Added conditional OS-specific constants and updated `DefineConstants`. |
| `runtime/.../DefaultWatchDog.cs`, `runtime/.../ForeignFunctionInterface.cs`, `runtime/.../IshtarCore.cs`, `runtime/.../NativeExports.cs`, `runtime/.../Program.cs`, `runtime/.../AppVault.cs`, `runtime/.../ModuleReader.cs`, `runtime/.../IshtarFrames.cs`, `runtime/.../VirtualMachine.cs`, `runtime/.../vm.shit.cs`, `runtime/.../vm.switch.cs`, `test/.../IshtarTestBase.cs` | Renamed `VM` to `VirtualMachine` and updated references. |
| `runtime/.../SmartPointer.cs`, `runtime/.../CallFrame.cs`, `runtime/.../stackval.cs` | Introduced `SmartPointer` struct for memory management and updated usage. |
| `runtime/.../IshtarGC.cs`, `runtime/.../IshtarObject.cs`, `runtime/.../RuntimeIshtarClass.cs`, `runtime/.../RuntimeIshtarField.cs`, `runtime/.../allocators/IIshtarAllocatorPool.cs` | Enhanced memory management with new data structures, allocator pool, and debug info. |
| `test/.../ArrayTest.cs`, `test/.../GCTest.cs`, `test/.../InstructionSizeTest.cs`, `test/.../InstructionTest.cs`, `test/.../MethodExecuteTest.cs` | Updated tests to use array indexing for `returnValue` and added new memory management tests. |
| `runtime/.../IshtarArray.cs`, `runtime/.../__builtin/B_StringBuilder.cs`, `runtime/.../runtime/IshtarGC.cs` | Modified memory allocation methods and assertions. |
| `runtime/.../FFI/GCFlags.cs`, `runtime/common/reflection/VeinTypeCode.cs` | Added new enum values and specified underlying type for `VeinTypeCode`. |
| `runtime/.../ishtar.vm.csproj`, `test/.../ishtar_test.csproj` | Updated project files for build configurations. |
| `test/.../NegativeCases.cs` | Modified test to handle unsafe pointer operations and exception assertions. |
> 🐇 In the fall, where leaves descend,
> Our code now safer, bugs to mend.
> With `SmartPointer` and `VirtualMachine`,
> Memory dances, clean and pristine. 🍂🧹
@coderabbitai review
Summary by CodeRabbit
Given the extensive nature of the provided changes, the existing bullet-point list remains valid and adequately summarizes the modifications. Therefore, it is repeated verbatim below:
Refactor
New Features
Bug Fixes
Tests
Documentation
Chores
Style
Revert