diff options
author | Peter Mikkelsen <peter@pmikkelsen.com> | 2021-07-08 17:07:15 +0000 |
---|---|---|
committer | Peter Mikkelsen <peter@pmikkelsen.com> | 2021-07-08 17:07:15 +0000 |
commit | 28e7dd47d568908702264977d70860c25467fb6e (patch) | |
tree | 61ec96a7ffc789fa518313ab5c78ead65d0db8a8 /builtins.c | |
parent | 96639193bad1db5ff22f17bacbcd4eeecd024ba9 (diff) |
Add a mark-sweep garbage collector
Diffstat (limited to 'builtins.c')
-rw-r--r-- | builtins.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -8,7 +8,7 @@ #define BuiltinProto(name) int name(Term *, Binding **, Module *) #define Match(X, Y) (runestrcmp(name, X) == 0 && arity == Y) #define Throw(What) do{\ - Goal *g = malloc(sizeof(Goal)); \ + Goal *g = gmalloc(sizeof(Goal)); \ g->goal = What; \ g->module = usermodule; \ g->catcher = nil; \ @@ -504,14 +504,14 @@ builtincatch(Term *goal, Binding **bindings, Module *module) Term *catcher = catchgoal->next; Term *recover = catcher->next; - Goal *catchframe = malloc(sizeof(Goal)); + Goal *catchframe = gmalloc(sizeof(Goal)); catchframe->goal = recover; catchframe->module = module; catchframe->catcher = catcher; catchframe->next = goalstack; goalstack = catchframe; - Goal *g = malloc(sizeof(Goal)); + Goal *g = gmalloc(sizeof(Goal)); g->goal = catchgoal; g->module = module; g->catcher = nil; @@ -543,7 +543,7 @@ builtinthrow(Term *goal, Binding **bindings, Module *module) return 0; }else{ goalstack = g->next; - Goal *newgoal = malloc(sizeof(Goal)); + Goal *newgoal = gmalloc(sizeof(Goal)); newgoal->goal = copyterm(g->goal, nil); newgoal->module = module; newgoal->catcher = nil; |