aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 05:33:33 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 05:33:33 +0000
commit4e22f464387725a5a282f3d72e11cfb694a31a5a (patch)
tree17fed09b30633e6aae583f490a0ad9c0c95fb045 /include
parent4dd85fd6ecd9a67e5c2b68380873e6e114714355 (diff)
feat(memory): add checked REALLOC with failure preservation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'include')
-rw-r--r--include/cps/MemoryHandler.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/cps/MemoryHandler.h b/include/cps/MemoryHandler.h
index fd2c93e..ded838b 100644
--- a/include/cps/MemoryHandler.h
+++ b/include/cps/MemoryHandler.h
@@ -20,8 +20,9 @@ class MemoryHandler {
llvm::IntegerType *SizeTy = nullptr;
llvm::StructType *NodeTy = nullptr;
llvm::GlobalVariable *Head = nullptr;
- llvm::FunctionCallee Malloc, Free;
- llvm::Function *AllocateFn = nullptr, *ReleaseFn = nullptr, *FindFn = nullptr;
+ llvm::FunctionCallee Malloc, Free, Realloc;
+ llvm::Function *AllocateFn = nullptr, *ReleaseFn = nullptr, *FindFn = nullptr,
+ *ResizeFn = nullptr;
llvm::Value *AllocationError = nullptr, *TrackingError = nullptr, *InvalidAddress = nullptr;
void ensureRuntime();
@@ -29,6 +30,7 @@ class MemoryHandler {
void buildFind();
void buildAllocate();
void buildRelease();
+ void buildResize();
public:
MemoryHandler(llvm::LLVMContext &C, llvm::IRBuilder<> &B, llvm::Module &M,
@@ -37,6 +39,7 @@ public:
llvm::Value *emitAllocate(llvm::Value *Size, int Line);
llvm::Value *emitRelease(llvm::Value *Address, int Line);
+ llvm::Value *emitResize(llvm::Value *Address, llvm::Value *Size, int Line);
};
} // namespace cps