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/StatementGen.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/StatementGen.cc')
| -rw-r--r-- | lib/CodeGen/StatementGen.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/CodeGen/StatementGen.cc b/lib/CodeGen/StatementGen.cc index c161049..3cacfe9 100644 --- a/lib/CodeGen/StatementGen.cc +++ b/lib/CodeGen/StatementGen.cc @@ -2,7 +2,6 @@ #include "cps/ArrayHandler.h" #include "cps/FileAST.h" #include "cps/FileHandler.h" -#include "cps/MemoryHandler.h" #include "cps/ExceptionHandler.h" #include "cps/TypeAST.h" #include "cps/TemplateAST.h" @@ -54,9 +53,9 @@ void CodeGen::emitStmtImpl(StmtAST *Stmt) { reportError("DELETE requires a class object"); return; } - Memory->emitValidate(Object.Addr, Stmt->getLine()); + if (!emitMemoryCall("_memory_impl_validate", Object.Addr, Stmt->getLine())) return; if (emitDestroy(Object.TypeName, Object.Addr, Stmt->getLine())) - Memory->emitRelease(Object.Addr, Stmt->getLine()); + emitMemoryCall("_memory_impl_free", Object.Addr, Stmt->getLine()); return; } if (auto *Try = dynamic_cast<TryStmtAST*>(Stmt)) { |
