| 1453 | } |
| 1454 | |
| 1455 | int asCContext::PopState() |
| 1456 | { |
| 1457 | if( !IsNested() ) |
| 1458 | return asERROR; |
| 1459 | |
| 1460 | // Clean up the current execution |
| 1461 | Unprepare(); |
| 1462 | |
| 1463 | // The topmost state must be a marker for nested call |
| 1464 | asASSERT( m_callStack[m_callStack.GetLength() - CALLSTACK_FRAME_SIZE] == 0 ); |
| 1465 | |
| 1466 | // Restore the previous state |
| 1467 | asPWORD *tmp = &m_callStack[m_callStack.GetLength() - CALLSTACK_FRAME_SIZE]; |
| 1468 | m_callingSystemFunction = reinterpret_cast<asCScriptFunction*>(tmp[1]); |
| 1469 | m_callStack.SetLength(m_callStack.GetLength() - CALLSTACK_FRAME_SIZE); |
| 1470 | |
| 1471 | // Restore the previous initial function and the associated values |
| 1472 | m_initialFunction = reinterpret_cast<asCScriptFunction*>(tmp[2]); |
| 1473 | m_originalStackPointer = (asDWORD*)tmp[3]; |
| 1474 | m_argumentsSize = (int)tmp[4]; |
| 1475 | |
| 1476 | m_regs.valueRegister = asQWORD(asDWORD(tmp[5])); |
| 1477 | m_regs.valueRegister |= asQWORD(tmp[6])<<32; |
| 1478 | m_regs.objectRegister = (void*)tmp[7]; |
| 1479 | m_regs.objectType = (asITypeInfo*)tmp[8]; |
| 1480 | |
| 1481 | // Calculate the returnValueSize |
| 1482 | if( m_initialFunction->DoesReturnOnStack() ) |
| 1483 | m_returnValueSize = m_initialFunction->returnType.GetSizeInMemoryDWords(); |
| 1484 | else |
| 1485 | m_returnValueSize = 0; |
| 1486 | |
| 1487 | // Pop the current script function. This will also restore the previous stack pointer |
| 1488 | PopCallState(); |
| 1489 | |
| 1490 | m_status = asEXECUTION_ACTIVE; |
| 1491 | |
| 1492 | return asSUCCESS; |
| 1493 | } |
| 1494 | |
| 1495 | int asCContext::PushCallState() |
| 1496 | { |
no test coverage detected