src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java
Index
Unified diffs
Context diffs
Sdiffs
Frames
Patch
New
Old
Previous File
Next File
*** old/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java Thu Mar 28 11:23:42 2019
--- new/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java Thu Mar 28 11:23:42 2019
*** 1,7 ****
--- 1,7 ----
/*
! * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
! * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 21,30 ****
--- 21,31 ----
* questions.
*/
package jdk.vm.ci.hotspot;
import java.util.Map;
+ import java.util.Objects;
import jdk.vm.ci.code.BailoutException;
import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.code.CodeCacheProvider;
import jdk.vm.ci.code.CompiledCode;
*** 100,128 ****
--- 101,146 ----
}
@Override
public InstalledCode installCode(ResolvedJavaMethod method, CompiledCode compiledCode, InstalledCode installedCode, SpeculationLog log, boolean isDefault) {
InstalledCode resultInstalledCode;
! if (installedCode == null) {
! if (installedCode != null) {
+ throw new IllegalArgumentException("InstalledCode argument must be null");
+ }
+ HotSpotCompiledCode hsCompiledCode = (HotSpotCompiledCode) compiledCode;
+ String name = hsCompiledCode.getName();
+ HotSpotCompiledNmethod hsCompiledNmethod = null;
if (method == null) {
// Must be a stub
! resultInstalledCode = new HotSpotRuntimeStub(((HotSpotCompiledCode) compiledCode).getName());
} else {
resultInstalledCode = new HotSpotNmethod((HotSpotResolvedJavaMethod) method, ((HotSpotCompiledCode) compiledCode).getName(), isDefault);
}
! resultInstalledCode = new HotSpotRuntimeStub(name);
} else {
! resultInstalledCode = installedCode;
! hsCompiledNmethod = (HotSpotCompiledNmethod) hsCompiledCode;
+ HotSpotResolvedJavaMethodImpl hsMethod = (HotSpotResolvedJavaMethodImpl) method;
+ resultInstalledCode = new HotSpotNmethod(hsMethod, name, isDefault, hsCompiledNmethod.id);
}
- HotSpotSpeculationLog speculationLog = (log != null && log.hasSpeculations()) ? (HotSpotSpeculationLog) log : null;
+ if (log != null) {
+ if (log.hasSpeculations()) {
+ speculationLog = (HotSpotSpeculationLog) log;
+ }
+ }
! int result = runtime.getCompilerToVM().installCode(target, (HotSpotCompiledCode) compiledCode, resultInstalledCode, speculationLog);
! byte[] speculations;
+ long failedSpeculationsAddress;
+ if (speculationLog != null) {
+ speculations = speculationLog.getFlattenedSpeculations(true);
+ failedSpeculationsAddress = speculationLog.getFailedSpeculationsAddress();
+ } else {
+ speculations = new byte[0];
+ failedSpeculationsAddress = 0L;
+ }
+ int result = runtime.getCompilerToVM().installCode(target, (HotSpotCompiledCode) compiledCode, resultInstalledCode, failedSpeculationsAddress, speculations);
if (result != config.codeInstallResultOk) {
String resultDesc = config.getCodeInstallResultDescription(result);
! if (compiledCode instanceof HotSpotCompiledNmethod) {
! HotSpotCompiledNmethod compiledNmethod = (HotSpotCompiledNmethod) compiledCode;
String msg = compiledNmethod.getInstallationFailureMessage();
! if (hsCompiledNmethod != null) {
! String msg = hsCompiledNmethod.getInstallationFailureMessage();
if (msg != null) {
msg = String.format("Code installation failed: %s%n%s", resultDesc, msg);
} else {
msg = String.format("Code installation failed: %s", resultDesc);
}
*** 137,147 ****
--- 155,169 ----
return logOrDump(resultInstalledCode, compiledCode);
}
@Override
public void invalidateInstalledCode(InstalledCode installedCode) {
runtime.getCompilerToVM().invalidateInstalledCode(installedCode);
+ if (installedCode instanceof HotSpotNmethod) {
+ runtime.getCompilerToVM().invalidateHotSpotNmethod((HotSpotNmethod) installedCode);
+ } else {
+ throw new IllegalArgumentException("Cannot invalidate a " + Objects.requireNonNull(installedCode).getClass().getName());
+ }
}
@Override
public TargetDescription getTarget() {
return target;
src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java
Index
Unified diffs
Context diffs
Sdiffs
Frames
Patch
New
Old
Previous File
Next File