- Fixed VMParamFiller to use proper A register tags.

- Changed RET so that it will still work if the caller expects fewer return values.

SVN r1843 (scripting)
This commit is contained in:
Randy Heit 2009-09-16 02:53:05 +00:00
parent fefc306a54
commit b7ad95446f
2 changed files with 10 additions and 6 deletions

View file

@ -104,6 +104,7 @@ enum
ATAG_SREGISTER, // pointer to a string register ATAG_SREGISTER, // pointer to a string register
ATAG_AREGISTER, // pointer to an address register ATAG_AREGISTER, // pointer to an address register
ATAG_STATE, // pointer to FState
}; };
class VMFunction : public DObject class VMFunction : public DObject
@ -758,14 +759,14 @@ public:
void ParamObject(DObject *obj) void ParamObject(DObject *obj)
{ {
Reg.a[RegA] = obj; Reg.a[RegA] = obj;
Reg.atag[RegA] = true; Reg.atag[RegA] = ATAG_OBJECT;
RegA++; RegA++;
} }
void ParamPointer(void *ptr) void ParamPointer(void *ptr, VM_UBTYE atag)
{ {
Reg.a[RegA] = ptr; Reg.a[RegA] = ptr;
Reg.atag[RegA] = false; Reg.atag[RegA] = atag;
RegA++; RegA++;
} }

View file

@ -533,11 +533,14 @@ begin:
{ // No return values { // No return values
return 0; return 0;
} }
assert(a < numret); assert(ret != NULL || numret == 0);
if (a < numret)
{
SetReturn(reg, f, &ret[a], B, C); SetReturn(reg, f, &ret[a], B, C);
}
if (B & REGT_FINAL) if (B & REGT_FINAL)
{ {
return a + 1; return MIN(numret, a + 1);
} }
NEXTOP; NEXTOP;
OP(RESULT): OP(RESULT):