Crash message: "JIT: sfunc->NumArgs != argsPos || regd > sfunc->NumRegD || regf > sfunc->NumRegF || rega > sfunc->NumRegA"
The message above always shows up in the example below. Before isolating the faulty code, the game simply froze and crashed with no message, unless I initialized the variable inside the method with, say, (0, 0).
Example: https://drive.google.com/open?id=1MzRdl ... XOWFuLTeZC
[4.2.1] JIT crash with "out vector2" as parameter.
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
- phantombeta
- Posts: 2088
- Joined: Thu May 02, 2013 1:27 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: Brazil
Re: [4.2.1] JIT crash with "out vector2" as parameter.
Some testing with an alternate example indicates this likely isn't the JIT's fault at all, and is probably just a case of the JIT being less forgiving of broken bytecode.
This alternate example causes the VM to crash with a Fatal Error window. Might include more details soon.
Edit: Further investigation shows that this is, indeed, (just as I thought) compiler fuckery:
More details soon maybe.
Code: Select all
class BEPlayerBase : DoomPlayer
{
private void CheckCursorMovement(out vector2 CursorPosition, int maxWidth, int maxHeight)
{
Console.Printf ("%f, %f", CursorPosition.X, CursorPosition.Y);
}
vector2 SomeGridCoords;
override void Tick()
{
int buttons = player.original_cmd.buttons;
int oldbuttons = player.original_oldbuttons;
if (buttons & BT_ATTACK)
{
CheckCursorMovement((50, 25), 5, 5);
}
Super.Tick();
}
}
Edit: Further investigation shows that this is, indeed, (just as I thought) compiler fuckery:
More details soon maybe.
- Attachments
-
- JIT out vector2 Test_Alternate.pk3
- (567 Bytes) Downloaded 126 times
Re: [4.2.1] JIT crash with "out vector2" as parameter.
The check in the JIT is indeed one I added for sanity. It verifies that the input is what the code expects it to be. Either the input is invalid, or the code is based on assumptions that aren't always true. I assume its the former, but Graf should know for sure.
- phantombeta
- Posts: 2088
- Joined: Thu May 02, 2013 1:27 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: Brazil
Re: [4.2.1] JIT crash with "out vector2" as parameter.
This is caused by a bug in the ZScript compiler Nevermind, I fucked up when debugging. Probably still a bug in the compiler, but not what I thought it was.
- Major Cooke
- Posts: 8175
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: [4.2.1] JIT crash with "out vector2" as parameter.
The problem lies with structs, and vectors are such (for those who don't know).
If you pass in a null Line struct, it'll destroy the game with the null check. But it doesn't crash if it's not in/out.
Code: Select all
bool CheckLine(out Line ln)
{
if (ln == null)
return false;
return true;
}
- phantombeta
- Posts: 2088
- Joined: Thu May 02, 2013 1:27 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: Brazil
Re: [4.2.1] JIT crash with "out vector2" as parameter.
It's not really about being a struct, this is an issue that seems specific to vectors. The Line struct is also a native struct, which is always passed by pointer, not value, so it doesn't suffer from a lot of the problems "normal" structs do.Major Cooke wrote:The problem lies with structs, and vectors are such (for those who don't know).
[...]
If you pass in a null Line struct, it'll destroy the game with the null check. But it doesn't crash if it's not in/out.
Also, please report that crash.
- phantombeta
- Posts: 2088
- Joined: Thu May 02, 2013 1:27 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: Brazil