- make dynamic object casts a dedicated VM instruction instead of a builtin function.

This can see some heavy use in iterators where saving several hundreds of function calls can be achieved. In these cases, using a function to do the job will become a significant time waster.
This commit is contained in:
Christoph Oelckers 2016-12-05 14:52:34 +01:00
commit 092461ed34
6 changed files with 44 additions and 72 deletions

View file

@ -414,6 +414,18 @@ begin:
reg.f[a+1] = reg.f[B+1];
reg.f[a+2] = reg.f[B+2];
NEXTOP;
OP(DYNCAST_R) :
ASSERTA(a); ASSERTA(B); ASSERTA(C);
b = B;
reg.a[a] = (reg.a[b] && ((DObject*)(reg.a[b]))->IsKindOf((PClass*)(reg.a[C]))) ? reg.a[b] : nullptr;
reg.atag[a] = ATAG_OBJECT;
NEXTOP;
OP(DYNCAST_K) :
ASSERTA(a); ASSERTA(B); ASSERTKA(C);
b = B;
reg.a[a] = (reg.a[b] && ((DObject*)(reg.a[b]))->IsKindOf((PClass*)(konsta[C].o))) ? reg.a[b] : nullptr;
reg.atag[a] = ATAG_OBJECT;
NEXTOP;
OP(CAST):
if (C == CAST_I2F)
{