src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Main.java
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 55509 d58442b8abc1
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
     1
/*
55094
80dd2b549354 8224931: disable JAOTC invokedynamic support until 8223533 is fixed
dlong
parents: 54084
diff changeset
     2
 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
     4
 *
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
     7
 * published by the Free Software Foundation.
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
     8
 *
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    13
 * accompanied this code).
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    14
 *
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    18
 *
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    21
 * questions.
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    22
 */
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    23
51436
091c0d22e735 8206992: Update Graal
iveresov
parents: 51206
diff changeset
    24
091c0d22e735 8206992: Update Graal
iveresov
parents: 51206
diff changeset
    25
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    26
package jdk.tools.jaotc;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    27
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    28
import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    29
import static org.graalvm.compiler.core.common.GraalOptions.ImmutableCode;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    30
import static org.graalvm.compiler.hotspot.meta.HotSpotAOTProfilingPlugin.Options.TieredAOT;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    31
53071
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    32
import java.io.IOException;
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    33
import java.io.PrintWriter;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    34
import java.text.MessageFormat;
53071
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    35
import java.util.ArrayList;
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    36
import java.util.Collections;
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    37
import java.util.List;
43405
1fab8e6866d7 8168792: [AOT] problems in MethodHandle with aot-compiled java.base
iveresov
parents: 42650
diff changeset
    38
import java.util.ListIterator;
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    39
import java.util.Set;
53071
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    40
import java.util.StringTokenizer;
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    41
import java.util.stream.Stream;
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    42
import java.nio.file.Files;
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    43
import java.nio.file.Paths;
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    44
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents: 46557
diff changeset
    45
import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    46
import org.graalvm.compiler.api.runtime.GraalJVMCICompiler;
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents: 46557
diff changeset
    47
import org.graalvm.compiler.debug.DebugContext;
70bdce04c59b 8183991: Update Graal
iveresov
parents: 46557
diff changeset
    48
import org.graalvm.compiler.debug.DebugContext.Activation;
46344
694c102fd8ed 8177046: Update Graal
iveresov
parents: 46327
diff changeset
    49
import org.graalvm.compiler.hotspot.CompilerConfigurationFactory;
43405
1fab8e6866d7 8168792: [AOT] problems in MethodHandle with aot-compiled java.base
iveresov
parents: 42650
diff changeset
    50
import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
46344
694c102fd8ed 8177046: Update Graal
iveresov
parents: 46327
diff changeset
    51
import org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory;
694c102fd8ed 8177046: Update Graal
iveresov
parents: 46327
diff changeset
    52
import org.graalvm.compiler.hotspot.HotSpotGraalOptionValues;
51206
14b870bda24f 8207069: [AOT] we should check that VM uses the same GC as one used for AOT library generation.
kvn
parents: 49873
diff changeset
    53
import org.graalvm.compiler.hotspot.HotSpotGraalRuntime;
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    54
import org.graalvm.compiler.hotspot.HotSpotHostBackend;
47668
fc4cfca10556 8132547: [AOT] support invokedynamic instructions
dlong
parents: 47216
diff changeset
    55
import org.graalvm.compiler.hotspot.meta.HotSpotInvokeDynamicPlugin;
43405
1fab8e6866d7 8168792: [AOT] problems in MethodHandle with aot-compiled java.base
iveresov
parents: 42650
diff changeset
    56
import org.graalvm.compiler.java.GraphBuilderPhase;
1fab8e6866d7 8168792: [AOT] problems in MethodHandle with aot-compiled java.base
iveresov
parents: 42650
diff changeset
    57
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration;
55094
80dd2b549354 8224931: disable JAOTC invokedynamic support until 8223533 is fixed
dlong
parents: 54084
diff changeset
    58
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
46344
694c102fd8ed 8177046: Update Graal
iveresov
parents: 46327
diff changeset
    59
import org.graalvm.compiler.options.OptionValues;
43405
1fab8e6866d7 8168792: [AOT] problems in MethodHandle with aot-compiled java.base
iveresov
parents: 42650
diff changeset
    60
import org.graalvm.compiler.phases.BasePhase;
1fab8e6866d7 8168792: [AOT] problems in MethodHandle with aot-compiled java.base
iveresov
parents: 42650
diff changeset
    61
import org.graalvm.compiler.phases.PhaseSuite;
1fab8e6866d7 8168792: [AOT] problems in MethodHandle with aot-compiled java.base
iveresov
parents: 42650
diff changeset
    62
import org.graalvm.compiler.phases.tiers.HighTierContext;
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents: 46557
diff changeset
    63
import org.graalvm.compiler.printer.GraalDebugHandlersFactory;
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    64
import org.graalvm.compiler.runtime.RuntimeProvider;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    65
51436
091c0d22e735 8206992: Update Graal
iveresov
parents: 51206
diff changeset
    66
import jdk.tools.jaotc.Options.Option;
091c0d22e735 8206992: Update Graal
iveresov
parents: 51206
diff changeset
    67
import jdk.tools.jaotc.binformat.BinaryContainer;
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    68
import jdk.vm.ci.meta.MetaAccessProvider;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    69
import jdk.vm.ci.meta.ResolvedJavaMethod;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    70
import jdk.vm.ci.runtime.JVMCI;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    71
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
    72
public final class Main {
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    73
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
    74
    final Options options = new Options();
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
    75
    private PrintWriter log;
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
    76
    LogPrinter printer;
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
    77
    GraalFilters filters;
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    78
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    79
    private static final int EXIT_OK = 0;        // No errors.
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    80
    private static final int EXIT_CMDERR = 2;    // Bad command-line arguments and/or switches.
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    81
    private static final int EXIT_ABNORMAL = 4;  // Terminated abnormally.
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    82
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    83
    private static final String PROGNAME = "jaotc";
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    84
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    85
    private static final String JVM_VERSION = System.getProperty("java.runtime.version");
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    86
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    87
    public static void main(String[] args) throws Exception {
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    88
        Main t = new Main();
53071
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    89
        final int exitCode = t.run(parse(args));
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    90
        System.exit(exitCode);
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    91
    }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
    92
53071
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    93
    /**
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    94
     * Expands '@file' in command line arguments by replacing '@file' with the content of 'file'
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    95
     * parsed by StringTokenizer. '@' character can be quoted as '@@'.
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    96
     */
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    97
    private static String[] parse(String[] args) throws IOException {
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    98
        List<String> result = new ArrayList<>();
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
    99
        for (String arg : args) {
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   100
            if (arg.length() > 1 && arg.charAt(0) == '@') {
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   101
                String v = arg.substring(1);
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   102
                if (v.charAt(0) == '@') {
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   103
                    result.add(v);
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   104
                } else {
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   105
                    try (Stream<String> file = Files.lines(Paths.get(v))) {
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   106
                        file.map(StringTokenizer::new).map(Collections::list).flatMap(l -> l.stream().map(o -> (String) o)).forEachOrdered(result::add);
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   107
                    }
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   108
                }
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   109
            } else {
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   110
                result.add(arg);
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   111
            }
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   112
        }
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   113
        return result.toArray(String[]::new);
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   114
    }
281c85f43f79 8215322: add @file support to jaotc
iignatyev
parents: 51436
diff changeset
   115
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   116
    private int run(String[] args) {
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   117
        log = new PrintWriter(System.out);
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   118
        printer = new LogPrinter(this, log);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   119
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   120
        try {
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   121
            Options.handleOptions(this, args);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   122
            if (options.help) {
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   123
                showHelp();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   124
                return EXIT_OK;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   125
            }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   126
            if (options.version) {
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   127
                showVersion();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   128
                return EXIT_OK;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   129
            }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   130
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   131
            printer.printlnInfo("Compiling " + options.outputName + "...");
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   132
            final long start = System.currentTimeMillis();
43464
f38fde4a6b52 8169588: [AOT] jaotc --classpath option is confusing
rbackman
parents: 43405
diff changeset
   133
            if (!run()) {
46344
694c102fd8ed 8177046: Update Graal
iveresov
parents: 46327
diff changeset
   134
                return EXIT_ABNORMAL;
43464
f38fde4a6b52 8169588: [AOT] jaotc --classpath option is confusing
rbackman
parents: 43405
diff changeset
   135
            }
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   136
            final long end = System.currentTimeMillis();
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   137
            printer.printlnInfo("Total time: " + (end - start) + " ms");
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   138
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   139
            return EXIT_OK;
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   140
        } catch (Options.BadArgs e) {
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   141
            printer.reportError(e.key, e.args);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   142
            if (e.showUsage) {
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   143
                showUsage();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   144
            }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   145
            return EXIT_CMDERR;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   146
        } catch (Exception e) {
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   147
            e.printStackTrace();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   148
            return EXIT_ABNORMAL;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   149
        } finally {
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   150
            log.flush();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   151
        }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   152
    }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   153
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   154
    @SuppressWarnings("try")
43464
f38fde4a6b52 8169588: [AOT] jaotc --classpath option is confusing
rbackman
parents: 43405
diff changeset
   155
    private boolean run() throws Exception {
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   156
        LogPrinter.openLog();
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   157
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   158
        try {
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   159
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   160
            final Linker linker = new Linker(this);
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   161
            final String objectFileName = linker.objFile();
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   162
            final Collector collector = new Collector(this);
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   163
            Set<Class<?>> classesToCompile;
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   164
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   165
            try (Timer t = new Timer(this, "")) {
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   166
                classesToCompile = collector.collectClassesToCompile();
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   167
                printer.printInfo(classesToCompile.size() + " classes found");
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   168
            }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   169
54084
84f10bbf993f 8218074: Update Graal
jwilhelm
parents: 53071
diff changeset
   170
            OptionValues graalOptions = HotSpotGraalOptionValues.defaultOptions();
46344
694c102fd8ed 8177046: Update Graal
iveresov
parents: 46327
diff changeset
   171
            // Setting -Dgraal.TieredAOT overrides --compile-for-tiered
694c102fd8ed 8177046: Update Graal
iveresov
parents: 46327
diff changeset
   172
            if (!TieredAOT.hasBeenSet(graalOptions)) {
694c102fd8ed 8177046: Update Graal
iveresov
parents: 46327
diff changeset
   173
                graalOptions = new OptionValues(graalOptions, TieredAOT, options.tiered);
694c102fd8ed 8177046: Update Graal
iveresov
parents: 46327
diff changeset
   174
            }
46557
eb30f7891bae 8181113: jaotc options lost after 8177046
kvn
parents: 46344
diff changeset
   175
            graalOptions = new OptionValues(graalOptions, GeneratePIC, true, ImmutableCode, true);
49873
26ebfe8ce852 8199755: Update Graal
dlong
parents: 47668
diff changeset
   176
            GraalJVMCICompiler graalCompiler = HotSpotGraalCompilerFactory.createCompiler("JAOTC", JVMCI.getRuntime(), graalOptions, CompilerConfigurationFactory.selectFactory(null, graalOptions));
51206
14b870bda24f 8207069: [AOT] we should check that VM uses the same GC as one used for AOT library generation.
kvn
parents: 49873
diff changeset
   177
            HotSpotGraalRuntime runtime = (HotSpotGraalRuntime) graalCompiler.getGraalRuntime();
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   178
            HotSpotHostBackend backend = (HotSpotHostBackend) runtime.getCapability(RuntimeProvider.class).getHostBackend();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   179
            MetaAccessProvider metaAccess = backend.getProviders().getMetaAccess();
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   180
            filters = new GraalFilters(metaAccess);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   181
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   182
            List<AOTCompiledClass> classes;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   183
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   184
            try (Timer t = new Timer(this, "")) {
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   185
                classes = collector.collectMethodsToCompile(classesToCompile, metaAccess);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   186
            }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   187
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   188
            // Free memory!
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   189
            try (Timer t = options.verbose ? new Timer(this, "Freeing memory") : null) {
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   190
                printer.printMemoryUsage();
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   191
                classesToCompile = null;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   192
                System.gc();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   193
            }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   194
47668
fc4cfca10556 8132547: [AOT] support invokedynamic instructions
dlong
parents: 47216
diff changeset
   195
            AOTDynamicTypeStore dynoStore = new AOTDynamicTypeStore();
fc4cfca10556 8132547: [AOT] support invokedynamic instructions
dlong
parents: 47216
diff changeset
   196
            AOTCompiledClass.setDynamicTypeStore(dynoStore);
fc4cfca10556 8132547: [AOT] support invokedynamic instructions
dlong
parents: 47216
diff changeset
   197
55509
d58442b8abc1 8225497: Update Graal
jwilhelm
parents: 55094
diff changeset
   198
            // AOTBackend aotBackend = new AOTBackend(this, graalOptions, backend, new
d58442b8abc1 8225497: Update Graal
jwilhelm
parents: 55094
diff changeset
   199
            // HotSpotInvokeDynamicPlugin(dynoStore));
55094
80dd2b549354 8224931: disable JAOTC invokedynamic support until 8223533 is fixed
dlong
parents: 54084
diff changeset
   200
            // Temporary workaround until JDK-8223533 is fixed.
80dd2b549354 8224931: disable JAOTC invokedynamic support until 8223533 is fixed
dlong
parents: 54084
diff changeset
   201
            // Disable invokedynamic support.
80dd2b549354 8224931: disable JAOTC invokedynamic support until 8223533 is fixed
dlong
parents: 54084
diff changeset
   202
            var indyPlugin = new HotSpotInvokeDynamicPlugin(dynoStore) {
80dd2b549354 8224931: disable JAOTC invokedynamic support until 8223533 is fixed
dlong
parents: 54084
diff changeset
   203
                @Override
80dd2b549354 8224931: disable JAOTC invokedynamic support until 8223533 is fixed
dlong
parents: 54084
diff changeset
   204
                public boolean supportsDynamicInvoke(GraphBuilderContext builder, int index, int opcode) {
80dd2b549354 8224931: disable JAOTC invokedynamic support until 8223533 is fixed
dlong
parents: 54084
diff changeset
   205
                    return false;
80dd2b549354 8224931: disable JAOTC invokedynamic support until 8223533 is fixed
dlong
parents: 54084
diff changeset
   206
                }
80dd2b549354 8224931: disable JAOTC invokedynamic support until 8223533 is fixed
dlong
parents: 54084
diff changeset
   207
            };
80dd2b549354 8224931: disable JAOTC invokedynamic support until 8223533 is fixed
dlong
parents: 54084
diff changeset
   208
            AOTBackend aotBackend = new AOTBackend(this, graalOptions, backend, indyPlugin);
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents: 46557
diff changeset
   209
            SnippetReflectionProvider snippetReflection = aotBackend.getProviders().getSnippetReflection();
46344
694c102fd8ed 8177046: Update Graal
iveresov
parents: 46327
diff changeset
   210
            AOTCompiler compiler = new AOTCompiler(this, graalOptions, aotBackend, options.threads);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   211
            classes = compiler.compileClasses(classes);
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   212
43405
1fab8e6866d7 8168792: [AOT] problems in MethodHandle with aot-compiled java.base
iveresov
parents: 42650
diff changeset
   213
            GraalHotSpotVMConfig graalHotSpotVMConfig = runtime.getVMConfig();
1fab8e6866d7 8168792: [AOT] problems in MethodHandle with aot-compiled java.base
iveresov
parents: 42650
diff changeset
   214
            PhaseSuite<HighTierContext> graphBuilderSuite = aotBackend.getGraphBuilderSuite();
1fab8e6866d7 8168792: [AOT] problems in MethodHandle with aot-compiled java.base
iveresov
parents: 42650
diff changeset
   215
            ListIterator<BasePhase<? super HighTierContext>> iterator = graphBuilderSuite.findPhase(GraphBuilderPhase.class);
1fab8e6866d7 8168792: [AOT] problems in MethodHandle with aot-compiled java.base
iveresov
parents: 42650
diff changeset
   216
            GraphBuilderConfiguration graphBuilderConfig = ((GraphBuilderPhase) iterator.previous()).getGraphBuilderConfig();
1fab8e6866d7 8168792: [AOT] problems in MethodHandle with aot-compiled java.base
iveresov
parents: 42650
diff changeset
   217
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   218
            // Free memory!
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   219
            try (Timer t = options.verbose ? new Timer(this, "Freeing memory") : null) {
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   220
                printer.printMemoryUsage();
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   221
                aotBackend = null;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   222
                compiler = null;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   223
                System.gc();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   224
            }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   225
51436
091c0d22e735 8206992: Update Graal
iveresov
parents: 51206
diff changeset
   226
            int gc = runtime.getGarbageCollector().ordinal() + 1;
51206
14b870bda24f 8207069: [AOT] we should check that VM uses the same GC as one used for AOT library generation.
kvn
parents: 49873
diff changeset
   227
            BinaryContainer binaryContainer = new BinaryContainer(graalOptions, graalHotSpotVMConfig, graphBuilderConfig, gc, JVM_VERSION);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   228
            DataBuilder dataBuilder = new DataBuilder(this, backend, classes, binaryContainer);
46640
70bdce04c59b 8183991: Update Graal
iveresov
parents: 46557
diff changeset
   229
70bdce04c59b 8183991: Update Graal
iveresov
parents: 46557
diff changeset
   230
            try (DebugContext debug = DebugContext.create(graalOptions, new GraalDebugHandlersFactory(snippetReflection)); Activation a = debug.activate()) {
70bdce04c59b 8183991: Update Graal
iveresov
parents: 46557
diff changeset
   231
                dataBuilder.prepareData(debug);
70bdce04c59b 8183991: Update Graal
iveresov
parents: 46557
diff changeset
   232
            }
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   233
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   234
            // Print information about section sizes
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   235
            printer.containersInfo(binaryContainer);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   236
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   237
            // Free memory!
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   238
            try (Timer t = options.verbose ? new Timer(this, "Freeing memory") : null) {
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   239
                printer.printMemoryUsage();
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   240
                backend = null;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   241
                for (AOTCompiledClass aotCompClass : classes) {
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   242
                    aotCompClass.clear();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   243
                }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   244
                classes.clear();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   245
                classes = null;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   246
                dataBuilder = null;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   247
                binaryContainer.freeMemory();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   248
                System.gc();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   249
            }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   250
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   251
            try (Timer t = new Timer(this, "Creating binary: " + objectFileName)) {
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   252
                binaryContainer.createBinary(objectFileName);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   253
            }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   254
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   255
            // Free memory!
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   256
            try (Timer t = options.verbose ? new Timer(this, "Freeing memory") : null) {
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   257
                printer.printMemoryUsage();
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   258
                binaryContainer = null;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   259
                System.gc();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   260
            }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   261
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   262
            try (Timer t = new Timer(this, "Creating shared library: " + linker.libFile())) {
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   263
                linker.link();
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   264
            }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   265
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   266
            printer.printVerbose("Final memory  ");
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   267
            printer.printMemoryUsage();
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   268
            printer.printlnVerbose("");
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   269
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   270
        } finally {
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   271
            LogPrinter.closeLog();
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   272
        }
43464
f38fde4a6b52 8169588: [AOT] jaotc --classpath option is confusing
rbackman
parents: 43405
diff changeset
   273
        return true;
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   274
    }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   275
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   276
    void handleError(ResolvedJavaMethod resolvedMethod, Throwable e, String message) {
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   277
        String methodName = JavaMethodInfo.uniqueMethodName(resolvedMethod);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   278
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   279
        if (options.debug) {
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   280
            printer.printError("Failed compilation: " + methodName + ": " + e);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   281
        }
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   282
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   283
        // Ignore some exceptions when meta-compiling Graal.
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   284
        if (GraalFilters.shouldIgnoreException(e)) {
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   285
            return;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   286
        }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   287
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   288
        LogPrinter.writeLog("Failed compilation of method " + methodName + message);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   289
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   290
        if (!options.debug) {
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   291
            printer.printError("Failed compilation: " + methodName + ": " + e);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   292
        }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   293
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   294
        if (options.verbose) {
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   295
            e.printStackTrace(log);
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   296
        }
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   297
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   298
        if (options.exitOnError) {
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   299
            System.exit(1);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   300
        }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   301
    }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   302
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   303
    void warning(String key, Object... args) {
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   304
        log.println("Warning: " + MessageFormat.format(key, args));
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   305
        log.flush();
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   306
    }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   307
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   308
    private void showUsage() {
43479
67507b173e81 8173158: [AOT] fix typo in jaotc --help output
kvn
parents: 43464
diff changeset
   309
        log.println("Usage: " + PROGNAME + " <options> list");
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   310
        log.println("use --help for a list of possible options");
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   311
        log.flush();
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   312
    }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   313
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   314
    private void showHelp() {
43479
67507b173e81 8173158: [AOT] fix typo in jaotc --help output
kvn
parents: 43464
diff changeset
   315
        log.println("Usage: " + PROGNAME + " <options> list");
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   316
        log.println();
43479
67507b173e81 8173158: [AOT] fix typo in jaotc --help output
kvn
parents: 43464
diff changeset
   317
        log.println("  list       A : separated list of class names, modules, jar files");
67507b173e81 8173158: [AOT] fix typo in jaotc --help output
kvn
parents: 43464
diff changeset
   318
        log.println("             or directories which contain class files.");
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   319
        log.println();
43479
67507b173e81 8173158: [AOT] fix typo in jaotc --help output
kvn
parents: 43464
diff changeset
   320
        log.println("where options include:");
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   321
        for (Option o : Options.recognizedOptions) {
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   322
            String name = o.aliases[0].substring(1); // there must always be at least one name
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   323
            name = name.charAt(0) == '-' ? name.substring(1) : name;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   324
            if (o.isHidden() || name.equals("h")) {
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   325
                continue;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   326
            }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   327
            log.println(o.help);
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   328
        }
46949
44ccdba2d72e 8186453: [AOT] refactor AOT tool code
kvn
parents: 46804
diff changeset
   329
        log.flush();
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   330
    }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   331
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   332
    private void showVersion() {
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   333
        log.println(PROGNAME + " " + JVM_VERSION);
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   334
    }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents:
diff changeset
   335
}