-
Notifications
You must be signed in to change notification settings - Fork 65
/
VMMakerConfiguration.class.st
255 lines (211 loc) · 6.63 KB
/
VMMakerConfiguration.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
Class {
#name : #VMMakerConfiguration,
#superclass : #Object,
#classVars : [
'DirNames'
],
#category : #'VMMaker-Slang'
}
{ #category : #accessing }
VMMakerConfiguration class >> baseClass [
^ VMClass
]
{ #category : #accessing }
VMMakerConfiguration class >> baseCogitClass [
^ Cogit
]
{ #category : #accessing }
VMMakerConfiguration class >> baseInterpreterClass [
^ InterpreterPrimitives
]
{ #category : #accessing }
VMMakerConfiguration class >> baseObjectMemoryManagerClass [
^ SpurMemoryManager
]
{ #category : #accessing }
VMMakerConfiguration class >> baseStructClass [
^ VMStructType
]
{ #category : #accessing }
VMMakerConfiguration class >> bytesPerOop [
^ self baseClass bytesPerOop
]
{ #category : #accessing }
VMMakerConfiguration class >> bytesPerOop: anInteger [
^ self baseClass bytesPerOop: anInteger
]
{ #category : #accessing }
VMMakerConfiguration class >> bytesPerWord [
^ self baseClass bytesPerWord
]
{ #category : #accessing }
VMMakerConfiguration class >> bytesPerWord: anInteger [
^ self baseClass bytesPerWord: anInteger
]
{ #category : #accessing }
VMMakerConfiguration class >> constantClass [
"The basic constant pool for full generation"
^ self baseClass constantClass
]
{ #category : #accessing }
VMMakerConfiguration class >> coreVMDirName [
^DirNames at: #coreVMDir
]
{ #category : #accessing }
VMMakerConfiguration class >> coreVMHeadersDirName [
^ DirNames at: #coreVMHeadersDir ifAbsent: [ self coreVMDirName ]
]
{ #category : #accessing }
VMMakerConfiguration class >> defaultInterpreterClass [
^ StackInterpreter
]
{ #category : #configurations }
VMMakerConfiguration class >> generateConfiguration [
"VMMaker generateConfiguration"
| configCategoryName selectors |
configCategoryName := self class whichCategoryIncludesSelector: thisContext selector.
selectors := Set new.
self class organization categories do:
[:cat|
(cat endsWith: configCategoryName) ifTrue:
[selectors addAll: (self class organization listAtCategoryNamed: cat)]].
selectors remove: thisContext selector.
selectors := selectors asArray sort.
(UIManager default
chooseFrom: (selectors collect: [:sel| self configurationNameFromSelector: sel])
values: selectors) ifNotNil:
[:choice|
self perform: choice]
]
{ #category : #configurations }
VMMakerConfiguration class >> generateSqueakSpurCog64VM [
"No primitives since we can use those for the Cog VM"
^VMMaker
generate: CoInterpreter
and: StackToRegisterMappingCogit
with: #(ObjectMemory Spur64BitCoMemoryManager
bytecodeTableInitializer initializeBytecodeTableForSistaV1)
to: self sourceTree, '/spur64src'
platformDir: self sourceTree, '/platforms'
including:#()
configuration: self
]
{ #category : #configurations }
VMMakerConfiguration class >> generateSqueakSpurCogSista64VM [
^VMMaker
generate: CoInterpreter
and: SistaCogit
with: #( SistaVM true
ObjectMemory Spur64BitCoMemoryManager
bytecodeTableInitializer initializeBytecodeTableForSistaV1)
to: self sourceTree, '/spursista64src'
platformDir: self sourceTree, '/platforms'
including:#()
configuration: self
]
{ #category : #configurations }
VMMakerConfiguration class >> generateSqueakSpurCogSistaVM [
"No primitives since we can use those for the Cog VM"
^VMMaker
generate: CoInterpreter
and: SistaCogit
with: #( SistaVM true
ObjectMemory Spur32BitCoMemoryManager
bytecodeTableInitializer initializeBytecodeTableForSistaV1)
to: self sourceTree, '/spursistasrc'
platformDir: self sourceTree, '/platforms'
including:#()
configuration: self
]
{ #category : #configurations }
VMMakerConfiguration class >> generateSqueakSpurCogVM [
"No primitives since we can use those for the Cog VM"
^VMMaker
generate: CoInterpreter
and: StackToRegisterMappingCogit
with: #(ObjectMemory Spur32BitCoMemoryManager
bytecodeTableInitializer initializeBytecodeTableForSistaV1)
to: self sourceTree, '/spursrc'
platformDir: self sourceTree, '/platforms'
including:#()
configuration: self
]
{ #category : #initialisation }
VMMakerConfiguration class >> initialize [
"VMMaker initialize"
DirNames := Dictionary new.
DirNames
at: #coreVMDir put: 'vm';
at: #platformsDir put: 'platforms';
at: #pluginsDir put: 'plugins';
at: #sourceDir put: 'src'.
"Try and decide where the Cog source tree is. Two configurations are likely.
One is that the VMMaker image is running in the image directory in the
source tree and hence everything will be at '..'.
Another is where the source tree is at the same level as the VMMaker image,
in which case it is likely called oscogvm or Cog."
#('../platforms' 'oscogvm/platforms' 'Cog/platforms' '../oscogvm/platforms')
with: #('..' 'oscogvm' 'Cog' '../oscogvm')
do: ((Smalltalk classNamed: #FileSystem)
ifNotNil:
[[:dir :path|
(FileLocator cwd / dir) isDirectory ifTrue:
[DirNames at: #sourceTree put: path.
^self]]]
ifNil:
[[:dir :path|
dir asFileReference exists
ifTrue: [DirNames at: #sourceTree put: path. ^self]]])
]
{ #category : #initialisation }
VMMakerConfiguration class >> initializeForPharo [
"VMMaker initialize"
DirNames := Dictionary new.
DirNames
at: #coreVMDir put: 'vm/src';
at: #coreVMHeadersDir put: 'vm/include';
at: #platformsDir put: 'platforms';
at: #pluginsDir put: 'plugins/src';
at: #sourceDir put: 'src'
]
{ #category : #initialize }
VMMakerConfiguration class >> initializeForPlugins: options [
VMClass initializeForPlugins: options
]
{ #category : #accessing }
VMMakerConfiguration class >> interpreterPluginClass [
^ InterpreterPlugin
]
{ #category : #accessing }
VMMakerConfiguration class >> interpreterProxyClass [
^ InterpreterProxy
]
{ #category : #accessing }
VMMakerConfiguration class >> platformsDirName [
^DirNames at: #platformsDir
]
{ #category : #accessing }
VMMakerConfiguration class >> pluginsDirName [
^DirNames at: #pluginsDir
]
{ #category : #accessing }
VMMakerConfiguration class >> referenceObjectMemoryClass [
"Define the class from which to take methods to define the interpreter proxy imports."
^ Spur32BitMemoryManager
]
{ #category : #accessing }
VMMakerConfiguration class >> sourceDirName [
^DirNames at: #sourceDir
]
{ #category : #accessing }
VMMakerConfiguration class >> sourceTree [
^DirNames at: #sourceTree ifAbsent: [ FileSystem workingDirectory pathString ]
]
{ #category : #accessing }
VMMakerConfiguration class >> unusedConstantNames [
"Don't generate any defines for the externally defined constants,
STACKVM, COGVM et al, unless they're actually used."
^ (VMClass class>>#initializeMiscConstants) literals
select: [ :lit | lit isVariableBinding and: [lit key isString]]
thenCollect: [ :lit | lit key]
]