annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java @ 21551:5324104ac4f3

moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Tue, 26 May 2015 17:13:37 +0200
parents 93c50cefb9e8
children b1530a6cce8c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
1 /*
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
4 *
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
7 * published by the Free Software Foundation.
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
8 *
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
13 * accompanied this code).
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
14 *
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
18 *
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
21 * questions.
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
22 */
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
23 package com.oracle.graal.hotspot;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
24
15259
d90e5c22ba55 Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
25 import static com.oracle.graal.compiler.common.GraalOptions.*;
16722
46eaf7cd8275 added memory usage analysis to CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
26 import static com.oracle.graal.debug.internal.MemUseTrackerImpl.*;
9289
261a43921c5e rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents: 9108
diff changeset
27 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
28 import static com.oracle.graal.nodes.StructuredGraph.*;
9289
261a43921c5e rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents: 9108
diff changeset
29
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 10672
diff changeset
30 import java.io.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 10672
diff changeset
31 import java.lang.reflect.*;
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
32 import java.net.*;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 10672
diff changeset
33 import java.util.*;
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
34 import java.util.concurrent.*;
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
35 import java.util.concurrent.atomic.*;
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
36 import java.util.jar.*;
20018
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
37 import java.util.stream.*;
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
38
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
39 import com.oracle.graal.api.meta.*;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 10672
diff changeset
40 import com.oracle.graal.bytecode.*;
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
41 import com.oracle.graal.compiler.*;
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
42 import com.oracle.graal.compiler.CompilerThreadFactory.DebugConfigAccess;
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
43 import com.oracle.graal.debug.*;
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
44 import com.oracle.graal.debug.internal.*;
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
45 import com.oracle.graal.options.*;
18684
137773e5250c Factor out VM-independent parts of option parsing
Christian Wimmer <christian.wimmer@oracle.com>
parents: 18674
diff changeset
46 import com.oracle.graal.options.OptionUtils.OptionConsumer;
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
47 import com.oracle.graal.options.OptionValue.OverrideScope;
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
48 import com.oracle.graal.printer.*;
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
49 import com.oracle.graal.replacements.*;
21543
93c50cefb9e8 moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
50 import com.oracle.jvmci.common.*;
21551
5324104ac4f3 moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21543
diff changeset
51 import com.oracle.jvmci.hotspot.*;
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
52
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
53 /**
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
54 * This class implements compile-the-world functionality in Graal.
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
55 */
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
56 public final class CompileTheWorld {
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
57
13361
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
58 /**
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
59 * Magic token to trigger reading files from the boot class path.
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
60 */
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
61 public static final String SUN_BOOT_CLASS_PATH = "sun.boot.class.path";
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
62
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
63 public static class Options {
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
64 // @formatter:off
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18525
diff changeset
65 @Option(help = "Compile all methods in all classes on given class path", type = OptionType.Debug)
13361
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
66 public static final OptionValue<String> CompileTheWorldClasspath = new OptionValue<>(SUN_BOOT_CLASS_PATH);
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18525
diff changeset
67 @Option(help = "Verbose CompileTheWorld operation", type = OptionType.Debug)
13361
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
68 public static final OptionValue<Boolean> CompileTheWorldVerbose = new OptionValue<>(true);
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18525
diff changeset
69 @Option(help = "The number of CompileTheWorld iterations to perform", type = OptionType.Debug)
13361
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
70 public static final OptionValue<Integer> CompileTheWorldIterations = new OptionValue<>(1);
20018
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
71 @Option(help = "Only compile methods matching this filter", type = OptionType.Debug)
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
72 public static final OptionValue<String> CompileTheWorldMethodFilter = new OptionValue<>(null);
20967
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
73 @Option(help = "Exclude methods matching this filter from compilation", type = OptionType.Debug)
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
74 public static final OptionValue<String> CompileTheWorldExcludeMethodFilter = new OptionValue<>(null);
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18525
diff changeset
75 @Option(help = "First class to consider when using -XX:+CompileTheWorld", type = OptionType.Debug)
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
76 public static final OptionValue<Integer> CompileTheWorldStartAt = new OptionValue<>(1);
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18525
diff changeset
77 @Option(help = "Last class to consider when using -XX:+CompileTheWorld", type = OptionType.Debug)
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
78 public static final OptionValue<Integer> CompileTheWorldStopAt = new OptionValue<>(Integer.MAX_VALUE);
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
79 @Option(help = "Option value overrides to use during compile the world. For example, " +
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
80 "to disable inlining and partial escape analysis specify '-PartialEscapeAnalysis -Inline'. " +
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18525
diff changeset
81 "The format for each option is the same as on the command line just without the '-G:' prefix.", type = OptionType.Debug)
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
82 public static final OptionValue<String> CompileTheWorldConfig = new OptionValue<>(null);
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
83
20007
83539d28f95c Fixed help text and add CompileTheWorldThreads flag
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19968
diff changeset
84 @Option(help = "Run CTW using as many threads as there are processors on the system", type = OptionType.Debug)
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
85 public static final OptionValue<Boolean> CompileTheWorldMultiThreaded = new OptionValue<>(false);
20007
83539d28f95c Fixed help text and add CompileTheWorldThreads flag
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19968
diff changeset
86 @Option(help = "Number of threads to use for multithreaded CTW. Defaults to Runtime.getRuntime().availableProcessors()", type = OptionType.Debug)
83539d28f95c Fixed help text and add CompileTheWorldThreads flag
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19968
diff changeset
87 public static final OptionValue<Integer> CompileTheWorldThreads = new OptionValue<>(0);
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
88 // @formatter:on
13361
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
89
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
90 /**
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
91 * Overrides {@link #CompileTheWorldStartAt} and {@link #CompileTheWorldStopAt} from
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
92 * {@code -XX} HotSpot options of the same name if the latter have non-default values.
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
93 */
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
94 static void overrideWithNativeOptions(HotSpotVMConfig c) {
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
95 if (c.compileTheWorldStartAt != 1) {
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
96 CompileTheWorldStartAt.setValue(c.compileTheWorldStartAt);
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
97 }
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
98 if (c.compileTheWorldStopAt != Integer.MAX_VALUE) {
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
99 CompileTheWorldStopAt.setValue(c.compileTheWorldStopAt);
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
100 }
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
101 }
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
102 }
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
103
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
104 /**
13371
4db09b7304da read DontCompileHugeMethods and HugeMethodLimit from VM
Doug Simon <doug.simon@oracle.com>
parents: 13366
diff changeset
105 * A mechanism for overriding Graal options that affect compilation. A {@link Config} object
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
106 * should be used in a try-with-resources statement to ensure overriding of options is scoped
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
107 * properly. For example:
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 13859
diff changeset
108 *
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
109 * <pre>
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
110 * Config config = ...;
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
111 * try (AutoCloseable s = config == null ? null : config.apply()) {
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
112 * // perform a Graal compilation
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
113 * }
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
114 * </pre>
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
115 */
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
116 @SuppressWarnings("serial")
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
117 public static class Config extends HashMap<OptionValue<?>, Object> implements OptionConsumer {
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
118 /**
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
119 * Creates a {@link Config} object by parsing a set of space separated override options.
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 13859
diff changeset
120 *
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
121 * @param options a space separated set of option value settings with each option setting in
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
122 * a format compatible with
13365
bfc5acea3c12 consolidated mechanism for overriding options in CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 13362
diff changeset
123 * {@link HotSpotOptions#parseOption(String, OptionConsumer)}. Ignored if null.
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
124 */
13361
5a6c617a66ac added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
Doug Simon <doug.simon@oracle.com>
parents: 13353
diff changeset
125 public Config(String options) {
13365
bfc5acea3c12 consolidated mechanism for overriding options in CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 13362
diff changeset
126 if (options != null) {
bfc5acea3c12 consolidated mechanism for overriding options in CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 13362
diff changeset
127 for (String option : options.split("\\s+")) {
bfc5acea3c12 consolidated mechanism for overriding options in CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 13362
diff changeset
128 if (!HotSpotOptions.parseOption(option, this)) {
21543
93c50cefb9e8 moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
129 throw new JVMCIError("Invalid option specified: %s", option);
13365
bfc5acea3c12 consolidated mechanism for overriding options in CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 13362
diff changeset
130 }
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
131 }
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
132 }
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
133 }
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
134
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
135 /**
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
136 * Applies the overrides represented by this object. The overrides are in effect until
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
137 * {@link OverrideScope#close()} is called on the returned object.
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
138 */
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
139 OverrideScope apply() {
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
140 return OptionValue.override(this);
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
141 }
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
142
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
143 public void set(OptionDescriptor desc, Object value) {
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
144 put(desc.getOptionValue(), value);
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
145 }
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
146 }
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
147
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
148 // Some runtime instances we need.
18525
c538c2c6b7e2 changed most references to HotSpotGraalRuntime to use HotSpotGraalRuntimeProvider instead
Doug Simon <doug.simon@oracle.com>
parents: 18373
diff changeset
149 private final HotSpotGraalRuntimeProvider runtime = runtime();
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
150
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 13859
diff changeset
151 /** List of Zip/Jar files to compile (see {@link Options#CompileTheWorldClasspath}). */
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
152 private final String files;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
153
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 13859
diff changeset
154 /** Class index to start compilation at (see {@link Options#CompileTheWorldStartAt}). */
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
155 private final int startAt;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
156
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 13859
diff changeset
157 /** Class index to stop compilation at (see {@link Options#CompileTheWorldStopAt}). */
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
158 private final int stopAt;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
159
20018
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
160 /** Only compile methods matching one of the filters in this array if the array is non-null. */
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
161 private final MethodFilter[] methodFilters;
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
162
20967
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
163 /** Exclude methods matching one of the filters in this array if the array is non-null. */
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
164 private final MethodFilter[] excludeMethodFilters;
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
165
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
166 // Counters
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
167 private int classFileCounter = 0;
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
168 private AtomicLong compiledMethodsCounter = new AtomicLong();
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
169 private AtomicLong compileTime = new AtomicLong();
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
170 private AtomicLong memoryUsed = new AtomicLong();
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
171
13200
ebdc13d9845d replaced use of graal.compileTheWorldTest.log system property with a field to control CTW verbosity which is true by default but is set to false by CTW unit test
Doug Simon <doug.simon@oracle.com>
parents: 13199
diff changeset
172 private boolean verbose;
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
173 private final Config config;
13200
ebdc13d9845d replaced use of graal.compileTheWorldTest.log system property with a field to control CTW verbosity which is true by default but is set to false by CTW unit test
Doug Simon <doug.simon@oracle.com>
parents: 13199
diff changeset
174
20014
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
175 /**
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
176 * Signal that the threads should start compiling in multithreaded mode.
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
177 */
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
178 private boolean running;
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
179
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
180 private ThreadPoolExecutor threadPool;
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
181
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
182 /**
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
183 * Creates a compile-the-world instance.
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 13859
diff changeset
184 *
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
185 * @param files {@link File#pathSeparator} separated list of Zip/Jar files to compile
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
186 * @param startAt index of the class file to start compilation at
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
187 * @param stopAt index of the class file to stop compilation at
20967
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
188 * @param methodFilters
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
189 * @param excludeMethodFilters
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
190 */
20967
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
191 public CompileTheWorld(String files, Config config, int startAt, int stopAt, String methodFilters, String excludeMethodFilters, boolean verbose) {
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
192 this.files = files;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
193 this.startAt = startAt;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
194 this.stopAt = stopAt;
20018
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
195 this.methodFilters = methodFilters == null || methodFilters.isEmpty() ? null : MethodFilter.parse(methodFilters);
20967
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
196 this.excludeMethodFilters = excludeMethodFilters == null || excludeMethodFilters.isEmpty() ? null : MethodFilter.parse(excludeMethodFilters);
13200
ebdc13d9845d replaced use of graal.compileTheWorldTest.log system property with a field to control CTW verbosity which is true by default but is set to false by CTW unit test
Doug Simon <doug.simon@oracle.com>
parents: 13199
diff changeset
197 this.verbose = verbose;
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
198 this.config = config;
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
199
13113
e2933e3d4fb0 print stack traces when doing CompileTheWorld
twisti
parents: 12456
diff changeset
200 // We don't want the VM to exit when a method fails to compile...
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
201 config.putIfAbsent(ExitVMOnException, false);
13113
e2933e3d4fb0 print stack traces when doing CompileTheWorld
twisti
parents: 12456
diff changeset
202
e2933e3d4fb0 print stack traces when doing CompileTheWorld
twisti
parents: 12456
diff changeset
203 // ...but we want to see exceptions.
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
204 config.putIfAbsent(PrintBailout, true);
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
205 config.putIfAbsent(PrintStackTraceOnException, true);
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
206 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
207
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
208 /**
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
209 * Compiles all methods in all classes in the Zip/Jar archive files in
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 13859
diff changeset
210 * {@link Options#CompileTheWorldClasspath}. If {@link Options#CompileTheWorldClasspath}
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 13859
diff changeset
211 * contains the magic token {@link #SUN_BOOT_CLASS_PATH} passed up from HotSpot we take the
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 13859
diff changeset
212 * files from the boot class path.
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
213 */
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
214 public void compile() throws Throwable {
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
215 // By default only report statistics for the CTW threads themselves
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
216 if (GraalDebugConfig.DebugValueThreadFilter.hasInitialValue()) {
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
217 GraalDebugConfig.DebugValueThreadFilter.setValue("^CompileTheWorld");
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
218 }
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
219
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
220 if (SUN_BOOT_CLASS_PATH.equals(files)) {
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
221 final String[] entries = System.getProperty(SUN_BOOT_CLASS_PATH).split(File.pathSeparator);
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
222 String bcpFiles = "";
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
223 for (int i = 0; i < entries.length; i++) {
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
224 final String entry = entries[i];
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
225
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
226 // We stop at rt.jar, unless it is the first boot class path entry.
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
227 if (entry.endsWith("rt.jar") && (i > 0)) {
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
228 break;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
229 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
230 if (i > 0) {
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
231 bcpFiles += File.pathSeparator;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
232 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
233 bcpFiles += entry;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
234 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
235 compile(bcpFiles);
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
236 } else {
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
237 compile(files);
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
238 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
239 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
240
13200
ebdc13d9845d replaced use of graal.compileTheWorldTest.log system property with a field to control CTW verbosity which is true by default but is set to false by CTW unit test
Doug Simon <doug.simon@oracle.com>
parents: 13199
diff changeset
241 public void println() {
13199
bae0869c829a put CompileTheWorldTest logging behind the graal.compileTheWorldTest.log system property
Doug Simon <doug.simon@oracle.com>
parents: 13113
diff changeset
242 println("");
bae0869c829a put CompileTheWorldTest logging behind the graal.compileTheWorldTest.log system property
Doug Simon <doug.simon@oracle.com>
parents: 13113
diff changeset
243 }
bae0869c829a put CompileTheWorldTest logging behind the graal.compileTheWorldTest.log system property
Doug Simon <doug.simon@oracle.com>
parents: 13113
diff changeset
244
13200
ebdc13d9845d replaced use of graal.compileTheWorldTest.log system property with a field to control CTW verbosity which is true by default but is set to false by CTW unit test
Doug Simon <doug.simon@oracle.com>
parents: 13199
diff changeset
245 public void println(String format, Object... args) {
13199
bae0869c829a put CompileTheWorldTest logging behind the graal.compileTheWorldTest.log system property
Doug Simon <doug.simon@oracle.com>
parents: 13113
diff changeset
246 println(String.format(format, args));
bae0869c829a put CompileTheWorldTest logging behind the graal.compileTheWorldTest.log system property
Doug Simon <doug.simon@oracle.com>
parents: 13113
diff changeset
247 }
bae0869c829a put CompileTheWorldTest logging behind the graal.compileTheWorldTest.log system property
Doug Simon <doug.simon@oracle.com>
parents: 13113
diff changeset
248
13200
ebdc13d9845d replaced use of graal.compileTheWorldTest.log system property with a field to control CTW verbosity which is true by default but is set to false by CTW unit test
Doug Simon <doug.simon@oracle.com>
parents: 13199
diff changeset
249 public void println(String s) {
ebdc13d9845d replaced use of graal.compileTheWorldTest.log system property with a field to control CTW verbosity which is true by default but is set to false by CTW unit test
Doug Simon <doug.simon@oracle.com>
parents: 13199
diff changeset
250 if (verbose) {
13199
bae0869c829a put CompileTheWorldTest logging behind the graal.compileTheWorldTest.log system property
Doug Simon <doug.simon@oracle.com>
parents: 13113
diff changeset
251 TTY.println(s);
bae0869c829a put CompileTheWorldTest logging behind the graal.compileTheWorldTest.log system property
Doug Simon <doug.simon@oracle.com>
parents: 13113
diff changeset
252 }
bae0869c829a put CompileTheWorldTest logging behind the graal.compileTheWorldTest.log system property
Doug Simon <doug.simon@oracle.com>
parents: 13113
diff changeset
253 }
bae0869c829a put CompileTheWorldTest logging behind the graal.compileTheWorldTest.log system property
Doug Simon <doug.simon@oracle.com>
parents: 13113
diff changeset
254
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
255 /**
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
256 * Compiles all methods in all classes in the Zip/Jar files passed.
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 13859
diff changeset
257 *
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
258 * @param fileList {@link File#pathSeparator} separated list of Zip/Jar files to compile
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
259 * @throws IOException
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
260 */
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
261 private void compile(String fileList) throws IOException {
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
262 final String[] entries = fileList.split(File.pathSeparator);
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
263 long start = System.currentTimeMillis();
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
264
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
265 CompilerThreadFactory factory = new CompilerThreadFactory("CompileTheWorld", new DebugConfigAccess() {
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
266 public GraalDebugConfig getDebugConfig() {
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
267 if (Debug.isEnabled() && DebugScope.getConfig() == null) {
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
268 return DebugEnvironment.initialize(System.out);
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
269 }
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
270 return null;
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
271 }
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
272 });
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
273
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
274 /*
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
275 * Always use a thread pool, even for single threaded mode since it simplifies the use of
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
276 * DebugValueThreadFilter to filter on the thread names.
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
277 */
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
278 int threadCount = 1;
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
279 if (Options.CompileTheWorldMultiThreaded.getValue()) {
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
280 threadCount = Options.CompileTheWorldThreads.getValue();
20007
83539d28f95c Fixed help text and add CompileTheWorldThreads flag
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19968
diff changeset
281 if (threadCount == 0) {
83539d28f95c Fixed help text and add CompileTheWorldThreads flag
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19968
diff changeset
282 threadCount = Runtime.getRuntime().availableProcessors();
83539d28f95c Fixed help text and add CompileTheWorldThreads flag
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19968
diff changeset
283 }
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
284 } else {
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
285 running = true;
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
286 }
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
287 threadPool = new ThreadPoolExecutor(threadCount, threadCount, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), factory);
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
288
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
289 try (OverrideScope s = config.apply()) {
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
290 for (int i = 0; i < entries.length; i++) {
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
291 final String entry = entries[i];
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
292
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
293 // For now we only compile all methods in all classes in zip/jar files.
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
294 if (!entry.endsWith(".zip") && !entry.endsWith(".jar")) {
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
295 println("CompileTheWorld : Skipped classes in " + entry);
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
296 println();
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
297 continue;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
298 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
299
20018
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
300 if (methodFilters == null || methodFilters.length == 0) {
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
301 println("CompileTheWorld : Compiling all classes in " + entry);
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
302 } else {
20967
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
303 String include = Arrays.asList(methodFilters).stream().map(MethodFilter::toString).collect(Collectors.joining(", "));
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
304 println("CompileTheWorld : Compiling all methods in " + entry + " matching one of the following filters: " + include);
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
305 }
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
306 if (excludeMethodFilters != null && excludeMethodFilters.length > 0) {
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
307 String exclude = Arrays.asList(excludeMethodFilters).stream().map(MethodFilter::toString).collect(Collectors.joining(", "));
21283
23f9cba1f250 fixed spelling error
Doug Simon <doug.simon@oracle.com>
parents: 21139
diff changeset
308 println("CompileTheWorld : Excluding all methods matching one of the following filters: " + exclude);
20018
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
309 }
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
310 println();
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
311
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
312 URL url = new URL("jar", "", "file:" + entry + "!/");
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
313 ClassLoader loader = new URLClassLoader(new URL[]{url});
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
314
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
315 JarFile jarFile = new JarFile(entry);
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
316 Enumeration<JarEntry> e = jarFile.entries();
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
317
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
318 while (e.hasMoreElements()) {
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
319 JarEntry je = e.nextElement();
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
320 if (je.isDirectory() || !je.getName().endsWith(".class")) {
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
321 continue;
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
322 }
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
323
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
324 // Are we done?
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
325 if (classFileCounter >= stopAt) {
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
326 break;
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
327 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
328
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
329 String className = je.getName().substring(0, je.getName().length() - ".class".length());
20018
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
330 String dottedClassName = className.replace('/', '.');
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
331 classFileCounter++;
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
332
20018
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
333 if (methodFilters != null && !MethodFilter.matchesClassName(methodFilters, dottedClassName)) {
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
334 continue;
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
335 }
20967
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
336 if (excludeMethodFilters != null && MethodFilter.matchesClassName(excludeMethodFilters, dottedClassName)) {
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
337 continue;
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
338 }
20018
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
339
20831
5a97208e1824 CTW: Black-list some package to avoid linking problems when using an Oracle JDK >= 8u40
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20031
diff changeset
340 if (dottedClassName.startsWith("jdk.management.") || dottedClassName.startsWith("jdk.internal.cmm.*")) {
5a97208e1824 CTW: Black-list some package to avoid linking problems when using an Oracle JDK >= 8u40
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20031
diff changeset
341 continue;
5a97208e1824 CTW: Black-list some package to avoid linking problems when using an Oracle JDK >= 8u40
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20031
diff changeset
342 }
5a97208e1824 CTW: Black-list some package to avoid linking problems when using an Oracle JDK >= 8u40
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20031
diff changeset
343
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
344 try {
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
345 // Load and initialize class
20018
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
346 Class<?> javaClass = Class.forName(dottedClassName, true, loader);
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
347
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
348 // Pre-load all classes in the constant pool.
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
349 try {
18223
17c98fad6980 converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18167
diff changeset
350 HotSpotResolvedObjectType objectType = HotSpotResolvedObjectTypeImpl.fromObjectClass(javaClass);
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
351 ConstantPool constantPool = objectType.constantPool();
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
352 for (int cpi = 1; cpi < constantPool.length(); cpi++) {
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
353 constantPool.loadReferencedType(cpi, Bytecodes.LDC);
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
354 }
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
355 } catch (Throwable t) {
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
356 // If something went wrong during pre-loading we just ignore it.
17395
c8bd29658465 be more verbose about class resolution during CTW
Doug Simon <doug.simon@oracle.com>
parents: 17377
diff changeset
357 println("Preloading failed for (%d) %s: %s", classFileCounter, className, t);
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
358 }
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
359
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
360 // Are we compiling this class?
18301
0f41072d8bbc moved use of HotSpotMetaAccessProvider to locations on the "local" side of remote compilation
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
361 MetaAccessProvider metaAccess = runtime.getHostProviders().getMetaAccess();
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
362 if (classFileCounter >= startAt) {
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
363 println("CompileTheWorld (%d) : %s", classFileCounter, className);
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
364
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
365 // Compile each constructor/method in the class.
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
366 for (Constructor<?> constructor : javaClass.getDeclaredConstructors()) {
18373
91283d4a1218 Use the base class Executable (introduced in Java 8) to unify the handling of Method and Constructor in MetaAccessProvider
Christian Wimmer <christian.wimmer@oracle.com>
parents: 18301
diff changeset
367 HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) metaAccess.lookupJavaMethod(constructor);
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
368 if (canBeCompiled(javaMethod, constructor.getModifiers())) {
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
369 compileMethod(javaMethod);
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
370 }
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
371 }
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
372 for (Method method : javaClass.getDeclaredMethods()) {
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
373 HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) metaAccess.lookupJavaMethod(method);
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
374 if (canBeCompiled(javaMethod, method.getModifiers())) {
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
375 compileMethod(javaMethod);
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
376 }
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
377 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
378 }
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
379 } catch (Throwable t) {
21023
3ceda1f37dcc [SPARC] Remove redundant compare type (kind) for CMOVE
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20967
diff changeset
380 println("CompileTheWorld (%d) : Skipping %s %s", classFileCounter, className, t.toString());
3ceda1f37dcc [SPARC] Remove redundant compare type (kind) for CMOVE
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20967
diff changeset
381 t.printStackTrace();
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
382 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
383 }
16872
ce8ac92efb14 Don't recreate suites on every CTW compile.
Roland Schatz <roland.schatz@oracle.com>
parents: 16831
diff changeset
384 jarFile.close();
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
385 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
386 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
387
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
388 if (!running) {
20014
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
389 startThreads();
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
390 }
21139
a17dc2584e81 Fix time reporting in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21023
diff changeset
391 int wakeups = 0;
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
392 while (threadPool.getCompletedTaskCount() != threadPool.getTaskCount()) {
21139
a17dc2584e81 Fix time reporting in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21023
diff changeset
393 if (wakeups % 15 == 0) {
a17dc2584e81 Fix time reporting in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21023
diff changeset
394 TTY.println("CompileTheWorld : Waiting for " + (threadPool.getTaskCount() - threadPool.getCompletedTaskCount()) + " compiles");
a17dc2584e81 Fix time reporting in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21023
diff changeset
395 }
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
396 try {
21139
a17dc2584e81 Fix time reporting in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21023
diff changeset
397 threadPool.awaitTermination(1, TimeUnit.SECONDS);
a17dc2584e81 Fix time reporting in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21023
diff changeset
398 wakeups++;
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
399 } catch (InterruptedException e) {
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
400 }
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
401 }
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
402 threadPool = null;
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
403
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
404 long elapsedTime = System.currentTimeMillis() - start;
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
405
13199
bae0869c829a put CompileTheWorldTest logging behind the graal.compileTheWorldTest.log system property
Doug Simon <doug.simon@oracle.com>
parents: 13113
diff changeset
406 println();
20017
926850b25c65 Restore old CTW output format
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20014
diff changeset
407 if (Options.CompileTheWorldMultiThreaded.getValue()) {
20029
d3b3a094df52 Alway print final CTW messages
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20018
diff changeset
408 TTY.println("CompileTheWorld : Done (%d classes, %d methods, %d ms elapsed, %d ms compile time, %d bytes of memory used)", classFileCounter, compiledMethodsCounter.get(), elapsedTime,
20017
926850b25c65 Restore old CTW output format
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20014
diff changeset
409 compileTime.get(), memoryUsed.get());
926850b25c65 Restore old CTW output format
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20014
diff changeset
410 } else {
20029
d3b3a094df52 Alway print final CTW messages
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20018
diff changeset
411 TTY.println("CompileTheWorld : Done (%d classes, %d methods, %d ms, %d bytes of memory used)", classFileCounter, compiledMethodsCounter.get(), compileTime.get(), memoryUsed.get());
20017
926850b25c65 Restore old CTW output format
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20014
diff changeset
412 }
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
413 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
414
20014
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
415 private synchronized void startThreads() {
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
416 running = true;
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
417 // Wake up any waiting threads
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
418 notifyAll();
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
419 }
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
420
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
421 private synchronized void waitToRun() {
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
422 while (!running) {
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
423 try {
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
424 wait();
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
425 } catch (InterruptedException e) {
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
426 }
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
427 }
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
428 }
dab7f071220a Wait until all classes are loaded before compiling in multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20007
diff changeset
429
13452
8275a0d0c90a create profiling info, phase plan and optimistic opts when running a CompilationTask, not when creating it (GRAAL-640)
Doug Simon <doug.simon@oracle.com>
parents: 13371
diff changeset
430 class CTWCompilationTask extends CompilationTask {
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
431
13859
1e01e2644a5d Make blocking compiles safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13630
diff changeset
432 CTWCompilationTask(HotSpotBackend backend, HotSpotResolvedJavaMethod method) {
17377
58f45b63b802 CompileTheWorld compilations are no longer installed as default nmethods
Doug Simon <doug.simon@oracle.com>
parents: 16872
diff changeset
433 super(backend, method, INVOCATION_ENTRY_BCI, 0L, method.allocateCompileId(INVOCATION_ENTRY_BCI), false);
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
434 }
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
435
13452
8275a0d0c90a create profiling info, phase plan and optimistic opts when running a CompilationTask, not when creating it (GRAAL-640)
Doug Simon <doug.simon@oracle.com>
parents: 13371
diff changeset
436 /**
8275a0d0c90a create profiling info, phase plan and optimistic opts when running a CompilationTask, not when creating it (GRAAL-640)
Doug Simon <doug.simon@oracle.com>
parents: 13371
diff changeset
437 * Returns empty profiling info to be as close to the CTW behavior of C1 and C2 as possible.
8275a0d0c90a create profiling info, phase plan and optimistic opts when running a CompilationTask, not when creating it (GRAAL-640)
Doug Simon <doug.simon@oracle.com>
parents: 13371
diff changeset
438 */
8275a0d0c90a create profiling info, phase plan and optimistic opts when running a CompilationTask, not when creating it (GRAAL-640)
Doug Simon <doug.simon@oracle.com>
parents: 13371
diff changeset
439 @Override
8275a0d0c90a create profiling info, phase plan and optimistic opts when running a CompilationTask, not when creating it (GRAAL-640)
Doug Simon <doug.simon@oracle.com>
parents: 13371
diff changeset
440 protected ProfilingInfo getProfilingInfo() {
8275a0d0c90a create profiling info, phase plan and optimistic opts when running a CompilationTask, not when creating it (GRAAL-640)
Doug Simon <doug.simon@oracle.com>
parents: 13371
diff changeset
441 // Be optimistic and return false for exceptionSeen.
8275a0d0c90a create profiling info, phase plan and optimistic opts when running a CompilationTask, not when creating it (GRAAL-640)
Doug Simon <doug.simon@oracle.com>
parents: 13371
diff changeset
442 return DefaultProfilingInfo.get(TriState.FALSE);
8275a0d0c90a create profiling info, phase plan and optimistic opts when running a CompilationTask, not when creating it (GRAAL-640)
Doug Simon <doug.simon@oracle.com>
parents: 13371
diff changeset
443 }
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
444 }
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
445
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
446 private void compileMethod(HotSpotResolvedJavaMethod method) throws InterruptedException, ExecutionException {
20018
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
447 if (methodFilters != null && !MethodFilter.matches(methodFilters, method)) {
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
448 return;
3cbb0846337c added -G:CompileTheWorldMethodFilter option
Doug Simon <doug.simon@oracle.com>
parents: 20017
diff changeset
449 }
20967
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
450 if (excludeMethodFilters != null && MethodFilter.matches(excludeMethodFilters, method)) {
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
451 return;
f61ff7f01bc2 Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 20831
diff changeset
452 }
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
453 Future<?> task = threadPool.submit(new Runnable() {
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
454 public void run() {
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
455 waitToRun();
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
456 try (OverrideScope s = config.apply()) {
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
457 compileMethod(method, classFileCounter);
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
458 }
20031
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
459 }
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
460 });
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
461 if (threadPool.getCorePoolSize() == 1) {
c5c8193325fa Only report debug values for CTW threads by default
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20029
diff changeset
462 task.get();
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
463 }
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
464 }
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
465
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
466 /**
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
467 * Compiles a method and gathers some statistics.
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
468 */
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
469 private void compileMethod(HotSpotResolvedJavaMethod method, int counter) {
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
470 try {
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
471 long start = System.currentTimeMillis();
16722
46eaf7cd8275 added memory usage analysis to CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
472 long allocatedAtStart = getCurrentThreadAllocatedBytes();
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
473
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
474 HotSpotBackend backend = runtime.getHostBackend();
13859
1e01e2644a5d Make blocking compiles safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13630
diff changeset
475 CompilationTask task = new CTWCompilationTask(backend, method);
15695
128359d7cddc once the Graal compilation queue has been shutdown, don't process any pending compilations and be more defensive about preventing future compilations to be queued
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
476 task.runCompilation();
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
477
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
478 memoryUsed.getAndAdd(getCurrentThreadAllocatedBytes() - allocatedAtStart);
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
479 compileTime.getAndAdd(System.currentTimeMillis() - start);
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
480 compiledMethodsCounter.incrementAndGet();
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
481 } catch (Throwable t) {
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
482 // Catch everything and print a message
19968
ccdcd530a3ec Add support for multithreaded CTW
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19717
diff changeset
483 println("CompileTheWorld (%d) : Error compiling method: %s", counter, method.format("%H.%n(%p):%r"));
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
484 t.printStackTrace(TTY.cachedOut);
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
485 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
486 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
487
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
488 /**
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13200
diff changeset
489 * Determines if a method should be compiled (Cf. CompilationPolicy::can_be_compiled).
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 13859
diff changeset
490 *
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
491 * @return true if it can be compiled, false otherwise
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
492 */
13371
4db09b7304da read DontCompileHugeMethods and HugeMethodLimit from VM
Doug Simon <doug.simon@oracle.com>
parents: 13366
diff changeset
493 private boolean canBeCompiled(HotSpotResolvedJavaMethod javaMethod, int modifiers) {
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
494 if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) {
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
495 return false;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
496 }
13371
4db09b7304da read DontCompileHugeMethods and HugeMethodLimit from VM
Doug Simon <doug.simon@oracle.com>
parents: 13366
diff changeset
497 HotSpotVMConfig c = runtime.getConfig();
4db09b7304da read DontCompileHugeMethods and HugeMethodLimit from VM
Doug Simon <doug.simon@oracle.com>
parents: 13366
diff changeset
498 if (c.dontCompileHugeMethods && javaMethod.getCodeSize() > c.hugeMethodLimit) {
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
499 return false;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
500 }
16831
217eee2ddead support use of -XX:CompileCommand=dontinline to exclude problematic methods from CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 16722
diff changeset
501 // Allow use of -XX:CompileCommand=dontinline to exclude problematic methods
217eee2ddead support use of -XX:CompileCommand=dontinline to exclude problematic methods from CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 16722
diff changeset
502 if (!javaMethod.canBeInlined()) {
217eee2ddead support use of -XX:CompileCommand=dontinline to exclude problematic methods from CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 16722
diff changeset
503 return false;
217eee2ddead support use of -XX:CompileCommand=dontinline to exclude problematic methods from CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 16722
diff changeset
504 }
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
505 // Skip @Snippets for now
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
506 if (javaMethod.getAnnotation(Snippet.class) != null) {
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
507 return false;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
508 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
509 return true;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
510 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
511
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents:
diff changeset
512 }