-
Notifications
You must be signed in to change notification settings - Fork 67
/
VMBasicConstants.class.st
136 lines (127 loc) · 4.21 KB
/
VMBasicConstants.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
"
I am a shared pool for basic constants upon which the VM as a whole depends.
self ensureClassPool.
self classPool declare: #BytesPerWord from: VMSqueakV3ObjectRepresentationConstants classPool.
self classPool declare: #BaseHeaderSize from: VMSqueakV3ObjectRepresentationConstants classPool
(ObjectMemory classPool keys select: [:k| k beginsWith: 'Byte']) do:
[:k| self classPool declare: k from: ObjectMemory classPool]
"
Class {
#name : #VMBasicConstants,
#superclass : #SharedPool,
#classVars : [
'BaseHeaderSize',
'BytecodeSetHasExtensions',
'BytesPerOop',
'BytesPerWord',
'COGVM',
'CloneOnGC',
'CloneOnScavenge',
'DoAssertionChecks',
'DoExpensiveAssertionChecks',
'FEATURE_FFI',
'FEATURE_MESSAGE_COUNT',
'FEATURE_THREADED_FFI',
'GCCheckPrimCall',
'GCModeBecome',
'GCModeFreeSpace',
'GCModeFull',
'GCModeImageSegment',
'GCModeIncremental',
'GCModeNewSpace',
'HashMultiplyConstant',
'HashMultiplyMask',
'IMMUTABILITY',
'PharoVM',
'PrimErrBadArgument',
'PrimErrBadIndex',
'PrimErrBadMethod',
'PrimErrBadNumArgs',
'PrimErrBadReceiver',
'PrimErrCallbackError',
'PrimErrFFIException',
'PrimErrGenericFailure',
'PrimErrInappropriate',
'PrimErrLimitExceeded',
'PrimErrNamedInternal',
'PrimErrNeedCompaction',
'PrimErrNoCMemory',
'PrimErrNoMemory',
'PrimErrNoModification',
'PrimErrNotFound',
'PrimErrOSError',
'PrimErrObjectIsPinned',
'PrimErrObjectMayMove',
'PrimErrObjectMoved',
'PrimErrObjectNotPinned',
'PrimErrOperationFailed',
'PrimErrUnsupported',
'PrimErrWritePastObject',
'PrimNoErr',
'STACKVM',
'SistaVM',
'TempVectReadBarrier',
'VMBIGENDIAN'
],
#category : #Melchor
}
{ #category : #'C translation' }
VMBasicConstants class >> defineAtCompileTime: anObject [
^anObject isSymbol
and: [self namesDefinedAtCompileTime includes: anObject]
]
{ #category : #'C translation' }
VMBasicConstants class >> mostBasicConstantNames [
"c.f. mostBasicConstantSelectors"
^#(BaseHeaderSize BytesPerWord BytesPerOop ShiftForWord BytesPerWord)
]
{ #category : #'C translation' }
VMBasicConstants class >> mostBasicConstantSelectors [
"c.f. mostBasicConstantNames"
^#( baseHeaderSize wordSize bytesPerOop shiftForWord
bytesPerWord "bytesPerWord isn't used, but kept for history"
minSmallInteger maxSmallInteger)
]
{ #category : #'C translation' }
VMBasicConstants class >> namesDefinedAtCompileTime [
"Answer the set of names for variables that should be defined at compile time.
Some of these get default values during simulation, and hence get defaulted in
the various initializeMiscConstants methods. But that they have values should
/not/ cause the code generator to do dead code elimination based on their
default values. In particular, methods marked with <option: ANameDefinedAtCompileTime>
will be emitted within #if defined(ANameDefinedAtCompileTime)...#endif."
^#( VMBIGENDIAN
IMMUTABILITY
STACKVM COGVM SPURVM
PharoVM "Pharo vs Squeak"
CheckRememberedInTrampoline "IMMUTABILITY"
LLDB "As of lldb-370.0.42 Swift-3.1, passing funciton parameters to printOopsSuchThat fails with Internal error [IRForTarget]: Couldn't rewrite one of the arguments of a function call. Turning off link time optimization with -fno-lto has no effect. hence we define some debugging functions as being <option: LLDB>"
"processor related"
__ARM_ARCH__ __arm__ __arm32__ ARM32 __arm64__ ARM64
_M_I386 _X86_ i386 i486 i586 i686 __i386__ __386__ X86 I386
x86_64 __amd64 __x86_64 __amd64__ __x86_64__ _M_AMD64 _M_X64
"os related"
ACORN
__GNUC__
__linux__
__MINGW32__
__OpenBSD__
__osf__
UNIX
WIN32 _WIN32 _WIN32_WCE
WIN64 _WIN64 _WIN64_WCE
FEATURE_FFI
FEATURE_THREADED_FFI
FEATURE_MESSAGE_COUNT)
]
{ #category : #'C translation' }
VMBasicConstants class >> valueOfBasicSelector: selector [
"Answer the numberic value of a basic constant accessed via the selector.
Answer nil if selector is not a basic constant accessor."
"self mostBasicConstantSelectors collect: [:s| {s. self valueOfBasicSelector: s}]"
| index key |
^((index := self mostBasicConstantSelectors indexOf: selector) > 0
and: [(key := self mostBasicConstantNames at: index ifAbsent: []) notNil
and: [self includesKey: key]]) ifTrue:
[classPool at: key]
]