typedef struct pic_code pic_code
This commit is contained in:
parent
07cdd24fe1
commit
751d0f87f8
|
@ -59,11 +59,11 @@ extern "C" {
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "picrin/value.h"
|
#include "picrin/value.h"
|
||||||
|
|
||||||
struct pic_code;
|
typedef struct pic_code pic_code;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int argc, retc;
|
int argc, retc;
|
||||||
struct pic_code *ip;
|
pic_code *ip;
|
||||||
pic_value *fp;
|
pic_value *fp;
|
||||||
struct pic_env *env;
|
struct pic_env *env;
|
||||||
} pic_callinfo;
|
} pic_callinfo;
|
||||||
|
@ -87,7 +87,7 @@ typedef struct {
|
||||||
pic_callinfo *ci;
|
pic_callinfo *ci;
|
||||||
pic_callinfo *cibase, *ciend;
|
pic_callinfo *cibase, *ciend;
|
||||||
|
|
||||||
struct pic_code *ip;
|
pic_code *ip;
|
||||||
|
|
||||||
struct pic_proc **rescue;
|
struct pic_proc **rescue;
|
||||||
size_t ridx, rlen;
|
size_t ridx, rlen;
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct pic_cont {
|
||||||
pic_callinfo *ci_ptr;
|
pic_callinfo *ci_ptr;
|
||||||
size_t ci_offset, ci_len;
|
size_t ci_offset, ci_len;
|
||||||
|
|
||||||
struct pic_code *ip;
|
pic_code *ip;
|
||||||
|
|
||||||
struct pic_proc **rescue;
|
struct pic_proc **rescue;
|
||||||
size_t ridx, rlen;
|
size_t ridx, rlen;
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct pic_code {
|
||||||
|
|
||||||
struct pic_irep {
|
struct pic_irep {
|
||||||
PIC_OBJECT_HEADER
|
PIC_OBJECT_HEADER
|
||||||
struct pic_code *code;
|
pic_code *code;
|
||||||
int argc, localc;
|
int argc, localc;
|
||||||
unsigned *cv_tbl, cv_num;
|
unsigned *cv_tbl, cv_num;
|
||||||
bool varg;
|
bool varg;
|
||||||
|
|
|
@ -948,7 +948,7 @@ typedef struct codegen_context {
|
||||||
/* closed variable table */
|
/* closed variable table */
|
||||||
unsigned *cv_tbl, cv_num;
|
unsigned *cv_tbl, cv_num;
|
||||||
/* actual bit code sequence */
|
/* actual bit code sequence */
|
||||||
struct pic_code *code;
|
pic_code *code;
|
||||||
size_t clen, ccapa;
|
size_t clen, ccapa;
|
||||||
/* child ireps */
|
/* child ireps */
|
||||||
struct pic_irep **irep;
|
struct pic_irep **irep;
|
||||||
|
@ -1045,7 +1045,7 @@ push_codegen_context(codegen_state *state, pic_value args, pic_value locals, boo
|
||||||
|
|
||||||
xh_destroy(vars);
|
xh_destroy(vars);
|
||||||
|
|
||||||
cxt->code = (struct pic_code *)pic_calloc(pic, PIC_ISEQ_SIZE, sizeof(struct pic_code));
|
cxt->code = (pic_code *)pic_calloc(pic, PIC_ISEQ_SIZE, sizeof(pic_code));
|
||||||
cxt->clen = 0;
|
cxt->clen = 0;
|
||||||
cxt->ccapa = PIC_ISEQ_SIZE;
|
cxt->ccapa = PIC_ISEQ_SIZE;
|
||||||
|
|
||||||
|
@ -1074,7 +1074,7 @@ pop_codegen_context(codegen_state *state)
|
||||||
irep->localc = state->cxt->localc;
|
irep->localc = state->cxt->localc;
|
||||||
irep->cv_tbl = state->cxt->cv_tbl;
|
irep->cv_tbl = state->cxt->cv_tbl;
|
||||||
irep->cv_num = state->cxt->cv_num;
|
irep->cv_num = state->cxt->cv_num;
|
||||||
irep->code = pic_realloc(pic, state->cxt->code, sizeof(struct pic_code) * state->cxt->clen);
|
irep->code = pic_realloc(pic, state->cxt->code, sizeof(pic_code) * state->cxt->clen);
|
||||||
irep->clen = state->cxt->clen;
|
irep->clen = state->cxt->clen;
|
||||||
irep->irep = pic_realloc(pic, state->cxt->irep, sizeof(struct pic_irep *) * state->cxt->ilen);
|
irep->irep = pic_realloc(pic, state->cxt->irep, sizeof(struct pic_irep *) * state->cxt->ilen);
|
||||||
irep->ilen = state->cxt->ilen;
|
irep->ilen = state->cxt->ilen;
|
||||||
|
@ -1553,7 +1553,7 @@ pic_set(pic_state *pic, const char *name, pic_value value)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
print_code(pic_state *pic, struct pic_code c)
|
print_code(pic_state *pic, pic_code c)
|
||||||
{
|
{
|
||||||
UNUSED(pic);
|
UNUSED(pic);
|
||||||
|
|
||||||
|
|
8
src/vm.c
8
src/vm.c
|
@ -362,7 +362,7 @@ pic_apply_argv(pic_state *pic, struct pic_proc *proc, size_t argc, ...)
|
||||||
return pic_apply(pic, proc, v);
|
return pic_apply(pic, proc, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_code(pic_state *, struct pic_code);
|
void print_code(pic_state *, pic_code);
|
||||||
|
|
||||||
#if VM_DEBUG
|
#if VM_DEBUG
|
||||||
# define OPCODE_EXEC_HOOK print_code(pic, c)
|
# define OPCODE_EXEC_HOOK print_code(pic, c)
|
||||||
|
@ -394,11 +394,11 @@ void print_code(pic_state *, struct pic_code);
|
||||||
pic_value
|
pic_value
|
||||||
pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
||||||
{
|
{
|
||||||
struct pic_code c;
|
pic_code c;
|
||||||
int ai = pic_gc_arena_preserve(pic);
|
int ai = pic_gc_arena_preserve(pic);
|
||||||
jmp_buf jmp, *prev_jmp = pic->jmp;
|
jmp_buf jmp, *prev_jmp = pic->jmp;
|
||||||
size_t argc, i;
|
size_t argc, i;
|
||||||
struct pic_code boot[2];
|
pic_code boot[2];
|
||||||
|
|
||||||
#if PIC_DIRECT_THREADED_VM
|
#if PIC_DIRECT_THREADED_VM
|
||||||
static void *oplabels[] = {
|
static void *oplabels[] = {
|
||||||
|
@ -849,7 +849,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
||||||
} VM_LOOP_END;
|
} VM_LOOP_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct pic_code trampoline_iseq[] = {
|
static pic_code trampoline_iseq[] = {
|
||||||
{ OP_NOP, {0} },
|
{ OP_NOP, {0} },
|
||||||
{ OP_TAILCALL, {0} },
|
{ OP_TAILCALL, {0} },
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue