diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-08-25 21:24:16 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-08-25 21:24:16 -0700 |
commit | 6439f7121b3a75d48d0db2e75c663de754a84c9c (patch) | |
tree | e337823f7c6c85dc11a469c98c3a0f89e78aad06 | |
parent | ce496a342712083526d424d965a6fa689b6b09cb (diff) | |
download | txr-6439f7121b3a75d48d0db2e75c663de754a84c9c.tar.gz txr-6439f7121b3a75d48d0db2e75c663de754a84c9c.tar.bz2 txr-6439f7121b3a75d48d0db2e75c663de754a84c9c.zip |
* gc.c (top): Renamed to gc_prot_top, turned extern.
(prot1, rel1, mark): Follow rename.
* gc.h (gc_prot_top): Declared.
* signal.h (extended_jmp_buf): New member, gc_pt.
(extended_setjmp): Save and restore gc_prot_top.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | gc.c | 10 | ||||
-rw-r--r-- | gc.h | 1 | ||||
-rw-r--r-- | signal.h | 11 |
4 files changed, 25 insertions, 7 deletions
@@ -1,5 +1,15 @@ 2014-08-25 Kaz Kylheku <kaz@kylheku.com> + * gc.c (top): Renamed to gc_prot_top, turned extern. + (prot1, rel1, mark): Follow rename. + + * gc.h (gc_prot_top): Declared. + + * signal.h (extended_jmp_buf): New member, gc_pt. + (extended_setjmp): Save and restore gc_prot_top. + +2014-08-25 Kaz Kylheku <kaz@kylheku.com> + GC correctness fixes: make sure we pin down objects for which we borrow low level C pointers, while we execute code that can cons memory. @@ -69,7 +69,7 @@ static val *gc_stack_bottom; static val *prot_stack[PROT_STACK_SIZE]; static val **prot_stack_limit = prot_stack + PROT_STACK_SIZE; -static val **top = prot_stack; +val **gc_prot_top = prot_stack; static val free_list, *free_tail = &free_list; static heap_t *heap_list; @@ -95,16 +95,16 @@ val break_obj; val prot1(val *loc) { - assert (top < prot_stack_limit); + assert (gc_prot_top < prot_stack_limit); assert (loc != 0); - *top++ = loc; + *gc_prot_top++ = loc; return nil; /* for use in macros */ } void rel1(val *loc) { /* protect and release calls must nest. */ - if (*--top != loc) + if (*--gc_prot_top != loc) abort(); } @@ -401,7 +401,7 @@ static void mark(mach_context_t *pmc, val *gc_stack_top) /* * First, scan the officially registered locations. */ - for (rootloc = prot_stack; rootloc != top; rootloc++) + for (rootloc = prot_stack; rootloc != gc_prot_top; rootloc++) mark_obj(**rootloc); #if CONFIG_GEN_GC @@ -44,6 +44,7 @@ void unmark(void); void gc_hint_func(val *); extern int gc_enabled; +extern val **gc_prot_top; #if EXTRA_DEBUGGING val break_obj; @@ -63,6 +63,7 @@ typedef struct { sigset_t blocked; val de; int gc; + val **gc_pt; int rv; } extended_jmp_buf; @@ -70,13 +71,16 @@ typedef struct { (setjmp((EJB).jb) \ ? (async_sig_enabled = (EJB).se, \ dyn_env = (EJB).de, \ - gc_enabled = ((EJB).gc), \ + gc_enabled = (EJB).gc, \ + gc_prot_top = (EJB).gc_pt, \ sig_mask(SIG_SETMASK, &(EJB).blocked, 0), \ (EJB).rv) \ : ((EJB).se = async_sig_enabled, \ (EJB).de = dyn_env, \ (EJB).gc = gc_enabled, \ - (EJB).blocked = sig_blocked_cache, 0)) + (EJB).gc_pt = gc_prot_top, \ + (EJB).blocked = sig_blocked_cache, \ + 0)) #define extended_longjmp(EJB, ARG) \ ((EJB).rv = (ARG), longjmp((EJB).jb, 1)) @@ -96,6 +100,7 @@ typedef struct { jmp_buf jb; val de; int gc; + val **gc_pt; int rv; } extended_jmp_buf; @@ -103,9 +108,11 @@ typedef struct { (setjmp((EJB).jb) \ ? (dyn_env = (EJB).de, \ gc_enabled = ((EJB).gc), \ + gc_prot_top = (EJB).gc_pt, \ (EJB).rv) \ : ((EJB).de = dyn_env, \ (EJB).gc = gc_enabled, \ + (EJB).gc_pt = gc_prot_top, \ 0)) #define extended_longjmp(EJB, ARG) \ |