From 9bd07e5c83ccb50c1d2a3499079c04663a8ff3d0 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 31 Jan 2021 14:47:33 +0200 Subject: [PATCH] - improved JIT simple frame error message https://forum.zdoom.org/viewtopic.php?t=71340 --- src/common/scripting/jit/jit.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/common/scripting/jit/jit.cpp b/src/common/scripting/jit/jit.cpp index 6d141e652..9823a6029 100644 --- a/src/common/scripting/jit/jit.cpp +++ b/src/common/scripting/jit/jit.cpp @@ -333,8 +333,29 @@ void JitCompiler::SetupSimpleFrame() } } - if (sfunc->NumArgs != argsPos || regd > sfunc->NumRegD || regf > sfunc->NumRegF || rega > sfunc->NumRegA) - I_FatalError("JIT: sfunc->NumArgs != argsPos || regd > sfunc->NumRegD || regf > sfunc->NumRegF || rega > sfunc->NumRegA"); + const char *errorDetails = nullptr; + + if (sfunc->NumArgs != argsPos) + { + errorDetails = "arguments"; + } + else if (regd > sfunc->NumRegD) + { + errorDetails = "integer registers"; + } + else if (regf > sfunc->NumRegF) + { + errorDetails = "floating point registers"; + } + else if (rega > sfunc->NumRegA) + { + errorDetails = "address registers"; + } + + if (errorDetails) + { + I_FatalError("JIT: inconsistent number of %s for function %s", errorDetails, sfunc->PrintableName.GetChars()); + } for (int i = regd; i < sfunc->NumRegD; i++) cc.xor_(regD[i], regD[i]);