< prev index next >

src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java

Print this page

137         }
138 
139         int result = runtime.getCompilerToVM().installCode(hsCompiledCode, resultInstalledCode, failedSpeculationsAddress, speculations);
140         if (result != config.codeInstallResultOk) {
141             String resultDesc = config.getCodeInstallResultDescription(result);
142             if (hsCompiledNmethod != null) {
143                 String msg = hsCompiledNmethod.getInstallationFailureMessage();
144                 if (msg != null) {
145                     msg = String.format("Code installation failed: %s%n%s", resultDesc, msg);
146                 } else {
147                     msg = String.format("Code installation failed: %s", resultDesc);
148                 }
149                 throw new BailoutException(result >= config.codeInstallResultFirstPermanentBailout, msg);
150             } else {
151                 throw new BailoutException("Error installing %s: %s", ((HotSpotCompiledCode) compiledCode).getName(), resultDesc);
152             }
153         }
154         return logOrDump(resultInstalledCode, compiledCode);
155     }
156 
157     @Override
158     public void invalidateInstalledCode(InstalledCode installedCode) {
159         if (installedCode instanceof HotSpotNmethod) {
160             HotSpotNmethod nmethod = (HotSpotNmethod) installedCode;
161             nmethod.invalidate(true);
162         } else {
163             throw new IllegalArgumentException("Cannot invalidate a " + Objects.requireNonNull(installedCode).getClass().getName());
164         }
165     }
166 





167     @Override
168     public TargetDescription getTarget() {
169         return target;
170     }
171 
172     public String disassemble(InstalledCode code) {
173         if (code.isValid()) {
174             return runtime.getCompilerToVM().disassembleCodeBlob(code);
175         }
176         return null;
177     }
178 
179     @Override
180     public SpeculationLog createSpeculationLog() {
181         return new HotSpotSpeculationLog();
182     }
183 
184     @Override
185     public long getMaxCallTargetOffset(long address) {
186         return runtime.getCompilerToVM().getMaxCallTargetOffset(address);
187     }
188 
189     @Override
190     public boolean shouldDebugNonSafepoints() {
191         return runtime.getCompilerToVM().shouldDebugNonSafepoints();
192     }
193 
194     public int interpreterFrameSize(BytecodeFrame pos) {
195         return runtime.getCompilerToVM().interpreterFrameSize(pos);
196     }
197 
198     /**
199      * Resets all compilation statistics.
200      */
201     public void resetCompilationStatistics() {
202         runtime.getCompilerToVM().resetCompilationStatistics();
203     }




204 }

137         }
138 
139         int result = runtime.getCompilerToVM().installCode(hsCompiledCode, resultInstalledCode, failedSpeculationsAddress, speculations);
140         if (result != config.codeInstallResultOk) {
141             String resultDesc = config.getCodeInstallResultDescription(result);
142             if (hsCompiledNmethod != null) {
143                 String msg = hsCompiledNmethod.getInstallationFailureMessage();
144                 if (msg != null) {
145                     msg = String.format("Code installation failed: %s%n%s", resultDesc, msg);
146                 } else {
147                     msg = String.format("Code installation failed: %s", resultDesc);
148                 }
149                 throw new BailoutException(result >= config.codeInstallResultFirstPermanentBailout, msg);
150             } else {
151                 throw new BailoutException("Error installing %s: %s", ((HotSpotCompiledCode) compiledCode).getName(), resultDesc);
152             }
153         }
154         return logOrDump(resultInstalledCode, compiledCode);
155     }
156 
157     public void invalidateInstalledCode(InstalledCode installedCode, int invalidationReason) {

158         if (installedCode instanceof HotSpotNmethod) {
159             HotSpotNmethod nmethod = (HotSpotNmethod) installedCode;
160             nmethod.invalidate(true, invalidationReason);
161         } else {
162             throw new IllegalArgumentException("Cannot invalidate a " + Objects.requireNonNull(installedCode).getClass().getName());
163         }
164     }
165 
166     @Override
167     public void invalidateInstalledCode(InstalledCode installedCode) {
168         invalidateInstalledCode(installedCode, jvmciInvalidationReason());
169     }
170 
171     @Override
172     public TargetDescription getTarget() {
173         return target;
174     }
175 
176     public String disassemble(InstalledCode code) {
177         if (code.isValid()) {
178             return runtime.getCompilerToVM().disassembleCodeBlob(code);
179         }
180         return null;
181     }
182 
183     @Override
184     public SpeculationLog createSpeculationLog() {
185         return new HotSpotSpeculationLog();
186     }
187 
188     @Override
189     public long getMaxCallTargetOffset(long address) {
190         return runtime.getCompilerToVM().getMaxCallTargetOffset(address);
191     }
192 
193     @Override
194     public boolean shouldDebugNonSafepoints() {
195         return runtime.getCompilerToVM().shouldDebugNonSafepoints();
196     }
197 
198     public int interpreterFrameSize(BytecodeFrame pos) {
199         return runtime.getCompilerToVM().interpreterFrameSize(pos);
200     }
201 
202     /**
203      * Resets all compilation statistics.
204      */
205     public void resetCompilationStatistics() {
206         runtime.getCompilerToVM().resetCompilationStatistics();
207     }
208 
209     private static int jvmciInvalidationReason() {
210         return HotSpotJVMCIRuntime.runtime().config.getConstant("nmethod::InvalidationReason::JVMCI_INVALIDATE", Integer.class);
211     }
212 }
< prev index next >