Merge remote-tracking branch 'remotes/ZDoom/gzdoom/staging' into gzd_staging
This commit is contained in:
commit
9e0bf90be6
177 changed files with 4290 additions and 12626 deletions
|
|
@ -277,7 +277,8 @@ bool AreCompatiblePointerTypes(PType *dest, PType *source, bool forcompare)
|
|||
// null pointers can be assigned to everything, everything can be assigned to void pointers.
|
||||
if (fromtype == nullptr || totype == TypeVoidPtr) return true;
|
||||
// when comparing const-ness does not matter.
|
||||
if (!forcompare && totype->IsConst != fromtype->IsConst) return false;
|
||||
// If not comparing, then we should not allow const to be cast away.
|
||||
if (!forcompare && fromtype->IsConst && !totype->IsConst) return false;
|
||||
// A type is always compatible to itself.
|
||||
if (fromtype == totype) return true;
|
||||
// Pointers to different types are only compatible if both point to an object and the source type is a child of the destination type.
|
||||
|
|
@ -4793,7 +4794,7 @@ FxExpression *FxTypeCheck::Resolve(FCompileContext& ctx)
|
|||
}
|
||||
else
|
||||
{
|
||||
left = new FxTypeCast(left, NewPointer(RUNTIME_CLASS(DObject)), false);
|
||||
left = new FxTypeCast(left, NewPointer(RUNTIME_CLASS(DObject), true), false);
|
||||
ClassCheck = false;
|
||||
}
|
||||
right = new FxClassTypeCast(NewClassPointer(RUNTIME_CLASS(DObject)), right, false);
|
||||
|
|
@ -8858,7 +8859,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx)
|
|||
}
|
||||
}
|
||||
|
||||
if (Self->ValueType->isRealPointer())
|
||||
if (Self->ValueType->isRealPointer() && Self->ValueType->toPointer()->PointedType)
|
||||
{
|
||||
auto ptype = Self->ValueType->toPointer()->PointedType;
|
||||
cls = ptype->toContainer();
|
||||
|
|
@ -9151,7 +9152,7 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
|
|||
// [Player701] Catch attempts to call abstract functions directly at compile time
|
||||
if (NoVirtual && Function->Variants[0].Implementation->VarFlags & VARF_Abstract)
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Cannot call abstract function %s", Function->Variants[0].Implementation->PrintableName.GetChars());
|
||||
ScriptPosition.Message(MSG_ERROR, "Cannot call abstract function %s", Function->Variants[0].Implementation->PrintableName);
|
||||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -348,8 +348,8 @@ public:
|
|||
bool IsQuaternion() const { return ValueType == TypeQuaternion || ValueType == TypeFQuaternion || ValueType == TypeQuaternionStruct; };
|
||||
bool IsBoolCompat() const { return ValueType->isScalar(); }
|
||||
bool IsObject() const { return ValueType->isObjectPointer(); }
|
||||
bool IsArray() const { return ValueType->isArray() || (ValueType->isPointer() && ValueType->toPointer()->PointedType->isArray()); }
|
||||
bool isStaticArray() const { return (ValueType->isPointer() && ValueType->toPointer()->PointedType->isStaticArray()); } // can only exist in pointer form.
|
||||
bool IsArray() const { return ValueType->isArray() || (ValueType->isPointer() && ValueType->toPointer()->PointedType && ValueType->toPointer()->PointedType->isArray()); }
|
||||
bool isStaticArray() const { return (ValueType->isPointer() && ValueType->toPointer()->PointedType && ValueType->toPointer()->PointedType->isStaticArray()); } // can only exist in pointer form.
|
||||
bool IsDynamicArray() const { return (ValueType->isDynArray()); }
|
||||
bool IsMap() const { return ValueType->isMap(); }
|
||||
bool IsMapIterator() const { return ValueType->isMapIterator(); }
|
||||
|
|
|
|||
|
|
@ -790,7 +790,7 @@ VMFunction *FFunctionBuildList::AddFunction(PNamespace *gnspc, const VersionInfo
|
|||
it.PrintableName = name;
|
||||
it.Function = new VMScriptFunction;
|
||||
it.Function->Name = functype->SymbolName;
|
||||
it.Function->PrintableName = name;
|
||||
it.Function->QualifiedName = it.Function->PrintableName = ClassDataAllocator.Strdup(name);
|
||||
it.Function->ImplicitArgs = functype->GetImplicitArgs();
|
||||
it.Proto = nullptr;
|
||||
it.FromDecorate = fromdecorate;
|
||||
|
|
|
|||
|
|
@ -198,7 +198,8 @@ void InitImports()
|
|||
{
|
||||
assert(afunc->VMPointer != NULL);
|
||||
*(afunc->VMPointer) = new VMNativeFunction(afunc->Function, afunc->FuncName);
|
||||
(*(afunc->VMPointer))->PrintableName.Format("%s.%s [Native]", afunc->ClassName+1, afunc->FuncName);
|
||||
(*(afunc->VMPointer))->QualifiedName = ClassDataAllocator.Strdup(FStringf("%s.%s", afunc->ClassName + 1, afunc->FuncName));
|
||||
(*(afunc->VMPointer))->PrintableName = ClassDataAllocator.Strdup(FStringf("%s.%s [Native]", afunc->ClassName+1, afunc->FuncName));
|
||||
(*(afunc->VMPointer))->DirectNativeCall = afunc->DirectNative;
|
||||
AFTable.Push(*afunc);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -221,5 +221,5 @@ void FScopeBarrier::ValidateCall(PClass* selftype, VMFunction *calledfunc, int o
|
|||
{
|
||||
int innerside = FScopeBarrier::SideFromObjectFlags(selftype->VMType->ScopeFlags);
|
||||
if ((outerside != innerside) && (innerside != FScopeBarrier::Side_PlainData))
|
||||
ThrowAbortException(X_OTHER, "Cannot call %s function %s from %s context", FScopeBarrier::StringFromSide(innerside), calledfunc->PrintableName.GetChars(), FScopeBarrier::StringFromSide(outerside));
|
||||
ThrowAbortException(X_OTHER, "Cannot call %s function %s from %s context", FScopeBarrier::StringFromSide(innerside), calledfunc->PrintableName, FScopeBarrier::StringFromSide(outerside));
|
||||
}
|
||||
|
|
@ -9,6 +9,16 @@ class PPrototype;
|
|||
struct ZCC_TreeNode;
|
||||
class PContainerType;
|
||||
|
||||
// This is needed in common code, despite being Doom specific.
|
||||
enum EStateUseFlags
|
||||
{
|
||||
SUF_ACTOR = 1,
|
||||
SUF_OVERLAY = 2,
|
||||
SUF_WEAPON = 4,
|
||||
SUF_ITEM = 8,
|
||||
};
|
||||
|
||||
|
||||
// Symbol information -------------------------------------------------------
|
||||
|
||||
class PTypeBase
|
||||
|
|
|
|||
|
|
@ -528,7 +528,7 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction
|
|||
}
|
||||
else if (code[i].op == OP_CALL_K && callfunc)
|
||||
{
|
||||
printf_wrapper(out, " [%s]\n", callfunc->PrintableName.GetChars());
|
||||
printf_wrapper(out, " [%s]\n", callfunc->PrintableName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2798,7 +2798,7 @@ void ZCCCompiler::InitFunctions()
|
|||
{
|
||||
if (v->VarFlags & VARF_Abstract)
|
||||
{
|
||||
Error(c->cls, "Non-abstract class %s must override abstract function %s", c->Type()->TypeName.GetChars(), v->PrintableName.GetChars());
|
||||
Error(c->cls, "Non-abstract class %s must override abstract function %s", c->Type()->TypeName.GetChars(), v->PrintableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ static void OutputJitLog(const asmjit::StringLogger &logger);
|
|||
JitFuncPtr JitCompile(VMScriptFunction *sfunc)
|
||||
{
|
||||
#if 0
|
||||
if (strcmp(sfunc->PrintableName.GetChars(), "StatusScreen.drawNum") != 0)
|
||||
if (strcmp(sfunc->PrintableName, "StatusScreen.drawNum") != 0)
|
||||
return nullptr;
|
||||
#endif
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ JitFuncPtr JitCompile(VMScriptFunction *sfunc)
|
|||
catch (const CRecoverableError &e)
|
||||
{
|
||||
OutputJitLog(logger);
|
||||
Printf("%s: Unexpected JIT error: %s\n",sfunc->PrintableName.GetChars(), e.what());
|
||||
Printf("%s: Unexpected JIT error: %s\n",sfunc->PrintableName, e.what());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
@ -237,7 +237,7 @@ void JitCompiler::Setup()
|
|||
cc.comment(marks, 56);
|
||||
|
||||
FString funcname;
|
||||
funcname.Format("Function: %s", sfunc->PrintableName.GetChars());
|
||||
funcname.Format("Function: %s", sfunc->PrintableName);
|
||||
cc.comment(funcname.GetChars(), funcname.Len());
|
||||
|
||||
cc.comment(marks, 56);
|
||||
|
|
@ -364,7 +364,7 @@ void JitCompiler::SetupSimpleFrame()
|
|||
|
||||
if (errorDetails)
|
||||
{
|
||||
I_FatalError("JIT: inconsistent number of %s for function %s", errorDetails, sfunc->PrintableName.GetChars());
|
||||
I_FatalError("JIT: inconsistent number of %s for function %s", errorDetails, sfunc->PrintableName);
|
||||
}
|
||||
|
||||
for (int i = regd; i < sfunc->NumRegD; i++)
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ void JitCompiler::EmitVMCall(asmjit::X86Gp vmfunc, VMFunction *target)
|
|||
call->setArg(2, Imm(B));
|
||||
call->setArg(3, GetCallReturns());
|
||||
call->setArg(4, Imm(C));
|
||||
call->setInlineComment(target ? target->PrintableName.GetChars() : "VMCall");
|
||||
call->setInlineComment(target ? target->PrintableName : "VMCall");
|
||||
|
||||
LoadInOuts();
|
||||
LoadReturns(pc + 1, C);
|
||||
|
|
@ -360,7 +360,7 @@ void JitCompiler::EmitNativeCall(VMNativeFunction *target)
|
|||
|
||||
asmjit::CBNode *cursorBefore = cc.getCursor();
|
||||
auto call = cc.call(imm_ptr(target->DirectNativeCall), CreateFuncSignature());
|
||||
call->setInlineComment(target->PrintableName.GetChars());
|
||||
call->setInlineComment(target->PrintableName);
|
||||
asmjit::CBNode *cursorAfter = cc.getCursor();
|
||||
cc.setCursor(cursorBefore);
|
||||
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ void *AddJitFunction(asmjit::CodeHolder* code, JitCompiler *compiler)
|
|||
if (result == 0)
|
||||
I_Error("RtlAddFunctionTable failed");
|
||||
|
||||
JitDebugInfo.Push({ compiler->GetScriptFunction()->PrintableName, compiler->GetScriptFunction()->SourceFileName, compiler->LineInfo, startaddr, endaddr });
|
||||
JitDebugInfo.Push({ FString(compiler->GetScriptFunction()->PrintableName), compiler->GetScriptFunction()->SourceFileName, compiler->LineInfo, startaddr, endaddr });
|
||||
#endif
|
||||
|
||||
return p;
|
||||
|
|
|
|||
|
|
@ -451,7 +451,8 @@ public:
|
|||
FName Name;
|
||||
const uint8_t *RegTypes = nullptr;
|
||||
TArray<TypedVMValue> DefaultArgs;
|
||||
FString PrintableName; // so that the VM can print meaningful info if something in this function goes wrong.
|
||||
const char* QualifiedName = nullptr;
|
||||
const char* PrintableName = nullptr; // same as QualifiedName, but can have additional annotations.
|
||||
|
||||
class PPrototype *Proto;
|
||||
TArray<uint32_t> ArgFlags; // Should be the same length as Proto->ArgumentTypes
|
||||
|
|
|
|||
|
|
@ -895,7 +895,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
catch (CVMAbortException &err)
|
||||
{
|
||||
err.MaybePrintMessage();
|
||||
err.stacktrace.AppendFormat("Called from %s\n", call->PrintableName.GetChars());
|
||||
err.stacktrace.AppendFormat("Called from %s\n", call->PrintableName);
|
||||
// PrintParameters(reg.param + f->NumParam - B, B);
|
||||
throw;
|
||||
}
|
||||
|
|
@ -2000,7 +2000,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
catch (CVMAbortException &err)
|
||||
{
|
||||
err.MaybePrintMessage();
|
||||
err.stacktrace.AppendFormat("Called from %s at %s, line %d\n", sfunc->PrintableName.GetChars(), sfunc->SourceFileName.GetChars(), sfunc->PCToLine(pc));
|
||||
err.stacktrace.AppendFormat("Called from %s at %s, line %d\n", sfunc->PrintableName, sfunc->SourceFileName.GetChars(), sfunc->PCToLine(pc));
|
||||
// PrintParameters(reg.param + f->NumParam - B, B);
|
||||
throw;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ void VMFunction::CreateRegUse()
|
|||
if (!Proto)
|
||||
{
|
||||
//if (RegTypes) return;
|
||||
//Printf(TEXTCOLOR_ORANGE "Function without prototype needs register info manually set: %s\n", PrintableName.GetChars());
|
||||
//Printf(TEXTCOLOR_ORANGE "Function without prototype needs register info manually set: %s\n", PrintableName);
|
||||
return;
|
||||
}
|
||||
assert(Proto->isPrototype());
|
||||
|
|
@ -277,7 +277,7 @@ static bool CanJit(VMScriptFunction *func)
|
|||
if (func->NumRegA + func->NumRegD + func->NumRegF + func->NumRegS < maxregs)
|
||||
return true;
|
||||
|
||||
Printf(TEXTCOLOR_ORANGE "%s is using too many registers (%d of max %d)! Function will not use native code.\n", func->PrintableName.GetChars(), func->NumRegA + func->NumRegD + func->NumRegF + func->NumRegS, maxregs);
|
||||
Printf(TEXTCOLOR_ORANGE "%s is using too many registers (%d of max %d)! Function will not use native code.\n", func->PrintableName, func->NumRegA + func->NumRegD + func->NumRegF + func->NumRegS, maxregs);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -289,7 +289,7 @@ int VMScriptFunction::FirstScriptCall(VMFunction *func, VMValue *params, int num
|
|||
// rather than let GZDoom crash.
|
||||
if (func->VarFlags & VARF_Abstract)
|
||||
{
|
||||
ThrowAbortException(X_OTHER, "attempt to call abstract function %s.", func->PrintableName.GetChars());
|
||||
ThrowAbortException(X_OTHER, "attempt to call abstract function %s.", func->PrintableName);
|
||||
}
|
||||
#ifdef HAVE_VM_JIT
|
||||
if (vm_jit && CanJit(static_cast<VMScriptFunction*>(func)))
|
||||
|
|
@ -320,7 +320,7 @@ int VMNativeFunction::NativeScriptCall(VMFunction *func, VMValue *params, int nu
|
|||
catch (CVMAbortException &err)
|
||||
{
|
||||
err.MaybePrintMessage();
|
||||
err.stacktrace.AppendFormat("Called from %s\n", func->PrintableName.GetChars());
|
||||
err.stacktrace.AppendFormat("Called from %s\n", func->PrintableName);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
|
@ -702,7 +702,7 @@ void CVMAbortException::MaybePrintMessage()
|
|||
|
||||
CVMAbortException err(reason, moreinfo, ap);
|
||||
|
||||
err.stacktrace.AppendFormat("Called from %s at %s, line %d\n", sfunc->PrintableName.GetChars(), sfunc->SourceFileName.GetChars(), sfunc->PCToLine(line));
|
||||
err.stacktrace.AppendFormat("Called from %s at %s, line %d\n", sfunc->PrintableName, sfunc->SourceFileName.GetChars(), sfunc->PCToLine(line));
|
||||
throw err;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue