127
128 byte[] speculations;
129 long failedSpeculationsAddress;
130 if (speculationLog != null) {
131 speculations = speculationLog.getFlattenedSpeculations(true);
132 failedSpeculationsAddress = speculationLog.getFailedSpeculationsAddress();
133 } else {
134 speculations = new byte[0];
135 failedSpeculationsAddress = 0L;
136 }
137 int result = runtime.getCompilerToVM().installCode(target, (HotSpotCompiledCode) compiledCode, resultInstalledCode, failedSpeculationsAddress, speculations);
138 if (result != config.codeInstallResultOk) {
139 String resultDesc = config.getCodeInstallResultDescription(result);
140 if (hsCompiledNmethod != null) {
141 String msg = hsCompiledNmethod.getInstallationFailureMessage();
142 if (msg != null) {
143 msg = String.format("Code installation failed: %s%n%s", resultDesc, msg);
144 } else {
145 msg = String.format("Code installation failed: %s", resultDesc);
146 }
147 if (result == config.codeInstallResultDependenciesInvalid) {
148 throw new AssertionError(resultDesc + " " + msg);
149 }
150 throw new BailoutException(result != config.codeInstallResultDependenciesFailed, msg);
151 } else {
152 throw new BailoutException("Error installing %s: %s", ((HotSpotCompiledCode) compiledCode).getName(), resultDesc);
153 }
154 }
155 return logOrDump(resultInstalledCode, compiledCode);
156 }
157
158 @Override
159 public void invalidateInstalledCode(InstalledCode installedCode) {
160 if (installedCode instanceof HotSpotNmethod) {
161 runtime.getCompilerToVM().invalidateHotSpotNmethod((HotSpotNmethod) installedCode);
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;
|
127
128 byte[] speculations;
129 long failedSpeculationsAddress;
130 if (speculationLog != null) {
131 speculations = speculationLog.getFlattenedSpeculations(true);
132 failedSpeculationsAddress = speculationLog.getFailedSpeculationsAddress();
133 } else {
134 speculations = new byte[0];
135 failedSpeculationsAddress = 0L;
136 }
137 int result = runtime.getCompilerToVM().installCode(target, (HotSpotCompiledCode) compiledCode, resultInstalledCode, failedSpeculationsAddress, speculations);
138 if (result != config.codeInstallResultOk) {
139 String resultDesc = config.getCodeInstallResultDescription(result);
140 if (hsCompiledNmethod != null) {
141 String msg = hsCompiledNmethod.getInstallationFailureMessage();
142 if (msg != null) {
143 msg = String.format("Code installation failed: %s%n%s", resultDesc, msg);
144 } else {
145 msg = String.format("Code installation failed: %s", resultDesc);
146 }
147 throw new BailoutException(result != config.codeInstallResultDependenciesFailed, msg);
148 } else {
149 throw new BailoutException("Error installing %s: %s", ((HotSpotCompiledCode) compiledCode).getName(), resultDesc);
150 }
151 }
152 return logOrDump(resultInstalledCode, compiledCode);
153 }
154
155 @Override
156 public void invalidateInstalledCode(InstalledCode installedCode) {
157 if (installedCode instanceof HotSpotNmethod) {
158 runtime.getCompilerToVM().invalidateHotSpotNmethod((HotSpotNmethod) installedCode);
159 } else {
160 throw new IllegalArgumentException("Cannot invalidate a " + Objects.requireNonNull(installedCode).getClass().getName());
161 }
162 }
163
164 @Override
165 public TargetDescription getTarget() {
166 return target;
|