Comments (5)
Hmm, it must be that the person who reported the bug must have been running an outdated version of LuaJIT, I'll fix the tailcalls in my next release so you can remove those hacks.
from dontstarveluajit.
Hmm, it must be that the person who reported the bug must have been running an outdated version of LuaJIT, I'll fix the tailcalls in my next release so you can remove those hacks.
Thanks a lot~
The GemCore is powerful. Thanks the contribution to Don't Starve 's world!
from dontstarveluajit.
The behavior of debug library of LuaJIT varies from original ones. For example, LuaJIT does not count tailcalls on function stack level.
I've bypassed the compatibility problems between LuaJIT & GemCore by replacing tailcalls with normal function call, by matching code text. It's not the best choice but I have no better idea. see: https://github.com/paintdream/DontStarveLuaJIT/blob/master/src/luajit/src/lib_package.c#L476
Have you released a new verison of GemCore and change the code that calls debug.getinfo()? If so, it would be better if you could remove tail calls on debug.getinfo.... THEN I could remove these unly code....
INSTRUCTIONS: Just as described here: https://github.com/paintdream/DontStarveLuaJIT#to-mod-developers%E5%AF%B9%E4%BA%8Emod%E5%BC%80%E5%8F%91%E8%80%85
Replace:
function a(option)
return debug.getinfo(1, "option")
end
with:
function a(option)
return debug.getinfo(1, "option"), nil
end
from dontstarveluajit.
Except thats the weird part, the crash occurs when enabling Gem Core, and I'm not doing the debug call, the game is.
take this crash log: https://pastebin.com/rkLRcJzK the game crashes when GemCore sets a function to GetModModConfigData
in the global namespace, the stacktrace even shows that the chunk is considered a "Lua" chunk(line 274 of that crash log), when I was testing on my machine(which doesn't have this installed), I could consistently get debug.getinfo to show the chunk as a "main" chunk, this is not my call to debug.getinfo, and therefore I can't fix it.
from dontstarveluajit.
I've upgraded GemCore to latest and it runs well. Have you applied the latest DontStarveLuaJIT patch?
OK, let me tell you what happened serveral months ago:
In strict.lua, klei calls debug.getinfo to test if you are in "main":
mt.__newindex = function (t, n, v)
if __STRICT and not mt.__declared[n] then
local w = debug.getinfo(2, "S").what
if w ~= "main" and w ~= "C" then
error("assign to undeclared variable '"..n.."'", 2)
end
mt.__declared[n] = true
end
rawset(t, n, v)
end
It works fine. But GemCore hooked the debug.getinfo() in fnhider.lua:
local _debug_getinfo = debug.getinfo
function debug.getinfo(...)
local args = {...}
local fnidx = (#args == 3 or (#args == 2 and type(args[2]) ~= "string")) and 2 or 1
local fn = args[fnidx]
if type(fn) ~= "function" then
local stack_count, current, traversed = fn + 1, 2, 1
if fn > 0 then
--jump over this function replacement.
fn = fn + 1
end
while traversed < stack_count do
if hiddenfns[(_debug_getinfo(current, "f") or {}).func] then
fn = fn + 1
else
traversed = traversed + 1
end
current = current + 1
end
args[fnidx] = fn
else
args[fnidx] = hiddenfns[fn] or fn
end
return _debug_getinfo(unpack(args)) --<<<<<<<<<<<<<<<<< Look at here!
end
You call original debug.getinfo in tail call, which behaviour divers from lua and luajit: Lua count the tail call as a layer of stack while LuaJIT not. So after applying fnhider.lua, the layer is not correct in LuaJIT.
So I fixed this problem by hooking kleiloadlua to replace your code with:
return _debug_getinfo(unpack(args)), nil -- Add nil HERE!
And it works fine now.
So if you can do the same change as I described above, THEN I could remove the hook to kleiloadlua and everything works fine.
So it look weird that it still crash in your computer. Maybe you are not applied the latest patch? I guess.
Here is my case: (Enabling GemCore with Global Pause, as well as DontStarveLuaJIT, and all things are good)
from dontstarveluajit.
Related Issues (20)
- steam联机版进入服务器报错 HOT 4
- Add support for macOS? HOT 7
- lib32readline6 dependency for Linux (both Dedicated Server and game) HOT 23
- 关于饥荒联机版不能识别luac编译出的字节码的问题 HOT 41
- More than 65536 constants HOT 3
- 支持多线程吗? HOT 3
- 服务器自动存档时卡住 HOT 1
- Not Loading Costumes - Win10 HOT 5
- Beefalo and Scarecow costumes not displaying HOT 2
- 不好意思打搅了,有空的话能看看我哪里做错了吗? HOT 5
- win10系统,steam联机版luajit导致牛的皮肤无法正常显示
- 命中克劳斯后游戏报错弹出
- 2020.08版本用vscode_dlls替换后启动后进入房间报错
- 和神话书说mod有冲突。 HOT 2
- Linux版使用失败 HOT 7
- Support GPU Instancing
- Redirect io.* library to klei's implementation. HOT 1
- Linux服务器版装上周期性卡一下 HOT 10
- Linux dst 客户端使用失败 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dontstarveluajit.