-
Notifications
You must be signed in to change notification settings - Fork 68
/
VMObjectProxy.class.st
74 lines (62 loc) · 1.74 KB
/
VMObjectProxy.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
"
A VMObjectProxy is a wraper for an oop in the VM, that provides limited access to that oop as an object.
"
Class {
#name : #VMObjectProxy,
#superclass : #Object,
#instVars : [
'coInterpreter',
'oop',
'objectMemory'
],
#category : #'VMMaker-Support'
}
{ #category : #accessing }
VMObjectProxy >> coInterpreter [
"Answer the value of coInterpreter"
^ coInterpreter
]
{ #category : #'initialize-release' }
VMObjectProxy >> for: aCompiledMethodOop coInterpreter: aCoInterpreter objectMemory: anObjectMemory [
oop := aCompiledMethodOop.
coInterpreter := aCoInterpreter.
objectMemory := anObjectMemory
]
{ #category : #'symbolic printing' }
VMObjectProxy >> key [
"For InstructionPrinter>>pushLiteralVariable:"
^coInterpreter stringOf: (objectMemory fetchPointer: 0 ofObject: oop)
]
{ #category : #accessing }
VMObjectProxy >> objectMemory [
"Answer the value of objectMemory"
^ objectMemory
]
{ #category : #accessing }
VMObjectProxy >> oop [
"Answer the value of oop"
^ oop
]
{ #category : #printing }
VMObjectProxy >> printOn: aStream [
| shortPrint |
shortPrint := [coInterpreter shortPrint: oop]
on: Error
do: [:ex| ^super printOn: aStream].
super printOn: aStream.
shortPrint first = $= ifTrue:
[shortPrint := shortPrint allButFirst].
aStream nextPutAll: ' for '; nextPutAll: shortPrint
]
{ #category : #accessing }
VMObjectProxy >> selector [
| selector |
selector := coInterpreter maybeSelectorOfMethod: oop.
^coInterpreter stringOf: selector
]
{ #category : #printing }
VMObjectProxy >> storeOn: aStream [
"We don't care about storing these things properly. Doing so involves printing an entire VM.
So simply print and hence get debuggable CompiledMethods whose literals are VMObjectProxys."
^self printOn: aStream
]