Will not emit OP_SCOPE if self type can be checked at compile time.

This commit is contained in:
ZZYZX 2017-03-12 12:03:41 +02:00 committed by Christoph Oelckers
parent 91e83bf3c6
commit 0176c29ec2

View file

@ -8815,8 +8815,12 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build)
if (outerside == FScopeBarrier::Side_Virtual) if (outerside == FScopeBarrier::Side_Virtual)
outerside = FScopeBarrier::SideFromObjectFlags(CallingFunction->OwningClass->ObjectFlags); outerside = FScopeBarrier::SideFromObjectFlags(CallingFunction->OwningClass->ObjectFlags);
// Check the self object against the calling function's flags at run time // [ZZ] only emit if target side cannot be checked at compile time.
build->Emit(OP_SCOPE, selfemit.RegNum, outerside + 1, build->GetConstantAddress(vmfunc, ATAG_OBJECT)); if (selfside == FScopeBarrier::Side_PlainData)
{
// Check the self object against the calling function's flags at run time
build->Emit(OP_SCOPE, selfemit.RegNum, outerside + 1, build->GetConstantAddress(vmfunc, ATAG_OBJECT));
}
} }
if (selfemit.Fixed && selfemit.Target) if (selfemit.Fixed && selfemit.Target)