-
Notifications
You must be signed in to change notification settings - Fork 71
/
VMObjectStackTest.class.st
151 lines (116 loc) · 4.58 KB
/
VMObjectStackTest.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
Class {
#name : #VMObjectStackTest,
#superclass : #VMSpurInitializedOldSpaceTest,
#category : #'VMMakerTests-MemoryTests'
}
{ #category : #tests }
VMObjectStackTest >> testGrowingMournQueueUpdatesVMGlobalVariable [
self testPushObjects: memory objectStackPageLimit + 1 inStackAtIndex: 4098"MournQueueRootIndex".
self assert: memory mournQueue equals: (memory objStackAt: 4098"MournQueueRootIndex")
]
{ #category : #tests }
VMObjectStackTest >> testNewMournQueueIsEmpty [
| objStack |
objStack := memory ensureRoomOnObjStackAt: 4098 "MournQueueIndex".
self assert: (memory isEmptyObjStack: objStack)
]
{ #category : #tests }
VMObjectStackTest >> testNewObjectStackIsEmpty [
"Create an object stack at the position of the mark stack in the class table (4096)"
| objStack |
objStack := memory ensureRoomOnObjStackAt: 4096.
self assert: (memory isEmptyObjStack: objStack)
]
{ #category : #tests }
VMObjectStackTest >> testObjectsInMournQueueArePoppedInOrder [
| objStack |
objStack := memory ensureRoomOnObjStackAt: 4098 "MournQueueIndex".
1 to: memory objectStackPageLimit do: [ :i |
memory noCheckPush: (memory integerObjectOf: i) onObjStack: objStack.
].
memory objectStackPageLimit to: 1 by: -1 do: [ :i |
self assert: (memory popObjStack: objStack) equals: (memory integerObjectOf: i).
].
]
{ #category : #tests }
VMObjectStackTest >> testObjectsInObjectStackArePoppedInOrder [
"Create an object stack at the position of the mark stack in the class table (4096)"
| objStack |
objStack := memory ensureRoomOnObjStackAt: 4096.
1 to: memory objectStackPageLimit do: [ :i |
memory noCheckPush: (memory integerObjectOf: i) onObjStack: objStack.
].
memory objectStackPageLimit to: 1 by: -1 do: [ :i |
self assert: (memory popObjStack: objStack) equals: (memory integerObjectOf: i).
].
]
{ #category : #tests }
VMObjectStackTest >> testPopMournQueueReducesSize [
| objStack |
objStack := memory ensureRoomOnObjStackAt: 4098 "MournQueueIndex".
memory noCheckPush: memory trueObject onObjStack: objStack.
memory popObjStack: objStack.
self assert: (memory isEmptyObjStack: objStack)
]
{ #category : #tests }
VMObjectStackTest >> testPopObjectInMournQueueReturnsInitiallyPushedObject [
| objStack |
objStack := memory ensureRoomOnObjStackAt: 4098 "MournQueueIndex".
memory noCheckPush: memory trueObject onObjStack: objStack.
self assert: (memory popObjStack: objStack) equals: memory trueObject
]
{ #category : #tests }
VMObjectStackTest >> testPopObjectInStackReturnsInitiallyPushedObject [
"Create an object stack at the position of the mark stack in the class table (4096)"
| objStack |
objStack := memory ensureRoomOnObjStackAt: 4096.
memory noCheckPush: memory trueObject onObjStack: objStack.
self assert: (memory popObjStack: objStack) equals: memory trueObject
]
{ #category : #tests }
VMObjectStackTest >> testPopObjectStackReducesSize [
"Create an object stack at the position of the mark stack in the class table (4096)"
| objStack |
objStack := memory ensureRoomOnObjStackAt: 4096.
memory noCheckPush: memory trueObject onObjStack: objStack.
memory popObjStack: objStack.
self assert: (memory isEmptyObjStack: objStack)
]
{ #category : #tests }
VMObjectStackTest >> testPushObjects: n [
"Create an object stack at the position of the mark stack in the class table (4096)"
self testPushObjects: n inStackAtIndex: 4096
]
{ #category : #tests }
VMObjectStackTest >> testPushObjects: n inStackAtIndex: objectStackIndex [
memory ensureRoomOnObjStackAt: objectStackIndex.
1 to: n do: [ :i |
memory
noCheckPush: (memory integerObjectOf: i)
onObjStack: (memory objStackAt: objectStackIndex).
].
self assert: (memory sizeOfObjStack: (memory objStackAt: objectStackIndex)) equals: n
]
{ #category : #tests }
VMObjectStackTest >> testPushObjectsAboveObjectStackLimit [
self testPushObjects: memory objectStackPageLimit + 1
]
{ #category : #tests }
VMObjectStackTest >> testPushObjectsToObjectStackLimit [
self testPushObjects: memory objectStackPageLimit
]
{ #category : #tests }
VMObjectStackTest >> testPushToMournQueueIncreasesSize [
| objStack |
objStack := memory ensureRoomOnObjStackAt: 4098 "MournQueueIndex".
memory noCheckPush: memory trueObject onObjStack: objStack.
self assert: (memory sizeOfObjStack: objStack) equals: 1
]
{ #category : #tests }
VMObjectStackTest >> testPushToObjectStackIncreasesSize [
"Create an object stack at the position of the mark stack in the class table (4096)"
| objStack |
objStack := memory ensureRoomOnObjStackAt: 4096.
memory noCheckPush: memory trueObject onObjStack: objStack.
self assert: (memory sizeOfObjStack: objStack) equals: 1
]