-
Notifications
You must be signed in to change notification settings - Fork 64
/
VMSimpleStackBasedCogitRememberedSetTest.class.st
93 lines (68 loc) · 2.41 KB
/
VMSimpleStackBasedCogitRememberedSetTest.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 : #VMSimpleStackBasedCogitRememberedSetTest,
#superclass : #VMSimpleStackBasedCogitAbstractTest,
#category : #'VMMakerTests-JitTests'
}
{ #category : #tests }
VMSimpleStackBasedCogitRememberedSetTest >> assertReceiver: receiver value: value shouldCallTrampoline: shouldCallTrampoline [
| trampoline afterBytecode |
machineSimulator receiverRegisterValue: receiver.
self pushAddress: value.
cogit objectRepresentation ceStoreCheckTrampoline: (self compileTrampoline: [ trampoline := cogit Stop ] named:#ceStoreCheckTrampoline).
"The bytecode for popIntoRcvrVariable is 0 based"
cogit byte0: 0.
self compile: [
cogit genStoreAndPopReceiverVariableBytecode.
afterBytecode := cogit Stop ].
machineSimulator
startAt: cogInitialAddress
until: (shouldCallTrampoline ifTrue:[trampoline address] ifFalse: [afterBytecode address])
timeout: 0
count: 0.
]
{ #category : #initialization }
VMSimpleStackBasedCogitRememberedSetTest >> setUp [
super setUp.
self setUpTrampolines
]
{ #category : #tests }
VMSimpleStackBasedCogitRememberedSetTest >> testStoringNewObjectInNewObjectDoesNotCallTrampoline [
| newObject otherNewObject |
newObject := self newObjectWithSlots: 1.
otherNewObject := self newObjectWithSlots: 0.
self
assertReceiver: newObject
value: otherNewObject
shouldCallTrampoline: false
]
{ #category : #tests }
VMSimpleStackBasedCogitRememberedSetTest >> testStoringNewObjectInOldObjectDoesCallTrampoline [
| oldObject otherNewObject |
oldObject := self newOldSpaceObjectWithSlots: 1.
otherNewObject := self newObjectWithSlots: 0.
self
assertReceiver: oldObject
value: otherNewObject
shouldCallTrampoline: true
]
{ #category : #tests }
VMSimpleStackBasedCogitRememberedSetTest >> testStoringOldObjectInOldObjectDoesNotCallTrampoline [
| oldObject otherOldObject |
oldObject := self newOldSpaceObjectWithSlots: 1.
otherOldObject := self newOldSpaceObjectWithSlots: 0.
self
assertReceiver: oldObject
value: otherOldObject
shouldCallTrampoline: false
]
{ #category : #tests }
VMSimpleStackBasedCogitRememberedSetTest >> testStoringOldObjectInPermObjectDoesCallTrampoline [
| permObject otherPermObject |
memory getMemoryMap extendPermObjectsSpaceMinimum: 0.
permObject := self newPermanentObjectWithSlots: 1.
otherPermObject := self newPermanentObjectWithSlots: 0.
self
assertReceiver: permObject
value: otherPermObject
shouldCallTrampoline: false
]