mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Added pc field for future host function support.
This commit is contained in:
parent
e4ba8d75c2
commit
108b19025e
3 changed files with 13 additions and 2 deletions
5
gc.c
5
gc.c
|
@ -788,6 +788,7 @@ char *gc_copy_obj(object dest, char *obj, gc_thread_data * thd)
|
|||
mark(hp) = thd->gc_alloc_color;
|
||||
type_of(hp) = closureN_tag;
|
||||
hp->fn = ((closureN) obj)->fn;
|
||||
hp->pc = ((closureN) obj)->pc;
|
||||
hp->num_args = ((closureN) obj)->num_args;
|
||||
hp->num_elements = ((closureN) obj)->num_elements;
|
||||
hp->elements = (object *) (((char *)hp) + sizeof(closureN_type));
|
||||
|
@ -896,6 +897,7 @@ char *gc_copy_obj(object dest, char *obj, gc_thread_data * thd)
|
|||
mark(hp) = thd->gc_alloc_color;
|
||||
type_of(hp) = macro_tag;
|
||||
hp->fn = ((macro) obj)->fn;
|
||||
hp->pc = ((macro) obj)->pc;
|
||||
hp->num_args = ((macro) obj)->num_args;
|
||||
return (char *)hp;
|
||||
}
|
||||
|
@ -904,6 +906,7 @@ char *gc_copy_obj(object dest, char *obj, gc_thread_data * thd)
|
|||
mark(hp) = thd->gc_alloc_color;
|
||||
type_of(hp) = closure1_tag;
|
||||
hp->fn = ((closure1) obj)->fn;
|
||||
hp->pc = ((closure1) obj)->pc;
|
||||
hp->num_args = ((closure1) obj)->num_args;
|
||||
hp->element = ((closure1) obj)->element;
|
||||
return (char *)hp;
|
||||
|
@ -2670,7 +2673,7 @@ void gc_thread_data_init(gc_thread_data * thd, int mut_num, char *stack_base,
|
|||
exit(1);
|
||||
}
|
||||
thd->pc = 0;
|
||||
thd->args = calloc(MAX_C_ARGS, sizeof(object));
|
||||
thd->args = NULL;
|
||||
thd->stack_traces = calloc(MAX_STACK_TRACES, sizeof(char *));
|
||||
thd->stack_trace_idx = 0;
|
||||
thd->stack_prev_frame = NULL;
|
||||
|
|
|
@ -1214,6 +1214,7 @@ typedef struct {
|
|||
gc_header_type hdr;
|
||||
tag_type tag;
|
||||
function_type fn;
|
||||
int pc;
|
||||
int num_args;
|
||||
} macro_type;
|
||||
|
||||
|
@ -1222,6 +1223,7 @@ typedef struct {
|
|||
gc_header_type hdr;
|
||||
tag_type tag;
|
||||
function_type fn;
|
||||
int pc;
|
||||
int num_args;
|
||||
} closure0_type;
|
||||
/** @brief A closed-over function with one variable */
|
||||
|
@ -1229,6 +1231,7 @@ typedef struct {
|
|||
gc_header_type hdr;
|
||||
tag_type tag;
|
||||
function_type fn;
|
||||
int pc;
|
||||
int num_args;
|
||||
object element;
|
||||
} closure1_type;
|
||||
|
@ -1237,6 +1240,7 @@ typedef struct {
|
|||
gc_header_type hdr;
|
||||
tag_type tag;
|
||||
function_type fn;
|
||||
int pc;
|
||||
int num_args;
|
||||
int num_elements;
|
||||
object *elements;
|
||||
|
@ -1254,10 +1258,11 @@ typedef closure0_type *macro;
|
|||
c.hdr.grayed = 0; \
|
||||
c.tag = macro_tag; \
|
||||
c.fn = f; \
|
||||
c.pc = 0; \
|
||||
c.num_args = -1;
|
||||
|
||||
#define mclosure0(c, f) \
|
||||
static closure0_type c = { .hdr.mark = gc_color_red, .hdr.grayed = 0, .tag = closure0_tag, .fn = f, .num_args = -1 }; /* TODO: need a new macro that initializes num_args */
|
||||
static closure0_type c = { .hdr.mark = gc_color_red, .hdr.grayed = 0, .tag = closure0_tag, .fn = f, .pc = 0, .num_args = -1 }; /* TODO: need a new macro that initializes num_args */
|
||||
|
||||
/*
|
||||
#define mclosure0(c,f) \
|
||||
|
@ -1275,6 +1280,7 @@ typedef closure0_type *macro;
|
|||
c.hdr.grayed = 0; \
|
||||
c.tag = closure0_tag; \
|
||||
c.fn = f; \
|
||||
c.pc = 0; \
|
||||
c.num_args = na;
|
||||
|
||||
#define mclosure1(c,f,a) \
|
||||
|
@ -1283,6 +1289,7 @@ typedef closure0_type *macro;
|
|||
c.hdr.grayed = 0; \
|
||||
c.tag = closure1_tag; \
|
||||
c.fn = f; \
|
||||
c.pc = 0; \
|
||||
c.num_args = -1; \
|
||||
c.element = a;
|
||||
|
||||
|
|
|
@ -1392,6 +1392,7 @@
|
|||
cv-name ".hdr.grayed = 0;\n"
|
||||
cv-name ".tag = closureN_tag;\n "
|
||||
cv-name ".fn = (function_type)__lambda_" (number->string lid) ";\n"
|
||||
cv-name ".pc = 0;\n" ;; TODO: need to set this appropriately
|
||||
cv-name ".num_args = " num-args-str ";\n"
|
||||
cv-name ".num_elements = " (number->string (length free-vars)) ";\n"
|
||||
cv-name ".elements = (object *)alloca(sizeof(object) * "
|
||||
|
|
Loading…
Add table
Reference in a new issue