-
Notifications
You must be signed in to change notification settings - Fork 65
/
CArrayOfLongsAccessor.class.st
54 lines (45 loc) · 1.65 KB
/
CArrayOfLongsAccessor.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
"
A CArrayOfLongsAccessor is a class that wraps an Array stored in the heap. It maps at:[put:] into a suitably aligned and offset longAt:[put:], for accessing Arrays stored in the heap, such as the primTraceLog.
Instance Variables
address: <Integer>
entryByteSize: <Integer>
objectMemory: <NewCoObjectMemorySimulator|Spur64BitMMLECoSimulator|Spur64BitMMLECoSimulator|Spur64BitMMBECoSimulator|Spur64BitMMBECoSimulator>
address
- the base address in the heap of the start of the array
entryByteSize
- the size of an element, in bytes
objectMemory
- the memory manager whose heap is being accessed
"
Class {
#name : #CArrayOfLongsAccessor,
#superclass : #CObjectAccessor,
#instVars : [
'objectMemory',
'address',
'elementByteSize'
],
#category : #'Slang-Types'
}
{ #category : #accessing }
CArrayOfLongsAccessor >> address [
^address
]
{ #category : #accessing }
CArrayOfLongsAccessor >> at: index [
"Map at: into a suitably aligned and offset longAt:, for accessing Arrays stored in the heap, such as the primTraceLog."
^objectMemory longAt: index * elementByteSize + address
]
{ #category : #accessing }
CArrayOfLongsAccessor >> at: index put: aValue [
"Map at:put: into a suitably aligned and offset longAt:put:, for accessing Arrays stored in the heap, such as the primTraceLog."
^objectMemory longAt: index * elementByteSize + address put: aValue
]
{ #category : #'initialize-release' }
CArrayOfLongsAccessor >> objectMemory: anObjectMemory at: anAddress [
objectMemory := anObjectMemory.
object := anObjectMemory memoryManager.
offset := anAddress / anObjectMemory wordSize.
elementByteSize := anObjectMemory wordSize.
address := anAddress
]