| 959 | } |
| 960 | |
| 961 | void *asCContext::GetReturnObject() |
| 962 | { |
| 963 | if( m_status != asEXECUTION_FINISHED ) return 0; |
| 964 | |
| 965 | asCDataType *dt = &m_initialFunction->returnType; |
| 966 | |
| 967 | if( !dt->IsObject() && !dt->IsFuncdef() ) return 0; |
| 968 | |
| 969 | if( dt->IsReference() ) |
| 970 | return *(void**)(asPWORD)m_regs.valueRegister; |
| 971 | else |
| 972 | { |
| 973 | if( m_initialFunction->DoesReturnOnStack() ) |
| 974 | { |
| 975 | // The address of the return value was passed as the first argument, after the object pointer |
| 976 | int offset = 0; |
| 977 | if( m_initialFunction->objectType ) |
| 978 | offset += AS_PTR_SIZE; |
| 979 | |
| 980 | return *(void**)(&m_regs.stackFramePointer[offset]); |
| 981 | } |
| 982 | |
| 983 | return m_regs.objectRegister; |
| 984 | } |
| 985 | } |
| 986 | |
| 987 | void *asCContext::GetAddressOfReturnValue() |
| 988 | { |