by dpJudas » Wed Dec 04, 2019 7:06 am
Nash wrote:Something I failed to mention in the past; I noticed that these "mysterious errors" starting popping up after the level rewrite was merged into master. And I mean the whole bunch - invalid instruction mov, unexplainable VM aborts, etc. I can say with 90% certainty that these things have never happened before said merge.
Edit for clarification: I am not blaming the level rewrite, perhaps it's not related at all... but I remember clearly _when_ these started manifesting.
I don't think the level rewrite can cause this. If anything, it was some other scripting backend related change during the same period that started it. The most likely candidate to the error is either that A) the JitCompiler compiler class receives a VM register index that is out of bounds, B) it itself fails to initialize an asmjit virtual register, or C) asmjit messes up its internal state.
We could add some validation for it in the JitCompiler, but I'd rather invest my time on my own IR backend. The unwind code in GZD is sort of a ticking time bomb in the sense that its extremely low level, IMO should be done by asmjit, and doesn't seem to become a feature there unless I add it myself (which I can't).
Graf Zahl wrote:Regarding JIT in general, it's really a shame that there's no way to create Visual Studio debugger info for scripted content - if that existed a lot more of the engine could be scriptified.
I'm actually not sure if that is impossible or not. Visual Studio is able to display the call stack for .net JIT code. The big question here is whether they implemented that in some .net specific way, or if it looks for a HMODULE header next to the function table. If it is the latter then it might be possible to give the functions names and reference source files.
[quote="Nash"]Something I failed to mention in the past; I noticed that these "mysterious errors" starting popping up after the level rewrite was merged into master. And I mean the whole bunch - invalid instruction mov, unexplainable VM aborts, etc. I can say with 90% certainty that these things have never happened before said merge.
Edit for clarification: I am not blaming the level rewrite, perhaps it's not related at all... but I remember clearly _when_ these started manifesting.[/quote]
I don't think the level rewrite can cause this. If anything, it was some other scripting backend related change during the same period that started it. The most likely candidate to the error is either that A) the JitCompiler compiler class receives a VM register index that is out of bounds, B) it itself fails to initialize an asmjit virtual register, or C) asmjit messes up its internal state.
We could add some validation for it in the JitCompiler, but I'd rather invest my time on my own IR backend. The unwind code in GZD is sort of a ticking time bomb in the sense that its extremely low level, IMO should be done by asmjit, and doesn't seem to become a feature there unless I add it myself (which I can't).
[quote="Graf Zahl"]Regarding JIT in general, it's really a shame that there's no way to create Visual Studio debugger info for scripted content - if that existed a lot more of the engine could be scriptified.[/quote]
I'm actually not sure if that is impossible or not. Visual Studio is able to display the call stack for .net JIT code. The big question here is whether they implemented that in some .net specific way, or if it looks for a HMODULE header next to the function table. If it is the latter then it might be possible to give the functions names and reference source files.