mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- updated VM from GZDoom.
Just to be up to date.
This commit is contained in:
parent
0314cdec55
commit
cb49bcb96d
9 changed files with 60 additions and 9 deletions
|
@ -4282,13 +4282,13 @@ FxExpression *FxBinaryLogical::Resolve(FCompileContext& ctx)
|
||||||
{
|
{
|
||||||
if (b_left==0 || b_right==0)
|
if (b_left==0 || b_right==0)
|
||||||
{
|
{
|
||||||
FxExpression *x = new FxConstant(true, ScriptPosition);
|
FxExpression *x = new FxConstant(false, ScriptPosition);
|
||||||
delete this;
|
delete this;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
else if (b_left==1 && b_right==1)
|
else if (b_left==1 && b_right==1)
|
||||||
{
|
{
|
||||||
FxExpression *x = new FxConstant(false, ScriptPosition);
|
FxExpression *x = new FxConstant(true, ScriptPosition);
|
||||||
delete this;
|
delete this;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,17 @@ template<class T> unsigned int ArrayReserve(T *self, int amount)
|
||||||
return self->Reserve(amount);
|
return self->Reserve(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<> unsigned int ArrayReserve(TArray<DObject*> *self, int amount)
|
||||||
|
{
|
||||||
|
const unsigned int oldSize = self->Reserve(amount);
|
||||||
|
const unsigned int fillCount = self->Size() - oldSize;
|
||||||
|
|
||||||
|
if (fillCount > 0)
|
||||||
|
memset(&(*self)[oldSize], 0, sizeof(DObject*) * fillCount);
|
||||||
|
|
||||||
|
return oldSize;
|
||||||
|
}
|
||||||
|
|
||||||
template<class T> int ArrayMax(T *self)
|
template<class T> int ArrayMax(T *self)
|
||||||
{
|
{
|
||||||
return self->Max();
|
return self->Max();
|
||||||
|
@ -908,7 +919,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Obj, Reserve, ArrayReserve<FDynArray_Obj
|
||||||
{
|
{
|
||||||
PARAM_SELF_STRUCT_PROLOGUE(FDynArray_Obj);
|
PARAM_SELF_STRUCT_PROLOGUE(FDynArray_Obj);
|
||||||
PARAM_INT(count);
|
PARAM_INT(count);
|
||||||
ACTION_RETURN_INT(self->Reserve(count));
|
ACTION_RETURN_INT(ArrayReserve(self, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Obj, Max, ArrayMax<FDynArray_Obj>)
|
DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Obj, Max, ArrayMax<FDynArray_Obj>)
|
||||||
|
|
|
@ -101,6 +101,7 @@ public:
|
||||||
VersionInfo mVersion = { 0,0,0 };
|
VersionInfo mVersion = { 0,0,0 };
|
||||||
uint8_t loadOp, storeOp, moveOp, RegType, RegCount;
|
uint8_t loadOp, storeOp, moveOp, RegType, RegCount;
|
||||||
EScopeFlags ScopeFlags = (EScopeFlags)0;
|
EScopeFlags ScopeFlags = (EScopeFlags)0;
|
||||||
|
bool SizeKnown = true;
|
||||||
|
|
||||||
PType(unsigned int size = 1, unsigned int align = 1);
|
PType(unsigned int size = 1, unsigned int align = 1);
|
||||||
virtual ~PType();
|
virtual ~PType();
|
||||||
|
|
|
@ -913,6 +913,25 @@ static void PrintPropertyStmt(FLispString &out, ZCC_TreeNode *node)
|
||||||
out.Close();
|
out.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void PrintMixinDef(FLispString &out, ZCC_TreeNode *node)
|
||||||
|
{
|
||||||
|
ZCC_MixinDef *mdnode = (ZCC_MixinDef *)node;
|
||||||
|
out.Break();
|
||||||
|
out.Open("mixin-def");
|
||||||
|
out.AddName(mdnode->NodeName);
|
||||||
|
PrintNodes(out, mdnode->Body);
|
||||||
|
out.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PrintMixinStmt(FLispString &out, ZCC_TreeNode *node)
|
||||||
|
{
|
||||||
|
ZCC_MixinStmt *msnode = (ZCC_MixinStmt *)node;
|
||||||
|
out.Break();
|
||||||
|
out.Open("mixin-stmt");
|
||||||
|
out.AddName(msnode->MixinName);
|
||||||
|
out.Close();
|
||||||
|
}
|
||||||
|
|
||||||
void (* const TreeNodePrinter[NUM_AST_NODE_TYPES])(FLispString &, ZCC_TreeNode *) =
|
void (* const TreeNodePrinter[NUM_AST_NODE_TYPES])(FLispString &, ZCC_TreeNode *) =
|
||||||
{
|
{
|
||||||
PrintIdentifier,
|
PrintIdentifier,
|
||||||
|
@ -972,6 +991,8 @@ void (* const TreeNodePrinter[NUM_AST_NODE_TYPES])(FLispString &, ZCC_TreeNode *
|
||||||
PrintStaticArrayState,
|
PrintStaticArrayState,
|
||||||
PrintProperty,
|
PrintProperty,
|
||||||
PrintFlagDef,
|
PrintFlagDef,
|
||||||
|
PrintMixinDef,
|
||||||
|
PrintMixinStmt,
|
||||||
};
|
};
|
||||||
|
|
||||||
FString ZCC_PrintAST(ZCC_TreeNode *root)
|
FString ZCC_PrintAST(ZCC_TreeNode *root)
|
||||||
|
|
|
@ -1476,8 +1476,12 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
|
||||||
auto name = field->Names;
|
auto name = field->Names;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (fieldtype->Size == 0 && !(varflags & VARF_Native)) // Size not known yet.
|
if ((fieldtype->Size == 0 || !fieldtype->SizeKnown) && !(varflags & VARF_Native)) // Size not known yet.
|
||||||
{
|
{
|
||||||
|
if (type != nullptr)
|
||||||
|
{
|
||||||
|
type->SizeKnown = false;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1532,6 +1536,10 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
|
||||||
|
|
||||||
if (OutNamespace->Symbols.AddSymbol(f) == nullptr)
|
if (OutNamespace->Symbols.AddSymbol(f) == nullptr)
|
||||||
{ // name is already in use
|
{ // name is already in use
|
||||||
|
if (type != nullptr)
|
||||||
|
{
|
||||||
|
type->SizeKnown = false;
|
||||||
|
}
|
||||||
f->Destroy();
|
f->Destroy();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1565,6 +1573,12 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
|
||||||
} while (name != field->Names);
|
} while (name != field->Names);
|
||||||
Fields.Delete(0);
|
Fields.Delete(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type != nullptr)
|
||||||
|
{
|
||||||
|
type->SizeKnown = Fields.Size() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
return Fields.Size() == 0;
|
return Fields.Size() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -390,7 +390,7 @@ static void PopFullVMFrame(VMFrameStack *stack)
|
||||||
|
|
||||||
void JitCompiler::EmitPopFrame()
|
void JitCompiler::EmitPopFrame()
|
||||||
{
|
{
|
||||||
if (sfunc->SpecialInits.Size() != 0 || sfunc->NumRegS != 0)
|
if (sfunc->SpecialInits.Size() != 0 || sfunc->NumRegS != 0 || sfunc->ExtraSpace != 0)
|
||||||
{
|
{
|
||||||
auto popFrame = CreateCall<void, VMFrameStack *>(PopFullVMFrame);
|
auto popFrame = CreateCall<void, VMFrameStack *>(PopFullVMFrame);
|
||||||
popFrame->setArg(0, stack);
|
popFrame->setArg(0, stack);
|
||||||
|
|
|
@ -310,7 +310,7 @@ void JitCompiler::ThrowArrayOutOfBounds(int index, int size)
|
||||||
{
|
{
|
||||||
if (index >= size)
|
if (index >= size)
|
||||||
{
|
{
|
||||||
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Max.index = %u, current index = %u\n", size, index);
|
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Size = %u, current index = %u\n", size, index);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -806,7 +806,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
||||||
OP(BOUND):
|
OP(BOUND):
|
||||||
if (reg.d[a] >= BC)
|
if (reg.d[a] >= BC)
|
||||||
{
|
{
|
||||||
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Max.index = %u, current index = %u\n", BC, reg.d[a]);
|
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Size = %u, current index = %u\n", BC, reg.d[a]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (reg.d[a] < 0)
|
else if (reg.d[a] < 0)
|
||||||
|
@ -820,7 +820,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
||||||
ASSERTKD(BC);
|
ASSERTKD(BC);
|
||||||
if (reg.d[a] >= konstd[BC])
|
if (reg.d[a] >= konstd[BC])
|
||||||
{
|
{
|
||||||
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Max.index = %u, current index = %u\n", konstd[BC], reg.d[a]);
|
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Size = %u, current index = %u\n", konstd[BC], reg.d[a]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (reg.d[a] < 0)
|
else if (reg.d[a] < 0)
|
||||||
|
@ -834,7 +834,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
||||||
ASSERTD(B);
|
ASSERTD(B);
|
||||||
if (reg.d[a] >= reg.d[B])
|
if (reg.d[a] >= reg.d[B])
|
||||||
{
|
{
|
||||||
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Max.index = %u, current index = %u\n", reg.d[B], reg.d[a]);
|
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Size = %u, current index = %u\n", reg.d[B], reg.d[a]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (reg.d[a] < 0)
|
else if (reg.d[a] < 0)
|
||||||
|
|
|
@ -45,7 +45,11 @@
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#ifdef HAVE_VM_JIT
|
#ifdef HAVE_VM_JIT
|
||||||
|
#ifdef __DragonFly__
|
||||||
|
CUSTOM_CVAR(Bool, vm_jit, false, CVAR_NOINITCALL)
|
||||||
|
#else
|
||||||
CUSTOM_CVAR(Bool, vm_jit, true, CVAR_NOINITCALL)
|
CUSTOM_CVAR(Bool, vm_jit, true, CVAR_NOINITCALL)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
Printf("You must restart " GAMENAME " for this change to take effect.\n");
|
Printf("You must restart " GAMENAME " for this change to take effect.\n");
|
||||||
Printf("This cvar is currently not saved. You must specify it on the command line.");
|
Printf("This cvar is currently not saved. You must specify it on the command line.");
|
||||||
|
|
Loading…
Reference in a new issue