diff options
| author | 2024-06-20 23:14:25 -0400 | |
|---|---|---|
| committer | 2024-06-20 23:14:25 -0400 | |
| commit | 62f299dcf7eaa1821cd3ea736bc9f40b93d2bac8 (patch) | |
| tree | 810206978544b653da78e2d3ebf739841eca9a56 /cheney_c89.c | |
| parent | add fake struct to help with type checker (diff) | |
fix root push and pop issue; make shared library for examples
Diffstat (limited to 'cheney_c89.c')
| -rw-r--r-- | cheney_c89.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/cheney_c89.c b/cheney_c89.c index 25b248f..abdbb76 100644 --- a/cheney_c89.c +++ b/cheney_c89.c @@ -14,6 +14,7 @@ * License along with this program. If not, see * <https://www.gnu.org/licenses/>. */ +#include <stdio.h> #include <stdlib.h> #include <limits.h> @@ -53,6 +54,11 @@ static void *raw_alloc(struct ctx *ctx, size_t len, int is_record) { unsigned char *p; +/* + printf("%lu (%ld)\n", (unsigned long)(len + sizeof(struct uns_c89_relo_hdr)), + (long)(ctx->tospace_end - ctx->tospace_alloc)); +*/ + assert(ctx->tospace_alloc + sizeof(struct uns_c89_relo_hdr) + len <= ctx->tospace_end); p = uns_c89_relo_init(ctx->tospace_alloc, len, is_record); ctx->tospace_alloc = p + len; @@ -89,8 +95,8 @@ static void scan_record(struct uns_gc *gc, unsigned char *p) void *newp; for (i = 0; i < l; i++) { - newp = relocate(gc, uns_c89_relo_record_get(p, i)); - uns_c89_relo_record_set(p, i, newp); + newp = relocate(gc, uns_c89_relo_record_get((void *)p, i)); + uns_c89_relo_record_set((void *)p, i, newp); } } @@ -118,6 +124,9 @@ int uns_cheney_c89_collect(struct uns_gc *gc) /* Setup statistics */ gc->before_collection = fromspace_lim - fromspace; +/* + printf("before: %ld\n", gc->before_collection); +*/ gc->after_collection = 0; gc->collection_number += 1; @@ -170,7 +179,7 @@ void *uns_cheney_c89_alloc_record(struct uns_gc *gc, size_t records) unsigned char *res = alloc(gc, records*sizeof(void *), 1); for (i = 0; i < records; i++) - uns_c89_relo_record_set(res, i, NULL); + uns_c89_relo_record_set((void *)res, i, NULL); return res; } |
