mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- fixed code generation of class type cast for local variables.
This commit is contained in:
parent
8205e6cf08
commit
022228d8a9
1 changed files with 5 additions and 3 deletions
|
@ -3884,7 +3884,6 @@ int BuiltinTypeCheck(VMFrameStack *stack, VMValue *param, TArray<VMValue> &defau
|
||||||
|
|
||||||
ExpEmit FxTypeCheck::Emit(VMFunctionBuilder *build)
|
ExpEmit FxTypeCheck::Emit(VMFunctionBuilder *build)
|
||||||
{
|
{
|
||||||
ExpEmit out(build, REGT_INT);
|
|
||||||
EmitParameter(build, left, ScriptPosition);
|
EmitParameter(build, left, ScriptPosition);
|
||||||
EmitParameter(build, right, ScriptPosition);
|
EmitParameter(build, right, ScriptPosition);
|
||||||
|
|
||||||
|
@ -3905,6 +3904,7 @@ ExpEmit FxTypeCheck::Emit(VMFunctionBuilder *build)
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExpEmit out(build, REGT_INT);
|
||||||
build->Emit(OP_RESULT, 0, REGT_INT, out.RegNum);
|
build->Emit(OP_RESULT, 0, REGT_INT, out.RegNum);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -3963,11 +3963,13 @@ FxExpression *FxDynamicCast::Resolve(FCompileContext& ctx)
|
||||||
|
|
||||||
ExpEmit FxDynamicCast::Emit(VMFunctionBuilder *build)
|
ExpEmit FxDynamicCast::Emit(VMFunctionBuilder *build)
|
||||||
{
|
{
|
||||||
ExpEmit out = expr->Emit(build);
|
ExpEmit in = expr->Emit(build);
|
||||||
|
ExpEmit out = in.Fixed ? ExpEmit(build, in.RegType) : in;
|
||||||
ExpEmit check(build, REGT_INT);
|
ExpEmit check(build, REGT_INT);
|
||||||
assert(out.RegType == REGT_POINTER);
|
assert(out.RegType == REGT_POINTER);
|
||||||
|
|
||||||
build->Emit(OP_PARAM, 0, REGT_POINTER, out.RegNum);
|
if (in.Fixed) build->Emit(OP_MOVEA, out.RegNum, in.RegNum);
|
||||||
|
build->Emit(OP_PARAM, 0, REGT_POINTER, in.RegNum);
|
||||||
build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, build->GetConstantAddress(CastType, ATAG_OBJECT));
|
build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, build->GetConstantAddress(CastType, ATAG_OBJECT));
|
||||||
|
|
||||||
PSymbol *sym = FindBuiltinFunction(NAME_BuiltinTypeCheck, BuiltinTypeCheck);
|
PSymbol *sym = FindBuiltinFunction(NAME_BuiltinTypeCheck, BuiltinTypeCheck);
|
||||||
|
|
Loading…
Reference in a new issue