hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java
changeset 38695 08b834856583
parent 38686 6c51f29cbc5d
child 39421 a9652c919db8
equal deleted inserted replaced
38694:7be3816c7642 38695:08b834856583
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 package jdk.vm.ci.hotspot;
    24 package jdk.vm.ci.hotspot;
    25 
    25 
       
    26 import static jdk.vm.ci.common.InitTimer.timer;
    26 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
    27 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
    27 import static jdk.vm.ci.inittimer.InitTimer.timer;
       
    28 
    28 
    29 import java.lang.reflect.Constructor;
    29 import java.lang.reflect.Constructor;
    30 import java.lang.reflect.Method;
    30 import java.lang.reflect.Method;
    31 
    31 
    32 import jdk.vm.ci.code.BytecodeFrame;
    32 import jdk.vm.ci.code.BytecodeFrame;
    33 import jdk.vm.ci.code.InstalledCode;
    33 import jdk.vm.ci.code.InstalledCode;
    34 import jdk.vm.ci.code.InvalidInstalledCodeException;
    34 import jdk.vm.ci.code.InvalidInstalledCodeException;
    35 import jdk.vm.ci.code.TargetDescription;
    35 import jdk.vm.ci.code.TargetDescription;
       
    36 import jdk.vm.ci.common.InitTimer;
    36 import jdk.vm.ci.common.JVMCIError;
    37 import jdk.vm.ci.common.JVMCIError;
    37 import jdk.vm.ci.hotspotvmconfig.HotSpotVMField;
    38 import jdk.vm.ci.hotspotvmconfig.HotSpotVMField;
    38 import jdk.vm.ci.inittimer.InitTimer;
       
    39 import jdk.vm.ci.meta.JavaType;
    39 import jdk.vm.ci.meta.JavaType;
    40 import jdk.vm.ci.meta.ResolvedJavaMethod;
    40 import jdk.vm.ci.meta.ResolvedJavaMethod;
    41 import jdk.vm.ci.meta.ResolvedJavaType;
    41 import jdk.vm.ci.meta.ResolvedJavaType;
    42 import jdk.internal.misc.Unsafe;
    42 import jdk.internal.misc.Unsafe;
    43 
    43 
    77      * @return a new byte array containing the original bytecode of {@code method}
    77      * @return a new byte array containing the original bytecode of {@code method}
    78      */
    78      */
    79     native byte[] getBytecode(HotSpotResolvedJavaMethodImpl method);
    79     native byte[] getBytecode(HotSpotResolvedJavaMethodImpl method);
    80 
    80 
    81     /**
    81     /**
    82      * Gets the number of entries in {@code method}'s exception handler table or 0 if it has not
    82      * Gets the number of entries in {@code method}'s exception handler table or 0 if it has no
    83      * exception handler table.
    83      * exception handler table.
    84      */
    84      */
    85     native int getExceptionTableLength(HotSpotResolvedJavaMethodImpl method);
    85     native int getExceptionTableLength(HotSpotResolvedJavaMethodImpl method);
    86 
    86 
    87     /**
    87     /**
   313      * @throws JVMCIError if there is something wrong with the compiled code or the associated
   313      * @throws JVMCIError if there is something wrong with the compiled code or the associated
   314      *             metadata.
   314      *             metadata.
   315      */
   315      */
   316     native int installCode(TargetDescription target, HotSpotCompiledCode compiledCode, InstalledCode code, HotSpotSpeculationLog speculationLog);
   316     native int installCode(TargetDescription target, HotSpotCompiledCode compiledCode, InstalledCode code, HotSpotSpeculationLog speculationLog);
   317 
   317 
       
   318     /**
       
   319      * Generates the VM metadata for some compiled code and copies them into {@code metaData}. This
       
   320      * method does not install anything into the code cache.
       
   321      *
       
   322      * @param target the target where this code would be installed
       
   323      * @param compiledCode the result of a compilation
       
   324      * @param metaData the metadata is written to this object
       
   325      * @return the outcome of the installation which will be one of
       
   326      *         {@link HotSpotVMConfig#codeInstallResultOk},
       
   327      *         {@link HotSpotVMConfig#codeInstallResultCacheFull},
       
   328      *         {@link HotSpotVMConfig#codeInstallResultCodeTooLarge},
       
   329      *         {@link HotSpotVMConfig#codeInstallResultDependenciesFailed} or
       
   330      *         {@link HotSpotVMConfig#codeInstallResultDependenciesInvalid}.
       
   331      * @throws JVMCIError if there is something wrong with the compiled code or the metadata
       
   332      */
   318     public native int getMetadata(TargetDescription target, HotSpotCompiledCode compiledCode, HotSpotMetaData metaData);
   333     public native int getMetadata(TargetDescription target, HotSpotCompiledCode compiledCode, HotSpotMetaData metaData);
   319 
   334 
   320     /**
   335     /**
   321      * Resets all compilation statistics.
   336      * Resets all compilation statistics.
   322      */
   337      */
   473      * @return the frame, or {@code null} if the end of the stack was reached during the search
   488      * @return the frame, or {@code null} if the end of the stack was reached during the search
   474      */
   489      */
   475     native HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, ResolvedJavaMethod[] methods, int initialSkip);
   490     native HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, ResolvedJavaMethod[] methods, int initialSkip);
   476 
   491 
   477     /**
   492     /**
   478      * Materializes all virtual objects within {@code stackFrame} updates its locals.
   493      * Materializes all virtual objects within {@code stackFrame} and updates its locals.
   479      *
   494      *
   480      * @param invalidate if {@code true}, the compiled method for the stack frame will be
   495      * @param invalidate if {@code true}, the compiled method for the stack frame will be
   481      *            invalidated.
   496      *            invalidated
   482      */
   497      */
   483     native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate);
   498     native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate);
   484 
   499 
   485     /**
   500     /**
   486      * Gets the v-table index for interface method {@code method} in the receiver {@code type} or
   501      * Gets the v-table index for interface method {@code method} in the receiver {@code type} or
   493     native int getVtableIndexForInterfaceMethod(HotSpotResolvedObjectTypeImpl type, HotSpotResolvedJavaMethodImpl method);
   508     native int getVtableIndexForInterfaceMethod(HotSpotResolvedObjectTypeImpl type, HotSpotResolvedJavaMethodImpl method);
   494 
   509 
   495     /**
   510     /**
   496      * Determines if debug info should also be emitted at non-safepoint locations.
   511      * Determines if debug info should also be emitted at non-safepoint locations.
   497      */
   512      */
   498 
       
   499     native boolean shouldDebugNonSafepoints();
   513     native boolean shouldDebugNonSafepoints();
   500 
   514 
   501     /**
   515     /**
   502      * Writes {@code length} bytes from {@code bytes} starting at offset {@code offset} to the
   516      * Writes {@code length} bytes from {@code bytes} starting at offset {@code offset} to the
   503      * HotSpot's log stream.
   517      * HotSpot's log stream.