109 return compileMethod(request, true, graalRuntime.getOptions()); |
109 return compileMethod(request, true, graalRuntime.getOptions()); |
110 } |
110 } |
111 |
111 |
112 @SuppressWarnings("try") |
112 @SuppressWarnings("try") |
113 CompilationRequestResult compileMethod(CompilationRequest request, boolean installAsDefault, OptionValues initialOptions) { |
113 CompilationRequestResult compileMethod(CompilationRequest request, boolean installAsDefault, OptionValues initialOptions) { |
114 if (graalRuntime.isShutdown()) { |
114 try (CompilationContext scope = HotSpotGraalServices.openLocalCompilationContext(request)) { |
115 return HotSpotCompilationRequestResult.failure(String.format("Shutdown entered"), true); |
115 if (graalRuntime.isShutdown()) { |
116 } |
116 return HotSpotCompilationRequestResult.failure(String.format("Shutdown entered"), true); |
117 |
117 } |
118 ResolvedJavaMethod method = request.getMethod(); |
118 |
119 |
119 ResolvedJavaMethod method = request.getMethod(); |
120 if (graalRuntime.isBootstrapping()) { |
120 |
121 if (DebugOptions.BootstrapInitializeOnly.getValue(initialOptions)) { |
121 if (graalRuntime.isBootstrapping()) { |
122 return HotSpotCompilationRequestResult.failure(String.format("Skip compilation because %s is enabled", DebugOptions.BootstrapInitializeOnly.getName()), true); |
122 if (DebugOptions.BootstrapInitializeOnly.getValue(initialOptions)) { |
123 } |
123 return HotSpotCompilationRequestResult.failure(String.format("Skip compilation because %s is enabled", DebugOptions.BootstrapInitializeOnly.getName()), true); |
124 if (bootstrapWatchDog != null) { |
124 } |
125 if (bootstrapWatchDog.hitCriticalCompilationRateOrTimeout()) { |
125 if (bootstrapWatchDog != null) { |
126 // Drain the compilation queue to expedite completion of the bootstrap |
126 if (bootstrapWatchDog.hitCriticalCompilationRateOrTimeout()) { |
127 return HotSpotCompilationRequestResult.failure("hit critical bootstrap compilation rate or timeout", true); |
127 // Drain the compilation queue to expedite completion of the bootstrap |
128 } |
128 return HotSpotCompilationRequestResult.failure("hit critical bootstrap compilation rate or timeout", true); |
129 } |
129 } |
130 } |
130 } |
131 HotSpotCompilationRequest hsRequest = (HotSpotCompilationRequest) request; |
131 } |
132 CompilationTask task = new CompilationTask(jvmciRuntime, this, hsRequest, true, shouldRetainLocalVariables(hsRequest.getJvmciEnv()), installAsDefault); |
132 HotSpotCompilationRequest hsRequest = (HotSpotCompilationRequest) request; |
133 OptionValues options = task.filterOptions(initialOptions); |
133 CompilationTask task = new CompilationTask(jvmciRuntime, this, hsRequest, true, shouldRetainLocalVariables(hsRequest.getJvmciEnv()), installAsDefault); |
134 try (CompilationWatchDog w1 = CompilationWatchDog.watch(method, hsRequest.getId(), options); |
134 OptionValues options = task.filterOptions(initialOptions); |
135 BootstrapWatchDog.Watch w2 = bootstrapWatchDog == null ? null : bootstrapWatchDog.watch(request); |
135 try (CompilationWatchDog w1 = CompilationWatchDog.watch(method, hsRequest.getId(), options); |
136 CompilationAlarm alarm = CompilationAlarm.trackCompilationPeriod(options);) { |
136 BootstrapWatchDog.Watch w2 = bootstrapWatchDog == null ? null : bootstrapWatchDog.watch(request); |
137 if (compilationCounters != null) { |
137 CompilationAlarm alarm = CompilationAlarm.trackCompilationPeriod(options);) { |
138 compilationCounters.countCompilation(method); |
138 if (compilationCounters != null) { |
139 } |
139 compilationCounters.countCompilation(method); |
140 CompilationRequestResult r = null; |
140 } |
141 try (DebugContext debug = graalRuntime.openDebugContext(options, task.getCompilationIdentifier(), method, getDebugHandlersFactories(), DebugContext.DEFAULT_LOG_STREAM); |
141 CompilationRequestResult r = null; |
142 Activation a = debug.activate()) { |
142 try (DebugContext debug = graalRuntime.openDebugContext(options, task.getCompilationIdentifier(), method, getDebugHandlersFactories(), DebugContext.DEFAULT_LOG_STREAM); |
143 r = task.runCompilation(debug); |
143 Activation a = debug.activate()) { |
144 } |
144 r = task.runCompilation(debug); |
145 assert r != null; |
145 } |
146 return r; |
146 assert r != null; |
|
147 return r; |
|
148 } |
147 } |
149 } |
148 } |
150 } |
149 |
151 |
150 private boolean shouldRetainLocalVariables(long envAddress) { |
152 private boolean shouldRetainLocalVariables(long envAddress) { |
151 GraalHotSpotVMConfig config = graalRuntime.getVMConfig(); |
153 GraalHotSpotVMConfig config = graalRuntime.getVMConfig(); |