combine numeric stacks into one common stack.

This commit is contained in:
Jeff Hutchinson 2021-04-16 19:20:15 -04:00
parent a2dea07d8b
commit bc0f5bd3a3
2 changed files with 119 additions and 128 deletions

View file

@ -109,14 +109,18 @@ ConsoleValueStack<4096> gCallStack;
StringStack STR; StringStack STR;
U32 _FLT = 0; ///< Stack pointer for floatStack.
U32 _UINT = 0; ///< Stack pointer for intStack.
U32 _ITER = 0; ///< Stack pointer for iterStack. U32 _ITER = 0; ///< Stack pointer for iterStack.
IterStackRecord iterStack[MaxStackSize]; IterStackRecord iterStack[MaxStackSize];
F64 floatStack[MaxStackSize]; union StackValue
S64 intStack[MaxStackSize]; {
F64 f;
S64 i;
};
StackValue numStack[MaxStackSize];
U32 _STK = 0;
char curFieldArray[256]; char curFieldArray[256];
char prevFieldArray[256]; char prevFieldArray[256];
@ -945,7 +949,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
} }
// What group will we be added to, if any? // What group will we be added to, if any?
U32 groupAddId = (U32)intStack[_UINT]; U32 groupAddId = (U32)numStack[_STK].i;
SimGroup* grp = NULL; SimGroup* grp = NULL;
SimSet* set = NULL; SimSet* set = NULL;
@ -990,9 +994,9 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
// id, if one was given, otherwise getting pushed) // id, if one was given, otherwise getting pushed)
S32 id = currentNewObject->getId(); S32 id = currentNewObject->getId();
if (placeAtRoot) if (placeAtRoot)
intStack[_UINT] = id; numStack[_STK].i = id;
else else
intStack[++_UINT] = id; numStack[++_STK].i = id;
break; break;
} }
@ -1003,7 +1007,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
// our group reference. // our group reference.
bool placeAtRoot = code[ip++]; bool placeAtRoot = code[ip++];
if (!placeAtRoot) if (!placeAtRoot)
_UINT--; _STK--;
break; break;
} }
@ -1020,7 +1024,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
} }
case OP_JMPIFFNOT: case OP_JMPIFFNOT:
if (floatStack[_FLT--]) if (numStack[_STK--].f)
{ {
ip++; ip++;
break; break;
@ -1028,7 +1032,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
ip = code[ip]; ip = code[ip];
break; break;
case OP_JMPIFNOT: case OP_JMPIFNOT:
if (intStack[_UINT--]) if (numStack[_STK--].i)
{ {
ip++; ip++;
break; break;
@ -1036,7 +1040,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
ip = code[ip]; ip = code[ip];
break; break;
case OP_JMPIFF: case OP_JMPIFF:
if (!floatStack[_FLT--]) if (!numStack[_STK--].f)
{ {
ip++; ip++;
break; break;
@ -1044,7 +1048,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
ip = code[ip]; ip = code[ip];
break; break;
case OP_JMPIF: case OP_JMPIF:
if (!intStack[_UINT--]) if (!numStack[_STK--].i)
{ {
ip++; ip++;
break; break;
@ -1052,18 +1056,18 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
ip = code[ip]; ip = code[ip];
break; break;
case OP_JMPIFNOT_NP: case OP_JMPIFNOT_NP:
if (intStack[_UINT]) if (numStack[_STK].i)
{ {
_UINT--; _STK--;
ip++; ip++;
break; break;
} }
ip = code[ip]; ip = code[ip];
break; break;
case OP_JMPIF_NP: case OP_JMPIF_NP:
if (!intStack[_UINT]) if (!numStack[_STK].i)
{ {
_UINT--; _STK--;
ip++; ip++;
break; break;
} }
@ -1111,8 +1115,8 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
} }
returnValue.setFloat(floatStack[_FLT]); returnValue.setFloat(numStack[_STK].f);
_FLT--; _STK--;
goto execFinished; goto execFinished;
@ -1128,124 +1132,116 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
} }
} }
returnValue.setInt(intStack[_UINT]); returnValue.setInt(numStack[_STK].i);
_UINT--; _STK--;
goto execFinished; goto execFinished;
case OP_CMPEQ: case OP_CMPEQ:
intStack[_UINT + 1] = bool(floatStack[_FLT] == floatStack[_FLT - 1]); numStack[_STK - 1].i = bool(numStack[_STK].f == numStack[_STK - 1].f);
_UINT++; _STK--;
_FLT -= 2;
break; break;
case OP_CMPGR: case OP_CMPGR:
intStack[_UINT + 1] = bool(floatStack[_FLT] > floatStack[_FLT - 1]); numStack[_STK - 1].i = bool(numStack[_STK].f > numStack[_STK - 1].f);
_UINT++; _STK--;
_FLT -= 2;
break; break;
case OP_CMPGE: case OP_CMPGE:
intStack[_UINT + 1] = bool(floatStack[_FLT] >= floatStack[_FLT - 1]); numStack[_STK - 1].i = bool(numStack[_STK].f >= numStack[_STK - 1].f);
_UINT++; _STK--;
_FLT -= 2;
break; break;
case OP_CMPLT: case OP_CMPLT:
intStack[_UINT + 1] = bool(floatStack[_FLT] < floatStack[_FLT - 1]); numStack[_STK - 1].i = bool(numStack[_STK].f < numStack[_STK - 1].f);
_UINT++; _STK--;
_FLT -= 2;
break; break;
case OP_CMPLE: case OP_CMPLE:
intStack[_UINT + 1] = bool(floatStack[_FLT] <= floatStack[_FLT - 1]); numStack[_STK - 1].i = bool(numStack[_STK].f <= numStack[_STK - 1].f);
_UINT++; _STK--;
_FLT -= 2;
break; break;
case OP_CMPNE: case OP_CMPNE:
intStack[_UINT + 1] = bool(floatStack[_FLT] != floatStack[_FLT - 1]); numStack[_STK - 1].i = bool(numStack[_STK].f != numStack[_STK - 1].f);
_UINT++; _STK--;
_FLT -= 2;
break; break;
case OP_XOR: case OP_XOR:
intStack[_UINT - 1] = intStack[_UINT] ^ intStack[_UINT - 1]; numStack[_STK - 1].i = numStack[_STK].i ^ numStack[_STK - 1].i;
_UINT--; _STK--;
break; break;
case OP_MOD: case OP_MOD:
if (intStack[_UINT - 1] != 0) if (numStack[_STK - 1].i != 0)
intStack[_UINT - 1] = intStack[_UINT] % intStack[_UINT - 1]; numStack[_STK - 1].i = numStack[_STK].i % numStack[_STK - 1].i;
else else
intStack[_UINT - 1] = 0; numStack[_STK - 1].i = 0;
_UINT--; _STK--;
break; break;
case OP_BITAND: case OP_BITAND:
intStack[_UINT - 1] = intStack[_UINT] & intStack[_UINT - 1]; numStack[_STK - 1].i = numStack[_STK].i & numStack[_STK - 1].i;
_UINT--; _STK--;
break; break;
case OP_BITOR: case OP_BITOR:
intStack[_UINT - 1] = intStack[_UINT] | intStack[_UINT - 1]; numStack[_STK - 1].i = numStack[_STK].i | numStack[_STK - 1].i;
_UINT--; _STK--;
break; break;
case OP_NOT: case OP_NOT:
intStack[_UINT] = !intStack[_UINT]; numStack[_STK].i = !numStack[_STK].i;
break; break;
case OP_NOTF: case OP_NOTF:
intStack[_UINT + 1] = !floatStack[_FLT]; numStack[_STK].i = !numStack[_STK].f;
_FLT--;
_UINT++;
break; break;
case OP_ONESCOMPLEMENT: case OP_ONESCOMPLEMENT:
intStack[_UINT] = ~intStack[_UINT]; numStack[_STK].i = ~numStack[_STK].i;
break; break;
case OP_SHR: case OP_SHR:
intStack[_UINT - 1] = intStack[_UINT] >> intStack[_UINT - 1]; numStack[_STK - 1].i = numStack[_STK].i >> numStack[_STK - 1].i;
_UINT--; _STK--;
break; break;
case OP_SHL: case OP_SHL:
intStack[_UINT - 1] = intStack[_UINT] << intStack[_UINT - 1]; numStack[_STK - 1].i = numStack[_STK].i << numStack[_STK - 1].i;
_UINT--; _STK--;
break; break;
case OP_AND: case OP_AND:
intStack[_UINT - 1] = intStack[_UINT] && intStack[_UINT - 1]; numStack[_STK - 1].i = numStack[_STK].i && numStack[_STK - 1].i;
_UINT--; _STK--;
break; break;
case OP_OR: case OP_OR:
intStack[_UINT - 1] = intStack[_UINT] || intStack[_UINT - 1]; numStack[_STK - 1].i = numStack[_STK].i || numStack[_STK - 1].i;
_UINT--; _STK--;
break; break;
case OP_ADD: case OP_ADD:
floatStack[_FLT - 1] = floatStack[_FLT] + floatStack[_FLT - 1]; numStack[_STK - 1].f = numStack[_STK].f + numStack[_STK - 1].f;
_FLT--; _STK--;
break; break;
case OP_SUB: case OP_SUB:
floatStack[_FLT - 1] = floatStack[_FLT] - floatStack[_FLT - 1]; numStack[_STK - 1].f = numStack[_STK].f - numStack[_STK - 1].f;
_FLT--; _STK--;
break; break;
case OP_MUL: case OP_MUL:
floatStack[_FLT - 1] = floatStack[_FLT] * floatStack[_FLT - 1]; numStack[_STK - 1].f = numStack[_STK].f * numStack[_STK - 1].f;
_FLT--; _STK--;
break; break;
case OP_DIV: case OP_DIV:
floatStack[_FLT - 1] = floatStack[_FLT] / floatStack[_FLT - 1]; numStack[_STK - 1].f = numStack[_STK].f / numStack[_STK - 1].f;
_FLT--; _STK--;
break; break;
case OP_NEG: case OP_NEG:
floatStack[_FLT] = -floatStack[_FLT]; numStack[_STK].f = -numStack[_STK].f;
break; break;
case OP_INC: case OP_INC:
@ -1320,13 +1316,13 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
break; break;
case OP_LOADVAR_UINT: case OP_LOADVAR_UINT:
intStack[_UINT + 1] = gEvalState.getIntVariable(); numStack[_STK + 1].i = gEvalState.getIntVariable();
_UINT++; _STK++;
break; break;
case OP_LOADVAR_FLT: case OP_LOADVAR_FLT:
floatStack[_FLT + 1] = gEvalState.getFloatVariable(); numStack[_STK + 1].f = gEvalState.getFloatVariable();
_FLT++; _STK++;
break; break;
case OP_LOADVAR_STR: case OP_LOADVAR_STR:
@ -1335,11 +1331,11 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
break; break;
case OP_SAVEVAR_UINT: case OP_SAVEVAR_UINT:
gEvalState.setIntVariable((S32)intStack[_UINT]); gEvalState.setIntVariable(numStack[_STK].i);
break; break;
case OP_SAVEVAR_FLT: case OP_SAVEVAR_FLT:
gEvalState.setFloatVariable(floatStack[_FLT]); gEvalState.setFloatVariable(numStack[_STK].f);
break; break;
case OP_SAVEVAR_STR: case OP_SAVEVAR_STR:
@ -1348,14 +1344,14 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
case OP_LOAD_LOCAL_VAR_UINT: case OP_LOAD_LOCAL_VAR_UINT:
reg = code[ip++]; reg = code[ip++];
intStack[_UINT + 1] = gEvalState.getLocalIntVariable(reg); numStack[_STK + 1].i = gEvalState.getLocalIntVariable(reg);
_UINT++; _STK++;
break; break;
case OP_LOAD_LOCAL_VAR_FLT: case OP_LOAD_LOCAL_VAR_FLT:
reg = code[ip++]; reg = code[ip++];
floatStack[_FLT + 1] = gEvalState.getLocalFloatVariable(reg); numStack[_STK + 1].f = gEvalState.getLocalFloatVariable(reg);
_FLT++; _STK++;
break; break;
case OP_LOAD_LOCAL_VAR_STR: case OP_LOAD_LOCAL_VAR_STR:
@ -1366,12 +1362,12 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
case OP_SAVE_LOCAL_VAR_UINT: case OP_SAVE_LOCAL_VAR_UINT:
reg = code[ip++]; reg = code[ip++];
gEvalState.setLocalIntVariable(reg, (S32)intStack[_UINT]); gEvalState.setLocalIntVariable(reg, numStack[_STK].i);
break; break;
case OP_SAVE_LOCAL_VAR_FLT: case OP_SAVE_LOCAL_VAR_FLT:
reg = code[ip++]; reg = code[ip++];
gEvalState.setLocalFloatVariable(reg, floatStack[_FLT]); gEvalState.setLocalFloatVariable(reg, numStack[_STK].f);
break; break;
case OP_SAVE_LOCAL_VAR_STR: case OP_SAVE_LOCAL_VAR_STR:
@ -1408,13 +1404,13 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
StringTableEntry intName = StringTable->insert(STR.getStringValue()); StringTableEntry intName = StringTable->insert(STR.getStringValue());
bool recurse = code[ip - 1]; bool recurse = code[ip - 1];
SimObject* obj = group->findObjectByInternalName(intName, recurse); SimObject* obj = group->findObjectByInternalName(intName, recurse);
intStack[_UINT + 1] = obj ? obj->getId() : 0; numStack[_STK + 1].i = obj ? obj->getId() : 0;
_UINT++; _STK++;
} }
else else
{ {
Con::errorf(ConsoleLogEntry::Script, "%s: Attempt to use -> on non-group %s of class %s.", getFileLine(ip - 2), curObject->getName(), curObject->getClassName()); Con::errorf(ConsoleLogEntry::Script, "%s: Attempt to use -> on non-group %s of class %s.", getFileLine(ip - 2), curObject->getName(), curObject->getClassName());
intStack[_UINT] = 0; numStack[_STK].i = 0;
} }
} }
break; break;
@ -1444,7 +1440,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
case OP_LOADFIELD_UINT: case OP_LOADFIELD_UINT:
if (curObject) if (curObject)
intStack[_UINT + 1] = U32(dAtoi(curObject->getDataField(curField, curFieldArray))); numStack[_STK + 1].i = dAtol(curObject->getDataField(curField, curFieldArray));
else else
{ {
// The field is not being retrieved from an object. Maybe it's // The field is not being retrieved from an object. Maybe it's
@ -1452,14 +1448,14 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
char buff[FieldBufferSizeNumeric]; char buff[FieldBufferSizeNumeric];
memset(buff, 0, sizeof(buff)); memset(buff, 0, sizeof(buff));
getFieldComponent(prevObject, prevField, prevFieldArray, curField, buff); getFieldComponent(prevObject, prevField, prevFieldArray, curField, buff);
intStack[_UINT + 1] = dAtoi(buff); numStack[_STK + 1].i = dAtol(buff);
} }
_UINT++; _STK++;
break; break;
case OP_LOADFIELD_FLT: case OP_LOADFIELD_FLT:
if (curObject) if (curObject)
floatStack[_FLT + 1] = dAtof(curObject->getDataField(curField, curFieldArray)); numStack[_STK + 1].f = dAtod(curObject->getDataField(curField, curFieldArray));
else else
{ {
// The field is not being retrieved from an object. Maybe it's // The field is not being retrieved from an object. Maybe it's
@ -1467,9 +1463,9 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
char buff[FieldBufferSizeNumeric]; char buff[FieldBufferSizeNumeric];
memset(buff, 0, sizeof(buff)); memset(buff, 0, sizeof(buff));
getFieldComponent(prevObject, prevField, prevFieldArray, curField, buff); getFieldComponent(prevObject, prevField, prevFieldArray, curField, buff);
floatStack[_FLT + 1] = dAtof(buff); numStack[_STK + 1].f = dAtod(buff);
} }
_FLT++; _STK++;
break; break;
case OP_LOADFIELD_STR: case OP_LOADFIELD_STR:
@ -1491,7 +1487,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
break; break;
case OP_SAVEFIELD_UINT: case OP_SAVEFIELD_UINT:
STR.setIntValue((U32)intStack[_UINT]); STR.setIntValue(numStack[_STK].i);
if (curObject) if (curObject)
curObject->setDataField(curField, curFieldArray, STR.getStringValue()); curObject->setDataField(curField, curFieldArray, STR.getStringValue());
else else
@ -1504,7 +1500,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
break; break;
case OP_SAVEFIELD_FLT: case OP_SAVEFIELD_FLT:
STR.setFloatValue(floatStack[_FLT]); STR.setFloatValue(numStack[_STK].f);
if (curObject) if (curObject)
curObject->setDataField(curField, curFieldArray, STR.getStringValue()); curObject->setDataField(curField, curFieldArray, STR.getStringValue());
else else
@ -1529,13 +1525,13 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
break; break;
case OP_STR_TO_UINT: case OP_STR_TO_UINT:
intStack[_UINT + 1] = STR.getIntValue(); numStack[_STK + 1].i = STR.getIntValue();
_UINT++; _STK++;
break; break;
case OP_STR_TO_FLT: case OP_STR_TO_FLT:
floatStack[_FLT + 1] = STR.getFloatValue(); numStack[_STK + 1].f = STR.getFloatValue();
_FLT++; _STK++;
break; break;
case OP_STR_TO_NONE: case OP_STR_TO_NONE:
@ -1543,44 +1539,39 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
break; break;
case OP_FLT_TO_UINT: case OP_FLT_TO_UINT:
intStack[_UINT + 1] = (S64)floatStack[_FLT]; numStack[_STK].i = (S64)numStack[_STK].f;
_FLT--;
_UINT++;
break; break;
case OP_FLT_TO_STR: case OP_FLT_TO_STR:
STR.setFloatValue(floatStack[_FLT]); STR.setFloatValue(numStack[_STK].f);
_FLT--; _STK--;
break; break;
case OP_FLT_TO_NONE: case OP_FLT_TO_NONE:
_FLT--; _STK--;
break; break;
case OP_UINT_TO_FLT: case OP_UINT_TO_FLT:
floatStack[_FLT + 1] = (F64)intStack[_UINT]; numStack[_STK].f = (F64)numStack[_STK].i;
_UINT--;
_FLT++;
break; break;
case OP_UINT_TO_STR: case OP_UINT_TO_STR:
STR.setIntValue((U32)intStack[_UINT]); STR.setIntValue(numStack[_STK].i);
_UINT--; _STK--;
break; break;
case OP_UINT_TO_NONE: case OP_UINT_TO_NONE:
_UINT--; _STK--;
break; break;
case OP_LOADIMMED_UINT: case OP_LOADIMMED_UINT:
intStack[_UINT + 1] = code[ip++]; numStack[_STK + 1].i = code[ip++];
_UINT++; _STK++;
break; break;
case OP_LOADIMMED_FLT: case OP_LOADIMMED_FLT:
floatStack[_FLT + 1] = curFloatTable[code[ip]]; numStack[_STK + 1].f = curFloatTable[code[ip++]];
ip++; _STK++;
_FLT++;
break; break;
case OP_TAG_TO_STR: case OP_TAG_TO_STR:
code[ip - 1] = OP_LOADIMMED_STR; code[ip - 1] = OP_LOADIMMED_STR;
@ -1791,18 +1782,18 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
} }
case Namespace::Entry::IntCallbackType: case Namespace::Entry::IntCallbackType:
{ {
S32 result = nsEntry->cb.mIntCallbackFunc(gEvalState.thisObject, callArgc, callArgv); S64 result = nsEntry->cb.mIntCallbackFunc(gEvalState.thisObject, callArgc, callArgv);
gCallStack.popFrame(); gCallStack.popFrame();
if (code[ip] == OP_STR_TO_UINT) if (code[ip] == OP_STR_TO_UINT)
{ {
ip++; ip++;
intStack[++_UINT] = result; numStack[++_STK].i = result;
break; break;
} }
else if (code[ip] == OP_STR_TO_FLT) else if (code[ip] == OP_STR_TO_FLT)
{ {
ip++; ip++;
floatStack[++_FLT] = result; numStack[++_STK].f = result;
break; break;
} }
else if (code[ip] == OP_STR_TO_NONE) else if (code[ip] == OP_STR_TO_NONE)
@ -1818,13 +1809,13 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
if (code[ip] == OP_STR_TO_UINT) if (code[ip] == OP_STR_TO_UINT)
{ {
ip++; ip++;
intStack[++_UINT] = (S64)result; numStack[++_STK].i = (S64)result;
break; break;
} }
else if (code[ip] == OP_STR_TO_FLT) else if (code[ip] == OP_STR_TO_FLT)
{ {
ip++; ip++;
floatStack[++_FLT] = result; numStack[++_STK].f = result;
break; break;
} }
else if (code[ip] == OP_STR_TO_NONE) else if (code[ip] == OP_STR_TO_NONE)
@ -1849,13 +1840,13 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
if (code[ip] == OP_STR_TO_UINT) if (code[ip] == OP_STR_TO_UINT)
{ {
ip++; ip++;
intStack[++_UINT] = result; numStack[++_STK].i = result;
break; break;
} }
else if (code[ip] == OP_STR_TO_FLT) else if (code[ip] == OP_STR_TO_FLT)
{ {
ip++; ip++;
floatStack[++_FLT] = result; numStack[++_STK].f = result;
break; break;
} }
else if (code[ip] == OP_STR_TO_NONE) else if (code[ip] == OP_STR_TO_NONE)
@ -1896,7 +1887,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
break; break;
case OP_COMPARE_STR: case OP_COMPARE_STR:
intStack[++_UINT] = STR.compare(); numStack[++_STK].i = STR.compare();
break; break;
case OP_PUSH: case OP_PUSH:
@ -1904,11 +1895,11 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
break; break;
case OP_PUSH_UINT: case OP_PUSH_UINT:
gCallStack.pushInt((U32)intStack[_UINT--]); gCallStack.pushInt((U32)numStack[_STK--].i);
break; break;
case OP_PUSH_FLT: case OP_PUSH_FLT:
gCallStack.pushFloat(floatStack[_FLT--]); gCallStack.pushFloat(numStack[_STK--].f);
break; break;
case OP_PUSH_FRAME: case OP_PUSH_FRAME:
@ -1917,7 +1908,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
case OP_ASSERT: case OP_ASSERT:
{ {
if (!intStack[_UINT--]) if (!numStack[_STK--].i)
{ {
const char* message = curStringTable + code[ip]; const char* message = curStringTable + code[ip];

View file

@ -114,15 +114,15 @@ struct StringStack
} }
/// Get an integer representation of the top of the stack. /// Get an integer representation of the top of the stack.
inline U32 getIntValue() inline S64 getIntValue()
{ {
return dAtoi(mBuffer + mStart); return dAtol(mBuffer + mStart);
} }
/// Get a float representation of the top of the stack. /// Get a float representation of the top of the stack.
inline F64 getFloatValue() inline F64 getFloatValue()
{ {
return dAtof(mBuffer + mStart); return dAtod(mBuffer + mStart);
} }
/// Get a string representation of the top of the stack. /// Get a string representation of the top of the stack.