#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;
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<lines>
bool step;
-} Debugger;
+} VMDebugger;
typedef struct VM_ {
Shreduler shreduler;
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;
MemPool mp;
VM_Code orig;
struct Vector_ frame;
- struct Vector_ line;
+ ShredDebugger *dbg;
};
struct ShredTick_ {
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)
// *(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;