-
Notifications
You must be signed in to change notification settings - Fork 65
/
VMInterpreterTests.class.st
69 lines (55 loc) · 1.81 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
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 : #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.
]