-
Notifications
You must be signed in to change notification settings - Fork 65
/
VMInterpreterTests.class.st
93 lines (74 loc) · 2.36 KB
/
VMInterpreterTests.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
Class {
#name : #VMInterpreterTests,
#superclass : #VMSpurMemoryManagerTest,
#pools : [
'VMClassIndices',
'VMObjectIndices'
],
#category : #'VMMakerTests-InterpreterTests'
}
{ #category : #tests }
VMInterpreterTests >> installSelector: aSelectorOop method: aMethodOop inMethodDictionary: aMethodDictionary [
| anArrayOfMethods |
anArrayOfMethods := memory fetchPointer: MethodArrayIndex ofObject: aMethodDictionary.
memory
storePointer: (memory methodDictionaryHash: aSelectorOop mask: 11) + 2
ofObject: aMethodDictionary
withValue: aSelectorOop.
memory
storePointer: (memory methodDictionaryHash: aSelectorOop mask: 11)
ofObject: anArrayOfMethods
withValue: aMethodOop
]
{ #category : #tests }
VMInterpreterTests >> setSmallIntegerClassIntoClassTable [
| class |
"install the class in both 1 and 3 index of class table
see SpurMemoryManager >> fetchClassOf: for more informations"
class := self
newClassInOldSpaceWithSlots: 0
instSpec: memory forwardedFormat.
memory setHashBitsOf: class to: memory smallIntegerTag.
memory
storePointer: memory smallIntegerTag
ofObject: memory classTableFirstPage
withValue: class.
memory
storePointer: 3
ofObject: memory classTableFirstPage
withValue: class.
^class
]
{ #category : #running }
VMInterpreterTests >> setUp [
"taken from VMSimpleStackBasedCogitBytecodeTest >> #setup"
super setUp.
memory nilObject: (self newObjectWithSlots: 0).
memory trueObject: (self newObjectWithSlots: 0).
memory falseObject: (self newObjectWithSlots: 0).
"We don't access its contents, but we need it to be after nil, true and false"
memory hiddenRootsObject: (self newArrayWithSlots: 0).
self initializeOldSpaceForScavenger.
]
{ #category : #tests }
VMInterpreterTests >> setUpMethodDictionaryIn: aClass [
"2 instances variables the array of methods and the tally
and 12 entries to put elemetns of the collection"
| aMethodDictionary anArrayOfMethods |
aMethodDictionary := self
newObjectWithSlots: 2 + 12
format: MethodDictionary instSpec
classIndex: memory arrayClassIndexPun.
anArrayOfMethods := self
newObjectWithSlots: 12
format: Array instSpec
classIndex: memory arrayClassIndexPun.
memory
storePointer: MethodDictionaryIndex
ofObject: aClass
withValue: aMethodDictionary.
memory
storePointer: MethodArrayIndex
ofObject: aMethodDictionary
withValue: anArrayOfMethods.
]