forked from dolphinsmalltalk/DolphinVM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InterpRegisters.h
66 lines (48 loc) · 1.99 KB
/
InterpRegisters.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/******************************************************************************
File: InterpRegisters.h
Description:
Specification of the Smalltalk Interpreter Registers
******************************************************************************/
#ifndef _IST_INTERPREGISTERS_H_
#define _IST_INTERPREGISTERS_H_
// Forward references
class Process;
class CompiledMethod;
struct StackFrame;
#include "STString.h"
#include "STMethod.h"
class Process;
typedef TOTE<Process> ProcessOTE;
// N.B. Must be kept in sync with istasm.inc
struct InterpreterRegisters
{
Process* m_pActiveProcess;
CompiledMethod* m_pMethod;
BYTE* m_instructionPointer;
StackFrame* m_pActiveFrame;
Oop* m_stackPointer;
Oop* m_basePointer;
// These are the only Oops the VM refererences without ref. counting them (for performance)
MethodOTE* m_oopNewMethod;
ProcessOTE* m_oteActiveProcess;
public:
Process* activeProcess() { return m_pActiveProcess; }
Oop activeFrameOop() { return Oop(m_pActiveFrame)+1; }
StackFrame& activeFrame() { return *m_pActiveFrame; }
void StoreIPInFrame(); // Save down IP to active frame
void LoadIPFromFrame(); // Load IP from active frame
void StoreSPInFrame(); // Save down SP to active frame
void LoadSPFromFrame(); // Load SP from active frame
void NewActiveProcess(ProcessOTE* newProcess);
void FetchContextRegisters(); // Load current IP/SP from active frame
void StoreContextRegisters(); // Save down current IP/SP to active frame
void StoreSuspendedFrame(); // Save active frame back to process as top frame
void LoadSuspendedFrame(); // Restore process suspended frame as active frame
void PrepareToSuspendProcess(); // Resize proc, update suspended frame, and store context to that frame
void PrepareToResumeProcess(); // Resize proc, update suspended frame, and store context to that frame
void ResizeProcess();
void IncStackRefs();
void DecStackRefs();
};
typedef __declspec(align(16)) struct InterpreterRegisters InterpreterRegisters16;
#endif //EOF