/*
 * Copyright (c) 2011, 2020, 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.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

package jdk.vm.ci.hotspot;

import static jdk.vm.ci.common.InitTimer.timer;
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;

import java.lang.reflect.Executable;
import java.lang.reflect.Field;

import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.code.InvalidInstalledCodeException;
import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.code.stack.InspectedFrameVisitor;
import jdk.vm.ci.common.InitTimer;
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.ConstantReflectionProvider;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaType;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.ResolvedJavaType;

Calls from Java into HotSpot. The behavior of all the methods in this class that take a native pointer as an argument (e.g., getSymbol(long)) is undefined if the argument does not denote a valid native object.
/** * Calls from Java into HotSpot. The behavior of all the methods in this class that take a native * pointer as an argument (e.g., {@link #getSymbol(long)}) is undefined if the argument does not * denote a valid native object. */
final class CompilerToVM {
Initializes the native part of the JVMCI runtime.
/** * Initializes the native part of the JVMCI runtime. */
private static native void registerNatives();
These values mirror the equivalent values from Unsafe but are appropriate for the JVM being compiled against.
/** * These values mirror the equivalent values from {@code Unsafe} but are appropriate for the JVM * being compiled against. */
// Checkstyle: stop final int ARRAY_BOOLEAN_BASE_OFFSET; final int ARRAY_BYTE_BASE_OFFSET; final int ARRAY_SHORT_BASE_OFFSET; final int ARRAY_CHAR_BASE_OFFSET; final int ARRAY_INT_BASE_OFFSET; final int ARRAY_LONG_BASE_OFFSET; final int ARRAY_FLOAT_BASE_OFFSET; final int ARRAY_DOUBLE_BASE_OFFSET; final int ARRAY_OBJECT_BASE_OFFSET; final int ARRAY_BOOLEAN_INDEX_SCALE; final int ARRAY_BYTE_INDEX_SCALE; final int ARRAY_SHORT_INDEX_SCALE; final int ARRAY_CHAR_INDEX_SCALE; final int ARRAY_INT_INDEX_SCALE; final int ARRAY_LONG_INDEX_SCALE; final int ARRAY_FLOAT_INDEX_SCALE; final int ARRAY_DOUBLE_INDEX_SCALE; final int ARRAY_OBJECT_INDEX_SCALE; // Checkstyle: resume @SuppressWarnings("try") CompilerToVM() { try (InitTimer t = timer("CompilerToVM.registerNatives")) { registerNatives(); ARRAY_BOOLEAN_BASE_OFFSET = arrayBaseOffset(JavaKind.Boolean); ARRAY_BYTE_BASE_OFFSET = arrayBaseOffset(JavaKind.Byte); ARRAY_SHORT_BASE_OFFSET = arrayBaseOffset(JavaKind.Short); ARRAY_CHAR_BASE_OFFSET = arrayBaseOffset(JavaKind.Char); ARRAY_INT_BASE_OFFSET = arrayBaseOffset(JavaKind.Int); ARRAY_LONG_BASE_OFFSET = arrayBaseOffset(JavaKind.Long); ARRAY_FLOAT_BASE_OFFSET = arrayBaseOffset(JavaKind.Float); ARRAY_DOUBLE_BASE_OFFSET = arrayBaseOffset(JavaKind.Double); ARRAY_OBJECT_BASE_OFFSET = arrayBaseOffset(JavaKind.Object); ARRAY_BOOLEAN_INDEX_SCALE = arrayIndexScale(JavaKind.Boolean); ARRAY_BYTE_INDEX_SCALE = arrayIndexScale(JavaKind.Byte); ARRAY_SHORT_INDEX_SCALE = arrayIndexScale(JavaKind.Short); ARRAY_CHAR_INDEX_SCALE = arrayIndexScale(JavaKind.Char); ARRAY_INT_INDEX_SCALE = arrayIndexScale(JavaKind.Int); ARRAY_LONG_INDEX_SCALE = arrayIndexScale(JavaKind.Long); ARRAY_FLOAT_INDEX_SCALE = arrayIndexScale(JavaKind.Float); ARRAY_DOUBLE_INDEX_SCALE = arrayIndexScale(JavaKind.Double); ARRAY_OBJECT_INDEX_SCALE = arrayIndexScale(JavaKind.Object); } } native int arrayBaseOffset(JavaKind kind); native int arrayIndexScale(JavaKind kind);
Gets the CompilerToVM instance associated with the singleton HotSpotJVMCIRuntime instance.
/** * Gets the {@link CompilerToVM} instance associated with the singleton * {@link HotSpotJVMCIRuntime} instance. */
public static CompilerToVM compilerToVM() { return runtime().getCompilerToVM(); }
Copies the original bytecode of method into a new byte array and returns it.
Returns:a new byte array containing the original bytecode of method
/** * Copies the original bytecode of {@code method} into a new byte array and returns it. * * @return a new byte array containing the original bytecode of {@code method} */
native byte[] getBytecode(HotSpotResolvedJavaMethodImpl method);
Gets the number of entries in method's exception handler table or 0 if it has no exception handler table.
/** * Gets the number of entries in {@code method}'s exception handler table or 0 if it has no * exception handler table. */
native int getExceptionTableLength(HotSpotResolvedJavaMethodImpl method);
Returns:0 if method has no exception handlers (i.e. getExceptionTableLength(method) == 0)
/** * Gets the address of the first entry in {@code method}'s exception handler table. * * Each entry is a native object described by these fields: * * <ul> * <li>{@link HotSpotVMConfig#exceptionTableElementSize}</li> * <li>{@link HotSpotVMConfig#exceptionTableElementStartPcOffset}</li> * <li>{@link HotSpotVMConfig#exceptionTableElementEndPcOffset}</li> * <li>{@link HotSpotVMConfig#exceptionTableElementHandlerPcOffset}</li> * <li>{@link HotSpotVMConfig#exceptionTableElementCatchTypeIndexOffset} * </ul> * * @return 0 if {@code method} has no exception handlers (i.e. * {@code getExceptionTableLength(method) == 0}) */
native long getExceptionTableStart(HotSpotResolvedJavaMethodImpl method);
Determines whether method is currently compilable by the JVMCI compiler being used by the VM. This can return false if JVMCI compilation failed earlier for method, a breakpoint is currently set in method or method contains other bytecode features that require special handling by the VM.
/** * Determines whether {@code method} is currently compilable by the JVMCI compiler being used by * the VM. This can return false if JVMCI compilation failed earlier for {@code method}, a * breakpoint is currently set in {@code method} or {@code method} contains other bytecode * features that require special handling by the VM. */
native boolean isCompilable(HotSpotResolvedJavaMethodImpl method);
Determines if method is targeted by a VM directive (e.g., -XX:CompileCommand=dontinline,<pattern>) or annotation (e.g., jdk.internal.vm.annotation.DontInline) that specifies it should not be inlined.
/** * Determines if {@code method} is targeted by a VM directive (e.g., * {@code -XX:CompileCommand=dontinline,<pattern>}) or annotation (e.g., * {@code jdk.internal.vm.annotation.DontInline}) that specifies it should not be inlined. */
native boolean hasNeverInlineDirective(HotSpotResolvedJavaMethodImpl method);
Determines if method should be inlined at any cost. This could be because:
  • a CompileOracle directive may forces inlining of this methods
  • an annotation forces inlining of this method
/** * Determines if {@code method} should be inlined at any cost. This could be because: * <ul> * <li>a CompileOracle directive may forces inlining of this methods</li> * <li>an annotation forces inlining of this method</li> * </ul> */
native boolean shouldInlineMethod(HotSpotResolvedJavaMethodImpl method);
Params:
  • method – the method on which to base the search
  • actualHolderType – the best known type of receiver
Returns:the method result or 0 is there is no unique concrete method for method
/** * Used to implement {@link ResolvedJavaType#findUniqueConcreteMethod(ResolvedJavaMethod)}. * * @param method the method on which to base the search * @param actualHolderType the best known type of receiver * @return the method result or 0 is there is no unique concrete method for {@code method} */
native HotSpotResolvedJavaMethodImpl findUniqueConcreteMethod(HotSpotResolvedObjectTypeImpl actualHolderType, HotSpotResolvedJavaMethodImpl method);
Gets the implementor for the interface class type.
Throws:
Returns:the implementor if there is a single implementor, null if there is no implementor, or type itself if there is more than one implementor
/** * Gets the implementor for the interface class {@code type}. * * @return the implementor if there is a single implementor, {@code null} if there is no * implementor, or {@code type} itself if there is more than one implementor * @throws IllegalArgumentException if type is not an interface type */
native HotSpotResolvedObjectTypeImpl getImplementor(HotSpotResolvedObjectTypeImpl type);
Determines if method is ignored by security stack walks.
/** * Determines if {@code method} is ignored by security stack walks. */
native boolean methodIsIgnoredBySecurityStackWalk(HotSpotResolvedJavaMethodImpl method);
Converts a name to a type.
Params:
  • name – a well formed Java type in internal format
  • accessingClass – the context of resolution. A value of null implies that the class should be resolved with the class loader.
  • resolve – force resolution to a ResolvedJavaType. If true, this method will either return a ResolvedJavaType or throw an exception
Throws:
Returns:the type for name or 0 if resolution failed and resolve == false
/** * Converts a name to a type. * * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format * @param accessingClass the context of resolution. A value of {@code null} implies that the * class should be resolved with the class loader. * @param resolve force resolution to a {@link ResolvedJavaType}. If true, this method will * either return a {@link ResolvedJavaType} or throw an exception * @return the type for {@code name} or 0 if resolution failed and {@code resolve == false} * @throws ClassNotFoundException if {@code resolve == true} and the resolution failed */
native HotSpotResolvedJavaType lookupType(String name, HotSpotResolvedObjectTypeImpl accessingClass, boolean resolve) throws ClassNotFoundException; native HotSpotResolvedJavaType lookupClass(Class<?> javaClass);
Resolves the entry at index cpi in constantPool to an object, looking in the constant pool cache first. The behavior of this method is undefined if cpi does not denote one of the following entry types: JVM_CONSTANT_String, JVM_CONSTANT_MethodHandle, JVM_CONSTANT_MethodHandleInError, JVM_CONSTANT_MethodType and JVM_CONSTANT_MethodTypeInError.
/** * Resolves the entry at index {@code cpi} in {@code constantPool} to an object, looking in the * constant pool cache first. * * The behavior of this method is undefined if {@code cpi} does not denote one of the following * entry types: {@code JVM_CONSTANT_String}, {@code JVM_CONSTANT_MethodHandle}, * {@code JVM_CONSTANT_MethodHandleInError}, {@code JVM_CONSTANT_MethodType} and * {@code JVM_CONSTANT_MethodTypeInError}. */
native HotSpotObjectConstantImpl resolvePossiblyCachedConstantInPool(HotSpotConstantPool constantPool, int cpi);
Gets the JVM_CONSTANT_NameAndType index from the entry at index cpi in constantPool. The behavior of this method is undefined if cpi does not denote an entry containing a JVM_CONSTANT_NameAndType index.
/** * Gets the {@code JVM_CONSTANT_NameAndType} index from the entry at index {@code cpi} in * {@code constantPool}. * * The behavior of this method is undefined if {@code cpi} does not denote an entry containing a * {@code JVM_CONSTANT_NameAndType} index. */
native int lookupNameAndTypeRefIndexInPool(HotSpotConstantPool constantPool, int cpi);
Gets the name of the JVM_CONSTANT_NameAndType entry referenced by another entry denoted by which in constantPool. The behavior of this method is undefined if which does not denote a entry that references a JVM_CONSTANT_NameAndType entry.
/** * Gets the name of the {@code JVM_CONSTANT_NameAndType} entry referenced by another entry * denoted by {@code which} in {@code constantPool}. * * The behavior of this method is undefined if {@code which} does not denote a entry that * references a {@code JVM_CONSTANT_NameAndType} entry. */
native String lookupNameInPool(HotSpotConstantPool constantPool, int which);
Gets the signature of the JVM_CONSTANT_NameAndType entry referenced by another entry denoted by which in constantPool. The behavior of this method is undefined if which does not denote a entry that references a JVM_CONSTANT_NameAndType entry.
/** * Gets the signature of the {@code JVM_CONSTANT_NameAndType} entry referenced by another entry * denoted by {@code which} in {@code constantPool}. * * The behavior of this method is undefined if {@code which} does not denote a entry that * references a {@code JVM_CONSTANT_NameAndType} entry. */
native String lookupSignatureInPool(HotSpotConstantPool constantPool, int which);
Gets the JVM_CONSTANT_Class index from the entry at index cpi in constantPool. The behavior of this method is undefined if cpi does not denote an entry containing a JVM_CONSTANT_Class index.
/** * Gets the {@code JVM_CONSTANT_Class} index from the entry at index {@code cpi} in * {@code constantPool}. * * The behavior of this method is undefined if {@code cpi} does not denote an entry containing a * {@code JVM_CONSTANT_Class} index. */
native int lookupKlassRefIndexInPool(HotSpotConstantPool constantPool, int cpi);
Looks up a class denoted by the JVM_CONSTANT_Class entry at index cpi in constantPool. This method does not perform any resolution. The behavior of this method is undefined if cpi does not denote a JVM_CONSTANT_Class entry.
Returns:the resolved class entry or a String otherwise
/** * Looks up a class denoted by the {@code JVM_CONSTANT_Class} entry at index {@code cpi} in * {@code constantPool}. This method does not perform any resolution. * * The behavior of this method is undefined if {@code cpi} does not denote a * {@code JVM_CONSTANT_Class} entry. * * @return the resolved class entry or a String otherwise */
native Object lookupKlassInPool(HotSpotConstantPool constantPool, int cpi);
Looks up a method denoted by the entry at index cpi in constantPool. This method does not perform any resolution. The behavior of this method is undefined if cpi does not denote an entry representing a method.
Params:
  • opcode – the opcode of the instruction for which the lookup is being performed or -1. If non-negative, then resolution checks specific to the bytecode it denotes are performed if the method is already resolved. Should any of these checks fail, 0 is returned.
Returns:the resolved method entry, 0 otherwise
/** * Looks up a method denoted by the entry at index {@code cpi} in {@code constantPool}. This * method does not perform any resolution. * * The behavior of this method is undefined if {@code cpi} does not denote an entry representing * a method. * * @param opcode the opcode of the instruction for which the lookup is being performed or * {@code -1}. If non-negative, then resolution checks specific to the bytecode it * denotes are performed if the method is already resolved. Should any of these * checks fail, 0 is returned. * @return the resolved method entry, 0 otherwise */
native HotSpotResolvedJavaMethodImpl lookupMethodInPool(HotSpotConstantPool constantPool, int cpi, byte opcode); // TODO resolving JVM_CONSTANT_Dynamic
Ensures that the type referenced by the specified JVM_CONSTANT_InvokeDynamic entry at index cpi in constantPool is loaded and initialized. The behavior of this method is undefined if cpi does not denote a JVM_CONSTANT_InvokeDynamic entry.
/** * Ensures that the type referenced by the specified {@code JVM_CONSTANT_InvokeDynamic} entry at * index {@code cpi} in {@code constantPool} is loaded and initialized. * * The behavior of this method is undefined if {@code cpi} does not denote a * {@code JVM_CONSTANT_InvokeDynamic} entry. */
native void resolveInvokeDynamicInPool(HotSpotConstantPool constantPool, int cpi);
If cpi denotes an entry representing a signature polymorphic method, this method ensures that the type referenced by the entry is loaded and initialized. It cpi does not denote a signature polymorphic method, this method does nothing.
/** * If {@code cpi} denotes an entry representing a * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature * polymorphic</a> method, this method ensures that the type referenced by the entry is loaded * and initialized. It {@code cpi} does not denote a signature polymorphic method, this method * does nothing. */
native void resolveInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi);
If cpi denotes an entry representing a resolved dynamic adapter (see resolveInvokeDynamicInPool and resolveInvokeHandleInPool), return the opcode of the instruction for which the resolution was performed (invokedynamic or invokevirtual), or -1 otherwise.
/** * If {@code cpi} denotes an entry representing a resolved dynamic adapter (see * {@link #resolveInvokeDynamicInPool} and {@link #resolveInvokeHandleInPool}), return the * opcode of the instruction for which the resolution was performed ({@code invokedynamic} or * {@code invokevirtual}), or {@code -1} otherwise. */
native int isResolvedInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi);
Gets the list of type names (in the format of JavaType.getName()) denoting the classes that define signature polymorphic methods.
/** * Gets the list of type names (in the format of {@link JavaType#getName()}) denoting the * classes that define signature polymorphic methods. */
native String[] getSignaturePolymorphicHolders();
Gets the resolved type denoted by the entry at index cpi in constantPool. The behavior of this method is undefined if cpi does not denote an entry representing a class.
Throws:
/** * Gets the resolved type denoted by the entry at index {@code cpi} in {@code constantPool}. * * The behavior of this method is undefined if {@code cpi} does not denote an entry representing * a class. * * @throws LinkageError if resolution failed */
native HotSpotResolvedObjectTypeImpl resolveTypeInPool(HotSpotConstantPool constantPool, int cpi) throws LinkageError;
Looks up and attempts to resolve the JVM_CONSTANT_Field entry for at index cpi in constantPool. For some opcodes, checks are performed that require the method that contains opcode to be specified. The values returned in info are:
    [ flags,  // fieldDescriptor::access_flags()
      offset, // fieldDescriptor::offset()
      index   // fieldDescriptor::index()
    ]
The behavior of this method is undefined if cpi does not denote a JVM_CONSTANT_Field entry.
Params:
  • info – an array in which the details of the field are returned
Returns:the type defining the field if resolution is successful, 0 otherwise
/** * Looks up and attempts to resolve the {@code JVM_CONSTANT_Field} entry for at index * {@code cpi} in {@code constantPool}. For some opcodes, checks are performed that require the * {@code method} that contains {@code opcode} to be specified. The values returned in * {@code info} are: * * <pre> * [ flags, // fieldDescriptor::access_flags() * offset, // fieldDescriptor::offset() * index // fieldDescriptor::index() * ] * </pre> * * The behavior of this method is undefined if {@code cpi} does not denote a * {@code JVM_CONSTANT_Field} entry. * * @param info an array in which the details of the field are returned * @return the type defining the field if resolution is successful, 0 otherwise */
native HotSpotResolvedObjectTypeImpl resolveFieldInPool(HotSpotConstantPool constantPool, int cpi, HotSpotResolvedJavaMethodImpl method, byte opcode, int[] info);
Converts cpci from an index into the cache for constantPool to an index directly into constantPool. The behavior of this method is undefined if ccpi is an invalid constant pool cache index.
/** * Converts {@code cpci} from an index into the cache for {@code constantPool} to an index * directly into {@code constantPool}. * * The behavior of this method is undefined if {@code ccpi} is an invalid constant pool cache * index. */
native int constantPoolRemapInstructionOperandFromCache(HotSpotConstantPool constantPool, int cpci);
Gets the appendix object (if any) associated with the entry at index cpi in constantPool.
/** * Gets the appendix object (if any) associated with the entry at index {@code cpi} in * {@code constantPool}. */
native HotSpotObjectConstantImpl lookupAppendixInPool(HotSpotConstantPool constantPool, int cpi);
Installs the result of a compilation into the code cache.
Params:
  • target – the target where this code should be installed
  • compiledCode – the result of a compilation
  • code – the details of the installed CodeBlob are written to this object
Throws:
  • JVMCIError – if there is something wrong with the compiled code or the associated metadata.
Returns:the outcome of the installation which will be one of HotSpotVMConfig.codeInstallResultOk, HotSpotVMConfig.codeInstallResultCacheFull, HotSpotVMConfig.codeInstallResultCodeTooLarge or HotSpotVMConfig.codeInstallResultDependenciesFailed.
/** * Installs the result of a compilation into the code cache. * * @param target the target where this code should be installed * @param compiledCode the result of a compilation * @param code the details of the installed CodeBlob are written to this object * @return the outcome of the installation which will be one of * {@link HotSpotVMConfig#codeInstallResultOk}, * {@link HotSpotVMConfig#codeInstallResultCacheFull}, * {@link HotSpotVMConfig#codeInstallResultCodeTooLarge} or * {@link HotSpotVMConfig#codeInstallResultDependenciesFailed}. * @throws JVMCIError if there is something wrong with the compiled code or the associated * metadata. */
native int installCode(TargetDescription target, HotSpotCompiledCode compiledCode, InstalledCode code, long failedSpeculationsAddress, byte[] speculations);
Generates the VM metadata for some compiled code and copies them into metaData. This method does not install anything into the code cache.
Params:
  • target – the target where this code would be installed
  • compiledCode – the result of a compilation
  • metaData – the metadata is written to this object
Throws:
  • JVMCIError – if there is something wrong with the compiled code or the metadata
Returns:the outcome of the installation which will be one of HotSpotVMConfig.codeInstallResultOk, HotSpotVMConfig.codeInstallResultCacheFull, HotSpotVMConfig.codeInstallResultCodeTooLarge or HotSpotVMConfig.codeInstallResultDependenciesFailed.
/** * Generates the VM metadata for some compiled code and copies them into {@code metaData}. This * method does not install anything into the code cache. * * @param target the target where this code would be installed * @param compiledCode the result of a compilation * @param metaData the metadata is written to this object * @return the outcome of the installation which will be one of * {@link HotSpotVMConfig#codeInstallResultOk}, * {@link HotSpotVMConfig#codeInstallResultCacheFull}, * {@link HotSpotVMConfig#codeInstallResultCodeTooLarge} or * {@link HotSpotVMConfig#codeInstallResultDependenciesFailed}. * @throws JVMCIError if there is something wrong with the compiled code or the metadata */
native int getMetadata(TargetDescription target, HotSpotCompiledCode compiledCode, HotSpotMetaData metaData);
Resets all compilation statistics.
/** * Resets all compilation statistics. */
native void resetCompilationStatistics();
Reads the database of VM info. The return value encodes the info in a nested object array that is described by the pseudo Java object info below:
    info = [
        VMField[] vmFields,
        [String name, Long size, ...] vmTypeSizes,
        [String name, Long value, ...] vmConstants,
        [String name, Long value, ...] vmAddresses,
        VMFlag[] vmFlags
        VMIntrinsicMethod[] vmIntrinsics
    ]
Returns:VM info as encoded above
/** * Reads the database of VM info. The return value encodes the info in a nested object array * that is described by the pseudo Java object {@code info} below: * * <pre> * info = [ * VMField[] vmFields, * [String name, Long size, ...] vmTypeSizes, * [String name, Long value, ...] vmConstants, * [String name, Long value, ...] vmAddresses, * VMFlag[] vmFlags * VMIntrinsicMethod[] vmIntrinsics * ] * </pre> * * @return VM info as encoded above */
native Object[] readConfiguration();
Resolves the implementation of method for virtual dispatches on objects of dynamic type exactReceiver. This resolution process only searches "up" the class hierarchy of exactReceiver.
Params:
  • caller – the caller or context type used to perform access checks
Returns:the link-time resolved method (might be abstract) or null if it is either a signature polymorphic method or can not be linked.
/** * Resolves the implementation of {@code method} for virtual dispatches on objects of dynamic * type {@code exactReceiver}. This resolution process only searches "up" the class hierarchy of * {@code exactReceiver}. * * @param caller the caller or context type used to perform access checks * @return the link-time resolved method (might be abstract) or {@code null} if it is either a * signature polymorphic method or can not be linked. */
native HotSpotResolvedJavaMethodImpl resolveMethod(HotSpotResolvedObjectTypeImpl exactReceiver, HotSpotResolvedJavaMethodImpl method, HotSpotResolvedObjectTypeImpl caller);
Gets the static initializer of type.
Returns:null if type has no static initializer
/** * Gets the static initializer of {@code type}. * * @return {@code null} if {@code type} has no static initializer */
native HotSpotResolvedJavaMethodImpl getClassInitializer(HotSpotResolvedObjectTypeImpl type);
Determines if type or any of its currently loaded subclasses overrides Object.finalize().
/** * Determines if {@code type} or any of its currently loaded subclasses overrides * {@code Object.finalize()}. */
native boolean hasFinalizableSubclass(HotSpotResolvedObjectTypeImpl type);
Gets the method corresponding to executable.
/** * Gets the method corresponding to {@code executable}. */
native HotSpotResolvedJavaMethodImpl asResolvedJavaMethod(Executable executable);
Gets the maximum absolute offset of a PC relative call to address from any position in the code cache.
Params:
  • address – an address that may be called from any code in the code cache
Returns:-1 if address == 0
/** * Gets the maximum absolute offset of a PC relative call to {@code address} from any position * in the code cache. * * @param address an address that may be called from any code in the code cache * @return -1 if {@code address == 0} */
native long getMaxCallTargetOffset(long address);
Gets a textual disassembly of codeBlob.
Returns:a non-zero length string containing a disassembly of codeBlob or null if codeBlob could not be disassembled for some reason
/** * Gets a textual disassembly of {@code codeBlob}. * * @return a non-zero length string containing a disassembly of {@code codeBlob} or null if * {@code codeBlob} could not be disassembled for some reason */
// The HotSpot disassembler seems not to be thread safe so it's better to synchronize its usage synchronized native String disassembleCodeBlob(InstalledCode installedCode);
Gets a stack trace element for method at bytecode index bci.
/** * Gets a stack trace element for {@code method} at bytecode index {@code bci}. */
native StackTraceElement getStackTraceElement(HotSpotResolvedJavaMethodImpl method, int bci);
Executes some installedCode with arguments args.
Throws:
Returns:the result of executing nmethodMirror
/** * Executes some {@code installedCode} with arguments {@code args}. * * @return the result of executing {@code nmethodMirror} * @throws InvalidInstalledCodeException if {@code nmethodMirror} has been invalidated */
native Object executeHotSpotNmethod(Object[] args, HotSpotNmethod nmethodMirror) throws InvalidInstalledCodeException;
Gets the line number table for method. The line number table is encoded as (bci, source line number) pairs.
Returns:the line number table for method or null if it doesn't have one
/** * Gets the line number table for {@code method}. The line number table is encoded as (bci, * source line number) pairs. * * @return the line number table for {@code method} or null if it doesn't have one */
native long[] getLineNumberTable(HotSpotResolvedJavaMethodImpl method);
Gets the number of entries in the local variable table for method.
Returns:the number of entries in the local variable table for method
/** * Gets the number of entries in the local variable table for {@code method}. * * @return the number of entries in the local variable table for {@code method} */
native int getLocalVariableTableLength(HotSpotResolvedJavaMethodImpl method);
Returns:0 if method does not have a local variable table
/** * Gets the address of the first entry in the local variable table for {@code method}. * * Each entry is a native object described by these fields: * * <ul> * <li>{@link HotSpotVMConfig#localVariableTableElementSize}</li> * <li>{@link HotSpotVMConfig#localVariableTableElementLengthOffset}</li> * <li>{@link HotSpotVMConfig#localVariableTableElementNameCpIndexOffset}</li> * <li>{@link HotSpotVMConfig#localVariableTableElementDescriptorCpIndexOffset}</li> * <li>{@link HotSpotVMConfig#localVariableTableElementSlotOffset} * <li>{@link HotSpotVMConfig#localVariableTableElementStartBciOffset} * </ul> * * @return 0 if {@code method} does not have a local variable table */
native long getLocalVariableTableStart(HotSpotResolvedJavaMethodImpl method);
Reads an object pointer within a VM data structure. That is, any VMField whose type is "oop" (e.g., Klass::_java_mirror, JavaThread::_threadObj). Note that Unsafe.getObject(Object, long) cannot be used for this since it does a narrowOop read if the VM is using compressed oops whereas oops within VM data structures are (currently) always uncompressed.
Params:
  • address – address of an oop field within a VM data structure
/** * Reads an object pointer within a VM data structure. That is, any {@link VMField} whose * {@link VMField#type type} is {@code "oop"} (e.g., {@code Klass::_java_mirror}, * {@code JavaThread::_threadObj}). * * Note that {@code Unsafe.getObject(Object, long)} cannot be used for this since it does a * {@code narrowOop} read if the VM is using compressed oops whereas oops within VM data * structures are (currently) always uncompressed. * * @param address address of an oop field within a VM data structure */
native HotSpotObjectConstantImpl readUncompressedOop(long address);
Sets flags on method indicating that it should never be inlined or compiled by the VM.
/** * Sets flags on {@code method} indicating that it should never be inlined or compiled by the * VM. */
native void setNotInlinableOrCompilable(HotSpotResolvedJavaMethodImpl method);
Invalidates the profiling information for method and (re)initializes it such that profiling restarts upon its next invocation.
/** * Invalidates the profiling information for {@code method} and (re)initializes it such that * profiling restarts upon its next invocation. */
native void reprofile(HotSpotResolvedJavaMethodImpl method);
Invalidates nmethodMirror such that InvalidInstalledCodeException will be raised the next time nmethodMirror is executed. The nmethod associated with nmethodMirror is also made non-entrant and any current activations of the nmethod are deoptimized.
/** * Invalidates {@code nmethodMirror} such that {@link InvalidInstalledCodeException} will be * raised the next time {@code nmethodMirror} is {@linkplain #executeHotSpotNmethod executed}. * The {@code nmethod} associated with {@code nmethodMirror} is also made non-entrant and any * current activations of the {@code nmethod} are deoptimized. */
native void invalidateHotSpotNmethod(HotSpotNmethod nmethodMirror);
Collects the current values of all JVMCI benchmark counters, summed up over all threads.
/** * Collects the current values of all JVMCI benchmark counters, summed up over all threads. */
native long[] collectCounters();
Get the current number of counters allocated for use by JVMCI. Should be the same value as the flag JVMCICounterSize.
/** * Get the current number of counters allocated for use by JVMCI. Should be the same value as * the flag {@code JVMCICounterSize}. */
native int getCountersSize();
Attempt to change the size of the counters allocated for JVMCI. This requires a safepoint to safely reallocate the storage but it's advisable to increase the size in reasonable chunks.
/** * Attempt to change the size of the counters allocated for JVMCI. This requires a safepoint to * safely reallocate the storage but it's advisable to increase the size in reasonable chunks. */
native boolean setCountersSize(int newSize);
Determines if metaspaceMethodData is mature.
/** * Determines if {@code metaspaceMethodData} is mature. */
native boolean isMature(long metaspaceMethodData);
Generate a unique id to identify the result of the compile.
/** * Generate a unique id to identify the result of the compile. */
native int allocateCompileId(HotSpotResolvedJavaMethodImpl method, int entryBCI);
Determines if method has OSR compiled code identified by entryBCI for compilation level level.
/** * Determines if {@code method} has OSR compiled code identified by {@code entryBCI} for * compilation level {@code level}. */
native boolean hasCompiledCodeForOSR(HotSpotResolvedJavaMethodImpl method, int entryBCI, int level);
Gets the value of metaspaceSymbol as a String.
/** * Gets the value of {@code metaspaceSymbol} as a String. */
native String getSymbol(long metaspaceSymbol);
See Also:
  • iterateFrames.iterateFrames
/** * @see jdk.vm.ci.code.stack.StackIntrospection#iterateFrames */
native <T> T iterateFrames(ResolvedJavaMethod[] initialMethods, ResolvedJavaMethod[] matchingMethods, int initialSkip, InspectedFrameVisitor<T> visitor);
Materializes all virtual objects within stackFrame and updates its locals.
Params:
  • invalidate – if true, the compiled method for the stack frame will be invalidated
/** * Materializes all virtual objects within {@code stackFrame} and updates its locals. * * @param invalidate if {@code true}, the compiled method for the stack frame will be * invalidated */
native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate);
Gets the v-table index for interface method method in the receiver type or HotSpotVMConfig.invalidVtableIndex if method is not in type's v-table.
Throws:
  • InternalError – if type is an interface or method is not held by an interface or class represented by type is not initialized
/** * Gets the v-table index for interface method {@code method} in the receiver {@code type} or * {@link HotSpotVMConfig#invalidVtableIndex} if {@code method} is not in {@code type}'s * v-table. * * @throws InternalError if {@code type} is an interface or {@code method} is not held by an * interface or class represented by {@code type} is not initialized */
native int getVtableIndexForInterfaceMethod(HotSpotResolvedObjectTypeImpl type, HotSpotResolvedJavaMethodImpl method);
Determines if debug info should also be emitted at non-safepoint locations.
/** * Determines if debug info should also be emitted at non-safepoint locations. */
native boolean shouldDebugNonSafepoints();
Writes length bytes from bytes starting at offset offset to HotSpot's log stream.
Params:
  • flush – specifies if the log stream should be flushed after writing
  • canThrow – specifies if an error in the bytes, offset or length arguments should result in an exception or a negative return value
Throws:
Returns:0 on success, -1 if bytes == null && !canThrow, -2 if !canThrow and copying would cause access of data outside array bounds
/** * Writes {@code length} bytes from {@code bytes} starting at offset {@code offset} to HotSpot's * log stream. * * @param flush specifies if the log stream should be flushed after writing * @param canThrow specifies if an error in the {@code bytes}, {@code offset} or {@code length} * arguments should result in an exception or a negative return value * @return 0 on success, -1 if {@code bytes == null && !canThrow}, -2 if {@code !canThrow} and * copying would cause access of data outside array bounds * @throws NullPointerException if {@code bytes == null} * @throws IndexOutOfBoundsException if copying would cause access of data outside array bounds */
native int writeDebugOutput(byte[] bytes, int offset, int length, boolean flush, boolean canThrow);
Flush HotSpot's log stream.
/** * Flush HotSpot's log stream. */
native void flushDebugOutput();
Read a HotSpot Method* value from the memory location described by base plus displacement and return the HotSpotResolvedJavaMethodImpl wrapping it. This method does no checking that the memory location actually contains a valid pointer and may crash the VM if an invalid location is provided. If the base is null then displacement is used by itself. If base is a HotSpotResolvedJavaMethodImpl, HotSpotConstantPool or HotSpotResolvedObjectTypeImpl then the metaspace pointer is fetched from that object and added to displacement. Any other non-null object type causes an IllegalArgumentException to be thrown.
Params:
  • base – an object to read from or null
  • displacement –
Returns:null or the resolved method for this location
/** * Read a HotSpot Method* value from the memory location described by {@code base} plus * {@code displacement} and return the {@link HotSpotResolvedJavaMethodImpl} wrapping it. This * method does no checking that the memory location actually contains a valid pointer and may * crash the VM if an invalid location is provided. If the {@code base} is null then * {@code displacement} is used by itself. If {@code base} is a * {@link HotSpotResolvedJavaMethodImpl}, {@link HotSpotConstantPool} or * {@link HotSpotResolvedObjectTypeImpl} then the metaspace pointer is fetched from that object * and added to {@code displacement}. Any other non-null object type causes an * {@link IllegalArgumentException} to be thrown. * * @param base an object to read from or null * @param displacement * @return null or the resolved method for this location */
native HotSpotResolvedJavaMethodImpl getResolvedJavaMethod(HotSpotObjectConstantImpl base, long displacement);
Gets the ConstantPool* associated with object and returns a HotSpotConstantPool wrapping it.
Params:
Throws:
Returns:a HotSpotConstantPool wrapping the ConstantPool* associated with object
/** * Gets the {@code ConstantPool*} associated with {@code object} and returns a * {@link HotSpotConstantPool} wrapping it. * * @param object a {@link HotSpotResolvedJavaMethodImpl} or * {@link HotSpotResolvedObjectTypeImpl} object * @return a {@link HotSpotConstantPool} wrapping the {@code ConstantPool*} associated with * {@code object} * @throws NullPointerException if {@code object == null} * @throws IllegalArgumentException if {@code object} is neither a * {@link HotSpotResolvedJavaMethodImpl} nor a {@link HotSpotResolvedObjectTypeImpl} */
native HotSpotConstantPool getConstantPool(MetaspaceObject object);
Read a HotSpot Klass* value from the memory location described by base plus displacement and return the HotSpotResolvedObjectTypeImpl wrapping it. This method does no checking that the memory location actually contains a valid pointer and may crash the VM if an invalid location is provided. If the base is null then displacement is used by itself. If base is a HotSpotResolvedJavaMethodImpl, HotSpotConstantPool or HotSpotResolvedObjectTypeImpl then the metaspace pointer is fetched from that object and added to displacement. Any other non-null object type causes an IllegalArgumentException to be thrown.
Params:
  • base – an object to read from or null
  • displacement –
  • compressed – true if the location contains a compressed Klass*
Returns:null or the resolved method for this location
/** * Read a HotSpot Klass* value from the memory location described by {@code base} plus * {@code displacement} and return the {@link HotSpotResolvedObjectTypeImpl} wrapping it. This * method does no checking that the memory location actually contains a valid pointer and may * crash the VM if an invalid location is provided. If the {@code base} is null then * {@code displacement} is used by itself. If {@code base} is a * {@link HotSpotResolvedJavaMethodImpl}, {@link HotSpotConstantPool} or * {@link HotSpotResolvedObjectTypeImpl} then the metaspace pointer is fetched from that object * and added to {@code displacement}. Any other non-null object type causes an * {@link IllegalArgumentException} to be thrown. * * @param base an object to read from or null * @param displacement * @param compressed true if the location contains a compressed Klass* * @return null or the resolved method for this location */
private native HotSpotResolvedObjectTypeImpl getResolvedJavaType0(Object base, long displacement, boolean compressed); HotSpotResolvedObjectTypeImpl getResolvedJavaType(MetaspaceObject base, long displacement, boolean compressed) { return getResolvedJavaType0(base, displacement, compressed); } HotSpotResolvedObjectTypeImpl getResolvedJavaType(HotSpotObjectConstantImpl base, long displacement, boolean compressed) { return getResolvedJavaType0(base, displacement, compressed); } HotSpotResolvedObjectTypeImpl getResolvedJavaType(long displacement, boolean compressed) { return getResolvedJavaType0(null, displacement, compressed); }
Return the size of the HotSpot ProfileData* pointed at by position. If position is outside the space of the MethodData then an IllegalArgumentException is thrown. A position inside the MethodData but that isn't pointing at a valid ProfileData will crash the VM.
Params:
  • metaspaceMethodData –
  • position –
Throws:
Returns:the size of the ProfileData item pointed at by position
/** * Return the size of the HotSpot ProfileData* pointed at by {@code position}. If * {@code position} is outside the space of the MethodData then an * {@link IllegalArgumentException} is thrown. A {@code position} inside the MethodData but that * isn't pointing at a valid ProfileData will crash the VM. * * @param metaspaceMethodData * @param position * @return the size of the ProfileData item pointed at by {@code position} * @throws IllegalArgumentException if an out of range position is given */
native int methodDataProfileDataSize(long metaspaceMethodData, int position);
Gets the fingerprint for a given Klass*.
Params:
  • metaspaceKlass –
Returns:the value of the fingerprint (zero for arrays and synthetic classes).
/** * Gets the fingerprint for a given Klass*. * * @param metaspaceKlass * @return the value of the fingerprint (zero for arrays and synthetic classes). */
native long getFingerprint(long metaspaceKlass);
Return the amount of native stack required for the interpreter frames represented by frame. This is used when emitting the stack banging code to ensure that there is enough space for the frames during deoptimization.
Params:
  • frame –
Returns:the number of bytes required for deoptimization of this frame state
/** * Return the amount of native stack required for the interpreter frames represented by * {@code frame}. This is used when emitting the stack banging code to ensure that there is * enough space for the frames during deoptimization. * * @param frame * @return the number of bytes required for deoptimization of this frame state */
native int interpreterFrameSize(BytecodeFrame frame);
Invokes non-public method java.lang.invoke.LambdaForm.compileToBytecode() on lambdaForm (which must be a java.lang.invoke.LambdaForm instance).
/** * Invokes non-public method {@code java.lang.invoke.LambdaForm.compileToBytecode()} on * {@code lambdaForm} (which must be a {@code java.lang.invoke.LambdaForm} instance). */
native void compileToBytecode(HotSpotObjectConstantImpl lambdaForm);
Gets the value of the VM flag named name.
Params:
  • name – name of a VM option
Returns:this if the named VM option doesn't exist, a String or null if its type is ccstr or ccstrlist, a Double if its type is double, a Boolean if its type is bool otherwise a Long
/** * Gets the value of the VM flag named {@code name}. * * @param name name of a VM option * @return {@code this} if the named VM option doesn't exist, a {@link String} or {@code null} * if its type is {@code ccstr} or {@code ccstrlist}, a {@link Double} if its type is * {@code double}, a {@link Boolean} if its type is {@code bool} otherwise a * {@link Long} */
native Object getFlagValue(String name);
Gets the host class for type.
/** * Gets the host class for {@code type}. */
native HotSpotResolvedObjectTypeImpl getHostClass(HotSpotResolvedObjectTypeImpl type);
Gets the object at the address oopAddress.
Params:
  • oopAddress – a valid oopDesc** value
/** * Gets the object at the address {@code oopAddress}. * * @param oopAddress a valid {@code oopDesc**} value */
native Object getObjectAtAddress(long oopAddress);
See Also:
  • getInterfaces.getInterfaces()
/** * @see ResolvedJavaType#getInterfaces() */
native HotSpotResolvedObjectTypeImpl[] getInterfaces(HotSpotResolvedObjectTypeImpl type);
See Also:
  • getComponentType.getComponentType()
/** * @see ResolvedJavaType#getComponentType() */
native HotSpotResolvedJavaType getComponentType(HotSpotResolvedObjectTypeImpl type);
Get the array class for type. This can't be done symbolically since anonymous types can't be looked up by name.
/** * Get the array class for {@code type}. This can't be done symbolically since anonymous types * can't be looked up by name. */
native HotSpotResolvedObjectTypeImpl getArrayType(HotSpotResolvedJavaType type);
Forces initialization of type.
/** * Forces initialization of {@code type}. */
native void ensureInitialized(HotSpotResolvedObjectTypeImpl type);
Forces linking of type.
/** * Forces linking of {@code type}. */
native void ensureLinked(HotSpotResolvedObjectTypeImpl type);
Checks if object is a String and is an interned string value.
/** * Checks if {@code object} is a String and is an interned string value. */
native boolean isInternedString(HotSpotObjectConstantImpl object);
Gets the identity has code for the object represented by this constant.
/** * Gets the {@linkplain System#identityHashCode(Object) identity} has code for the object * represented by this constant. */
native int getIdentityHashCode(HotSpotObjectConstantImpl object);
Converts a constant object representing a boxed primitive into a boxed primitive.
/** * Converts a constant object representing a boxed primitive into a boxed primitive. */
native Object unboxPrimitive(HotSpotObjectConstantImpl object);
Converts a boxed primitive into a JavaConstant representing the same value.
/** * Converts a boxed primitive into a JavaConstant representing the same value. */
native HotSpotObjectConstantImpl boxPrimitive(Object source);
Gets the ResolvedJavaMethods for all the constructors of the type holder.
/** * Gets the {@link ResolvedJavaMethod}s for all the constructors of the type {@code holder}. */
native ResolvedJavaMethod[] getDeclaredConstructors(HotSpotResolvedObjectTypeImpl holder);
Gets the ResolvedJavaMethods for all the non-constructor methods of the type holder.
/** * Gets the {@link ResolvedJavaMethod}s for all the non-constructor methods of the type * {@code holder}. */
native ResolvedJavaMethod[] getDeclaredMethods(HotSpotResolvedObjectTypeImpl holder);
Reads the current value of a static field.
/** * Reads the current value of a static field. */
native JavaConstant readFieldValue(HotSpotResolvedObjectTypeImpl resolvedObjectType, HotSpotResolvedJavaField field, boolean isVolatile);
Reads the current value of an instance field.
/** * Reads the current value of an instance field. */
native JavaConstant readFieldValue(HotSpotObjectConstantImpl object, HotSpotResolvedJavaField field, boolean isVolatile);
See Also:
  • isInstance.isInstance(JavaConstant)
/** * @see ResolvedJavaType#isInstance(JavaConstant) */
native boolean isInstance(HotSpotResolvedObjectTypeImpl holder, HotSpotObjectConstantImpl object);
See Also:
  • isAssignableFrom.isAssignableFrom(ResolvedJavaType)
/** * @see ResolvedJavaType#isAssignableFrom(ResolvedJavaType) */
native boolean isAssignableFrom(HotSpotResolvedObjectTypeImpl holder, HotSpotResolvedObjectTypeImpl otherType);
See Also:
  • asJavaType.asJavaType(Constant)
/** * @see ConstantReflectionProvider#asJavaType(Constant) */
native HotSpotResolvedJavaType asJavaType(HotSpotObjectConstantImpl object);
Converts a String constant into a String.
/** * Converts a String constant into a String. */
native String asString(HotSpotObjectConstantImpl object);
Compares the contents of xHandle and yHandle for pointer equality.
/** * Compares the contents of {@code xHandle} and {@code yHandle} for pointer equality. */
native boolean equals(HotSpotObjectConstantImpl x, long xHandle, HotSpotObjectConstantImpl y, long yHandle);
Gets a JavaConstant wrapping the Class mirror for type.
/** * Gets a {@link JavaConstant} wrapping the {@link java.lang.Class} mirror for {@code type}. */
native HotSpotObjectConstantImpl getJavaMirror(HotSpotResolvedJavaType type);
Returns the length of the array if object represents an array or -1 otherwise.
/** * Returns the length of the array if {@code object} represents an array or -1 otherwise. */
native int getArrayLength(HotSpotObjectConstantImpl object);
Reads the element at index if object is an array. Elements of an object array are returned as JavaConstants and primitives are returned as boxed values. The value null is returned if the index is out of range or object is not an array.
/** * Reads the element at {@code index} if {@code object} is an array. Elements of an object array * are returned as {@link JavaConstant}s and primitives are returned as boxed values. The value * {@code null} is returned if the {@code index} is out of range or object is not an array. */
native Object readArrayElement(HotSpotObjectConstantImpl object, int index);
Reads a byte sized value from displacement in object.
/** * Reads a byte sized value from {@code displacement} in {@code object}. */
native byte getByte(HotSpotObjectConstantImpl object, long displacement);
Reads a short sized value from displacement in object.
/** * Reads a short sized value from {@code displacement} in {@code object}. */
native short getShort(HotSpotObjectConstantImpl object, long displacement);
Reads an int sized value from displacement in object.
/** * Reads an int sized value from {@code displacement} in {@code object}. */
native int getInt(HotSpotObjectConstantImpl object, long displacement);
Reads a long sized value from displacement in object.
/** * Reads a long sized value from {@code displacement} in {@code object}. */
native long getLong(HotSpotObjectConstantImpl object, long displacement);
Reads a Java object from displacement in object.
/** * Reads a Java object from {@code displacement} in {@code object}. */
native HotSpotObjectConstantImpl getObject(HotSpotObjectConstantImpl object, long displacement);
See Also:
  • registerNativeMethods.registerNativeMethods
/** * @see HotSpotJVMCIRuntime#registerNativeMethods */
native long[] registerNativeMethods(Class<?> clazz);
See Also:
  • translate.translate(Object)
/** * @see HotSpotJVMCIRuntime#translate(Object) */
native long translate(Object obj);
See Also:
  • unhand.unhand(Class, long)
/** * @see HotSpotJVMCIRuntime#unhand(Class, long) */
native Object unhand(long handle);
Updates address and entryPoint fields of nmethodMirror based on the current state of the nmethod identified by address and nmethodMirror.compileId in the code cache.
/** * Updates {@code address} and {@code entryPoint} fields of {@code nmethodMirror} based on the * current state of the {@code nmethod} identified by {@code address} and * {@code nmethodMirror.compileId} in the code cache. */
native void updateHotSpotNmethod(HotSpotNmethod nmethodMirror);
See Also:
  • getCode.getCode()
/** * @see InstalledCode#getCode() */
native byte[] getCode(HotSpotInstalledCode code);
Gets a Executable corresponding to method.
/** * Gets a {@link Executable} corresponding to {@code method}. */
native Executable asReflectionExecutable(HotSpotResolvedJavaMethodImpl method);
Gets a Field denoted by holder and index.
Params:
  • holder – the class in which the requested field is declared
  • fieldIndex – the fieldDescriptor::index() denoting the field
/** * Gets a {@link Field} denoted by {@code holder} and {@code index}. * * @param holder the class in which the requested field is declared * @param fieldIndex the {@code fieldDescriptor::index()} denoting the field */
native Field asReflectionField(HotSpotResolvedObjectTypeImpl holder, int fieldIndex);
See Also:
  • getIntrinsificationTrustPredicate.getIntrinsificationTrustPredicate(Class...)
/** * @see HotSpotJVMCIRuntime#getIntrinsificationTrustPredicate(Class...) */
native boolean isTrustedForIntrinsics(HotSpotResolvedObjectTypeImpl type);
Releases the resources backing the global JNI handle. This is equivalent to the DeleteGlobalRef JNI function.
/** * Releases the resources backing the global JNI {@code handle}. This is equivalent to the * {@code DeleteGlobalRef} JNI function. */
native void deleteGlobalHandle(long handle);
Gets the failed speculations pointed to by *failedSpeculationsAddress.
Params:
  • currentFailures – the known failures at failedSpeculationsAddress
Returns:the list of failed speculations with each entry being a single speculation in the format emitted by ByteArrayOutputStream.toByteArray()
/** * Gets the failed speculations pointed to by {@code *failedSpeculationsAddress}. * * @param currentFailures the known failures at {@code failedSpeculationsAddress} * @return the list of failed speculations with each entry being a single speculation in the * format emitted by {@link HotSpotSpeculationEncoding#toByteArray()} */
native byte[][] getFailedSpeculations(long failedSpeculationsAddress, byte[][] currentFailures);
Gets the address of the MethodData::_failed_speculations field in the MethodData associated with method. This will create and install the MethodData if it didn't already exist.
/** * Gets the address of the {@code MethodData::_failed_speculations} field in the * {@code MethodData} associated with {@code method}. This will create and install the * {@code MethodData} if it didn't already exist. */
native long getFailedSpeculationsAddress(HotSpotResolvedJavaMethodImpl method);
Frees the failed speculations pointed to by *failedSpeculationsAddress.
/** * Frees the failed speculations pointed to by {@code *failedSpeculationsAddress}. */
native void releaseFailedSpeculations(long failedSpeculationsAddress);
Adds a speculation to the failed speculations pointed to by *failedSpeculationsAddress.
Returns:false if the speculation could not be appended to the list
/** * Adds a speculation to the failed speculations pointed to by * {@code *failedSpeculationsAddress}. * * @return {@code false} if the speculation could not be appended to the list */
native boolean addFailedSpeculation(long failedSpeculationsAddress, byte[] speculation);
See Also:
  • isCurrentThreadAttached.isCurrentThreadAttached()
/** * @see HotSpotJVMCIRuntime#isCurrentThreadAttached() */
native boolean isCurrentThreadAttached();
See Also:
  • getCurrentJavaThread.getCurrentJavaThread()
/** * @see HotSpotJVMCIRuntime#getCurrentJavaThread() */
native long getCurrentJavaThread();
Params:
  • name – name of current thread if in a native image otherwise null
See Also:
/** * @param name name of current thread if in a native image otherwise {@code null} * @see HotSpotJVMCIRuntime#attachCurrentThread */
native boolean attachCurrentThread(byte[] name, boolean asDaemon);
See Also:
  • detachCurrentThread.detachCurrentThread()
/** * @see HotSpotJVMCIRuntime#detachCurrentThread() */
native void detachCurrentThread();
See Also:
  • exitHotSpot.exitHotSpot(int)
/** * @see HotSpotJVMCIRuntime#exitHotSpot(int) */
native void callSystemExit(int status);
See Also:
  • now.now
/** * @see JFR.Ticks#now */
native long ticksNow();
Adds phases in HotSpot JFR.
See Also:
  • write.write
/** * Adds phases in HotSpot JFR. * * @see JFR.CompilerPhaseEvent#write */
native int registerCompilerPhase(String phaseName);
See Also:
  • write.write
/** * @see JFR.CompilerPhaseEvent#write */
native void notifyCompilerPhaseEvent(long startTime, int phase, int compileId, int level);
See Also:
  • write.write
/** * @see JFR.CompilerInliningEvent#write */
native void notifyCompilerInliningEvent(int compileId, HotSpotResolvedJavaMethodImpl caller, HotSpotResolvedJavaMethodImpl callee, boolean succeeded, String message, int bci); }