-
Notifications
You must be signed in to change notification settings - Fork 65
/
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation.class.st
286 lines (239 loc) · 9.53 KB
/
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
Class {
#name : #CurrentImageCoInterpreterFacadeForSpurObjectRepresentation,
#superclass : #CurrentImageCoInterpreterFacade,
#instVars : [
'hiddenRoots'
],
#category : #'VMMaker-Support'
}
{ #category : #'accessing class hierarchy' }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation class >> objectMemoryClass [
^Spur32BitCoMemoryManager
]
{ #category : #'accessing class hierarchy' }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation class >> objectRepresentationClass [
^CogObjectRepresentationFor32BitSpur
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> accessorDepthForPrimitiveIndex: anInteger [
^StackInterpreterPrimitives primitiveAccessorDepthTable at: anInteger + 1
]
{ #category : #'cog jit support' }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> allocatePinnedSlots: nSlots [
^(objectMemory allocatePinnedSlots: nSlots)
ifNil: [nil]
ifNotNil:
[:objOop |
objectMap at: objOop put: objOop]
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> arrayFormat [
^objectMemory arrayFormat
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> baseHeaderSize [
^SpurMemoryManager baseHeaderSize
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> ceCheckAndMaybeRetryPrimitive: primIndex [
^coInterpreter ceCheckAndMaybeRetryPrimitive: primIndex
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> characterTag [
^objectMemory characterTag
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> classIndexMask [
^objectMemory classIndexMask
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> classTableMajorIndexShift [
^objectMemory classTableMajorIndexShift
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> classTableMinorIndexMask [
^objectMemory classTableMinorIndexMask
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> classTablePageSize [
^objectMemory classTablePageSize
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> classTableRootObj [
hiddenRoots ifNil:
[hiddenRoots := Array new: objectMemory classTableRootSlots + objectMemory hiddenRootSlots].
^self oopForObject: hiddenRoots
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> classTagForClass: classOop [
^(self objectForOop: classOop) identityHash
]
{ #category : #'cog jit support' }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> eeInstantiateClassIndex: knownClassIndex format: objFormat numSlots: numSlots [
self assert: knownClassIndex = ClassArrayCompactIndex.
^self oopForObject: (Array new: numSlots)
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> fetchClassTagOf: anOop [
| class |
self assert: SmalltalkImage current isRunningSpur.
class := (self objectForOop: anOop) class.
^SystemVersion current isPharo
ifTrue: [class basicIdentityHash]
ifFalse: [class identityHash]
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> firstShortFormat [
^objectMemory firstShortFormat
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> fixedFieldsOfClassFormatMask [
^objectMemory fixedFieldsOfClassFormatMask
]
{ #category : #forwarding }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> followForwardedObjectFields: objOop toDepth: depth [
"This is a noop in the facade"
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> formatMask [
^objectMemory formatMask
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> formatOfClass: classOop [
^(self objectForOop: classOop) format
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> formatShift [
^objectMemory formatShift
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> getScavengeThreshold [
^variables
at: 'scavengeThreshold'
ifAbsentPut: [objectMemory getScavengeThreshold ifNil: [16r24680]]
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> headerForSlots: numSlots format: formatField classIndex: classIndex [
^objectMemory headerForSlots: numSlots format: formatField classIndex: classIndex
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> identityHashFullWordShift [
^objectMemory identityHashFullWordShift
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> immutableBitMask [
^objectMemory immutableBitMask
]
{ #category : #'cog jit support' }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> instSpecOfClassFormat: classFormat [
^objectMemory instSpecOfClassFormat: classFormat
]
{ #category : #'cog jit support' }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> isFixedSizePointerFormat: formatOop [
^objectMemory isFixedSizePointerFormat: formatOop
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> isForwardedObjectClassIndexPun [
^objectMemory isForwardedObjectClassIndexPun
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> isImmediateClass: classOop [
"Can't rely on the host image; may be running on SqueakV3. hence..."
^#(Character SmallInteger SmallFloat) includes: (self objectForOop: classOop) name
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> maybeMethodClassOf: methodObj seemsToBeInstantiating: format [
"Answers if the code is installed in a class instantiating objects with the format. Used in primitive
generation to make a quick path based on where the method is installed. This method cannot
be used as a guarantee as there can be false positive, it's just a heuristic.
Tries to interpret the last literal of the method as a behavior (more than 3 fields, 3rd field a Smi).
If it can be interpreted as a behavior, answers if instSpec matches the format, else answers false."
<api>
| maybeClassObj|
maybeClassObj := (self objectForOop: methodObj) methodClass.
^maybeClassObj isBehavior
and: [maybeClassObj instSpec = format]
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> needGCFlagAddress [
^self addressForLabel: #needGCFlag
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> numSlotsFullShift [
^objectMemory numSlotsFullShift
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> numSlotsMask [
^objectMemory numSlotsMask
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> numTagBits [
^objectMemory numTagBits
]
{ #category : #'private-cacheing' }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> objectForOop: anOop [
"This is a keyAtValue: search and so needs speeding up either by a reverse map or a simple cache."
^(anOop bitAnd: 3) caseOf: {
[0] -> [anOop = cachedOop
ifTrue: [cachedObject]
ifFalse: [cachedObject := objectMap keyAtValue: anOop. "may raise Error"
cachedOop := anOop. "Don't assign until accessed without error"
cachedObject]].
[1] -> [anOop signedIntFromLong >> 1].
[2] -> [Character value: anOop >> 2].
[3] -> [anOop signedIntFromLong >> 1] }
]
{ #category : #'object map' }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> oopForObject: o [
^(o isInteger and: [o between: objectMemory minSmallInteger and: objectMemory maxSmallInteger])
ifTrue: [o << 1 + 1]
ifFalse:
[o isCharacter
ifTrue: [o asInteger << 2 + 2]
ifFalse: [objectMap at: o ifAbsentPut: [objectMap size * 8 + (1024 * 1024)]]]
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> rawHashBitsOf: obj [
^(self objectForOop: obj) identityHash
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> receiverTagBitsForMethod: methodOop [
^(self objectForOop: methodOop) methodClass
caseOf: {
[SmallInteger] -> [objectMemory smallIntegerTag].
[Character] -> [objectMemory characterTag].
[SmallFloat64] -> [objectMemory smallFloatTag] }
otherwise: [0]
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> rememberedBitShift [
^objectMemory rememberedBitShift
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> remoteIsInstVarAccess [
^ 128
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> scavengeThreshold [
^objectMemory scavengeThreshold
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> shiftForWord [
^objectMemory shiftForWord
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> smallIntegerTag [
^objectMemory smallIntegerTag
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> smallObjectBytesForSlots: numSlots [
^objectMemory smallObjectBytesForSlots: numSlots
]
{ #category : #accessing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> storeCheckBoundary [
^objectMemory storeCheckBoundary ifNil: [16r12345678]
]
{ #category : #testing }
CurrentImageCoInterpreterFacadeForSpurObjectRepresentation >> tagMask [
^objectMemory tagMask
]