1 /*
   2  * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  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.replacements.arraycopy.ArrayCopyForeignCalls.UNSAFE_ARRAYCOPY;
  28 
  29 import java.util.EnumSet;
  30 
  31 import jdk.internal.vm.compiler.collections.EconomicMap;
  32 import jdk.internal.vm.compiler.collections.EconomicSet;
  33 import jdk.internal.vm.compiler.collections.Equivalence;
  34 import jdk.internal.vm.compiler.collections.MapCursor;
  35 import org.graalvm.compiler.code.CompilationResult;
  36 import org.graalvm.compiler.core.common.CompilationIdentifier;
  37 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
  38 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
  39 import org.graalvm.compiler.core.common.spi.ForeignCallLinkage;
  40 import org.graalvm.compiler.core.target.Backend;
  41 import org.graalvm.compiler.graph.Node.ConstantNodeParameter;
  42 import org.graalvm.compiler.graph.Node.NodeIntrinsic;
  43 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
  44 import org.graalvm.compiler.hotspot.nodes.VMErrorNode;
  45 import org.graalvm.compiler.hotspot.nodes.aot.ResolveConstantStubCall;
  46 import org.graalvm.compiler.hotspot.replacements.AESCryptSubstitutions;
  47 import org.graalvm.compiler.hotspot.replacements.BigIntegerSubstitutions;
  48 import org.graalvm.compiler.hotspot.replacements.CipherBlockChainingSubstitutions;
  49 import org.graalvm.compiler.hotspot.replacements.SHA2Substitutions;
  50 import org.graalvm.compiler.hotspot.replacements.SHA5Substitutions;
  51 import org.graalvm.compiler.hotspot.replacements.SHASubstitutions;
  52 import org.graalvm.compiler.hotspot.stubs.ExceptionHandlerStub;
  53 import org.graalvm.compiler.hotspot.stubs.Stub;
  54 import org.graalvm.compiler.hotspot.stubs.UnwindExceptionToCallerStub;
  55 import org.graalvm.compiler.hotspot.word.KlassPointer;
  56 import org.graalvm.compiler.hotspot.word.MethodCountersPointer;
  57 import org.graalvm.compiler.lir.LIR;
  58 import org.graalvm.compiler.lir.LIRFrameState;
  59 import org.graalvm.compiler.lir.LIRInstruction;
  60 import org.graalvm.compiler.lir.LIRInstruction.OperandFlag;
  61 import org.graalvm.compiler.lir.LIRInstruction.OperandMode;
  62 import org.graalvm.compiler.lir.StandardOp.LabelOp;
  63 import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
  64 import org.graalvm.compiler.lir.ValueConsumer;
  65 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
  66 import org.graalvm.compiler.lir.framemap.FrameMap;
  67 import org.graalvm.compiler.nodes.UnwindNode;
  68 import org.graalvm.compiler.nodes.extended.ForeignCallNode;
  69 import org.graalvm.compiler.options.Option;
  70 import org.graalvm.compiler.options.OptionKey;
  71 import org.graalvm.compiler.options.OptionType;
  72 import org.graalvm.compiler.options.OptionValues;
  73 import org.graalvm.compiler.phases.tiers.SuitesProvider;
  74 import org.graalvm.compiler.word.Word;
  75 import jdk.internal.vm.compiler.word.Pointer;
  76 
  77 import jdk.vm.ci.code.CompilationRequest;
  78 import jdk.vm.ci.code.CompiledCode;
  79 import jdk.vm.ci.code.Register;
  80 import jdk.vm.ci.code.RegisterSaveLayout;
  81 import jdk.vm.ci.code.StackSlot;
  82 import jdk.vm.ci.code.ValueUtil;
  83 import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
  84 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
  85 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
  86 import jdk.vm.ci.meta.ResolvedJavaMethod;
  87 import jdk.vm.ci.meta.Value;
  88 import jdk.vm.ci.runtime.JVMCICompiler;
  89 
  90 /**
  91  * HotSpot specific backend.
  92  */
  93 public abstract class HotSpotBackend extends Backend implements FrameMap.ReferenceMapBuilderFactory {
  94 
  95     public static class Options {
  96         // @formatter:off
  97         @Option(help = "Use Graal arithmetic stubs instead of HotSpot stubs where possible")
  98         public static final OptionKey<Boolean> GraalArithmeticStubs = new OptionKey<>(false); // GR-8276
  99         @Option(help = "Enables instruction profiling on assembler level. Valid values are a comma separated list of supported instructions." +
 100                         " Compare with subclasses of Assembler.InstructionCounter.", type = OptionType.Debug)
 101         public static final OptionKey<String> ASMInstructionProfiling = new OptionKey<>(null);
 102         // @formatter:on
 103     }
 104 
 105     /**
 106      * Descriptor for {@link ExceptionHandlerStub}. This stub is called by the
 107      * {@linkplain GraalHotSpotVMConfig#MARKID_EXCEPTION_HANDLER_ENTRY exception handler} in a
 108      * compiled method.
 109      */
 110     public static final ForeignCallDescriptor EXCEPTION_HANDLER = new ForeignCallDescriptor("exceptionHandler", void.class, Object.class, Word.class);
 111 
 112     /**
 113      * Descriptor for SharedRuntime::get_ic_miss_stub().
 114      */
 115     public static final ForeignCallDescriptor IC_MISS_HANDLER = new ForeignCallDescriptor("icMissHandler", void.class);
 116 
 117     /**
 118      * Descriptor for SharedRuntime::get_handle_wrong_method_stub().
 119      */
 120     public static final ForeignCallDescriptor WRONG_METHOD_HANDLER = new ForeignCallDescriptor("wrongMethodHandler", void.class);
 121 
 122     /**
 123      * Descriptor for {@link UnwindExceptionToCallerStub}. This stub is called by code generated
 124      * from {@link UnwindNode}.
 125      */
 126     public static final ForeignCallDescriptor UNWIND_EXCEPTION_TO_CALLER = new ForeignCallDescriptor("unwindExceptionToCaller", void.class, Object.class, Word.class);
 127 
 128     /**
 129      * Descriptor for the arguments when unwinding to an exception handler in a caller.
 130      */
 131     public static final ForeignCallDescriptor EXCEPTION_HANDLER_IN_CALLER = new ForeignCallDescriptor("exceptionHandlerInCaller", void.class, Object.class, Word.class);
 132 
 133     private final HotSpotGraalRuntimeProvider runtime;
 134 
 135     /**
 136      * @see AESCryptSubstitutions#encryptBlockStub(ForeignCallDescriptor, Word, Word, Pointer)
 137      */
 138     public static final ForeignCallDescriptor ENCRYPT_BLOCK = new ForeignCallDescriptor("encrypt_block", void.class, Word.class, Word.class, Pointer.class);
 139 
 140     /**
 141      * @see AESCryptSubstitutions#decryptBlockStub(ForeignCallDescriptor, Word, Word, Pointer)
 142      */
 143     public static final ForeignCallDescriptor DECRYPT_BLOCK = new ForeignCallDescriptor("decrypt_block", void.class, Word.class, Word.class, Pointer.class);
 144 
 145     /**
 146      * @see AESCryptSubstitutions#decryptBlockStub(ForeignCallDescriptor, Word, Word, Pointer)
 147      */
 148     public static final ForeignCallDescriptor DECRYPT_BLOCK_WITH_ORIGINAL_KEY = new ForeignCallDescriptor("decrypt_block_with_original_key", void.class, Word.class, Word.class, Pointer.class,
 149                     Pointer.class);
 150 
 151     /**
 152      * @see CipherBlockChainingSubstitutions#crypt
 153      */
 154     public static final ForeignCallDescriptor ENCRYPT = new ForeignCallDescriptor("encrypt", void.class, Word.class, Word.class, Pointer.class, Pointer.class, int.class);
 155 
 156     /**
 157      * @see CipherBlockChainingSubstitutions#crypt
 158      */
 159     public static final ForeignCallDescriptor DECRYPT = new ForeignCallDescriptor("decrypt", void.class, Word.class, Word.class, Pointer.class, Pointer.class, int.class);
 160 
 161     /**
 162      * @see CipherBlockChainingSubstitutions#crypt
 163      */
 164     public static final ForeignCallDescriptor DECRYPT_WITH_ORIGINAL_KEY = new ForeignCallDescriptor("decrypt_with_original_key", void.class, Word.class, Word.class, Pointer.class, Pointer.class,
 165                     int.class, Pointer.class);
 166 
 167     /**
 168      * @see BigIntegerSubstitutions#multiplyToLen
 169      */
 170     public static final ForeignCallDescriptor MULTIPLY_TO_LEN = new ForeignCallDescriptor("multiplyToLen", void.class, Word.class, int.class, Word.class, int.class, Word.class, int.class);
 171 
 172     public static void multiplyToLenStub(Word xAddr, int xlen, Word yAddr, int ylen, Word zAddr, int zLen) {
 173         multiplyToLenStub(HotSpotBackend.MULTIPLY_TO_LEN, xAddr, xlen, yAddr, ylen, zAddr, zLen);
 174     }
 175 
 176     @NodeIntrinsic(ForeignCallNode.class)
 177     private static native void multiplyToLenStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word xIn, int xLen, Word yIn, int yLen, Word zIn, int zLen);
 178 
 179     /**
 180      * @see BigIntegerSubstitutions#mulAdd
 181      */
 182     public static final ForeignCallDescriptor MUL_ADD = new ForeignCallDescriptor("mulAdd", int.class, Word.class, Word.class, int.class, int.class, int.class);
 183 
 184     public static int mulAddStub(Word inAddr, Word outAddr, int newOffset, int len, int k) {
 185         return mulAddStub(HotSpotBackend.MUL_ADD, inAddr, outAddr, newOffset, len, k);
 186     }
 187 
 188     @NodeIntrinsic(ForeignCallNode.class)
 189     private static native int mulAddStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word inAddr, Word outAddr, int newOffset, int len, int k);
 190 
 191     /**
 192      * @see BigIntegerSubstitutions#implMontgomeryMultiply
 193      */
 194     public static final ForeignCallDescriptor MONTGOMERY_MULTIPLY = new ForeignCallDescriptor("implMontgomeryMultiply", void.class, Word.class, Word.class, Word.class, int.class, long.class,
 195                     Word.class);
 196 
 197     public static void implMontgomeryMultiply(Word aAddr, Word bAddr, Word nAddr, int len, long inv, Word productAddr) {
 198         implMontgomeryMultiply(HotSpotBackend.MONTGOMERY_MULTIPLY, aAddr, bAddr, nAddr, len, inv, productAddr);
 199     }
 200 
 201     @NodeIntrinsic(ForeignCallNode.class)
 202     private static native void implMontgomeryMultiply(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word aAddr, Word bAddr, Word nAddr, int len, long inv, Word productAddr);
 203 
 204     /**
 205      * @see BigIntegerSubstitutions#implMontgomerySquare
 206      */
 207     public static final ForeignCallDescriptor MONTGOMERY_SQUARE = new ForeignCallDescriptor("implMontgomerySquare", void.class, Word.class, Word.class, int.class, long.class, Word.class);
 208 
 209     public static void implMontgomerySquare(Word aAddr, Word nAddr, int len, long inv, Word productAddr) {
 210         implMontgomerySquare(HotSpotBackend.MONTGOMERY_SQUARE, aAddr, nAddr, len, inv, productAddr);
 211     }
 212 
 213     @NodeIntrinsic(ForeignCallNode.class)
 214     private static native void implMontgomerySquare(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word aAddr, Word nAddr, int len, long inv, Word productAddr);
 215 
 216     /**
 217      * @see BigIntegerSubstitutions#implSquareToLen
 218      */
 219     public static final ForeignCallDescriptor SQUARE_TO_LEN = new ForeignCallDescriptor("implSquareToLen", void.class, Word.class, int.class, Word.class, int.class);
 220 
 221     public static void implSquareToLen(Word xAddr, int len, Word zAddr, int zLen) {
 222         implSquareToLen(SQUARE_TO_LEN, xAddr, len, zAddr, zLen);
 223     }
 224 
 225     @NodeIntrinsic(ForeignCallNode.class)
 226     private static native void implSquareToLen(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word xAddr, int len, Word zAddr, int zLen);
 227 
 228     /**
 229      * @see SHASubstitutions#implCompress0
 230      */
 231     public static final ForeignCallDescriptor SHA_IMPL_COMPRESS = new ForeignCallDescriptor("shaImplCompress", void.class, Word.class, Object.class);
 232 
 233     public static void shaImplCompressStub(Word bufAddr, Object state) {
 234         shaImplCompressStub(HotSpotBackend.SHA_IMPL_COMPRESS, bufAddr, state);
 235     }
 236 
 237     @NodeIntrinsic(ForeignCallNode.class)
 238     private static native void shaImplCompressStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word bufAddr, Object state);
 239 
 240     /**
 241      * @see SHA2Substitutions#implCompress0
 242      */
 243     public static final ForeignCallDescriptor SHA2_IMPL_COMPRESS = new ForeignCallDescriptor("sha2ImplCompress", void.class, Word.class, Object.class);
 244 
 245     public static void sha2ImplCompressStub(Word bufAddr, Object state) {
 246         sha2ImplCompressStub(HotSpotBackend.SHA2_IMPL_COMPRESS, bufAddr, state);
 247     }
 248 
 249     @NodeIntrinsic(ForeignCallNode.class)
 250     private static native void sha2ImplCompressStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word bufAddr, Object state);
 251 
 252     /**
 253      * @see SHA5Substitutions#implCompress0
 254      */
 255     public static final ForeignCallDescriptor SHA5_IMPL_COMPRESS = new ForeignCallDescriptor("sha5ImplCompress", void.class, Word.class, Object.class);
 256 
 257     public static void sha5ImplCompressStub(Word bufAddr, Object state) {
 258         sha5ImplCompressStub(HotSpotBackend.SHA5_IMPL_COMPRESS, bufAddr, state);
 259     }
 260 
 261     @NodeIntrinsic(ForeignCallNode.class)
 262     private static native void sha5ImplCompressStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word bufAddr, Object state);
 263 
 264     public static void unsafeArraycopy(Word srcAddr, Word dstAddr, Word size) {
 265         unsafeArraycopyStub(UNSAFE_ARRAYCOPY, srcAddr, dstAddr, size);
 266     }
 267 
 268     @NodeIntrinsic(ForeignCallNode.class)
 269     private static native void unsafeArraycopyStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word srcAddr, Word dstAddr, Word size);
 270 
 271     /**
 272      * @see VMErrorNode
 273      */
 274     public static final ForeignCallDescriptor VM_ERROR = new ForeignCallDescriptor("vm_error", void.class, Object.class, Object.class, long.class);
 275 
 276     /**
 277      * New multi array stub that throws an {@link OutOfMemoryError} on allocation failure.
 278      */
 279     public static final ForeignCallDescriptor NEW_MULTI_ARRAY = new ForeignCallDescriptor("new_multi_array", Object.class, KlassPointer.class, int.class, Word.class);
 280 
 281     /**
 282      * New multi array stub that will return null on allocation failure.
 283      */
 284     public static final ForeignCallDescriptor NEW_MULTI_ARRAY_OR_NULL = new ForeignCallDescriptor("new_multi_array_or_null", Object.class, KlassPointer.class, int.class, Word.class);
 285 
 286     /**
 287      * New array stub that throws an {@link OutOfMemoryError} on allocation failure.
 288      */
 289     public static final ForeignCallDescriptor NEW_ARRAY = new ForeignCallDescriptor("new_array", Object.class, KlassPointer.class, int.class);
 290 
 291     /**
 292      * New array stub that will return null on allocation failure.
 293      */
 294     public static final ForeignCallDescriptor NEW_ARRAY_OR_NULL = new ForeignCallDescriptor("new_array_or_null", Object.class, KlassPointer.class, int.class);
 295 
 296     /**
 297      * New instance stub that throws an {@link OutOfMemoryError} on allocation failure.
 298      */
 299     public static final ForeignCallDescriptor NEW_INSTANCE = new ForeignCallDescriptor("new_instance", Object.class, KlassPointer.class);
 300 
 301     /**
 302      * New instance stub that will return null on allocation failure.
 303      */
 304     public static final ForeignCallDescriptor NEW_INSTANCE_OR_NULL = new ForeignCallDescriptor("new_instance_or_null", Object.class, KlassPointer.class);
 305 
 306     /**
 307      * @see ResolveConstantStubCall
 308      */
 309     public static final ForeignCallDescriptor RESOLVE_STRING_BY_SYMBOL = new ForeignCallDescriptor("resolve_string_by_symbol", Object.class, Word.class, Word.class);
 310 
 311     /**
 312      * @see ResolveConstantStubCall
 313      */
 314     public static final ForeignCallDescriptor RESOLVE_DYNAMIC_INVOKE = new ForeignCallDescriptor("resolve_dynamic_invoke", Object.class, Word.class);
 315 
 316     /**
 317      * @see ResolveConstantStubCall
 318      */
 319     public static final ForeignCallDescriptor RESOLVE_KLASS_BY_SYMBOL = new ForeignCallDescriptor("resolve_klass_by_symbol", Word.class, Word.class, Word.class);
 320 
 321     /**
 322      * @see ResolveConstantStubCall
 323      */
 324     public static final ForeignCallDescriptor INITIALIZE_KLASS_BY_SYMBOL = new ForeignCallDescriptor("initialize_klass_by_symbol", Word.class, Word.class, Word.class);
 325 
 326     /**
 327      * @see ResolveConstantStubCall
 328      */
 329     public static final ForeignCallDescriptor RESOLVE_METHOD_BY_SYMBOL_AND_LOAD_COUNTERS = new ForeignCallDescriptor("resolve_method_by_symbol_and_load_counters", Word.class, Word.class, Word.class,
 330                     Word.class);
 331 
 332     /**
 333      * Tiered support.
 334      */
 335     public static final ForeignCallDescriptor INVOCATION_EVENT = new ForeignCallDescriptor("invocation_event", void.class, MethodCountersPointer.class);
 336     public static final ForeignCallDescriptor BACKEDGE_EVENT = new ForeignCallDescriptor("backedge_event", void.class, MethodCountersPointer.class, int.class, int.class);
 337 
 338     public HotSpotBackend(HotSpotGraalRuntimeProvider runtime, HotSpotProviders providers) {
 339         super(providers);
 340         this.runtime = runtime;
 341     }
 342 
 343     public HotSpotGraalRuntimeProvider getRuntime() {
 344         return runtime;
 345     }
 346 
 347     /**
 348      * Performs any remaining initialization that was deferred until the {@linkplain #getRuntime()
 349      * runtime} object was initialized and this backend was registered with it.
 350      *
 351      * @param jvmciRuntime
 352      * @param options
 353      */
 354     public void completeInitialization(HotSpotJVMCIRuntime jvmciRuntime, OptionValues options) {
 355     }
 356 
 357     /**
 358      * Finds all the registers that are defined by some given LIR.
 359      *
 360      * @param lir the LIR to examine
 361      * @return the registers that are defined by or used as temps for any instruction in {@code lir}
 362      */
 363     protected final EconomicSet<Register> gatherDestroyedCallerRegisters(LIR lir) {
 364         final EconomicSet<Register> destroyedRegisters = EconomicSet.create(Equivalence.IDENTITY);
 365         ValueConsumer defConsumer = new ValueConsumer() {
 366 
 367             @Override
 368             public void visitValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) {
 369                 if (ValueUtil.isRegister(value)) {
 370                     final Register reg = ValueUtil.asRegister(value);
 371                     destroyedRegisters.add(reg);
 372                 }
 373             }
 374         };
 375         for (AbstractBlockBase<?> block : lir.codeEmittingOrder()) {
 376             if (block == null) {
 377                 continue;
 378             }
 379             for (LIRInstruction op : lir.getLIRforBlock(block)) {
 380                 if (op instanceof LabelOp) {
 381                     // Don't consider this as a definition
 382                 } else {
 383                     op.visitEachTemp(defConsumer);
 384                     op.visitEachOutput(defConsumer);
 385                 }
 386             }
 387         }
 388         return translateToCallerRegisters(destroyedRegisters);
 389     }
 390 
 391     /**
 392      * Updates a given stub with respect to the registers it destroys.
 393      * <p>
 394      * Any entry in {@code calleeSaveInfo} that {@linkplain SaveRegistersOp#supportsRemove()
 395      * supports} pruning will have {@code destroyedRegisters}
 396      * {@linkplain SaveRegistersOp#remove(EconomicSet) removed} as these registers are declared as
 397      * temporaries in the stub's {@linkplain ForeignCallLinkage linkage} (and thus will be saved by
 398      * the stub's caller).
 399      *
 400      * @param stub the stub to update
 401      * @param destroyedRegisters the registers destroyed by the stub
 402      * @param calleeSaveInfo a map from debug infos to the operations that provide their
 403      *            {@linkplain RegisterSaveLayout callee-save information}
 404      * @param frameMap used to {@linkplain FrameMap#offsetForStackSlot(StackSlot) convert} a virtual
 405      *            slot to a frame slot index
 406      */
 407     protected void updateStub(Stub stub, EconomicSet<Register> destroyedRegisters, EconomicMap<LIRFrameState, SaveRegistersOp> calleeSaveInfo, FrameMap frameMap) {
 408         stub.initDestroyedCallerRegisters(destroyedRegisters);
 409 
 410         MapCursor<LIRFrameState, SaveRegistersOp> cursor = calleeSaveInfo.getEntries();
 411         while (cursor.advance()) {
 412             SaveRegistersOp save = cursor.getValue();
 413             if (save.supportsRemove()) {
 414                 save.remove(destroyedRegisters);
 415             }
 416             if (cursor.getKey() != LIRFrameState.NO_STATE) {
 417                 cursor.getKey().debugInfo().setCalleeSaveInfo(save.getMap(frameMap));
 418             }
 419         }
 420     }
 421 
 422     @Override
 423     public HotSpotProviders getProviders() {
 424         return (HotSpotProviders) super.getProviders();
 425     }
 426 
 427     @Override
 428     public SuitesProvider getSuites() {
 429         return getProviders().getSuites();
 430     }
 431 
 432     protected void profileInstructions(LIR lir, CompilationResultBuilder crb) {
 433         if (HotSpotBackend.Options.ASMInstructionProfiling.getValue(lir.getOptions()) != null) {
 434             HotSpotInstructionProfiling.countInstructions(lir, crb.asm);
 435         }
 436     }
 437 
 438     @Override
 439     public CompiledCode createCompiledCode(ResolvedJavaMethod method,
 440                     CompilationRequest compilationRequest,
 441                     CompilationResult compResult,
 442                     boolean isDefault,
 443                     OptionValues options) {
 444         assert !isDefault || compResult.getName() == null : "a default nmethod should have a null name since it is associated with a Method*";
 445         HotSpotCompilationRequest compRequest = compilationRequest instanceof HotSpotCompilationRequest ? (HotSpotCompilationRequest) compilationRequest : null;
 446         return HotSpotCompiledCodeBuilder.createCompiledCode(getCodeCache(), method, compRequest, compResult, options);
 447     }
 448 
 449     @Override
 450     public CompilationIdentifier getCompilationIdentifier(ResolvedJavaMethod resolvedJavaMethod) {
 451         if (resolvedJavaMethod instanceof HotSpotResolvedJavaMethod) {
 452             HotSpotCompilationRequest request = new HotSpotCompilationRequest((HotSpotResolvedJavaMethod) resolvedJavaMethod, JVMCICompiler.INVOCATION_ENTRY_BCI, 0L);
 453             return new HotSpotCompilationIdentifier(request);
 454         }
 455         return super.getCompilationIdentifier(resolvedJavaMethod);
 456     }
 457 }