From 7a9ca1ad3ffc7968f80d16ca190789f20ee81d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Sun, 2 Apr 2023 08:30:49 -0300 Subject: [PATCH] Allow dumping jit for mod functions only --- src/common/scripting/backend/vmbuilder.cpp | 11 ++++++++--- src/common/scripting/backend/vmbuilder.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/common/scripting/backend/vmbuilder.cpp b/src/common/scripting/backend/vmbuilder.cpp index ffd29d4ddf..d063790d28 100644 --- a/src/common/scripting/backend/vmbuilder.cpp +++ b/src/common/scripting/backend/vmbuilder.cpp @@ -37,6 +37,7 @@ #include "m_argv.h" #include "c_cvars.h" #include "jit.h" +#include "filesystem.h" CVAR(Bool, strictdecorate, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE) @@ -922,13 +923,17 @@ void FFunctionBuildList::Build() VMFunction::CreateRegUseInfo(); FScriptPosition::StrictErrors = strictdecorate; - if (FScriptPosition::ErrorCounter == 0 && Args->CheckParm("-dumpjit")) DumpJit(); + if (FScriptPosition::ErrorCounter == 0) + { + if (Args->CheckParm("-dumpjit")) DumpJit(true); + else if (Args->CheckParm("-dumpjitmod")) DumpJit(false); + } mItems.Clear(); mItems.ShrinkToFit(); FxAlloc.FreeAllBlocks(); } -void FFunctionBuildList::DumpJit() +void FFunctionBuildList::DumpJit(bool include_gzdoom_pk3) { #ifdef HAVE_VM_JIT FILE *dump = fopen("dumpjit.txt", "w"); @@ -937,7 +942,7 @@ void FFunctionBuildList::DumpJit() for (auto &item : mItems) { - JitDumpLog(dump, item.Function); + if(include_gzdoom_pk3 || fileSystem.GetFileContainer(item.Lump)) JitDumpLog(dump, item.Function); } fclose(dump); diff --git a/src/common/scripting/backend/vmbuilder.h b/src/common/scripting/backend/vmbuilder.h index 8bb43565e6..43ef1bc4cf 100644 --- a/src/common/scripting/backend/vmbuilder.h +++ b/src/common/scripting/backend/vmbuilder.h @@ -155,7 +155,7 @@ class FFunctionBuildList TArray mItems; - void DumpJit(); + void DumpJit(bool include_gzdoom_pk3); public: VMFunction *AddFunction(PNamespace *curglobals, const VersionInfo &ver, PFunction *func, FxExpression *code, const FString &name, bool fromdecorate, int currentstate, int statecnt, int lumpnum);