--disable-jit flag
will be less efficient than if compiled with -DJIT_ENABLED=0, but better than nothing
This commit is contained in:
parent
0f5e3c354d
commit
2adb0a3586
@ -963,6 +963,9 @@ int main(int argc, char* argv[]) {
|
|||||||
} else if (!strcmp(carg, "--replxx-read-only")) {
|
} else if (!strcmp(carg, "--replxx-read-only")) {
|
||||||
replxx_read_only = true;
|
replxx_read_only = true;
|
||||||
continue;
|
continue;
|
||||||
|
} else if (!strcmp(carg, "--disable-jit")) {
|
||||||
|
jit_enabled = false;
|
||||||
|
continue;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
printf("%s: Unknown option: %s\n", argv[0], carg);
|
printf("%s: Unknown option: %s\n", argv[0], carg);
|
||||||
|
|||||||
2
src/vm.c
2
src/vm.c
@ -985,8 +985,10 @@ NOINLINE Scope* m_scope(Body* body, Scope* psc, u16 varAm, i32 initVarAm, B* ini
|
|||||||
|
|
||||||
B execBlockInplaceImpl(Body* body, Scope* sc, Block* block) { return execBodyInplaceI(block->bodies[0], sc, block); }
|
B execBlockInplaceImpl(Body* body, Scope* sc, Block* block) { return execBodyInplaceI(block->bodies[0], sc, block); }
|
||||||
|
|
||||||
|
bool jit_enabled = true;
|
||||||
#if JIT_START != -1
|
#if JIT_START != -1
|
||||||
B mnvmExecBodyInplace(Body* body, Scope* sc) {
|
B mnvmExecBodyInplace(Body* body, Scope* sc) {
|
||||||
|
if (!jit_enabled) return evalBC(body, sc, body->bl);
|
||||||
Nvm_res r = m_nvm(body);
|
Nvm_res r = m_nvm(body);
|
||||||
body->nvm = r.p;
|
body->nvm = r.p;
|
||||||
body->nvmRefs = r.refs;
|
body->nvmRefs = r.refs;
|
||||||
|
|||||||
4
src/vm.h
4
src/vm.h
@ -177,12 +177,14 @@ static B execBlockInplace(Block* block, Scope* sc) { // doesn't consume; execute
|
|||||||
#if JIT_START != -1
|
#if JIT_START != -1
|
||||||
NOINLINE B mnvmExecBodyInplace(Body* body, Scope* sc);
|
NOINLINE B mnvmExecBodyInplace(Body* body, Scope* sc);
|
||||||
#endif
|
#endif
|
||||||
|
extern bool jit_enabled;
|
||||||
FORCE_INLINE B execBodyInplaceI(Body* body, Scope* sc, Block* block) { // consumes sc, unlike execBlockInplace
|
FORCE_INLINE B execBodyInplaceI(Body* body, Scope* sc, Block* block) { // consumes sc, unlike execBlockInplace
|
||||||
|
debug_assert(body->bl == block);
|
||||||
#if JIT_START != -1
|
#if JIT_START != -1
|
||||||
if (LIKELY(body->nvm != NULL)) return evalJIT(body, sc, body->nvm);
|
if (LIKELY(body->nvm != NULL)) return evalJIT(body, sc, body->nvm);
|
||||||
bool jit = true;
|
bool jit = true;
|
||||||
#if JIT_START > 0
|
#if JIT_START > 0
|
||||||
jit = body->callCount++ >= JIT_START;
|
jit = body->callCount++ == JIT_START;
|
||||||
#endif
|
#endif
|
||||||
// jit = body->bc[2]==m_f64(123456).u>>32; // enable JIT for blocks starting with `123456⋄`
|
// jit = body->bc[2]==m_f64(123456).u>>32; // enable JIT for blocks starting with `123456⋄`
|
||||||
if (jit) return mnvmExecBodyInplace(body, sc);
|
if (jit) return mnvmExecBodyInplace(body, sc);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user