- fixed: A VM function's NumArgs value needs to count stack arguments, not logical ones, meaning that for vectors each element needs to count separately.

- renamed VMFunction::Defaults to DefaultArgs to make searching easier.
- let ZCCCompiler process vector defaults for function parameters.
This commit is contained in:
Christoph Oelckers 2016-10-30 09:05:42 +01:00
commit 9eeb56212b
7 changed files with 54 additions and 17 deletions

View file

@ -722,7 +722,13 @@ void FFunctionBuildList::Build()
// Emit code
item.Code->Emit(&buildit);
buildit.MakeFunction(sfunc);
sfunc->NumArgs = item.Func->Variants[0].Proto->ArgumentTypes.Size();
sfunc->NumArgs = 0;
// NumArgs for the VMFunction must be the amount of stack elements, which can differ from the amount of logical function arguments if vectors are in the list.
// For the VM a vector is 2 or 3 args, depending on size.
for (auto s : item.Func->Variants[0].Proto->ArgumentTypes)
{
sfunc->NumArgs += s->GetRegCount();
}
if (dump != nullptr)
{