Skip to content

Commit 1d1cfe9

Browse files
committed
Rename RecordMetadata to TraceMetadata
1 parent 3f8a5b5 commit 1d1cfe9

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/metadata/MetadataTracer.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,33 @@
6363
/**
6464
* Implements reachability metadata tracing during native image execution. Enabling
6565
* {@link Options#MetadataTracingSupport} at build time will generate code to trace all accesses of
66-
* reachability metadata, and then the run-time option {@link Options#RecordMetadata} enables
66+
* reachability metadata, and then the run-time option {@link Options#TraceMetadata} enables
6767
* tracing.
6868
*/
6969
public final class MetadataTracer {
7070

7171
public static class Options {
7272
@Option(help = "Generate an image that supports reachability metadata access tracing. " +
73-
"When tracing is supported, use the -XX:RecordMetadata option to enable tracing at run time.")//
73+
"When tracing is supported, use the -XX:TraceMetadata option to enable tracing at run time.")//
7474
public static final HostedOptionKey<Boolean> MetadataTracingSupport = new HostedOptionKey<>(false);
7575

76-
static final String RECORD_METADATA_HELP = """
76+
static final String TRACE_METADATA_HELP = """
7777
Enables metadata tracing at run time. This option is only supported if -H:+MetadataTracingSupport is set when building the image.
7878
The value of this option is a comma-separated list of arguments specified as key-value pairs. The following arguments are supported:
7979
8080
- path=<trace-output-directory> (required): Specifies the directory to write traced metadata to.
8181
- merge=<boolean> (optional): Specifies whether to merge or overwrite metadata with existing files at the output path (default: true).
8282
8383
Example usage:
84-
-H:RecordMetadata=path=trace_output_directory
85-
-H:RecordMetadata=path=trace_output_directory,merge=false
84+
-H:TraceMetadata=path=trace_output_directory
85+
-H:TraceMetadata=path=trace_output_directory,merge=false
8686
""";
8787

88-
@Option(help = RECORD_METADATA_HELP, stability = OptionStability.EXPERIMENTAL)//
89-
public static final RuntimeOptionKey<String> RecordMetadata = new RuntimeOptionKey<>(null);
88+
@Option(help = TRACE_METADATA_HELP, stability = OptionStability.EXPERIMENTAL)//
89+
public static final RuntimeOptionKey<String> TraceMetadata = new RuntimeOptionKey<>(null);
9090
}
9191

92-
private RecordOptions options;
92+
private TraceOptions options;
9393

9494
/**
9595
* The configuration set to trace with. Do not read this field directly when tracing; instead
@@ -120,7 +120,7 @@ public static boolean enabled() {
120120
}
121121

122122
/**
123-
* Returns whether tracing is enabled at run time (using {@code -XX:RecordMetadata}).
123+
* Returns whether tracing is enabled at run time (using {@code -XX:TraceMetadata}).
124124
*/
125125
private boolean enabledAtRunTime() {
126126
VMError.guarantee(Options.MetadataTracingSupport.getValue());
@@ -214,10 +214,10 @@ public void traceSerializationType(String className) {
214214
}
215215
}
216216

217-
private static void initialize(String recordMetadataValue) {
217+
private static void initialize(String traceMetadataValue) {
218218
assert Options.MetadataTracingSupport.getValue();
219219

220-
RecordOptions parsedOptions = RecordOptions.parse(recordMetadataValue);
220+
TraceOptions parsedOptions = TraceOptions.parse(traceMetadataValue);
221221
try {
222222
Files.createDirectories(parsedOptions.path());
223223
} catch (IOException ex) {
@@ -229,7 +229,7 @@ private static void initialize(String recordMetadataValue) {
229229
singleton.config = initializeConfigurationSet(parsedOptions);
230230
}
231231

232-
private static ConfigurationSet initializeConfigurationSet(RecordOptions options) {
232+
private static ConfigurationSet initializeConfigurationSet(TraceOptions options) {
233233
if (options.merge() && Files.exists(options.path())) {
234234
ConfigurationFileCollection mergeConfigs = new ConfigurationFileCollection();
235235
mergeConfigs.addDirectory(options.path());
@@ -268,8 +268,8 @@ static RuntimeSupport.Hook initializeMetadataTracingHook() {
268268
return;
269269
}
270270
VMError.guarantee(Options.MetadataTracingSupport.getValue());
271-
if (Options.RecordMetadata.hasBeenSet()) {
272-
initialize(Options.RecordMetadata.getValue());
271+
if (Options.TraceMetadata.hasBeenSet()) {
272+
initialize(Options.TraceMetadata.getValue());
273273
}
274274
};
275275
}
@@ -280,7 +280,7 @@ static RuntimeSupport.Hook shutDownMetadataTracingHook() {
280280
return;
281281
}
282282
VMError.guarantee(Options.MetadataTracingSupport.getValue());
283-
if (Options.RecordMetadata.hasBeenSet()) {
283+
if (Options.TraceMetadata.hasBeenSet()) {
284284
shutdown();
285285
}
286286
};
@@ -295,29 +295,29 @@ static RuntimeSupport.Hook checkImproperOptionUsageHook() {
295295
return;
296296
}
297297
VMError.guarantee(!Options.MetadataTracingSupport.getValue());
298-
if (Options.RecordMetadata.hasBeenSet()) {
298+
if (Options.TraceMetadata.hasBeenSet()) {
299299
throw new IllegalArgumentException(
300-
"The option " + Options.RecordMetadata.getName() + " can only be used if metadata tracing is enabled at build time (using " +
300+
"The option " + Options.TraceMetadata.getName() + " can only be used if metadata tracing is enabled at build time (using " +
301301
hostedOptionCommandArgument + ").");
302302
}
303303
};
304304
}
305305
}
306306

307-
record RecordOptions(Path path, boolean merge) {
307+
record TraceOptions(Path path, boolean merge) {
308308

309309
private static final int ARGUMENT_PARTS = 2;
310310

311-
static RecordOptions parse(String recordMetadataValue) {
312-
if (recordMetadataValue.isEmpty()) {
313-
throw printHelp("Option " + MetadataTracer.Options.RecordMetadata.getName() + " cannot be empty.");
314-
} else if (recordMetadataValue.equals("help")) {
315-
throw printHelp("Option " + MetadataTracer.Options.RecordMetadata.getName() + " value is 'help'. Printing a description and aborting.");
311+
static TraceOptions parse(String traceMetadataValue) {
312+
if (traceMetadataValue.isEmpty()) {
313+
throw printHelp("Option " + MetadataTracer.Options.TraceMetadata.getName() + " cannot be empty.");
314+
} else if (traceMetadataValue.equals("help")) {
315+
throw printHelp("Option " + MetadataTracer.Options.TraceMetadata.getName() + " value is 'help'. Printing a description and aborting.");
316316
}
317317

318318
Map<String, String> parsedArguments = new HashMap<>();
319319
Set<String> allArguments = new LinkedHashSet<>(List.of("path", "merge"));
320-
for (String argument : recordMetadataValue.split(",")) {
320+
for (String argument : traceMetadataValue.split(",")) {
321321
String[] parts = SubstrateUtil.split(argument, "=", ARGUMENT_PARTS);
322322
if (parts.length != ARGUMENT_PARTS) {
323323
throw badArgumentError(argument, "Argument should be a key-value pair separated by '='");
@@ -333,7 +333,7 @@ static RecordOptions parse(String recordMetadataValue) {
333333

334334
String path = requiredArgument(parsedArguments, "path", IDENTITY_PARSER);
335335
boolean merge = optionalArgument(parsedArguments, "merge", true, BOOLEAN_PARSER);
336-
return new RecordOptions(Paths.get(path), merge);
336+
return new TraceOptions(Paths.get(path), merge);
337337
}
338338

339339
private static IllegalArgumentException printHelp(String errorMessage) {
@@ -343,15 +343,15 @@ private static IllegalArgumentException printHelp(String errorMessage) {
343343
%s description:
344344
345345
%s
346-
""".formatted(errorMessage, MetadataTracer.Options.RecordMetadata.getName(), MetadataTracer.Options.RECORD_METADATA_HELP));
346+
""".formatted(errorMessage, MetadataTracer.Options.TraceMetadata.getName(), MetadataTracer.Options.TRACE_METADATA_HELP));
347347
}
348348

349349
private static IllegalArgumentException parseError(String message) {
350-
return new IllegalArgumentException(message + ". For more information (including usage examples), pass 'help' as an argument to " + MetadataTracer.Options.RecordMetadata.getName() + ".");
350+
return new IllegalArgumentException(message + ". For more information (including usage examples), pass 'help' as an argument to " + MetadataTracer.Options.TraceMetadata.getName() + ".");
351351
}
352352

353353
private static IllegalArgumentException badArgumentError(String argument, String message) {
354-
throw parseError("Bad argument provided for " + MetadataTracer.Options.RecordMetadata.getName() + ": '" + argument + "'. " + message);
354+
throw parseError("Bad argument provided for " + MetadataTracer.Options.TraceMetadata.getName() + ": '" + argument + "'. " + message);
355355
}
356356

357357
private static IllegalArgumentException badArgumentValueError(String argumentKey, String argumentValue, String message) {
@@ -373,7 +373,7 @@ private static <T> T requiredArgument(Map<String, String> arguments, String key,
373373
if (arguments.containsKey(key)) {
374374
return parser.parse(key, arguments.get(key));
375375
}
376-
throw parseError(MetadataTracer.Options.RecordMetadata.getName() + " missing required argument '" + key + "'");
376+
throw parseError(MetadataTracer.Options.TraceMetadata.getName() + " missing required argument '" + key + "'");
377377
}
378378

379379
private static <T> T optionalArgument(Map<String, String> options, String key, T defaultValue, ArgumentParser<T> parser) {

0 commit comments

Comments
 (0)