- 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.
This commit is contained in:
Christoph Oelckers 2017-03-02 11:58:30 +01:00
parent b194ba205a
commit cfda1a49d4
2 changed files with 6 additions and 2 deletions

View File

@ -846,6 +846,7 @@ void FFunctionBuildList::Build()
{ {
int errorcount = 0; int errorcount = 0;
int codesize = 0; int codesize = 0;
int datasize = 0;
FILE *dump = nullptr; FILE *dump = nullptr;
if (Args->CheckParm("-dumpdisasm")) dump = fopen("disasm.txt", "w"); 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()); DumpFunction(dump, sfunc, item.PrintableName.GetChars(), (int)item.PrintableName.Len());
codesize += sfunc->CodeSize; 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; sfunc->Unsafe = ctx.Unsafe;
} }
@ -944,10 +947,11 @@ void FFunctionBuildList::Build()
} }
if (dump != nullptr) 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); fclose(dump);
} }
FScriptPosition::StrictErrors = false; FScriptPosition::StrictErrors = false;
mItems.Clear(); mItems.Clear();
mItems.ShrinkToFit();
FxAlloc.FreeAllBlocks(); FxAlloc.FreeAllBlocks();
} }

View File

@ -112,7 +112,7 @@ class MaxHealth : Health
MaxAmount += player.BonusHealth; MaxAmount += player.BonusHealth;
} }
success |= Super.TryPickup(other); success |= Super.TryPickup(other);
MaxAmount = saved; MaxAmount = savedAmount;
if (success) GoAwayAndDie(); if (success) GoAwayAndDie();
return success; return success;
} }