pic_callinfo -> struct pic_callinfo, pic_code -> struct pic_code

This commit is contained in:
Yuichi Nishiwaki 2016-02-21 20:18:31 +09:00
parent 5c7c5a69cf
commit 684eb6502d
9 changed files with 42 additions and 42 deletions

View File

@ -16,7 +16,7 @@ struct pic_fullcont {
size_t sp_offset;
ptrdiff_t st_len;
pic_callinfo *ci_ptr;
struct pic_callinfo *ci_ptr;
size_t ci_offset;
ptrdiff_t ci_len;
@ -24,7 +24,7 @@ struct pic_fullcont {
size_t xp_offset;
ptrdiff_t xp_len;
pic_code *ip;
struct pic_code *ip;
pic_value ptable;
@ -54,7 +54,7 @@ cont_mark(pic_state *pic, void *data, void (*mark)(pic_state *, pic_value))
struct pic_fullcont *cont = data;
struct pic_checkpoint *cp;
pic_value *stack;
pic_callinfo *ci;
struct pic_callinfo *ci;
struct pic_proc **xp;
size_t i;
@ -141,8 +141,8 @@ save_cont(pic_state *pic, struct pic_fullcont **c)
cont->ci_offset = pic->ci - pic->cibase;
cont->ci_len = pic->ciend - pic->cibase;
cont->ci_ptr = pic_malloc(pic, sizeof(pic_callinfo) * cont->ci_len);
memcpy(cont->ci_ptr, pic->cibase, sizeof(pic_callinfo) * cont->ci_len);
cont->ci_ptr = pic_malloc(pic, sizeof(struct pic_callinfo) * cont->ci_len);
memcpy(cont->ci_ptr, pic->cibase, sizeof(struct pic_callinfo) * cont->ci_len);
cont->xp_offset = pic->xp - pic->xpbase;
cont->xp_len = pic->xpend - pic->xpbase;
@ -193,7 +193,7 @@ restore_cont(pic_state *pic, struct pic_fullcont *cont)
pic->stend = pic->stbase + cont->st_len;
assert(pic->ciend - pic->cibase >= cont->ci_len);
memcpy(pic->cibase, cont->ci_ptr, sizeof(pic_callinfo) * cont->ci_len);
memcpy(pic->cibase, cont->ci_ptr, sizeof(struct pic_callinfo) * cont->ci_len);
pic->ci = pic->cibase + cont->ci_offset;
pic->ciend = pic->cibase + cont->ci_len;

View File

@ -17,7 +17,7 @@ struct pic_cont {
ptrdiff_t xp_offset;
size_t arena_idx;
pic_value ptable;
pic_code *ip;
struct pic_code *ip;
int retc;
pic_value *retv;
@ -218,7 +218,7 @@ pic_valuesk(pic_state *pic, int argc, pic_value *argv)
int
pic_receive(pic_state *pic, int n, pic_value *argv)
{
pic_callinfo *ci;
struct pic_callinfo *ci;
int i, retc;
/* take info from discarded frame */

View File

@ -11,7 +11,7 @@ pic_value
pic_get_backtrace(pic_state *pic)
{
size_t ai = pic_enter(pic);
pic_callinfo *ci;
struct pic_callinfo *ci;
pic_value trace;
trace = pic_lit_value(pic, "");

View File

@ -354,7 +354,7 @@ typedef struct codegen_context {
pic_value rest;
pic_value args, locals, captures;
/* actual bit code sequence */
pic_code *code;
struct pic_code *code;
size_t clen, ccapa;
/* child ireps */
struct pic_irep **irep;
@ -382,7 +382,7 @@ codegen_context_init(pic_state *pic, codegen_context *cxt, codegen_context *up,
cxt->locals = locals;
cxt->captures = captures;
cxt->code = pic_calloc(pic, PIC_ISEQ_SIZE, sizeof(pic_code));
cxt->code = pic_calloc(pic, PIC_ISEQ_SIZE, sizeof(struct pic_code));
cxt->clen = 0;
cxt->ccapa = PIC_ISEQ_SIZE;
@ -417,7 +417,7 @@ codegen_context_destroy(pic_state *pic, codegen_context *cxt)
irep->argc = pic_vec_len(pic, cxt->args) + 1;
irep->localc = pic_vec_len(pic, cxt->locals);
irep->capturec = pic_vec_len(pic, cxt->captures);
irep->code = pic_realloc(pic, cxt->code, sizeof(pic_code) * cxt->clen);
irep->code = pic_realloc(pic, cxt->code, sizeof(struct pic_code) * cxt->clen);
irep->irep = pic_realloc(pic, cxt->irep, sizeof(struct pic_irep *) * cxt->ilen);
irep->ints = pic_realloc(pic, cxt->ints, sizeof(int) * cxt->klen);
irep->nums = pic_realloc(pic, cxt->nums, sizeof(double) * cxt->flen);
@ -443,7 +443,7 @@ codegen_context_destroy(pic_state *pic, codegen_context *cxt)
} \
} while (0)
#define check_code_size(pic, cxt) check_size(pic, cxt, c, code, pic_code)
#define check_code_size(pic, cxt) check_size(pic, cxt, c, code, struct pic_code)
#define check_irep_size(pic, cxt) check_size(pic, cxt, i, irep, struct pic_irep *)
#define check_pool_size(pic, cxt) check_size(pic, cxt, p, pool, struct pic_object *)
#define check_ints_size(pic, cxt) check_size(pic, cxt, k, ints, int)

View File

@ -412,9 +412,9 @@ static void
gc_mark_phase(pic_state *pic)
{
pic_value *stack;
pic_callinfo *ci;
struct pic_callinfo *ci;
struct pic_proc **xhandler;
struct pic_list *list;
struct pic_list_head *list;
int it;
size_t j;

View File

@ -21,16 +21,16 @@ struct pic_lib {
struct pic_dict *exports;
};
typedef struct {
struct pic_callinfo {
int argc, retc;
pic_code *ip;
struct pic_code *ip;
pic_value *fp;
struct pic_irep *irep;
struct pic_context *cxt;
int regc;
pic_value *regs;
struct pic_context *up;
} pic_callinfo;
};
KHASH_DECLARE(oblist, struct pic_string *, struct pic_identifier *)
KHASH_DECLARE(ltable, const char *, struct pic_lib)
@ -46,13 +46,13 @@ struct pic_state {
pic_value *sp;
pic_value *stbase, *stend;
pic_callinfo *ci;
pic_callinfo *cibase, *ciend;
struct pic_callinfo *ci;
struct pic_callinfo *cibase, *ciend;
struct pic_proc **xp;
struct pic_proc **xpbase, **xpend;
pic_code *ip;
struct pic_code *ip;
pic_value ptable; /* list of ephemerons */
@ -65,10 +65,10 @@ struct pic_state {
pic_value globals; /* weak */
pic_value macros; /* weak */
khash_t(ltable) ltable;
struct pic_list ireps; /* chain */
struct pic_list_head ireps; /* chain */
xFILE files[XOPEN_MAX];
pic_code iseq[2]; /* for pic_apply_trampoline */
struct pic_code iseq[2]; /* for pic_apply_trampoline */
bool gc_enable;
struct pic_heap *heap;

View File

@ -52,22 +52,22 @@ enum {
OP_STOP
};
typedef struct {
struct pic_code {
int insn;
int a;
int b;
} pic_code;
};
struct pic_list {
struct pic_list *prev, *next;
struct pic_list_head {
struct pic_list_head *prev, *next;
};
struct pic_irep {
struct pic_list list;
struct pic_list_head list;
unsigned refc;
int argc, localc, capturec;
bool varg;
pic_code *code;
struct pic_code *code;
struct pic_irep **irep;
int *ints;
double *nums;

View File

@ -253,7 +253,7 @@ vm_gset(pic_state *pic, pic_value uid, pic_value value)
static void
vm_push_cxt(pic_state *pic)
{
pic_callinfo *ci = pic->ci;
struct pic_callinfo *ci = pic->ci;
ci->cxt = (struct pic_context *)pic_obj_alloc(pic, offsetof(struct pic_context, storage) + sizeof(pic_value) * ci->regc, PIC_TYPE_CXT);
ci->cxt->up = ci->up;
@ -262,7 +262,7 @@ vm_push_cxt(pic_state *pic)
}
static void
vm_tear_off(pic_callinfo *ci)
vm_tear_off(struct pic_callinfo *ci)
{
struct pic_context *cxt;
int i;
@ -283,7 +283,7 @@ vm_tear_off(pic_callinfo *ci)
void
pic_vm_tear_off(pic_state *pic)
{
pic_callinfo *ci;
struct pic_callinfo *ci;
for (ci = pic->ci; ci > pic->cibase; ci--) {
if (ci->cxt != NULL) {
@ -326,9 +326,9 @@ bool pic_ge(pic_state *, pic_value, pic_value);
pic_value
pic_apply(pic_state *pic, pic_value proc, int argc, pic_value *argv)
{
pic_code c;
struct pic_code c;
size_t ai = pic_enter(pic);
pic_code boot[2];
struct pic_code boot[2];
int i;
#if PIC_DIRECT_THREADED_VM
@ -411,7 +411,7 @@ pic_apply(pic_state *pic, pic_value proc, int argc, pic_value *argv)
NEXT;
}
CASE(OP_LREF) {
pic_callinfo *ci = pic->ci;
struct pic_callinfo *ci = pic->ci;
struct pic_irep *irep = ci->irep;
if (ci->cxt != NULL && ci->cxt->regs == ci->cxt->storage) {
@ -424,7 +424,7 @@ pic_apply(pic_state *pic, pic_value proc, int argc, pic_value *argv)
NEXT;
}
CASE(OP_LSET) {
pic_callinfo *ci = pic->ci;
struct pic_callinfo *ci = pic->ci;
struct pic_irep *irep = ci->irep;
if (ci->cxt != NULL && ci->cxt->regs == ci->cxt->storage) {
@ -477,7 +477,7 @@ pic_apply(pic_state *pic, pic_value proc, int argc, pic_value *argv)
}
CASE(OP_CALL) {
pic_value x, v;
pic_callinfo *ci;
struct pic_callinfo *ci;
struct pic_proc *proc;
if (c.a == -1) {
@ -557,7 +557,7 @@ pic_apply(pic_state *pic, pic_value proc, int argc, pic_value *argv)
CASE(OP_TAILCALL) {
int i, argc;
pic_value *argv;
pic_callinfo *ci;
struct pic_callinfo *ci;
if (pic->ci->cxt != NULL) {
vm_tear_off(pic->ci);
@ -583,7 +583,7 @@ pic_apply(pic_state *pic, pic_value proc, int argc, pic_value *argv)
CASE(OP_RET) {
int i, retc;
pic_value *retv;
pic_callinfo *ci;
struct pic_callinfo *ci;
if (pic->ci->cxt != NULL) {
vm_tear_off(pic->ci);
@ -772,7 +772,7 @@ pic_value
pic_applyk(pic_state *pic, pic_value proc, int argc, pic_value *args)
{
pic_value *sp;
pic_callinfo *ci;
struct pic_callinfo *ci;
int i;
pic->iseq[0].insn = OP_NOP;

View File

@ -219,7 +219,7 @@ pic_open(pic_allocf allocf, void *userdata)
}
/* callinfo */
pic->cibase = pic->ci = allocf(userdata, NULL, PIC_STACK_SIZE * sizeof(pic_callinfo));
pic->cibase = pic->ci = allocf(userdata, NULL, PIC_STACK_SIZE * sizeof(struct pic_callinfo));
pic->ciend = pic->cibase + PIC_STACK_SIZE;
if (! pic->ci) {
@ -356,7 +356,7 @@ pic_close(pic_state *pic)
{
/* FIXME */
int i = 0;
struct pic_list *list;
struct pic_list_head *list;
for (list = pic->ireps.next; list != &pic->ireps; list = list->next) {
i++;
}