src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/DebugOptions.java
author dlong
Thu, 15 Nov 2018 09:04:07 -0800
changeset 52578 7dd81e82d083
parent 50858 2d3e99a72541
child 52910 583fd71c47d6
permissions -rw-r--r--
8210777: Update Graal Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
     1
/*
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
     4
 *
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
     8
 *
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    13
 * accompanied this code).
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    14
 *
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    18
 *
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    21
 * questions.
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    22
 */
50858
2d3e99a72541 8205824: Update Graal
never
parents: 49873
diff changeset
    23
2d3e99a72541 8205824: Update Graal
never
parents: 49873
diff changeset
    24
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    25
package org.graalvm.compiler.debug;
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    26
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    27
import java.io.IOException;
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    28
import java.nio.file.Files;
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    29
import java.nio.file.Path;
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    30
import java.nio.file.Paths;
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    31
49873
26ebfe8ce852 8199755: Update Graal
dlong
parents: 48861
diff changeset
    32
import jdk.internal.vm.compiler.collections.EconomicMap;
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    33
import org.graalvm.compiler.options.Option;
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    34
import org.graalvm.compiler.options.OptionKey;
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    35
import org.graalvm.compiler.options.OptionType;
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    36
import org.graalvm.compiler.options.OptionValues;
49873
26ebfe8ce852 8199755: Update Graal
dlong
parents: 48861
diff changeset
    37
import org.graalvm.compiler.serviceprovider.GraalServices;
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    38
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    39
/**
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    40
 * Options that configure a {@link DebugContext} and related functionality.
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    41
 */
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    42
public class DebugOptions {
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    43
    static class DeprecatedOptionKey<T> extends OptionKey<T> {
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    44
        private final OptionKey<T> replacement;
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    45
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    46
        DeprecatedOptionKey(OptionKey<T> replacement) {
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    47
            super(replacement.getDefaultValue());
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    48
            this.replacement = replacement;
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    49
        }
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    50
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    51
        @Override
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    52
        protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, T oldValue, T newValue) {
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    53
            // Ideally we'd use TTY here but it may not yet be initialized.
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    54
            System.err.printf("Warning: the %s option is deprecated - use %s instead%n", getName(), replacement.getName());
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    55
            replacement.update(values, newValue);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    56
        }
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    57
    }
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    58
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    59
    // @formatter:off
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    60
    @Option(help = "Comma separated names of timers that are enabled irrespective of the value for Time option. " +
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    61
                   "An empty value enables all timers unconditionally.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    62
    public static final OptionKey<String> Timers = new OptionKey<>(null);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    63
    @Option(help = "Comma separated names of counters that are enabled irrespective of the value for Count option. " +
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    64
                   "An empty value enables all counters unconditionally.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    65
    public static final OptionKey<String> Counters = new OptionKey<>(null);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    66
    @Option(help = "Comma separated names of memory usage trackers that are enabled irrespective of the value for TrackMemUse option. " +
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    67
                   "An empty value enables all memory usage trackers unconditionally.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    68
    public static final OptionKey<String> MemUseTrackers = new OptionKey<>(null);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    69
46963
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
    70
    @Option(help = "Pattern for specifying scopes in which counters are enabled. " +
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
    71
                   "See the Dump option for the pattern syntax. " +
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    72
                   "An empty value enables all counters unconditionally.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    73
    public static final OptionKey<String> Count = new OptionKey<>(null);
46963
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
    74
    @Option(help = "Pattern for specifying scopes in which memory use tracking is enabled. " +
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
    75
                   "See the Dump option for the pattern syntax. " +
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    76
                   "An empty value enables all memory use trackers unconditionally.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    77
    public static final OptionKey<String> TrackMemUse = new OptionKey<>(null);
46963
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
    78
    @Option(help = "Pattern for specifying scopes in which timing is enabled. " +
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
    79
                   "See the Dump option for the pattern syntax. " +
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    80
                   "An empty value enables all timers unconditionally.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    81
    public static final OptionKey<String> Time = new OptionKey<>(null);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    82
46963
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
    83
    @Option(help = "Pattern for specifying scopes in which logging is enabled. " +
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
    84
                   "See the Dump option for the pattern syntax.", type = OptionType.Debug)
46762
f7defa99f173 8185829: Update Graal
dlong
parents: 46680
diff changeset
    85
    public static final OptionKey<String> Verify = new OptionKey<>(null);
46963
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
    86
    @Option(help = "file:doc-files/DumpHelp.txt", type = OptionType.Debug)
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    87
    public static final OptionKey<String> Dump = new OptionKey<>(null);
46963
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
    88
    @Option(help = "Pattern for specifying scopes in which logging is enabled. " +
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
    89
                   "See the Dump option for the pattern syntax.", type = OptionType.Debug)
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    90
    public static final OptionKey<String> Log = new OptionKey<>(null);
46963
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
    91
    @Option(help = "file:doc-files/MethodFilterHelp.txt")
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    92
    public static final OptionKey<String> MethodFilter = new OptionKey<>(null);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    93
    @Option(help = "Only check MethodFilter against the root method in the context if true, otherwise check all methods", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    94
    public static final OptionKey<Boolean> MethodFilterRootOnly = new OptionKey<>(false);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    95
    @Option(help = "Dump a before and after graph if the named phase changes the graph.%n" +
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    96
                   "The argument is substring matched against the simple name of the phase class", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    97
    public static final OptionKey<String> DumpOnPhaseChange = new OptionKey<>(null);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
    98
46963
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
    99
    @Option(help = "Lists on the console at VM shutdown the metric names available to the Timers, Counters and MemUseTrackers options. " +
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   100
                   "Note that this only lists the metrics that were initialized during the VM execution and so " +
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   101
                   "will not include metrics for compiler code that is not executed.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   102
    public static final OptionKey<Boolean> ListMetrics = new OptionKey<>(false);
46963
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
   103
    @Option(help = "file:doc-files/MetricsFileHelp.txt", type = OptionType.Debug)
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   104
     public static final OptionKey<String> MetricsFile = new OptionKey<>(null);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   105
    @Option(help = "File to which aggregated metrics are dumped at shutdown. A CSV format is used if the file ends with .csv " +
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   106
                    "otherwise a more human readable format is used. If not specified, metrics are dumped to the console.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   107
    public static final OptionKey<String> AggregatedMetricsFile = new OptionKey<>(null);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   108
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   109
    @Option(help = "Only report metrics for threads whose name matches the regular expression.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   110
    public static final OptionKey<String> MetricsThreadFilter = new OptionKey<>(null);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   111
    @Option(help = "Enable debug output for stub code generation and snippet preparation.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   112
    public static final OptionKey<Boolean> DebugStubsAndSnippets = new OptionKey<>(false);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   113
    @Option(help = "Send Graal compiler IR to dump handlers on error.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   114
    public static final OptionKey<Boolean> DumpOnError = new OptionKey<>(false);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   115
    @Option(help = "Intercept also bailout exceptions", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   116
    public static final OptionKey<Boolean> InterceptBailout = new OptionKey<>(false);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   117
    @Option(help = "Enable more verbose log output when available", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   118
    public static final OptionKey<Boolean> LogVerbose = new OptionKey<>(false);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   119
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   120
    @Option(help = "The directory where various Graal dump files are written.")
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   121
    public static final OptionKey<String> DumpPath = new OptionKey<>("dumps");
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   122
    @Option(help = "Print the name of each dump file path as it's created.")
46762
f7defa99f173 8185829: Update Graal
dlong
parents: 46680
diff changeset
   123
    public static final OptionKey<Boolean> ShowDumpFiles = new OptionKey<>(false);
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   124
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   125
    @Option(help = "Enable dumping to the C1Visualizer. Enabling this option implies PrintBackendCFG.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   126
    public static final OptionKey<Boolean> PrintCFG = new OptionKey<>(false);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   127
    @Option(help = "Enable dumping LIR, register allocation and code generation info to the C1Visualizer.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   128
    public static final OptionKey<Boolean> PrintBackendCFG = new OptionKey<>(true);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   129
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   130
    @Option(help = "Enable dumping to the IdealGraphVisualizer.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   131
    public static final OptionKey<Boolean> PrintGraph = new OptionKey<>(true);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   132
    @Option(help = "Print graphs to files instead of sending them over the network.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   133
    public static final OptionKey<Boolean> PrintGraphFile = new OptionKey<>(false);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   134
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   135
    @Option(help = "Host part of the address to which graphs are dumped.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   136
    public static final OptionKey<String> PrintGraphHost = new OptionKey<>("127.0.0.1");
49873
26ebfe8ce852 8199755: Update Graal
dlong
parents: 48861
diff changeset
   137
    @Option(help = "Port part of the address to which graphs are dumped in binary format.", type = OptionType.Debug)
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   138
    public static final OptionKey<Integer> PrintBinaryGraphPort = new OptionKey<>(4445);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   139
    @Option(help = "Schedule graphs as they are dumped.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   140
    public static final OptionKey<Boolean> PrintGraphWithSchedule = new OptionKey<>(false);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   141
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   142
    @Option(help = "Enable dumping Truffle ASTs to the IdealGraphVisualizer.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   143
    public static final OptionKey<Boolean> PrintTruffleTrees = new OptionKey<>(true);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   144
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   145
    @Option(help = "Treat any exceptions during dumping as fatal.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   146
    public static final OptionKey<Boolean> DumpingErrorsAreFatal = new OptionKey<>(false);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   147
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   148
    @Option(help = "Enable dumping canonical text from for graphs.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   149
    public static final OptionKey<Boolean> PrintCanonicalGraphStrings = new OptionKey<>(false);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   150
    @Option(help = "Choose format used when dumping canonical text for graphs: " +
46963
089674d9949b 8186681: Update Graal
iveresov
parents: 46762
diff changeset
   151
            "0 gives a scheduled graph (better for spotting changes involving the schedule) " +
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   152
            "while 1 gives a CFG containing expressions rooted at fixed nodes (better for spotting small structure differences)", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   153
    public static final OptionKey<Integer> PrintCanonicalGraphStringFlavor = new OptionKey<>(0);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   154
    @Option(help = "Exclude virtual nodes when dumping canonical text for graphs.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   155
    public static final OptionKey<Boolean> CanonicalGraphStringsExcludeVirtuals = new OptionKey<>(true);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   156
    @Option(help = "Exclude virtual nodes when dumping canonical text for graphs.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   157
    public static final OptionKey<Boolean> CanonicalGraphStringsCheckConstants = new OptionKey<>(false);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   158
    @Option(help = "Attempts to remove object identity hashes when dumping canonical text for graphs.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   159
    public static final OptionKey<Boolean> CanonicalGraphStringsRemoveIdentities = new OptionKey<>(true);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   160
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   161
    @Option(help = "Clear the debug metrics after bootstrap.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   162
    public static final OptionKey<Boolean> ClearMetricsAfterBootstrap = new OptionKey<>(false);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   163
    @Option(help = "Do not compile anything on bootstrap but just initialize the compiler.", type = OptionType.Debug)
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   164
    public static final OptionKey<Boolean> BootstrapInitializeOnly = new OptionKey<>(false);
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   165
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   166
    /**
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   167
     * Gets the directory in which {@link DebugDumpHandler}s can generate output. This will be the
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   168
     * directory specified by {@link #DumpPath} if it has been set otherwise it will be derived from
49873
26ebfe8ce852 8199755: Update Graal
dlong
parents: 48861
diff changeset
   169
     * the default value of {@link #DumpPath} and {@link GraalServices#getGlobalTimeStamp()}.
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   170
     *
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   171
     * This method will ensure the returned directory exists, printing a message to {@link TTY} if
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   172
     * it creates it.
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   173
     *
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   174
     * @return a path as described above whose directories are guaranteed to exist
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   175
     * @throws IOException if there was an error in {@link Files#createDirectories}
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   176
     */
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   177
    public static Path getDumpDirectory(OptionValues options) throws IOException {
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   178
        Path dumpDir;
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   179
        if (DumpPath.hasBeenSet(options)) {
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   180
            dumpDir = Paths.get(DumpPath.getValue(options));
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   181
        } else {
49873
26ebfe8ce852 8199755: Update Graal
dlong
parents: 48861
diff changeset
   182
            dumpDir = Paths.get(DumpPath.getValue(options), String.valueOf(GraalServices.getGlobalTimeStamp()));
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   183
        }
46680
2894e4262fd6 8184768: Update Graal
iveresov
parents: 46640
diff changeset
   184
        dumpDir = dumpDir.toAbsolutePath();
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   185
        if (!Files.exists(dumpDir)) {
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   186
            synchronized (DebugConfigImpl.class) {
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   187
                if (!Files.exists(dumpDir)) {
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   188
                    Files.createDirectories(dumpDir);
49873
26ebfe8ce852 8199755: Update Graal
dlong
parents: 48861
diff changeset
   189
                    if (ShowDumpFiles.getValue(options)) {
26ebfe8ce852 8199755: Update Graal
dlong
parents: 48861
diff changeset
   190
                        TTY.println("Dumping debug output in %s", dumpDir.toString());
26ebfe8ce852 8199755: Update Graal
dlong
parents: 48861
diff changeset
   191
                    }
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   192
                }
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   193
            }
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   194
        }
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   195
        return dumpDir;
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   196
    }
70bdce04c59b 8183991: Update Graal
iveresov
parents:
diff changeset
   197
}