From cfda1a49d427918ad94d873ac477a3fa5734694a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 2 Mar 2017 11:58:30 +0100 Subject: [PATCH] - forgot to save the last fix for the previous commit. - let the script compiler also output the size of the allocated data for the script functions in addition to the actual code size. --- src/scripting/backend/vmbuilder.cpp | 6 +++++- wadsrc/static/zscript/inventory/health.txt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/scripting/backend/vmbuilder.cpp b/src/scripting/backend/vmbuilder.cpp index 74f845248c..3be1000c59 100644 --- a/src/scripting/backend/vmbuilder.cpp +++ b/src/scripting/backend/vmbuilder.cpp @@ -846,6 +846,7 @@ void FFunctionBuildList::Build() { int errorcount = 0; int codesize = 0; + int datasize = 0; FILE *dump = nullptr; if (Args->CheckParm("-dumpdisasm")) dump = fopen("disasm.txt", "w"); @@ -927,6 +928,8 @@ void FFunctionBuildList::Build() { DumpFunction(dump, sfunc, item.PrintableName.GetChars(), (int)item.PrintableName.Len()); codesize += sfunc->CodeSize; + datasize += sfunc->LineInfoCount * sizeof(FStatementInfo) + sfunc->ExtraSpace + sfunc->NumKonstD * sizeof(int) + + sfunc->NumKonstA * sizeof(void*) + sfunc->NumKonstF * sizeof(double) + sfunc->NumKonstS * sizeof(FString); } sfunc->Unsafe = ctx.Unsafe; } @@ -944,10 +947,11 @@ void FFunctionBuildList::Build() } if (dump != nullptr) { - fprintf(dump, "\n*************************************************************************\n%i code bytes\n", codesize * 4); + fprintf(dump, "\n*************************************************************************\n%i code bytes\n%i data bytes", codesize * 4, datasize); fclose(dump); } FScriptPosition::StrictErrors = false; mItems.Clear(); + mItems.ShrinkToFit(); FxAlloc.FreeAllBlocks(); } \ No newline at end of file diff --git a/wadsrc/static/zscript/inventory/health.txt b/wadsrc/static/zscript/inventory/health.txt index 986dc7069f..e69d85814d 100644 --- a/wadsrc/static/zscript/inventory/health.txt +++ b/wadsrc/static/zscript/inventory/health.txt @@ -112,7 +112,7 @@ class MaxHealth : Health MaxAmount += player.BonusHealth; } success |= Super.TryPickup(other); - MaxAmount = saved; + MaxAmount = savedAmount; if (success) GoAwayAndDie(); return success; }