244 /**
245 * Ensures that the type referenced by the specified {@code JVM_CONSTANT_InvokeDynamic} entry at
246 * index {@code cpi} in {@code constantPool} is loaded and initialized.
247 *
248 * The behavior of this method is undefined if {@code cpi} does not denote a
249 * {@code JVM_CONSTANT_InvokeDynamic} entry.
250 */
251 native void resolveInvokeDynamicInPool(HotSpotConstantPool constantPool, int cpi);
252
253 /**
254 * If {@code cpi} denotes an entry representing a
255 * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature
256 * polymorphic</a> method, this method ensures that the type referenced by the entry is loaded
257 * and initialized. It {@code cpi} does not denote a signature polymorphic method, this method
258 * does nothing.
259 */
260 native void resolveInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi);
261
262 /**
263 * If {@code cpi} denotes an entry representing a resolved dynamic adapter (see
264 * {@code resolveInvokeDynamicInPool} and {@code resolveInvokeHandleInPool}), return the opcode
265 * of the instruction for which the resolution was performed ({@code invokedynamic} or
266 * {@code invokevirtual}}, or {@code -1} otherwise.
267 */
268 native int isResolvedInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi);
269
270 /**
271 * Gets the list of type names (in the format of {@link JavaType#getName()}) denoting the
272 * classes that define signature polymorphic methods.
273 */
274 native String[] getSignaturePolymorphicHolders();
275
276 /**
277 * Gets the resolved type denoted by the entry at index {@code cpi} in {@code constantPool}.
278 *
279 * The behavior of this method is undefined if {@code cpi} does not denote an entry representing
280 * a class.
281 *
282 * @throws LinkageError if resolution failed
283 */
284 native HotSpotResolvedObjectTypeImpl resolveTypeInPool(HotSpotConstantPool constantPool, int cpi) throws LinkageError;
285
286 /**
526 * invalidated
527 */
528 native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate);
529
530 /**
531 * Gets the v-table index for interface method {@code method} in the receiver {@code type} or
532 * {@link HotSpotVMConfig#invalidVtableIndex} if {@code method} is not in {@code type}'s
533 * v-table.
534 *
535 * @throws InternalError if {@code type} is an interface or {@code method} is not held by an
536 * interface or class represented by {@code type} is not initialized
537 */
538 native int getVtableIndexForInterfaceMethod(HotSpotResolvedObjectTypeImpl type, HotSpotResolvedJavaMethodImpl method);
539
540 /**
541 * Determines if debug info should also be emitted at non-safepoint locations.
542 */
543 native boolean shouldDebugNonSafepoints();
544
545 /**
546 * Writes {@code length} bytes from {@code bytes} starting at offset {@code offset} to the
547 * HotSpot's log stream.
548 *
549 * @exception NullPointerException if {@code bytes == null}
550 * @exception IndexOutOfBoundsException if copying would cause access of data outside array
551 * bounds
552 */
553 native void writeDebugOutput(byte[] bytes, int offset, int length);
554
555 /**
556 * Flush HotSpot's log stream.
557 */
558 native void flushDebugOutput();
559
560 /**
561 * Read a HotSpot Method* value from the memory location described by {@code base} plus
562 * {@code displacement} and return the {@link HotSpotResolvedJavaMethodImpl} wrapping it. This
563 * method does no checking that the memory location actually contains a valid pointer and may
564 * crash the VM if an invalid location is provided. If the {@code base} is null then
565 * {@code displacement} is used by itself. If {@code base} is a
566 * {@link HotSpotResolvedJavaMethodImpl}, {@link HotSpotConstantPool} or
567 * {@link HotSpotResolvedObjectTypeImpl} then the metaspace pointer is fetched from that object
568 * and added to {@code displacement}. Any other non-null object type causes an
569 * {@link IllegalArgumentException} to be thrown.
570 *
571 * @param base an object to read from or null
603 * @param displacement
604 * @param compressed true if the location contains a compressed Klass*
605 * @return null or the resolved method for this location
606 */
607 native HotSpotResolvedObjectTypeImpl getResolvedJavaType(Object base, long displacement, boolean compressed);
608
609 /**
610 * Return the size of the HotSpot ProfileData* pointed at by {@code position}. If
611 * {@code position} is outside the space of the MethodData then an
612 * {@link IllegalArgumentException} is thrown. A {@code position} inside the MethodData but that
613 * isn't pointing at a valid ProfileData will crash the VM.
614 *
615 * @param metaspaceMethodData
616 * @param position
617 * @return the size of the ProfileData item pointed at by {@code position}
618 * @throws IllegalArgumentException if an out of range position is given
619 */
620 native int methodDataProfileDataSize(long metaspaceMethodData, int position);
621
622 /**
623 * Gets the fingerprint for a given Klass*
624 *
625 * @param metaspaceKlass
626 * @return the value of the fingerprint (zero for arrays and synthetic classes).
627 */
628 native long getFingerprint(long metaspaceKlass);
629
630 /**
631 * Return the amount of native stack required for the interpreter frames represented by
632 * {@code frame}. This is used when emitting the stack banging code to ensure that there is
633 * enough space for the frames during deoptimization.
634 *
635 * @param frame
636 * @return the number of bytes required for deoptimization of this frame state
637 */
638 native int interpreterFrameSize(BytecodeFrame frame);
639
640 /**
641 * Invokes non-public method {@code java.lang.invoke.LambdaForm.compileToBytecode()} on
642 * {@code lambdaForm} (which must be a {@code java.lang.invoke.LambdaForm} instance).
643 */
|
244 /**
245 * Ensures that the type referenced by the specified {@code JVM_CONSTANT_InvokeDynamic} entry at
246 * index {@code cpi} in {@code constantPool} is loaded and initialized.
247 *
248 * The behavior of this method is undefined if {@code cpi} does not denote a
249 * {@code JVM_CONSTANT_InvokeDynamic} entry.
250 */
251 native void resolveInvokeDynamicInPool(HotSpotConstantPool constantPool, int cpi);
252
253 /**
254 * If {@code cpi} denotes an entry representing a
255 * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature
256 * polymorphic</a> method, this method ensures that the type referenced by the entry is loaded
257 * and initialized. It {@code cpi} does not denote a signature polymorphic method, this method
258 * does nothing.
259 */
260 native void resolveInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi);
261
262 /**
263 * If {@code cpi} denotes an entry representing a resolved dynamic adapter (see
264 * {@link #resolveInvokeDynamicInPool} and {@link #resolveInvokeHandleInPool}), return the
265 * opcode of the instruction for which the resolution was performed ({@code invokedynamic} or
266 * {@code invokevirtual}), or {@code -1} otherwise.
267 */
268 native int isResolvedInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi);
269
270 /**
271 * Gets the list of type names (in the format of {@link JavaType#getName()}) denoting the
272 * classes that define signature polymorphic methods.
273 */
274 native String[] getSignaturePolymorphicHolders();
275
276 /**
277 * Gets the resolved type denoted by the entry at index {@code cpi} in {@code constantPool}.
278 *
279 * The behavior of this method is undefined if {@code cpi} does not denote an entry representing
280 * a class.
281 *
282 * @throws LinkageError if resolution failed
283 */
284 native HotSpotResolvedObjectTypeImpl resolveTypeInPool(HotSpotConstantPool constantPool, int cpi) throws LinkageError;
285
286 /**
526 * invalidated
527 */
528 native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate);
529
530 /**
531 * Gets the v-table index for interface method {@code method} in the receiver {@code type} or
532 * {@link HotSpotVMConfig#invalidVtableIndex} if {@code method} is not in {@code type}'s
533 * v-table.
534 *
535 * @throws InternalError if {@code type} is an interface or {@code method} is not held by an
536 * interface or class represented by {@code type} is not initialized
537 */
538 native int getVtableIndexForInterfaceMethod(HotSpotResolvedObjectTypeImpl type, HotSpotResolvedJavaMethodImpl method);
539
540 /**
541 * Determines if debug info should also be emitted at non-safepoint locations.
542 */
543 native boolean shouldDebugNonSafepoints();
544
545 /**
546 * Writes {@code length} bytes from {@code bytes} starting at offset {@code offset} to HotSpot's
547 * log stream.
548 *
549 * @throws NullPointerException if {@code bytes == null}
550 * @throws IndexOutOfBoundsException if copying would cause access of data outside array bounds
551 */
552 native void writeDebugOutput(byte[] bytes, int offset, int length);
553
554 /**
555 * Flush HotSpot's log stream.
556 */
557 native void flushDebugOutput();
558
559 /**
560 * Read a HotSpot Method* value from the memory location described by {@code base} plus
561 * {@code displacement} and return the {@link HotSpotResolvedJavaMethodImpl} wrapping it. This
562 * method does no checking that the memory location actually contains a valid pointer and may
563 * crash the VM if an invalid location is provided. If the {@code base} is null then
564 * {@code displacement} is used by itself. If {@code base} is a
565 * {@link HotSpotResolvedJavaMethodImpl}, {@link HotSpotConstantPool} or
566 * {@link HotSpotResolvedObjectTypeImpl} then the metaspace pointer is fetched from that object
567 * and added to {@code displacement}. Any other non-null object type causes an
568 * {@link IllegalArgumentException} to be thrown.
569 *
570 * @param base an object to read from or null
602 * @param displacement
603 * @param compressed true if the location contains a compressed Klass*
604 * @return null or the resolved method for this location
605 */
606 native HotSpotResolvedObjectTypeImpl getResolvedJavaType(Object base, long displacement, boolean compressed);
607
608 /**
609 * Return the size of the HotSpot ProfileData* pointed at by {@code position}. If
610 * {@code position} is outside the space of the MethodData then an
611 * {@link IllegalArgumentException} is thrown. A {@code position} inside the MethodData but that
612 * isn't pointing at a valid ProfileData will crash the VM.
613 *
614 * @param metaspaceMethodData
615 * @param position
616 * @return the size of the ProfileData item pointed at by {@code position}
617 * @throws IllegalArgumentException if an out of range position is given
618 */
619 native int methodDataProfileDataSize(long metaspaceMethodData, int position);
620
621 /**
622 * Gets the fingerprint for a given Klass*.
623 *
624 * @param metaspaceKlass
625 * @return the value of the fingerprint (zero for arrays and synthetic classes).
626 */
627 native long getFingerprint(long metaspaceKlass);
628
629 /**
630 * Return the amount of native stack required for the interpreter frames represented by
631 * {@code frame}. This is used when emitting the stack banging code to ensure that there is
632 * enough space for the frames during deoptimization.
633 *
634 * @param frame
635 * @return the number of bytes required for deoptimization of this frame state
636 */
637 native int interpreterFrameSize(BytecodeFrame frame);
638
639 /**
640 * Invokes non-public method {@code java.lang.invoke.LambdaForm.compileToBytecode()} on
641 * {@code lambdaForm} (which must be a {@code java.lang.invoke.LambdaForm} instance).
642 */
|