/
Factory.java
399 lines (371 loc) · 12 KB
/
Factory.java
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
/*
* This file is part of the Jikes RVM project (http://jikesrvm.org).
*
* This file is licensed to You under the Common Public License (CPL);
* You may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.opensource.org/licenses/cpl1.0.php
*
* See the COPYRIGHT.txt file distributed with this work for information
* regarding copyright ownership.
*/
package org.mmtk.harness.vm;
import org.vmutil.options.OptionSet;
import org.mmtk.harness.Harness;
import org.mmtk.harness.scheduler.Lock;
import org.mmtk.harness.scheduler.Scheduler;
import org.mmtk.utility.gcspy.Color;
import org.mmtk.utility.gcspy.drivers.AbstractDriver;
import org.mmtk.vm.gcspy.ByteStream;
import org.mmtk.vm.gcspy.IntStream;
import org.mmtk.vm.gcspy.ServerInterpreter;
import org.mmtk.vm.gcspy.ServerSpace;
import org.mmtk.vm.gcspy.ShortStream;
import org.mmtk.vm.gcspy.Util;
/**
* This class defines factory methods for VM-specific types which must
* be instantiated within MMTk. Since the concrete type is defined at
* build time, we leave it to a concrete vm-specific instance of this class
* to perform the object instantiation.
*/
public class Factory extends org.mmtk.vm.Factory {
/**
* Create or retrieve the OptionSet used for MMTk options.
*
* @return A concrete VM-specific OptionSet instance
*/
public OptionSet getOptionSet() {
return Harness.options;
}
/**
* Create a new ActivePlan instance using the appropriate VM-specific
* concrete ActivePlan sub-class.
*
* @see ActivePlan
* @return A concrete VM-specific ActivePlan instance.
*/
public ActivePlan newActivePlan() {
return new ActivePlan();
}
/**
* Create a new Assert instance using the appropriate VM-specific
* concrete Assert sub-class.
*
* @see Assert
* @return A concrete VM-specific Assert instance.
*/
public Assert newAssert() {
return new Assert();
}
/**
* Create a new Barriers instance using the appropriate VM-specific
* concrete Barriers sub-class.
*
* @see Barriers
* @return A concrete VM-specific Barriers instance.
*/
public Barriers newBarriers() {
return new Barriers();
}
/**
* Create a new Collection instance using the appropriate VM-specific
* concrete Collection sub-class.
*
* @see Collection
* @return A concrete VM-specific Collection instance.
*/
public Collection newCollection() {
return new Collection();
}
/**
* Create a new Config instance using the appropriate VM-specific
* concrete Config sub-class.
*
* @see Collection
* @return A concrete VM-specific Collection instance.
*/
public BuildTimeConfig newBuildTimeConfig() {
return new BuildTimeConfig();
}
/**
* Create a new Lock instance using the appropriate VM-specific
* concrete Lock sub-class.
*
* @see Lock
* @param name The string to be associated with this lock instance
* @return A concrete VM-specific Lock instance.
*/
public Lock newLock(String name) {
return Scheduler.newLock(name);
}
/**
* Create a new Memory instance using the appropriate VM-specific
* concrete Memory sub-class.
*
* @see Memory
* @return A concrete VM-specific Memory instance.
*/
public Memory newMemory() {
return new Memory();
}
/**
* Create a new ObjectModel instance using the appropriate VM-specific
* concrete ObjectModel sub-class.
*
* @see ObjectModel
* @return A concrete VM-specific ObjectModel instance.
*/
public ObjectModel newObjectModel() {
return new ObjectModel();
}
/**
* Create a new ReferenceProcessor instance using the appropriate VM-specific
* concrete ReferenceProcessor sub-class.
*
* @see ReferenceProcessor
* @return A concrete VM-specific ReferenceProcessor instance.
*/
public ReferenceProcessor newReferenceProcessor(ReferenceProcessor.Semantics semantics) {
return new ReferenceProcessor();
}
/**
* Create a new FinalizableProcessor instance using the appropriate VM-specific
* concrete FinalizableProcessor sub-class.
*
* @see FinalizableProcessor
* @return A concrete VM-specific FinalizableProcessor instance.
*/
public FinalizableProcessor newFinalizableProcessor() {
return new FinalizableProcessor();
}
/**
* Create a new Scanning instance using the appropriate VM-specific
* concrete Scanning sub-class.
*
* @see Scanning
* @return A concrete VM-specific Scanning instance.
*/
public Scanning newScanning() {
return new Scanning();
}
/**
* Create a new Statistics instance using the appropriate VM-specific
* concrete Statistics sub-class.
*
* @see Statistics
* @return A concrete VM-specific Statistics instance.
*/
public Statistics newStatistics() {
return new Statistics();
}
/**
* Create a new Strings instance using the appropriate VM-specific
* concrete Strings sub-class.
*
* @see Strings
* @return A concrete VM-specific Strings instance.
*/
public Strings newStrings() {
return new Strings();
}
/**
* Create a new SynchronizedCounter instance using the appropriate
* VM-specific concrete SynchronizedCounter sub-class.
*
* @see SynchronizedCounter
*
* @return A concrete VM-specific SynchronizedCounter instance.
*/
public SynchronizedCounter newSynchronizedCounter() {
return new SynchronizedCounter();
}
/**
* Create a new TraceInterface instance using the appropriate VM-specific
* concrete TraceInterface sub-class.
*
* @see TraceInterface
* @return A concrete VM-specific TraceInterface instance.
*/
public org.mmtk.vm.TraceInterface newTraceInterface() {
/* Not supported */
return null;
}
/**********************************************************************
* GCspy methods
*/
/**
* Create a new Util instance using the appropriate VM-specific
* concrete Util sub-class.
*
* @see Util
* @return A concrete VM-specific Util instance.
*/
public Util newGCspyUtil() {
Assert.notImplemented();
return null;
}
/**
* Create a new ServerInterpreter instance using the appropriate VM-specific
* concrete ServerInterpreter sub-class.
*
* @see ServerInterpreter
* @return A concrete VM-specific ServerInterpreter instance.
*/
public ServerInterpreter newGCspyServerInterpreter() {
Assert.notImplemented();
return null;
}
/**
* Create a new ServerSpace instance using the appropriate VM-specific
* concrete ServerSpace sub-class.
*
* @param serverInterpreter The server that owns this space
* @param serverName The server's name
* @param driverName The space driver's name
* @param title Title for the space
* @param blockInfo A label for each block
* @param tileNum Max number of tiles in this space
* @param unused A label for unused blocks
* @param mainSpace Whether this space is the main space
*
* @see ServerSpace
* @return A concrete VM-specific ServerSpace instance.
*/
public ServerSpace newGCspyServerSpace(
ServerInterpreter serverInterpreter,
String serverName,
String driverName,
String title,
String blockInfo,
int tileNum,
String unused,
boolean mainSpace) {
Assert.notImplemented();
return null;
}
/**
* Create a new IntStream instance using the appropriate
* VM-specific concrete IntStream sub-class.
*
* @param driver The driver that owns this Stream
* @param name The name of the stream (e.g. "Used space")
* @param minValue The minimum value for any item in this stream.
* Values less than this will be represented as "minValue-"
* @param maxValue The maximum value for any item in this stream.
* Values greater than this will be represented as "maxValue+"
* @param zeroValue The zero value for this stream
* @param defaultValue The default value for this stream
* @param stringPre A string to prefix values (e.g. "Used: ")
* @param stringPost A string to suffix values (e.g. " bytes.")
* @param presentation How a stream value is to be presented.
* @param paintStyle How the value is to be painted.
* @param indexMaxStream The index of the maximum stream if the presentation is *_VAR.
* @param colour The default colour for tiles of this stream
* @see IntStream
*
* @return A concrete VM-specific IntStream instance.
*/
public IntStream newGCspyIntStream(
AbstractDriver driver,
String name,
int minValue,
int maxValue,
int zeroValue,
int defaultValue,
String stringPre,
String stringPost,
int presentation,
int paintStyle,
int indexMaxStream,
Color colour,
boolean summary) {
Assert.notImplemented();
return null;
}
/**
* Create a new ByteStream instance using the appropriate
* VM-specific concrete ByteStream sub-class.
*
* @param driver The driver that owns this Stream
* @param name The name of the stream (e.g. "Used space")
* @param minValue The minimum value for any item in this stream.
* Values less than this will be represented as "minValue-"
* @param maxValue The maximum value for any item in this stream.
* Values greater than this will be represented as "maxValue+"
* @param zeroValue The zero value for this stream
* @param defaultValue The default value for this stream
* @param stringPre A string to prefix values (e.g. "Used: ")
* @param stringPost A string to suffix values (e.g. " bytes.")
* @param presentation How a stream value is to be presented.
* @param paintStyle How the value is to be painted.
* @param indexMaxStream The index of the maximum stream if the presentation is *_VAR.
* @param colour The default colour for tiles of this stream
* @see IntStream
*
* @return A concrete VM-specific ByteStream instance.
*/
public ByteStream newGCspyByteStream(
AbstractDriver driver,
String name,
byte minValue,
byte maxValue,
byte zeroValue,
byte defaultValue,
String stringPre,
String stringPost,
int presentation,
int paintStyle,
int indexMaxStream,
Color colour,
boolean summary) {
Assert.notImplemented();
return null;
}
/**
* Create a new ShortStream instance using the appropriate
* VM-specific concrete ShortStream sub-class.
*
* @param driver The driver that owns this Stream
* @param name The name of the stream (e.g. "Used space")
* @param minValue The minimum value for any item in this stream.
* Values less than this will be represented as "minValue-"
* @param maxValue The maximum value for any item in this stream.
* Values greater than this will be represented as "maxValue+"
* @param zeroValue The zero value for this stream
* @param defaultValue The default value for this stream
* @param stringPre A string to prefix values (e.g. "Used: ")
* @param stringPost A string to suffix values (e.g. " bytes.")
* @param presentation How a stream value is to be presented.
* @param paintStyle How the value is to be painted.
* @param indexMaxStream The index of the maximum stream if the presentation is *_VAR.
* @param colour The default colour for tiles of this stream
* @see IntStream
*
* @return A concrete VM-specific ShortStream instance.
*/
public ShortStream newGCspyShortStream(
AbstractDriver driver,
String name,
short minValue,
short maxValue,
short zeroValue,
short defaultValue,
String stringPre,
String stringPost,
int presentation,
int paintStyle,
int indexMaxStream,
Color colour,
boolean summary) {
Assert.notImplemented();
return null;
}
/**
* TuningFork support
*/
@Override
public org.mmtk.vm.MMTk_Events newEvents() {
return new MMTkEvents();
}
}