Allow dumping jit for mod functions only

This commit is contained in:
Ricardo Luís Vaz Silva 2023-04-02 08:30:49 -03:00 committed by Christoph Oelckers
parent 3cb8f1be44
commit 7a9ca1ad3f
2 changed files with 9 additions and 4 deletions

View file

@ -37,6 +37,7 @@
#include "m_argv.h" #include "m_argv.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "jit.h" #include "jit.h"
#include "filesystem.h"
CVAR(Bool, strictdecorate, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE) CVAR(Bool, strictdecorate, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
@ -922,13 +923,17 @@ void FFunctionBuildList::Build()
VMFunction::CreateRegUseInfo(); VMFunction::CreateRegUseInfo();
FScriptPosition::StrictErrors = strictdecorate; 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.Clear();
mItems.ShrinkToFit(); mItems.ShrinkToFit();
FxAlloc.FreeAllBlocks(); FxAlloc.FreeAllBlocks();
} }
void FFunctionBuildList::DumpJit() void FFunctionBuildList::DumpJit(bool include_gzdoom_pk3)
{ {
#ifdef HAVE_VM_JIT #ifdef HAVE_VM_JIT
FILE *dump = fopen("dumpjit.txt", "w"); FILE *dump = fopen("dumpjit.txt", "w");
@ -937,7 +942,7 @@ void FFunctionBuildList::DumpJit()
for (auto &item : mItems) for (auto &item : mItems)
{ {
JitDumpLog(dump, item.Function); if(include_gzdoom_pk3 || fileSystem.GetFileContainer(item.Lump)) JitDumpLog(dump, item.Function);
} }
fclose(dump); fclose(dump);

View file

@ -155,7 +155,7 @@ class FFunctionBuildList
TArray<Item> mItems; TArray<Item> mItems;
void DumpJit(); void DumpJit(bool include_gzdoom_pk3);
public: public:
VMFunction *AddFunction(PNamespace *curglobals, const VersionInfo &ver, PFunction *func, FxExpression *code, const FString &name, bool fromdecorate, int currentstate, int statecnt, int lumpnum); VMFunction *AddFunction(PNamespace *curglobals, const VersionInfo &ver, PFunction *func, FxExpression *code, const FString &name, bool fromdecorate, int currentstate, int statecnt, int lumpnum);