From f51e72d1549cdbfb0e98716af4adda00f2066a3e Mon Sep 17 00:00:00 2001 From: servostar Date: Fri, 7 Jun 2024 12:37:50 +0200 Subject: [PATCH] fixed: clone not using memory cache --- src/compiler.c | 4 +++- src/set/set.c | 8 +------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/compiler.c b/src/compiler.c index dd2d388..38ce793 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -143,9 +143,11 @@ static void build_target(ModuleFileStack *unit, const TargetConfig *target) { print_ast_to_file(ast, target); Module * test = create_set(ast); - free(test); + // TODO: parse AST to semantic values // TODO: backend codegen + + mem_free(test); } } diff --git a/src/set/set.c b/src/set/set.c index d6f369c..c11fc64 100644 --- a/src/set/set.c +++ b/src/set/set.c @@ -536,13 +536,7 @@ TypeValue createTypeValue(AST_NODE_PTR currentNode){ return value; } -static inline void* clone(int size, void* ptr) { - char* data = mem_alloc(MemoryNamespaceSet,size); - memcpy(data, ptr, size); - return data; -} - -#define CLONE(x) clone(sizeof(x), (void*)&(x)) +#define CLONE(x) mem_clone(MemoryNamespaceSet, (void*)&(x), sizeof(x)) TypeValue createString(AST_NODE_PTR currentNode) { DEBUG("create String");