use execBodyInline everywhere
This commit is contained in:
parent
cbd113870a
commit
953ea0d20d
@ -527,9 +527,6 @@ Nvm_res m_nvm(Body* body) {
|
||||
INCB(R_RES,R_A2,R_A3); // increment refcount if one's needed
|
||||
if (d) { IMM(R_A2, bi_noVar.u); CMP(R_A2,R_RES); JNE(lN); IMM(R_A0,off); INV(1,1,i_NOVAR); LBL1(lN); } // check for error
|
||||
} break;
|
||||
// case LOCO: TOPs; { u64 d=*bc++; u64 p=*bc++; LSC(R_A1,d); MOV8rmo(R_RES,R_A1,p*8+offsetof(Scope,vars)); INCB(R_RES,R_A2,R_A3); } break; // non-erroring inline
|
||||
// case LOCO: TOPs; { u64 d=*bc++; IMM(R_A0,*bc++); LSC(R_A1,d); IMM(R_A2,off); INV(3,1,i_LOCO); } break; // original
|
||||
// case LOCO: TOPs; { u64 d=*bc++; IMM(R_A0,*bc++); LSC(R_A1,d); CCALL(i_LOCO); } break; // original with no error handling
|
||||
case EXTO: TOPs; { u64 d=*bc++; IMM(R_A0,*bc++); LSC(R_A1,d); IMM(R_A2,off); INV(3,1,i_EXTO); } break; // (u32 p, Scope* sc, u32* bc, S)
|
||||
case LOCU: TOPs; { u64 d=*bc++; IMM(R_A0,*bc++); LSC(R_A1,d); CCALL(i_LOCU); } break; // (u32 p, Scope* sc, S)
|
||||
case EXTU: TOPs; { u64 d=*bc++; IMM(R_A0,*bc++); LSC(R_A1,d); CCALL(i_EXTU); } break; // (u32 p, Scope* sc, S)
|
||||
|
||||
@ -20,7 +20,7 @@ static B gsc_exec_inline(B src, B path, B args) {
|
||||
Block* block = bqn_compSc(src, path, args, gsc, true);
|
||||
ptr_dec(gsc->body); ptr_inc(block->body); // redirect new errors to the newly executed code; initial scope had 0 vars, so this is safe
|
||||
gsc->body = block->body;
|
||||
B r = evalBC(block->body, gsc);
|
||||
B r = execBodyInline(block->body, gsc);
|
||||
ptr_dec(block);
|
||||
return r;
|
||||
}
|
||||
@ -162,11 +162,11 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
#ifdef TIME
|
||||
u64 sns = nsTime();
|
||||
B res = evalBC(block->body, gsc);
|
||||
B res = execBodyInline(block->body, gsc);
|
||||
u64 ens = nsTime();
|
||||
printf("%fms\n", (ens-sns)/1e6);
|
||||
#else
|
||||
B res = evalBC(block->body, gsc);
|
||||
B res = execBodyInline(block->body, gsc);
|
||||
#endif
|
||||
ptr_dec(block);
|
||||
|
||||
|
||||
4
src/vm.h
4
src/vm.h
@ -105,7 +105,7 @@ Block* bqn_comp(B str, B path, B args);
|
||||
Block* bqn_compSc(B str, B path, B args, Scope* sc, bool repl);
|
||||
Block* compile(B bcq, B objs, B blocksq, B indices, B tokenInfo, B src, Scope* sc);
|
||||
Scope* m_scope(Body* body, Scope* psc, u16 varAm, i32 initVarAm, B* initVars);
|
||||
B evalBC(Body* b, Scope* sc); // doesn't consume; executes bytecode of the body directly in the scope
|
||||
B execBodyInline(Body* b, Scope* sc); // doesn't consume; executes bytecode of the body directly in the scope
|
||||
|
||||
u32* nextBC(u32* p);
|
||||
i32 stackDiff(u32* p);
|
||||
@ -128,8 +128,8 @@ B m_md2Block(Block* bl, Scope* psc);
|
||||
|
||||
|
||||
typedef struct Env {
|
||||
Scope* sc;
|
||||
union { u32* bcL; i32 bcV; };
|
||||
Scope* sc;
|
||||
} Env;
|
||||
extern Env* envCurr;
|
||||
extern Env* envStart;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user