-
Notifications
You must be signed in to change notification settings - Fork 65
/
VMContext.class.st
81 lines (67 loc) · 1.96 KB
/
VMContext.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
Class {
#name : #VMContext,
#superclass : #Object,
#instVars : [
'contextOop',
'interpreter'
],
#pools : [
'VMObjectIndices'
],
#category : #'VMMakerTests-Visualisation'
}
{ #category : #'instance creation' }
VMContext class >> newOnContext: anInteger withInterpreter: aStackInterpreterSimulatorLSB [
^ self new
contextOop: anInteger;
interpreter: aStackInterpreterSimulatorLSB;
yourself
]
{ #category : #accessing }
VMContext >> caller [
| senderContext |
"Check if widowed (marriage should have been checked by sender)"
"If widowed it's just me!"
(interpreter isMarriedOrWidowedContext: contextOop)
ifTrue: [ ^ nil ].
senderContext := self sender.
senderContext = interpreter objectMemory nilObject
ifTrue: [ ^ nil ].
^ VMContext newOnContext: senderContext withInterpreter: interpreter
]
{ #category : #accessing }
VMContext >> contextOop: anInteger [
contextOop := anInteger
]
{ #category : #accessing }
VMContext >> description [
| homeContextOop method selector |
homeContextOop := interpreter findHomeForContext: contextOop.
method := interpreter objectMemory fetchPointer: MethodIndex ofObject: homeContextOop.
selector := interpreter findSelectorOfMethod: method.
^ interpreter stringOf: selector
]
{ #category : #accessing }
VMContext >> instructionPointer [
^interpreter objectMemory fetchPointer: InstructionPointerIndex ofObject: contextOop.
]
{ #category : #accessing }
VMContext >> interpreter: aStackInterpreterSimulatorLSB [
interpreter := aStackInterpreterSimulatorLSB
]
{ #category : #testing }
VMContext >> isMarried [
^interpreter isStillMarriedContext: contextOop.
]
{ #category : #testing }
VMContext >> isNilObject [
^interpreter objectMemory nilObject = contextOop.
]
{ #category : #accessing }
VMContext >> receiver [
^interpreter objectMemory fetchPointer: ReceiverIndex ofObject: contextOop
]
{ #category : #accessing }
VMContext >> sender [
^interpreter objectMemory fetchPointer: SenderIndex ofObject: contextOop.
]