- whitespace cleanup, updated from Raze.
This commit is contained in:
parent
3b879c5656
commit
e60e6967c0
182 changed files with 835 additions and 824 deletions
|
|
@ -1964,7 +1964,7 @@ ExpEmit FxUnaryNotBitwise::Emit(VMFunctionBuilder *build)
|
|||
from.Free(build);
|
||||
ExpEmit to(build, REGT_INT);
|
||||
assert(!from.Konst);
|
||||
|
||||
|
||||
build->Emit(OP_NOT, to.RegNum, from.RegNum, 0);
|
||||
return to;
|
||||
}
|
||||
|
|
@ -2746,7 +2746,7 @@ FxExpression *FxAddSub::Resolve(FCompileContext& ctx)
|
|||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
if (compileEnvironment.CheckForCustomAddition)
|
||||
{
|
||||
auto result = compileEnvironment.CheckForCustomAddition(this, ctx);
|
||||
|
|
@ -2756,7 +2756,7 @@ FxExpression *FxAddSub::Resolve(FCompileContext& ctx)
|
|||
goto goon;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (left->ValueType == TypeTextureID && right->IsInteger())
|
||||
{
|
||||
ValueType = TypeTextureID;
|
||||
|
|
@ -5125,10 +5125,10 @@ ExpEmit FxNew::Emit(VMFunctionBuilder *build)
|
|||
// Call DecoRandom to generate a random number.
|
||||
VMFunction *callfunc;
|
||||
auto sym = FindBuiltinFunction(compileEnvironment.CustomBuiltinNew != NAME_None? compileEnvironment.CustomBuiltinNew : NAME_BuiltinNew);
|
||||
|
||||
|
||||
assert(sym);
|
||||
callfunc = sym->Variants[0].Implementation;
|
||||
|
||||
|
||||
FunctionCallEmitter emitters(callfunc);
|
||||
|
||||
int outerside = -1;
|
||||
|
|
@ -5886,7 +5886,7 @@ FxExpression *FxIdentifier::Resolve(FCompileContext& ctx)
|
|||
{
|
||||
PSymbol * sym;
|
||||
FxExpression *newex = nullptr;
|
||||
|
||||
|
||||
CHECKRESOLVED();
|
||||
|
||||
// Local variables have highest priority.
|
||||
|
|
@ -6038,7 +6038,7 @@ FxExpression *FxIdentifier::Resolve(FCompileContext& ctx)
|
|||
deprecationMessage.IsEmpty() ? "" : ", ", deprecationMessage.GetChars());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
newex = new FxGlobalVariable(static_cast<PField *>(sym), ScriptPosition);
|
||||
goto foundit;
|
||||
|
|
@ -6068,7 +6068,7 @@ FxExpression *FxIdentifier::Resolve(FCompileContext& ctx)
|
|||
newex = new FxCVar(cvar, ScriptPosition);
|
||||
goto foundit;
|
||||
}
|
||||
|
||||
|
||||
ScriptPosition.Message(MSG_ERROR, "Unknown identifier '%s'", Identifier.GetChars());
|
||||
delete this;
|
||||
return nullptr;
|
||||
|
|
@ -6406,7 +6406,7 @@ bool FxLocalVariable::RequestAddress(FCompileContext &ctx, bool *writable)
|
|||
if (writable != nullptr) *writable = !ctx.CheckWritable(Variable->VarFlags);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
ExpEmit FxLocalVariable::Emit(VMFunctionBuilder *build)
|
||||
{
|
||||
// 'Out' variables are actually pointers but this fact must be hidden to the script.
|
||||
|
|
@ -6771,7 +6771,7 @@ FxExpression *FxStackVariable::Resolve(FCompileContext &ctx)
|
|||
ExpEmit FxStackVariable::Emit(VMFunctionBuilder *build)
|
||||
{
|
||||
int offsetreg = -1;
|
||||
|
||||
|
||||
if (membervar->Offset != 0) offsetreg = build->GetConstantInt((int)membervar->Offset);
|
||||
|
||||
if (AddressRequested)
|
||||
|
|
@ -6963,7 +6963,7 @@ FxExpression *FxStructMember::Resolve(FCompileContext &ctx)
|
|||
{
|
||||
locvar->RegOffset = int(membervar->Offset);
|
||||
}
|
||||
|
||||
|
||||
locvar->ValueType = membervar->Type;
|
||||
classx = nullptr;
|
||||
delete this;
|
||||
|
|
@ -7245,7 +7245,7 @@ FxExpression *FxArrayElement::Resolve(FCompileContext &ctx)
|
|||
ExpEmit FxArrayElement::Emit(VMFunctionBuilder *build)
|
||||
{
|
||||
PArray *arraytype;
|
||||
|
||||
|
||||
if (arrayispointer)
|
||||
{
|
||||
auto ptr = Array->ValueType->toPointer();
|
||||
|
|
@ -7267,7 +7267,7 @@ ExpEmit FxArrayElement::Emit(VMFunctionBuilder *build)
|
|||
ExpEmit start;
|
||||
ExpEmit bound;
|
||||
bool nestedarray = false;
|
||||
|
||||
|
||||
if (SizeAddr != ~0u)
|
||||
{
|
||||
bool ismeta = Array->ExprType == EFX_ClassMember && static_cast<FxClassMember*>(Array)->membervar->Flags & VARF_Meta;
|
||||
|
|
@ -7669,7 +7669,7 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
|||
return x->Resolve(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (compileEnvironment.CheckCustomGlobalFunctions)
|
||||
{
|
||||
auto result = compileEnvironment.CheckCustomGlobalFunctions(this, ctx);
|
||||
|
|
@ -8508,7 +8508,7 @@ VMFunction *FxVMFunctionCall::GetDirectFunction(PFunction *callingfunc, const Ve
|
|||
if (Function->Variants[0].ArgFlags.Size() > imp && !(Function->Variants[0].ArgFlags[imp] & VARF_Optional)) return nullptr;
|
||||
return Function->Variants[0].Implementation;
|
||||
}
|
||||
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -8567,7 +8567,7 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
|
|||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
bool foundvarargs = false;
|
||||
PType * type = nullptr;
|
||||
int flag = 0;
|
||||
|
|
@ -10509,7 +10509,7 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
|
|||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
if (basex->ValueType != TypeName && basex->ValueType != TypeString)
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Cannot convert %s to class type", basex->ValueType->DescriptiveName());
|
||||
|
|
@ -10526,7 +10526,7 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
|
|||
{
|
||||
if (Explicit) cls = FindClassType(clsname, ctx);
|
||||
else cls = PClass::FindClass(clsname);
|
||||
|
||||
|
||||
if (cls == nullptr || cls->VMType == nullptr)
|
||||
{
|
||||
/* lax */
|
||||
|
|
@ -10761,7 +10761,7 @@ FxExpression *FxLocalVariableDeclaration::Resolve(FCompileContext &ctx)
|
|||
{
|
||||
auto sfunc = static_cast<VMScriptFunction *>(ctx.Function->Variants[0].Implementation);
|
||||
StackOffset = sfunc->AllocExtraStack(ValueType);
|
||||
|
||||
|
||||
if (Init != nullptr)
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Cannot initialize non-scalar variable %s here", Name.GetChars());
|
||||
|
|
@ -11203,7 +11203,7 @@ ExpEmit FxLocalArrayDeclaration::Emit(VMFunctionBuilder *build)
|
|||
break;
|
||||
}
|
||||
build->Registers[regtype].Return(regNum, 1);
|
||||
|
||||
|
||||
emitval.Free(build);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ struct ExpVal
|
|||
int regtype = Type->GetRegType();
|
||||
return regtype == REGT_INT ? !!Int : regtype == REGT_FLOAT ? Float!=0. : false;
|
||||
}
|
||||
|
||||
|
||||
FName GetName() const
|
||||
{
|
||||
if (Type == TypeString)
|
||||
|
|
@ -325,7 +325,7 @@ protected:
|
|||
public:
|
||||
virtual ~FxExpression() {}
|
||||
virtual FxExpression *Resolve(FCompileContext &ctx);
|
||||
|
||||
|
||||
virtual bool isConstant() const;
|
||||
virtual bool RequestAddress(FCompileContext &ctx, bool *writable);
|
||||
virtual PPrototype *ReturnProto();
|
||||
|
|
@ -525,7 +525,7 @@ public:
|
|||
}
|
||||
ValueType = value.Type = type;
|
||||
}
|
||||
|
||||
|
||||
static FxExpression *MakeConstant(PSymbol *sym, const FScriptPosition &pos);
|
||||
|
||||
bool isConstant() const
|
||||
|
|
@ -1864,7 +1864,7 @@ protected:
|
|||
: FxExpression(etype, pos)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Backpatch(VMFunctionBuilder *build, size_t loopstart, size_t loopend);
|
||||
FxExpression *Resolve(FCompileContext&) final;
|
||||
virtual FxExpression *DoResolve(FCompileContext&) = 0;
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ int VMFunctionBuilder::RegAvailability::Get(int count)
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
mask = count == 32 ? ~0u : (1 << count) - 1;
|
||||
|
||||
for (i = 0; i < 256 / 32; ++i)
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ template<> unsigned int ArrayReserve(TArray<DObject*> *self, int amount)
|
|||
|
||||
if (fillCount > 0)
|
||||
memset(&(*self)[oldSize], 0, sizeof(DObject*) * fillCount);
|
||||
|
||||
|
||||
return oldSize;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ struct FScopeBarrier
|
|||
//
|
||||
static int FlagsFromSide(int side);
|
||||
static EScopeFlags ObjectFlagsFromSide(int side);
|
||||
|
||||
|
||||
// used for errors
|
||||
static const char* StringFromSide(int side);
|
||||
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ bool PContainerType::IsMatch(intptr_t id1, intptr_t id2) const
|
|||
{
|
||||
const PTypeBase *outer = (const PTypeBase *)id1;
|
||||
FName name = (ENamedName)(intptr_t)id2;
|
||||
|
||||
|
||||
return Outer == outer && TypeName == name;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1069,7 +1069,7 @@ void ZCCCompiler::AddConstant(ZCC_ConstantWork &constant)
|
|||
auto def = constant.node;
|
||||
auto val = def->Value;
|
||||
ExpVal &c = constant.constval;
|
||||
|
||||
|
||||
// This is for literal constants.
|
||||
if (val->NodeType == AST_ExprConstant)
|
||||
{
|
||||
|
|
@ -1364,7 +1364,7 @@ void ZCCCompiler::CompileAllFields()
|
|||
for (unsigned i = 0; i < Classes.Size(); i++)
|
||||
{
|
||||
auto type = Classes[i]->ClassType();
|
||||
|
||||
|
||||
if (type->Size == TentativeClass)
|
||||
{
|
||||
if (type->ParentClass->Size == TentativeClass)
|
||||
|
|
@ -1528,7 +1528,7 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
|
|||
Error(field, "Must specify array size");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PField *f = nullptr;
|
||||
|
||||
if (varflags & VARF_Native)
|
||||
|
|
@ -1867,7 +1867,7 @@ PType *ZCCCompiler::ResolveUserType(ZCC_BasicType *type, PSymbolTable *symt, boo
|
|||
{
|
||||
// Check the symbol table for the identifier.
|
||||
PSymbol *sym = nullptr;
|
||||
|
||||
|
||||
// We first look in the current class and its parents, and then in the current namespace and its parents.
|
||||
if (symt != nullptr) sym = symt->FindSymbol(type->UserType->Id, true);
|
||||
if (sym == nullptr) sym = OutNamespace->Symbols.FindSymbol(type->UserType->Id, true);
|
||||
|
|
@ -2244,7 +2244,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
|
||||
flags |= VARF_Optional;
|
||||
hasoptionals = true;
|
||||
|
||||
|
||||
if ((varflags & VARF_Override) && !overridemsg)
|
||||
{
|
||||
// This is illegal, but in older compilers wasn't checked, so there it has to be demoted to a warning.
|
||||
|
|
@ -2465,11 +2465,11 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
sym->Variants[0].Flags |= VARF_ReadOnly;
|
||||
if (oldfunc->VarFlags & VARF_Protected)
|
||||
sym->Variants[0].Flags |= VARF_Protected;
|
||||
|
||||
|
||||
clstype->Virtuals[virtindex] = sym->Variants[0].Implementation;
|
||||
sym->Variants[0].Implementation->VirtualIndex = virtindex;
|
||||
sym->Variants[0].Implementation->VarFlags = sym->Variants[0].Flags;
|
||||
|
||||
|
||||
// Defaults must be identical to parent class
|
||||
if (parentfunc->Variants[0].Implementation->DefaultArgs.Size() > 0)
|
||||
{
|
||||
|
|
@ -3112,7 +3112,7 @@ FxExpression *ZCCCompiler::ConvertImplicitScopeNode(ZCC_TreeNode *node, ZCC_Stat
|
|||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
FxExpression *nestedExpr = ConvertNode(nested);
|
||||
assert(nullptr != nestedExpr);
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ protected:
|
|||
|
||||
void InitFunctions();
|
||||
virtual void InitDefaults();
|
||||
|
||||
|
||||
TArray<ZCC_ConstantDef *> Constants;
|
||||
TArray<ZCC_StructWork *> Structs;
|
||||
TArray<ZCC_ClassWork *> Classes;
|
||||
|
|
|
|||
|
|
@ -1267,7 +1267,7 @@ ZCC_TreeNode *TreeNodeDeepCopy_Internal(ZCC_AST *ast, ZCC_TreeNode *orig, bool c
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case AST_ClassCast:
|
||||
{
|
||||
TreeNodeDeepCopy_Start(ClassCast);
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ void JitCompiler::EmitNativeCall(VMNativeFunction *target)
|
|||
I_Error("Unexpected register type for self pointer\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
cc.test(*reg, *reg);
|
||||
cc.jz(label);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ void JitCompiler::EmitTEST()
|
|||
cc.cmp(regD[A], BC);
|
||||
cc.jne(GetLabel(i + 2));
|
||||
}
|
||||
|
||||
|
||||
void JitCompiler::EmitTESTN()
|
||||
{
|
||||
int bc = BC;
|
||||
|
|
|
|||
|
|
@ -902,7 +902,7 @@ void JitCompiler::EmitMINF_RK()
|
|||
cc.movsd(regF[A], asmjit::x86::qword_ptr(tmp));
|
||||
cc.minpd(regF[A], rb); // minsd requires SSE 4.1
|
||||
}
|
||||
|
||||
|
||||
void JitCompiler::EmitMAXF_RR()
|
||||
{
|
||||
auto rc = CheckRegF(C, A);
|
||||
|
|
@ -919,7 +919,7 @@ void JitCompiler::EmitMAXF_RK()
|
|||
cc.movsd(regF[A], asmjit::x86::qword_ptr(tmp));
|
||||
cc.maxpd(regF[A], rb); // maxsd requires SSE 4.1
|
||||
}
|
||||
|
||||
|
||||
void JitCompiler::EmitATAN2()
|
||||
{
|
||||
auto result = newResultXmmSd();
|
||||
|
|
@ -1441,7 +1441,7 @@ void JitCompiler::EmitEQV3_R()
|
|||
EmitVectorComparison<3> (check, fail, success);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void JitCompiler::EmitEQV3_K()
|
||||
{
|
||||
I_Error("EQV3_K is not used.");
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ static void WriteCIE(TArray<uint8_t> &stream, const TArray<uint8_t> &cieInstruct
|
|||
unsigned int lengthPos = stream.Size();
|
||||
WriteUInt32(stream, 0); // Length
|
||||
WriteUInt32(stream, 0); // CIE ID
|
||||
|
||||
|
||||
WriteUInt8(stream, 1); // CIE Version
|
||||
WriteUInt8(stream, 'z');
|
||||
WriteUInt8(stream, 'R'); // fde encoding
|
||||
|
|
@ -428,7 +428,7 @@ static void WriteFDE(TArray<uint8_t> &stream, const TArray<uint8_t> &fdeInstruct
|
|||
WriteUInt32(stream, 0); // Length
|
||||
uint32_t offsetToCIE = stream.Size() - cieLocation;
|
||||
WriteUInt32(stream, offsetToCIE);
|
||||
|
||||
|
||||
functionStart = stream.Size();
|
||||
WriteUInt64(stream, 0); // func start
|
||||
WriteUInt64(stream, 0); // func size
|
||||
|
|
@ -499,7 +499,7 @@ static TArray<uint8_t> CreateUnwindInfoUnix(asmjit::CCFunc *func, unsigned int &
|
|||
//
|
||||
// The CFI_Parser<A>::decodeFDE parser on the other side..
|
||||
// https://github.com/llvm-mirror/libunwind/blob/master/src/DwarfParser.hpp
|
||||
|
||||
|
||||
// Asmjit -> DWARF register id
|
||||
int dwarfRegId[16];
|
||||
dwarfRegId[X86Gp::kIdAx] = 0;
|
||||
|
|
@ -520,7 +520,7 @@ static TArray<uint8_t> CreateUnwindInfoUnix(asmjit::CCFunc *func, unsigned int &
|
|||
dwarfRegId[X86Gp::kIdR15] = 15;
|
||||
int dwarfRegRAId = 16;
|
||||
int dwarfRegXmmId = 17;
|
||||
|
||||
|
||||
TArray<uint8_t> cieInstructions;
|
||||
TArray<uint8_t> fdeInstructions;
|
||||
|
||||
|
|
@ -529,7 +529,7 @@ static TArray<uint8_t> CreateUnwindInfoUnix(asmjit::CCFunc *func, unsigned int &
|
|||
|
||||
WriteDefineCFA(cieInstructions, dwarfRegId[X86Gp::kIdSp], stackOffset);
|
||||
WriteRegisterStackLocation(cieInstructions, returnAddressReg, stackOffset);
|
||||
|
||||
|
||||
FuncFrameLayout layout;
|
||||
Error error = layout.init(func->getDetail(), func->getFrameInfo());
|
||||
if (error != kErrorOk)
|
||||
|
|
@ -702,7 +702,7 @@ void *AddJitFunction(asmjit::CodeHolder* code, JitCompiler *compiler)
|
|||
uint64_t length64 = *((uint64_t *)(entry + 4));
|
||||
if (length64 == 0)
|
||||
break;
|
||||
|
||||
|
||||
uint64_t offset = *((uint64_t *)(entry + 12));
|
||||
if (offset != 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -515,7 +515,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
DoCast(reg, f, a, B, C);
|
||||
}
|
||||
NEXTOP;
|
||||
|
||||
|
||||
OP(CASTB):
|
||||
if (C == CASTB_I)
|
||||
{
|
||||
|
|
@ -538,7 +538,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
reg.d[a] = reg.s[B].Len() > 0;
|
||||
}
|
||||
NEXTOP;
|
||||
|
||||
|
||||
OP(TEST):
|
||||
ASSERTD(a);
|
||||
if (reg.d[a] != BC)
|
||||
|
|
@ -852,7 +852,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
ASSERTD(a); ASSERTS(B);
|
||||
reg.d[a] = (int)reg.s[B].Len();
|
||||
NEXTOP;
|
||||
|
||||
|
||||
OP(CMPS):
|
||||
// String comparison is a fairly expensive operation, so I've
|
||||
// chosen to conserve a few opcodes by condensing all the
|
||||
|
|
@ -1347,7 +1347,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
fb = reg.f[B];
|
||||
reg.f[a] = (C == FLOP_ABS) ? fabs(fb) : (C == FLOP_NEG) ? -fb : DoFLOP(C, fb);
|
||||
NEXTOP;
|
||||
|
||||
|
||||
OP(EQF_R):
|
||||
ASSERTF(B); ASSERTF(C);
|
||||
if (a & CMP_APPROX)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue