From: Jérémie Astor Date: Thu, 13 May 2021 14:42:30 +0000 (+0200) Subject: :art: Clean headers X-Git-Tag: nightly~674 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=26ca6ae9cbebe00360cecb0cf8cd4af7144fe44c;p=gwion.git :art: Clean headers --- diff --git a/include/emit.h b/include/emit.h index cda0a13e..f48db3ab 100644 --- a/include/emit.h +++ b/include/emit.h @@ -2,17 +2,17 @@ #define EMIT_H typedef struct Frame_ { - size_t curr_offset; struct Vector_ stack; - struct Vector_ defer; + size_t curr_offset; struct Map_ handlers; + struct Vector_ defer; m_uint try_top; } Frame; typedef struct Code_ { Frame* frame; - size_t stack_depth; struct Vector_ instr; + size_t stack_depth; struct Vector_ stack_cont; struct Vector_ stack_break; struct Vector_ stack_return; diff --git a/include/env/context.h b/include/env/context.h index 2e15d7b8..a302f04c 100644 --- a/include/env/context.h +++ b/include/env/context.h @@ -2,12 +2,12 @@ #define __CONTEXT typedef struct Context_ * Context; struct Context_ { + Nspc nspc; m_str name; Ast tree; - Nspc nspc; + uint16_t ref; bool error; bool global; - uint16_t ref; }; REF_FUNC(Context, context) diff --git a/include/env/env.h b/include/env/env.h index 60ac4523..85ff9565 100644 --- a/include/env/env.h +++ b/include/env/env.h @@ -19,10 +19,10 @@ struct Env_Scope_ { typedef struct Env_ { m_str name; Nspc curr; - Nspc global_nspc; - struct Context_ *context; Type class_def; Func func; + struct Context_ *context; + Nspc global_nspc; struct Gwion_ *gwion; struct Env_Scope_* scope; } *Env; diff --git a/include/env/func.h b/include/env/func.h index a89f3cda..90e76c1a 100644 --- a/include/env/func.h +++ b/include/env/func.h @@ -11,11 +11,11 @@ enum fflag { } __attribute__((packed)); struct Func_ { - m_str name; Func_Def def; struct VM_Code_* code; Value value_ref; Func next; + m_str name; size_t vt_index; struct Map_ upvalues; uint16_t ref; diff --git a/include/env/nspc.h b/include/env/nspc.h index 3ea6d7e0..f8dda3c8 100644 --- a/include/env/nspc.h +++ b/include/env/nspc.h @@ -12,11 +12,11 @@ struct NspcInfo_ { }; struct Nspc_ { - m_str name; + struct NspcInfo_* info; Nspc parent; + m_str name; struct VM_Code_* pre_ctor; struct VM_Code_* dtor; - struct NspcInfo_* info; uint16_t ref; }; diff --git a/include/gwion.h b/include/gwion.h index 89834da5..220d040e 100644 --- a/include/gwion.h +++ b/include/gwion.h @@ -8,14 +8,14 @@ struct Arg_; struct Gwion_ { + MemPool mp; + VM* vm; + SymTable *st; Env env; Emitter emit; - VM* vm; struct GwionData_ *data; - SymTable *st; - MemPool mp; - struct PPArg_ *ppa; Type *type; + struct PPArg_ *ppa; }; ANN m_bool gwion_ini(const Gwion, struct Arg_*); diff --git a/include/operator.h b/include/operator.h index 80168864..b376f828 100644 --- a/include/operator.h +++ b/include/operator.h @@ -35,7 +35,7 @@ struct Op_Import { }; struct Implicit { - Exp e; + Exp e; Type t; loc_t pos; }; diff --git a/include/vm.h b/include/vm.h index 917cb0a1..7a77b8a5 100644 --- a/include/vm.h +++ b/include/vm.h @@ -35,11 +35,12 @@ typedef struct Shreduler_* Shreduler; typedef struct Emitter_ * Emitter; typedef struct VM_Shred_* VM_Shred; -typedef struct Debugger_ { - struct Vector_ breakpoint; - Nspc nspc; +typedef struct VMDebugger_ { + struct VM_ *vm; +// struct VM_Shred *shred; + struct Map_ map; // code, Vector bool step; -} Debugger; +} VMDebugger; typedef struct VM_ { Shreduler shreduler; @@ -48,10 +49,16 @@ typedef struct VM_ { struct Gwion_* gwion; VM_Shred cleaner_shred; struct VM_ *parent; - Debugger debugger; uint32_t rand[2]; + VMDebugger *dbg; } VM; +typedef struct ShredDebugger_ { + struct Vector_ breakpoint; + struct Vector_ line; + struct Scope_ scope; +} ShredDebugger; + struct ShredInfo_ { VM* vm; struct M_Object_* me; @@ -59,7 +66,7 @@ struct ShredInfo_ { MemPool mp; VM_Code orig; struct Vector_ frame; - struct Vector_ line; + ShredDebugger *dbg; }; struct ShredTick_ { diff --git a/tests/plug/callback.c b/tests/plug/callback.c index 5c5e19f4..e7f662df 100644 --- a/tests/plug/callback.c +++ b/tests/plug/callback.c @@ -21,7 +21,7 @@ struct ret_info { static INSTR(my_ret) { struct ret_info* info = (struct ret_info*)instr->m_val; POP_MEM(shred, info->offset); - vector_set(shred->code->instr, shred->pc, (vtype)info->instr); + vector_set(&shred->code->instr, shred->pc, (vtype)info->instr); shred->code = info->code; //*(VM_Code*)instr->ptr; POP_REG(shred, info->size) @@ -53,12 +53,12 @@ static SFUN(cb_func) { // *(VM_Code*)instr->ptr = shred->code; instr->m_val = (m_uint)info; // instr->m_val2 = shred->pc; - for(i = 0; i < vector_size(f->code->instr); i++) { - Instr in = (Instr)vector_at(f->code->instr, i); + for(i = 0; i < vector_size(&f->code->instr); i++) { + Instr in = (Instr)vector_at(&f->code->instr, i); if(in->execute == FuncReturn || in->execute == my_ret) { info->instr = in; - vector_set(f->code->instr, i, (vtype)instr); + vector_set(&f->code->instr, i, (vtype)instr); } } *(m_int*)RETURN = 1;