diff options
| author | 彭宣正 <[email protected]> | 2022-09-08 17:50:33 +0800 |
|---|---|---|
| committer | 彭宣正 <[email protected]> | 2022-09-08 17:50:33 +0800 |
| commit | ca53d85c263274e1d121668d0594e1c642c98447 (patch) | |
| tree | 1018a782d1555042578cb3d611985ccf413c467d | |
| parent | 82005b0c81b7e62046acdcda17477138ac08cd6b (diff) | |
✨ feat(TSG-11870): 修改lua mode 选项v2.0.0
| -rw-r--r-- | gtest/script/elua_time_out.lua | 11 | ||||
| -rw-r--r-- | src/elua_func.cpp | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/gtest/script/elua_time_out.lua b/gtest/script/elua_time_out.lua index 112dabc..21af197 100644 --- a/gtest/script/elua_time_out.lua +++ b/gtest/script/elua_time_out.lua @@ -1,10 +1,15 @@ local str = TEST.data local sum = 0 -for i = 0, 10000 do - for j = 0, 1000 do - sum = sum + i + j + +local function test() + for i = 0, 10000 do + for j = 0, 10000 do + sum = sum + i + j + end end end +test() + return string.len(str), str diff --git a/src/elua_func.cpp b/src/elua_func.cpp index 287efff..4c105d0 100644 --- a/src/elua_func.cpp +++ b/src/elua_func.cpp @@ -548,7 +548,7 @@ static int elua_set_script_timeout(struct lua_State *L, int ms) else { elua_info->elua_mode = elua_JIT_OFF; - luaJIT_setmode(L, 1, LUAJIT_MODE_FUNC | LUAJIT_MODE_OFF); + luaJIT_setmode(L, 0, LUAJIT_MODE_ENGINE | LUAJIT_MODE_OFF); int hook_granularity = ms * 1000000 / 20; // about ms / 20 lua_sethook(L, (lua_Hook)luaMaskCountHook, LUA_MASKCOUNT, hook_granularity); } |
