-
Notifications
You must be signed in to change notification settings - Fork 67
/
VMTFreeListNode.class.st
98 lines (76 loc) · 1.69 KB
/
VMTFreeListNode.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
Class {
#name : #VMTFreeListNode,
#superclass : #Object,
#instVars : [
'nodeOop',
'memory'
],
#category : #'VMMaker-Tools'
}
{ #category : #'instance-creation' }
VMTFreeListNode class >> on: anOop memory: aMemory [
anOop = 0 ifTrue: [ self halt ].
^ self new
memory: aMemory;
nodeOop: anOop;
yourself
]
{ #category : #accessing }
VMTFreeListNode >> address [
^ memory startOfObject: nodeOop
]
{ #category : #accessing }
VMTFreeListNode >> children [
^ self edges
]
{ #category : #accessing }
VMTFreeListNode >> edges [
| edges |
edges := OrderedCollection new.
edges add: (VMTFreeTreeNodeEdge2 memory: memory label: 'Next' oop: self nextOop).
edges add: (VMTFreeTreeNodeEdge2 memory: memory label: 'Previous' oop: self previousOop).
^ edges
]
{ #category : #accessing }
VMTFreeListNode >> hasChildren [
^ self nextOop ~= 0 or: [ self previousOop ~= 0 ]
]
{ #category : #accessing }
VMTFreeListNode >> memory [
^ memory
]
{ #category : #accessing }
VMTFreeListNode >> memory: anObject [
memory := anObject
]
{ #category : #accessing }
VMTFreeListNode >> nextOop [
^ memory
fetchPointer: memory freeChunkNextIndex
ofFreeChunk: nodeOop
]
{ #category : #accessing }
VMTFreeListNode >> nodeOop [
^ nodeOop
]
{ #category : #accessing }
VMTFreeListNode >> nodeOop: anObject [
nodeOop := anObject
]
{ #category : #accessing }
VMTFreeListNode >> previousOop [
^ memory
fetchPointer: memory freeChunkPrevIndex
ofFreeChunk: nodeOop
]
{ #category : #accessing }
VMTFreeListNode >> printOn: aStream [
aStream
nextPutAll: 'FreeTreeNode(';
nextPutAll: nodeOop hex;
nextPutAll: ')'
]
{ #category : #accessing }
VMTFreeListNode >> size [
^ memory bytesInObject: nodeOop
]