- implemented pass-by-reference arguments - so far only for memory based variables.

- changed Dehacked weapon function lookup to check the symbol table instead of directly referencing the VM functions. Once scriptified these pointers will no longer be available.
- removed all special ATAGs from the VM. While well intentioned any pointer tagged with them is basically unusable because it'd trigger asserts all over the place.
- scriptified A_Punch for testing pass-by-reference parameters and stack variables.
This commit is contained in:
Christoph Oelckers 2016-11-19 01:23:56 +01:00
parent 7ff5069617
commit 3ce699bf9b
20 changed files with 205 additions and 126 deletions

View file

@ -157,13 +157,15 @@ enum
ATAG_OBJECT, // pointer to an object; will be followed by GC
// The following are all for documentation during debugging and are
// functionally no different than ATAG_GENERIC.
// functionally no different than ATAG_GENERIC (meaning they are useless because they trigger asserts all over the place.)
/*
ATAG_FRAMEPOINTER, // pointer to extra stack frame space for this function
ATAG_DREGISTER, // pointer to a data register
ATAG_FREGISTER, // pointer to a float register
ATAG_SREGISTER, // pointer to a string register
ATAG_AREGISTER, // pointer to an address register
*/
ATAG_RNG, // pointer to FRandom
ATAG_STATE = ATAG_GENERIC, // pointer to FState (cannot have its own type because there's no means to track inside the VM.)

View file

@ -87,7 +87,7 @@ begin:
OP(LFP):
ASSERTA(a); assert(sfunc != NULL); assert(sfunc->ExtraSpace > 0);
reg.a[a] = f->GetExtra();
reg.atag[a] = ATAG_FRAMEPOINTER;
reg.atag[a] = ATAG_GENERIC; // using ATAG_FRAMEPOINTER will cause endless asserts.
NEXTOP;
OP(LB):
@ -461,7 +461,7 @@ begin:
break;
case REGT_INT | REGT_ADDROF:
assert(C < f->NumRegD);
::new(param) VMValue(&reg.d[C], ATAG_DREGISTER);
::new(param) VMValue(&reg.d[C], ATAG_GENERIC);
break;
case REGT_INT | REGT_KONST:
assert(C < sfunc->NumKonstD);
@ -473,7 +473,7 @@ begin:
break;
case REGT_STRING | REGT_ADDROF:
assert(C < f->NumRegS);
::new(param) VMValue(&reg.s[C], ATAG_SREGISTER);
::new(param) VMValue(&reg.s[C], ATAG_GENERIC);
break;
case REGT_STRING | REGT_KONST:
assert(C < sfunc->NumKonstS);
@ -485,7 +485,7 @@ begin:
break;
case REGT_POINTER | REGT_ADDROF:
assert(C < f->NumRegA);
::new(param) VMValue(&reg.a[C], ATAG_AREGISTER);
::new(param) VMValue(&reg.a[C], ATAG_GENERIC);
break;
case REGT_POINTER | REGT_KONST:
assert(C < sfunc->NumKonstA);
@ -512,7 +512,7 @@ begin:
break;
case REGT_FLOAT | REGT_ADDROF:
assert(C < f->NumRegF);
::new(param) VMValue(&reg.f[C], ATAG_FREGISTER);
::new(param) VMValue(&reg.f[C], ATAG_GENERIC);
break;
case REGT_FLOAT | REGT_KONST:
assert(C < sfunc->NumKonstF);