summaryrefslogtreecommitdiff
path: root/src/lib_jit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib_jit.c')
-rw-r--r--src/lib_jit.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/lib_jit.c b/src/lib_jit.c
index 0ee5ad0d..34e5bd34 100644
--- a/src/lib_jit.c
+++ b/src/lib_jit.c
@@ -49,12 +49,10 @@ static int setjitmode(lua_State *L, int mode)
49 mode |= LUAJIT_MODE_FUNC; 49 mode |= LUAJIT_MODE_FUNC;
50 } 50 }
51 if (luaJIT_setmode(L, idx, mode) != 1) { 51 if (luaJIT_setmode(L, idx, mode) != 1) {
52 if ((mode & LUAJIT_MODE_MASK) == LUAJIT_MODE_ENGINE)
53 lj_err_caller(L, LJ_ERR_NOJIT);
52 err: 54 err:
53#if LJ_HASJIT
54 lj_err_arg(L, 1, LJ_ERR_NOLFUNC); 55 lj_err_arg(L, 1, LJ_ERR_NOLFUNC);
55#else
56 lj_err_caller(L, LJ_ERR_NOJIT);
57#endif
58 } 56 }
59 return 0; 57 return 0;
60} 58}
@@ -532,19 +530,15 @@ static uint32_t jit_cpudetect(lua_State *L)
532 } 530 }
533#endif 531#endif
534 } 532 }
535 /* Check for required instruction set support on x86. */ 533 /* Check for required instruction set support on x86 (unnecessary on x64). */
536#if LJ_TARGET_X86 534#if LJ_TARGET_X86
537#if !defined(LUAJIT_CPU_NOCMOV) 535#if !defined(LUAJIT_CPU_NOCMOV)
538 if (!(flags & JIT_F_CMOV)) 536 if (!(flags & JIT_F_CMOV))
539 luaL_error(L, "Ancient CPU lacks CMOV support (recompile with -DLUAJIT_CPU_NOCMOV)"); 537 luaL_error(L, "Ancient CPU lacks CMOV support (recompile with -DLUAJIT_CPU_NOCMOV)");
540#endif 538#endif
541 if (!(flags & JIT_F_SSE2))
542#if defined(LUAJIT_CPU_SSE2) 539#if defined(LUAJIT_CPU_SSE2)
540 if (!(flags & JIT_F_SSE2))
543 luaL_error(L, "CPU does not support SSE2 (recompile without -DLUAJIT_CPU_SSE2)"); 541 luaL_error(L, "CPU does not support SSE2 (recompile without -DLUAJIT_CPU_SSE2)");
544#elif LJ_HASJIT
545 luaL_error(L, "Sorry, SSE2 CPU support required for this beta release");
546#else
547 (void)0;
548#endif 542#endif
549#endif 543#endif
550 UNUSED(L); 544 UNUSED(L);
@@ -560,7 +554,11 @@ static void jit_init(lua_State *L)
560 uint32_t flags = jit_cpudetect(L); 554 uint32_t flags = jit_cpudetect(L);
561#if LJ_HASJIT 555#if LJ_HASJIT
562 jit_State *J = L2J(L); 556 jit_State *J = L2J(L);
563 J->flags = flags | JIT_F_ON | JIT_F_OPT_DEFAULT; 557#if LJ_TARGET_X86
558 /* Silently turn off the JIT compiler on CPUs without SSE2. */
559 if ((flags & JIT_F_SSE2))
560#endif
561 J->flags = flags | JIT_F_ON | JIT_F_OPT_DEFAULT;
564 memcpy(J->param, jit_param_default, sizeof(J->param)); 562 memcpy(J->param, jit_param_default, sizeof(J->param));
565 lj_dispatch_update(G(L)); 563 lj_dispatch_update(G(L));
566#else 564#else