- allocate storage for all of a function's return values

This commit is contained in:
Christoph Oelckers 2018-11-28 00:24:00 +01:00
parent 6a9696e525
commit fc7ca39927
3 changed files with 14 additions and 2 deletions

View file

@ -35,6 +35,7 @@
#include "vmbuilder.h"
#include "codegen.h"
#include "m_argv.h"
#include "c_cvars.h"
#include "scripting/vm/jit.h"
struct VMRemap
@ -1046,6 +1047,8 @@ void FunctionCallEmitter::AddParameterStringConst(const FString &konst)
});
}
EXTERN_CVAR(Bool, vm_jit)
ExpEmit FunctionCallEmitter::EmitCall(VMFunctionBuilder *build, TArray<ExpEmit> *ReturnRegs)
{
unsigned paramcount = 0;
@ -1085,6 +1088,15 @@ ExpEmit FunctionCallEmitter::EmitCall(VMFunctionBuilder *build, TArray<ExpEmit>
if (ReturnRegs) ReturnRegs->Push(reg);
else return reg;
}
if (vm_jit) // The JIT compiler needs this, but the VM interpreter does not.
{
for (unsigned i = returns.Size(); i < target->Proto->ReturnTypes.Size(); i++)
{
ExpEmit reg(build, target->Proto->ReturnTypes[i]->RegType, target->Proto->ReturnTypes[i]->RegCount);
build->Emit(OP_RESULT, 0, EncodeRegType(reg), reg.RegNum);
reg.Free(build);
}
}
return ExpEmit();
}

View file

@ -36,8 +36,8 @@
#ifndef VM_H
#define VM_H
#include "zstring.h"
#include "autosegs.h"
#include "zstring.h"
#include "vectors.h"
#include "cmdlib.h"
#include "doomerrors.h"

View file

@ -1,4 +1,4 @@
s//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//
// Copyright 2016-2018 Christoph Oelckers
//