From 0dd0b0908300eee08a06ee51d9eb48b85fd97d74 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 27 Oct 2026 13:27:14 +0000 Subject: 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 --- lib/CodeGen/StatementGen.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/StatementGen.cc') 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(Stmt)) { -- cgit v1.3.1-4-g156e