14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24
25 package org.graalvm.compiler.hotspot;
26
27 import static org.graalvm.compiler.core.CompilationWrapper.ExceptionAction.Diagnose;
28 import static org.graalvm.compiler.core.CompilationWrapper.ExceptionAction.ExitVM;
29 import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationBailoutAction;
30 import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationFailureAction;
31 import static org.graalvm.compiler.core.phases.HighTier.Options.Inline;
32 import static org.graalvm.compiler.java.BytecodeParserOptions.InlineDuringParsing;
33
34 import java.util.List;
35
36 import jdk.internal.vm.compiler.collections.EconomicMap;
37 import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
38 import org.graalvm.compiler.code.CompilationResult;
39 import org.graalvm.compiler.core.CompilationPrinter;
40 import org.graalvm.compiler.core.CompilationWrapper;
41 import org.graalvm.compiler.core.common.CompilationIdentifier;
42 import org.graalvm.compiler.debug.Assertions;
43 import org.graalvm.compiler.debug.CounterKey;
44 import org.graalvm.compiler.debug.DebugCloseable;
45 import org.graalvm.compiler.debug.DebugContext;
46 import org.graalvm.compiler.debug.DebugDumpScope;
47 import org.graalvm.compiler.debug.GraalError;
48 import org.graalvm.compiler.debug.TimerKey;
49 import org.graalvm.compiler.options.EnumOptionKey;
50 import org.graalvm.compiler.options.OptionKey;
51 import org.graalvm.compiler.options.OptionValues;
52 import org.graalvm.compiler.printer.GraalDebugHandlersFactory;
53
88
89 /**
90 * Specifies whether the compilation result is installed as the
91 * {@linkplain HotSpotNmethod#isDefault() default} nmethod for the compiled method.
92 */
93 private final boolean installAsDefault;
94
95 private final boolean useProfilingInfo;
96 private final OptionValues options;
97
98 final class HotSpotCompilationWrapper extends CompilationWrapper<HotSpotCompilationRequestResult> {
99 private final EventProvider.CompilationEvent compilationEvent;
100 CompilationResult result;
101
102 HotSpotCompilationWrapper(EventProvider.CompilationEvent compilationEvent) {
103 super(compiler.getGraalRuntime().getOutputDirectory(), compiler.getGraalRuntime().getCompilationProblemsPerAction());
104 this.compilationEvent = compilationEvent;
105 }
106
107 @Override
108 protected DebugContext createRetryDebugContext(OptionValues retryOptions) {
109 SnippetReflectionProvider snippetReflection = compiler.getGraalRuntime().getHostProviders().getSnippetReflection();
110 return DebugContext.create(retryOptions, new GraalDebugHandlersFactory(snippetReflection));
111 }
112
113 @Override
114 public String toString() {
115 return getMethod().format("%H.%n(%p)");
116 }
117
118 @Override
119 protected HotSpotCompilationRequestResult handleException(Throwable t) {
120 if (t instanceof BailoutException) {
121 BailoutException bailout = (BailoutException) t;
122 /*
123 * Handling of permanent bailouts: Permanent bailouts that can happen for example
124 * due to unsupported unstructured control flow in the bytecodes of a method must
125 * not be retried. Hotspot compile broker will ensure that no recompilation at the
126 * given tier will happen if retry is false.
127 */
128 return HotSpotCompilationRequestResult.failure(bailout.getMessage(), !bailout.isPermanent());
129 }
130 // Log a failure event.
|
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24
25 package org.graalvm.compiler.hotspot;
26
27 import static org.graalvm.compiler.core.CompilationWrapper.ExceptionAction.Diagnose;
28 import static org.graalvm.compiler.core.CompilationWrapper.ExceptionAction.ExitVM;
29 import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationBailoutAction;
30 import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationFailureAction;
31 import static org.graalvm.compiler.core.phases.HighTier.Options.Inline;
32 import static org.graalvm.compiler.java.BytecodeParserOptions.InlineDuringParsing;
33
34 import java.io.PrintStream;
35 import java.util.List;
36
37 import jdk.internal.vm.compiler.collections.EconomicMap;
38 import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
39 import org.graalvm.compiler.code.CompilationResult;
40 import org.graalvm.compiler.core.CompilationPrinter;
41 import org.graalvm.compiler.core.CompilationWrapper;
42 import org.graalvm.compiler.core.common.CompilationIdentifier;
43 import org.graalvm.compiler.debug.Assertions;
44 import org.graalvm.compiler.debug.CounterKey;
45 import org.graalvm.compiler.debug.DebugCloseable;
46 import org.graalvm.compiler.debug.DebugContext;
47 import org.graalvm.compiler.debug.DebugDumpScope;
48 import org.graalvm.compiler.debug.GraalError;
49 import org.graalvm.compiler.debug.TimerKey;
50 import org.graalvm.compiler.options.EnumOptionKey;
51 import org.graalvm.compiler.options.OptionKey;
52 import org.graalvm.compiler.options.OptionValues;
53 import org.graalvm.compiler.printer.GraalDebugHandlersFactory;
54
89
90 /**
91 * Specifies whether the compilation result is installed as the
92 * {@linkplain HotSpotNmethod#isDefault() default} nmethod for the compiled method.
93 */
94 private final boolean installAsDefault;
95
96 private final boolean useProfilingInfo;
97 private final OptionValues options;
98
99 final class HotSpotCompilationWrapper extends CompilationWrapper<HotSpotCompilationRequestResult> {
100 private final EventProvider.CompilationEvent compilationEvent;
101 CompilationResult result;
102
103 HotSpotCompilationWrapper(EventProvider.CompilationEvent compilationEvent) {
104 super(compiler.getGraalRuntime().getOutputDirectory(), compiler.getGraalRuntime().getCompilationProblemsPerAction());
105 this.compilationEvent = compilationEvent;
106 }
107
108 @Override
109 protected DebugContext createRetryDebugContext(OptionValues retryOptions, PrintStream logStream) {
110 SnippetReflectionProvider snippetReflection = compiler.getGraalRuntime().getHostProviders().getSnippetReflection();
111 return DebugContext.create(retryOptions, logStream, new GraalDebugHandlersFactory(snippetReflection));
112 }
113
114 @Override
115 public String toString() {
116 return getMethod().format("%H.%n(%p)");
117 }
118
119 @Override
120 protected HotSpotCompilationRequestResult handleException(Throwable t) {
121 if (t instanceof BailoutException) {
122 BailoutException bailout = (BailoutException) t;
123 /*
124 * Handling of permanent bailouts: Permanent bailouts that can happen for example
125 * due to unsupported unstructured control flow in the bytecodes of a method must
126 * not be retried. Hotspot compile broker will ensure that no recompilation at the
127 * given tier will happen if retry is false.
128 */
129 return HotSpotCompilationRequestResult.failure(bailout.getMessage(), !bailout.isPermanent());
130 }
131 // Log a failure event.
|