-
Notifications
You must be signed in to change notification settings - Fork 67
/
VMMachineCodeFrameBuilderForTest.class.st
132 lines (105 loc) · 2.97 KB
/
VMMachineCodeFrameBuilderForTest.class.st
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
Class {
#name : #VMMachineCodeFrameBuilderForTest,
#superclass : #Object,
#instVars : [
'test',
'returnAddress',
'receiver',
'arguments',
'temporaries',
'spouseContext',
'method'
],
#category : #VMMakerTests
}
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> arguments [
^ arguments
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> arguments: anObject [
arguments := anObject
]
{ #category : #building }
VMMachineCodeFrameBuilderForTest >> buildFrame [
| methodAddress |
test createFramelessCallFrom: returnAddress receiver: receiver arguments: arguments.
test machineSimulator hasLinkRegister
ifTrue: [ test pushAddress: returnAddress ].
"These are pushed when activating the method"
test pushAddress: test machineSimulator framePointerRegisterValue.
test machineSimulator framePointerRegisterValue: test machineSimulator smalltalkStackPointerRegisterValue.
"Method can be nil or a cog method.
If nil, put a nil address.
Otherwise, use the address of the cog method"
methodAddress := method
ifNil: [ test memory nilObject ]
ifNotNil: [ method address ].
test pushAddress: (methodAddress bitOr: (self hasSpouseContext ifTrue: [1] ifFalse: [0])). "method"
test pushAddress: (self hasSpouseContext
ifTrue: [ spouseContext ]
ifFalse: [ test memory nilObject ]). "context"
test pushAddress: receiver.
temporaries do: [ :aTemporary | test pushAddress: aTemporary ].
test cogit needsFrame: true.
]
{ #category : #testing }
VMMachineCodeFrameBuilderForTest >> hasSpouseContext [
^ spouseContext notNil
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> initializeWithTest: aTest [
self test: aTest.
receiver := test memory nilObject.
returnAddress := test callerAddress.
arguments := #().
temporaries := #().
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> method [
^ method
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> method: anObject [
method := anObject
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> receiver [
^ receiver
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> receiver: anObject [
receiver := anObject
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> returnAddress [
^ returnAddress
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> returnAddress: anObject [
returnAddress := anObject
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> spouseContext [
^ spouseContext
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> spouseContext: aContextOop [
spouseContext := aContextOop
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> temporaries [
^ temporaries
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> temporaries: anObject [
temporaries := anObject
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> test [
^ test
]
{ #category : #accessing }
VMMachineCodeFrameBuilderForTest >> test: anObject [
test := anObject
]