diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-27 13:27:14 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-27 13:27:14 +0000 |
| commit | 0dd0b0908300eee08a06ee51d9eb48b85fd97d74 (patch) | |
| tree | 8e18df810a1d88f686f2b85ed2f05e3aa0985119 /lib/CodeGen/ConstructorGen.cc | |
| parent | 790e0fd7c5a81b9a27a6d84e0f3f4c7a0b17d04b (diff) | |
refactor(memory)!: move allocation functions into memory.cps
Route keyword NEW and DELETE through the same library runtime and retain
allocation tracking, runtime diagnostics and exception behavior.
BREAKING CHANGE: -no-std programs using NEW or DELETE must explicitly import memory.cps.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/ConstructorGen.cc')
| -rw-r--r-- | lib/CodeGen/ConstructorGen.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/CodeGen/ConstructorGen.cc b/lib/CodeGen/ConstructorGen.cc index f598494..b029385 100644 --- a/lib/CodeGen/ConstructorGen.cc +++ b/lib/CodeGen/ConstructorGen.cc @@ -1,5 +1,4 @@ #include "cps/CodeGen.h" -#include "cps/MemoryHandler.h" #include "cps/ExceptionHandler.h" #include "cps/TypeAST.h" #include <climits> @@ -165,7 +164,8 @@ void CodeGen::emitAssignment(const LValueInfo &Target, ExprAST *Expr, const Symb // a non-null object address (MALLOC(0) deliberately returns null). Size = Builder->CreateSelect(Builder->CreateICmpEQ(Size, ConstantInt::get(Size->getType(), 0)), ConstantInt::get(Size->getType(), 1), Size); - Value *Object = Memory->emitAllocate(Size, New->getLine()); + Value *Object = emitMemoryCall("_memory_impl_malloc", Size, New->getLine()); + if (!Object) return; Builder->CreateStore(Types->getZeroValue(Class->Name), Object); if (!emitConstruct(Class->Name, Object, New->getArgs(), New->getLine())) return; if (Symbol && Symbol->IsReference) { |
