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.code.stack.InspectedFrameVisitor; |
36 import jdk.vm.ci.code.stack.InspectedFrameVisitor; |
37 import jdk.vm.ci.common.InitTimer; |
37 import jdk.vm.ci.common.InitTimer; |
38 import jdk.vm.ci.common.JVMCIError; |
38 import jdk.vm.ci.common.JVMCIError; |
|
39 import jdk.vm.ci.meta.Constant; |
|
40 import jdk.vm.ci.meta.ConstantReflectionProvider; |
|
41 import jdk.vm.ci.meta.JavaConstant; |
|
42 import jdk.vm.ci.meta.JavaKind; |
39 import jdk.vm.ci.meta.JavaType; |
43 import jdk.vm.ci.meta.JavaType; |
40 import jdk.vm.ci.meta.ResolvedJavaMethod; |
44 import jdk.vm.ci.meta.ResolvedJavaMethod; |
41 import jdk.vm.ci.meta.ResolvedJavaType; |
45 import jdk.vm.ci.meta.ResolvedJavaType; |
42 |
46 |
43 /** |
47 /** |
49 /** |
53 /** |
50 * Initializes the native part of the JVMCI runtime. |
54 * Initializes the native part of the JVMCI runtime. |
51 */ |
55 */ |
52 private static native void registerNatives(); |
56 private static native void registerNatives(); |
53 |
57 |
54 static { |
58 /** |
55 initialize(); |
59 * These values mirror the equivalent values from {@link Unsafe} but are approriate for the JVM |
56 } |
60 * being compiled against. |
|
61 */ |
|
62 // Checkstyle: stop |
|
63 final int ARRAY_BOOLEAN_BASE_OFFSET; |
|
64 final int ARRAY_BYTE_BASE_OFFSET; |
|
65 final int ARRAY_SHORT_BASE_OFFSET; |
|
66 final int ARRAY_CHAR_BASE_OFFSET; |
|
67 final int ARRAY_INT_BASE_OFFSET; |
|
68 final int ARRAY_LONG_BASE_OFFSET; |
|
69 final int ARRAY_FLOAT_BASE_OFFSET; |
|
70 final int ARRAY_DOUBLE_BASE_OFFSET; |
|
71 final int ARRAY_OBJECT_BASE_OFFSET; |
|
72 final int ARRAY_BOOLEAN_INDEX_SCALE; |
|
73 final int ARRAY_BYTE_INDEX_SCALE; |
|
74 final int ARRAY_SHORT_INDEX_SCALE; |
|
75 final int ARRAY_CHAR_INDEX_SCALE; |
|
76 final int ARRAY_INT_INDEX_SCALE; |
|
77 final int ARRAY_LONG_INDEX_SCALE; |
|
78 final int ARRAY_FLOAT_INDEX_SCALE; |
|
79 final int ARRAY_DOUBLE_INDEX_SCALE; |
|
80 final int ARRAY_OBJECT_INDEX_SCALE; |
|
81 // Checkstyle: resume |
57 |
82 |
58 @SuppressWarnings("try") |
83 @SuppressWarnings("try") |
59 private static void initialize() { |
84 CompilerToVM() { |
60 try (InitTimer t = timer("CompilerToVM.registerNatives")) { |
85 try (InitTimer t = timer("CompilerToVM.registerNatives")) { |
61 registerNatives(); |
86 registerNatives(); |
|
87 ARRAY_BOOLEAN_BASE_OFFSET = arrayBaseOffset(JavaKind.Boolean); |
|
88 ARRAY_BYTE_BASE_OFFSET = arrayBaseOffset(JavaKind.Byte); |
|
89 ARRAY_SHORT_BASE_OFFSET = arrayBaseOffset(JavaKind.Short); |
|
90 ARRAY_CHAR_BASE_OFFSET = arrayBaseOffset(JavaKind.Char); |
|
91 ARRAY_INT_BASE_OFFSET = arrayBaseOffset(JavaKind.Int); |
|
92 ARRAY_LONG_BASE_OFFSET = arrayBaseOffset(JavaKind.Long); |
|
93 ARRAY_FLOAT_BASE_OFFSET = arrayBaseOffset(JavaKind.Float); |
|
94 ARRAY_DOUBLE_BASE_OFFSET = arrayBaseOffset(JavaKind.Double); |
|
95 ARRAY_OBJECT_BASE_OFFSET = arrayBaseOffset(JavaKind.Object); |
|
96 ARRAY_BOOLEAN_INDEX_SCALE = arrayIndexScale(JavaKind.Boolean); |
|
97 ARRAY_BYTE_INDEX_SCALE = arrayIndexScale(JavaKind.Byte); |
|
98 ARRAY_SHORT_INDEX_SCALE = arrayIndexScale(JavaKind.Short); |
|
99 ARRAY_CHAR_INDEX_SCALE = arrayIndexScale(JavaKind.Char); |
|
100 ARRAY_INT_INDEX_SCALE = arrayIndexScale(JavaKind.Int); |
|
101 ARRAY_LONG_INDEX_SCALE = arrayIndexScale(JavaKind.Long); |
|
102 ARRAY_FLOAT_INDEX_SCALE = arrayIndexScale(JavaKind.Float); |
|
103 ARRAY_DOUBLE_INDEX_SCALE = arrayIndexScale(JavaKind.Double); |
|
104 ARRAY_OBJECT_INDEX_SCALE = arrayIndexScale(JavaKind.Object); |
62 } |
105 } |
63 } |
106 } |
|
107 |
|
108 native int arrayBaseOffset(JavaKind kind); |
|
109 |
|
110 native int arrayIndexScale(JavaKind kind); |
64 |
111 |
65 /** |
112 /** |
66 * Gets the {@link CompilerToVM} instance associated with the singleton |
113 * Gets the {@link CompilerToVM} instance associated with the singleton |
67 * {@link HotSpotJVMCIRuntime} instance. |
114 * {@link HotSpotJVMCIRuntime} instance. |
68 */ |
115 */ |
150 |
197 |
151 /** |
198 /** |
152 * Converts a name to a type. |
199 * Converts a name to a type. |
153 * |
200 * |
154 * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format |
201 * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format |
155 * @param accessingClass the context of resolution (must not be null) |
202 * @param accessingClass the context of resolution. A value of {@code null} implies that the |
|
203 * class should be resolved with the class loader. |
156 * @param resolve force resolution to a {@link ResolvedJavaType}. If true, this method will |
204 * @param resolve force resolution to a {@link ResolvedJavaType}. If true, this method will |
157 * either return a {@link ResolvedJavaType} or throw an exception |
205 * either return a {@link ResolvedJavaType} or throw an exception |
158 * @return the type for {@code name} or 0 if resolution failed and {@code resolve == false} |
206 * @return the type for {@code name} or 0 if resolution failed and {@code resolve == false} |
159 * @throws ClassNotFoundException if {@code resolve == true} and the resolution failed |
207 * @throws ClassNotFoundException if {@code resolve == true} and the resolution failed |
160 */ |
208 */ |
161 native HotSpotResolvedObjectTypeImpl lookupType(String name, Class<?> accessingClass, boolean resolve) throws ClassNotFoundException; |
209 native HotSpotResolvedJavaType lookupType(String name, HotSpotResolvedObjectTypeImpl accessingClass, boolean resolve) throws ClassNotFoundException; |
|
210 |
|
211 native HotSpotResolvedJavaType lookupClass(Class<?> javaClass); |
162 |
212 |
163 /** |
213 /** |
164 * Resolves the entry at index {@code cpi} in {@code constantPool} to an object. |
214 * Resolves the entry at index {@code cpi} in {@code constantPool} to an object. |
165 * |
215 * |
166 * The behavior of this method is undefined if {@code cpi} does not denote one of the following |
216 * The behavior of this method is undefined if {@code cpi} does not denote one of the following |
167 * entry types: {@code JVM_CONSTANT_MethodHandle}, {@code JVM_CONSTANT_MethodHandleInError}, |
217 * entry types: {@code JVM_CONSTANT_MethodHandle}, {@code JVM_CONSTANT_MethodHandleInError}, |
168 * {@code JVM_CONSTANT_MethodType} and {@code JVM_CONSTANT_MethodTypeInError}. |
218 * {@code JVM_CONSTANT_MethodType} and {@code JVM_CONSTANT_MethodTypeInError}. |
169 */ |
219 */ |
170 native Object resolveConstantInPool(HotSpotConstantPool constantPool, int cpi); |
220 native HotSpotObjectConstantImpl resolveConstantInPool(HotSpotConstantPool constantPool, int cpi); |
171 |
221 |
172 /** |
222 /** |
173 * Resolves the entry at index {@code cpi} in {@code constantPool} to an object, looking in the |
223 * Resolves the entry at index {@code cpi} in {@code constantPool} to an object, looking in the |
174 * constant pool cache first. |
224 * constant pool cache first. |
175 * |
225 * |
176 * The behavior of this method is undefined if {@code cpi} does not denote a |
226 * The behavior of this method is undefined if {@code cpi} does not denote a |
177 * {@code JVM_CONSTANT_String} entry. |
227 * {@code JVM_CONSTANT_String} entry. |
178 */ |
228 */ |
179 native Object resolvePossiblyCachedConstantInPool(HotSpotConstantPool constantPool, int cpi); |
229 native HotSpotObjectConstantImpl resolvePossiblyCachedConstantInPool(HotSpotConstantPool constantPool, int cpi); |
180 |
230 |
181 /** |
231 /** |
182 * Gets the {@code JVM_CONSTANT_NameAndType} index from the entry at index {@code cpi} in |
232 * Gets the {@code JVM_CONSTANT_NameAndType} index from the entry at index {@code cpi} in |
183 * {@code constantPool}. |
233 * {@code constantPool}. |
184 * |
234 * |
431 native StackTraceElement getStackTraceElement(HotSpotResolvedJavaMethodImpl method, int bci); |
481 native StackTraceElement getStackTraceElement(HotSpotResolvedJavaMethodImpl method, int bci); |
432 |
482 |
433 /** |
483 /** |
434 * Executes some {@code installedCode} with arguments {@code args}. |
484 * Executes some {@code installedCode} with arguments {@code args}. |
435 * |
485 * |
436 * @return the result of executing {@code installedCode} |
486 * @return the result of executing {@code nmethodMirror} |
437 * @throws InvalidInstalledCodeException if {@code installedCode} has been invalidated |
487 * @throws InvalidInstalledCodeException if {@code nmethodMirror} has been invalidated |
438 */ |
488 */ |
439 native Object executeInstalledCode(Object[] args, InstalledCode installedCode) throws InvalidInstalledCodeException; |
489 native Object executeHotSpotNmethod(Object[] args, HotSpotNmethod nmethodMirror) throws InvalidInstalledCodeException; |
440 |
490 |
441 /** |
491 /** |
442 * Gets the line number table for {@code method}. The line number table is encoded as (bci, |
492 * Gets the line number table for {@code method}. The line number table is encoded as (bci, |
443 * source line number) pairs. |
493 * source line number) pairs. |
444 * |
494 * |
470 * @return 0 if {@code method} does not have a local variable table |
520 * @return 0 if {@code method} does not have a local variable table |
471 */ |
521 */ |
472 native long getLocalVariableTableStart(HotSpotResolvedJavaMethodImpl method); |
522 native long getLocalVariableTableStart(HotSpotResolvedJavaMethodImpl method); |
473 |
523 |
474 /** |
524 /** |
|
525 * Reads an object pointer within a VM data structure. That is, any {@link VMField} whose |
|
526 * {@link VMField#type type} is {@code "oop"} (e.g., |
|
527 * {@code Klass::_java_mirror}, {@code JavaThread::_threadObj}). |
|
528 * |
|
529 * Note that {@link Unsafe#getObject(Object, long)} cannot be used for this since it does a |
|
530 * {@code narrowOop} read if the VM is using compressed oops whereas oops within VM data |
|
531 * structures are (currently) always uncompressed. |
|
532 * |
|
533 * @param address address of an oop field within a VM data structure |
|
534 */ |
|
535 native HotSpotObjectConstantImpl readUncompressedOop(long address); |
|
536 |
|
537 /** |
475 * Sets flags on {@code method} indicating that it should never be inlined or compiled by the |
538 * Sets flags on {@code method} indicating that it should never be inlined or compiled by the |
476 * VM. |
539 * VM. |
477 */ |
540 */ |
478 native void setNotInlinableOrCompilable(HotSpotResolvedJavaMethodImpl method); |
541 native void setNotInlinableOrCompilable(HotSpotResolvedJavaMethodImpl method); |
479 |
542 |
482 * profiling restarts upon its next invocation. |
545 * profiling restarts upon its next invocation. |
483 */ |
546 */ |
484 native void reprofile(HotSpotResolvedJavaMethodImpl method); |
547 native void reprofile(HotSpotResolvedJavaMethodImpl method); |
485 |
548 |
486 /** |
549 /** |
487 * Invalidates {@code installedCode} such that {@link InvalidInstalledCodeException} will be |
550 * Invalidates {@code nmethodMirror} such that {@link InvalidInstalledCodeException} will be |
488 * raised the next time {@code installedCode} is executed. |
551 * raised the next time {@code nmethodMirror} is {@linkplain #executeHotSpotNmethod executed}. |
489 */ |
552 * The {@code nmethod} associated with {@code nmethodMirror} is also made non-entrant and any |
490 native void invalidateInstalledCode(InstalledCode installedCode); |
553 * current activations of the {@code nmethod} are deoptimized. |
|
554 */ |
|
555 native void invalidateHotSpotNmethod(HotSpotNmethod nmethodMirror); |
491 |
556 |
492 /** |
557 /** |
493 * Collects the current values of all JVMCI benchmark counters, summed up over all threads. |
558 * Collects the current values of all JVMCI benchmark counters, summed up over all threads. |
494 */ |
559 */ |
495 native long[] collectCounters(); |
560 native long[] collectCounters(); |
602 * @param base an object to read from or null |
667 * @param base an object to read from or null |
603 * @param displacement |
668 * @param displacement |
604 * @param compressed true if the location contains a compressed Klass* |
669 * @param compressed true if the location contains a compressed Klass* |
605 * @return null or the resolved method for this location |
670 * @return null or the resolved method for this location |
606 */ |
671 */ |
607 native HotSpotResolvedObjectTypeImpl getResolvedJavaType(Object base, long displacement, boolean compressed); |
672 private native HotSpotResolvedObjectTypeImpl getResolvedJavaType0(Object base, long displacement, boolean compressed); |
|
673 |
|
674 HotSpotResolvedObjectTypeImpl getResolvedJavaType(MetaspaceObject base, long displacement, boolean compressed) { |
|
675 return getResolvedJavaType0(base, displacement, compressed); |
|
676 } |
|
677 |
|
678 HotSpotResolvedObjectTypeImpl getResolvedJavaType(HotSpotObjectConstantImpl base, long displacement, boolean compressed) { |
|
679 return getResolvedJavaType0(base, displacement, compressed); |
|
680 } |
|
681 |
|
682 HotSpotResolvedObjectTypeImpl getResolvedJavaType(long displacement, boolean compressed) { |
|
683 return getResolvedJavaType0(null, displacement, compressed); |
|
684 } |
608 |
685 |
609 /** |
686 /** |
610 * Return the size of the HotSpot ProfileData* pointed at by {@code position}. If |
687 * 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 |
688 * {@code position} is outside the space of the MethodData then an |
612 * {@link IllegalArgumentException} is thrown. A {@code position} inside the MethodData but that |
689 * {@link IllegalArgumentException} is thrown. A {@code position} inside the MethodData but that |
658 * Gets the host class for {@code type}. |
735 * Gets the host class for {@code type}. |
659 */ |
736 */ |
660 native HotSpotResolvedObjectTypeImpl getHostClass(HotSpotResolvedObjectTypeImpl type); |
737 native HotSpotResolvedObjectTypeImpl getHostClass(HotSpotResolvedObjectTypeImpl type); |
661 |
738 |
662 /** |
739 /** |
|
740 * Gets the object at the address {@code oopAddress}. |
|
741 * |
|
742 * @param oopAddress a valid {@code oopDesc**} value |
|
743 */ |
|
744 native Object getObjectAtAddress(long oopAddress); |
|
745 |
|
746 /** |
|
747 * @see ResolvedJavaType#getInterfaces() |
|
748 */ |
|
749 native HotSpotResolvedObjectTypeImpl[] getInterfaces(HotSpotResolvedObjectTypeImpl type); |
|
750 |
|
751 /** |
|
752 * @see ResolvedJavaType#getComponentType() |
|
753 */ |
|
754 native HotSpotResolvedJavaType getComponentType(HotSpotResolvedObjectTypeImpl type); |
|
755 |
|
756 /** |
|
757 * Forces initialization of {@code type}. |
|
758 */ |
|
759 native void ensureInitialized(HotSpotResolvedObjectTypeImpl type); |
|
760 |
|
761 /** |
|
762 * Checks if {@code object} is a String and is an interned string value. |
|
763 */ |
|
764 native boolean isInternedString(HotSpotObjectConstantImpl object); |
|
765 |
|
766 /** |
|
767 * Gets the {@linkplain System#identityHashCode(Object) identity} has code for the object |
|
768 * represented by this constant. |
|
769 */ |
|
770 native int getIdentityHashCode(HotSpotObjectConstantImpl object); |
|
771 |
|
772 /** |
|
773 * Converts a constant object representing a boxed primitive into a boxed primitive. |
|
774 */ |
|
775 native Object unboxPrimitive(HotSpotObjectConstantImpl object); |
|
776 |
|
777 /** |
|
778 * Converts a boxed primitive into a JavaConstant representing the same value. |
|
779 */ |
|
780 native HotSpotObjectConstantImpl boxPrimitive(Object source); |
|
781 |
|
782 /** |
|
783 * Gets the {@link ResolvedJavaMethod}s for all the constructors of the type {@code holder}. |
|
784 */ |
|
785 native ResolvedJavaMethod[] getDeclaredConstructors(HotSpotResolvedObjectTypeImpl holder); |
|
786 |
|
787 /** |
|
788 * Gets the {@link ResolvedJavaMethod}s for all the non-constructor methods of the type |
|
789 * {@code holder}. |
|
790 */ |
|
791 native ResolvedJavaMethod[] getDeclaredMethods(HotSpotResolvedObjectTypeImpl holder); |
|
792 |
|
793 /** |
|
794 * Reads the current value of a static field. |
|
795 */ |
|
796 native JavaConstant readFieldValue(HotSpotResolvedObjectTypeImpl resolvedObjectType, HotSpotResolvedJavaField field, boolean isVolatile); |
|
797 |
|
798 /** |
|
799 * Reads the current value of an instance field. |
|
800 */ |
|
801 native JavaConstant readFieldValue(HotSpotObjectConstantImpl object, HotSpotResolvedJavaField field, boolean isVolatile); |
|
802 |
|
803 /** |
|
804 * @see ResolvedJavaType#isInstance(JavaConstant) |
|
805 */ |
|
806 native boolean isInstance(HotSpotResolvedObjectTypeImpl holder, HotSpotObjectConstantImpl object); |
|
807 |
|
808 /** |
|
809 * @see ResolvedJavaType#isAssignableFrom(ResolvedJavaType) |
|
810 */ |
|
811 native boolean isAssignableFrom(HotSpotResolvedObjectTypeImpl holder, HotSpotResolvedObjectTypeImpl otherType); |
|
812 |
|
813 /** |
|
814 * @see ConstantReflectionProvider#asJavaType(Constant) |
|
815 */ |
|
816 native HotSpotResolvedJavaType asJavaType(HotSpotObjectConstantImpl object); |
|
817 |
|
818 /** |
|
819 * Converts a String constant into a String. |
|
820 */ |
|
821 native String asString(HotSpotObjectConstantImpl object); |
|
822 |
|
823 /** |
|
824 * Compares the contents of {@code xHandle} and {@code yHandle} for pointer equality. |
|
825 */ |
|
826 native boolean equals(HotSpotObjectConstantImpl x, long xHandle, HotSpotObjectConstantImpl y, long yHandle); |
|
827 |
|
828 /** |
|
829 * Gets a {@link JavaConstant} wrapping the {@link java.lang.Class} mirror for {@code type}. |
|
830 */ |
|
831 native HotSpotObjectConstantImpl getJavaMirror(HotSpotResolvedJavaType type); |
|
832 |
|
833 /** |
|
834 * Returns the length of the array if {@code object} represents an array or -1 otherwise. |
|
835 */ |
|
836 native int getArrayLength(HotSpotObjectConstantImpl object); |
|
837 |
|
838 /** |
|
839 * Reads the element at {@code index} if {@code object} is an array. Elements of an object array |
|
840 * are returned as {@link JavaConstant}s and primitives are returned as boxed values. The value |
|
841 * {@code null} is returned if the {@code index} is out of range or object is not an array. |
|
842 */ |
|
843 native Object readArrayElement(HotSpotObjectConstantImpl object, int index); |
|
844 |
|
845 /** |
|
846 * Reads a byte sized value from {@code displacement} in {@code object}. |
|
847 */ |
|
848 native byte getByte(HotSpotObjectConstantImpl object, long displacement); |
|
849 |
|
850 /** |
|
851 * Reads a short sized value from {@code displacement} in {@code object}. |
|
852 */ |
|
853 native short getShort(HotSpotObjectConstantImpl object, long displacement); |
|
854 |
|
855 /** |
|
856 * Reads an int sized value from {@code displacement} in {@code object}. |
|
857 */ |
|
858 native int getInt(HotSpotObjectConstantImpl object, long displacement); |
|
859 |
|
860 /** |
|
861 * Reads a long sized value from {@code displacement} in {@code object}. |
|
862 */ |
|
863 native long getLong(HotSpotObjectConstantImpl object, long displacement); |
|
864 |
|
865 /** |
|
866 * Reads a Java object from {@code displacement} in {@code object}. |
|
867 */ |
|
868 native HotSpotObjectConstantImpl getObject(HotSpotObjectConstantImpl object, long displacement); |
|
869 |
|
870 /** |
|
871 * @see HotSpotJVMCIRuntime#registerNativeMethods |
|
872 */ |
|
873 native long[] registerNativeMethods(Class<?> clazz); |
|
874 |
|
875 /** |
|
876 * @see HotSpotJVMCIRuntime#translate(Object) |
|
877 */ |
|
878 native long translate(Object obj); |
|
879 |
|
880 /** |
|
881 * @see HotSpotJVMCIRuntime#unhand(Class, long) |
|
882 */ |
|
883 native Object unhand(long handle); |
|
884 |
|
885 /** |
|
886 * Updates {@code address} and {@code entryPoint} fields of {@code nmethodMirror} based on the |
|
887 * current state of the {@code nmethod} identified by {@code address} and |
|
888 * {@code nmethodMirror.compileId} in the code cache. |
|
889 */ |
|
890 native void updateHotSpotNmethod(HotSpotNmethod nmethodMirror); |
|
891 |
|
892 /** |
|
893 * @see InstalledCode#getCode() |
|
894 */ |
|
895 native byte[] getCode(HotSpotInstalledCode code); |
|
896 |
|
897 /** |
663 * Gets a {@link Executable} corresponding to {@code method}. |
898 * Gets a {@link Executable} corresponding to {@code method}. |
664 */ |
899 */ |
665 native Executable asReflectionExecutable(HotSpotResolvedJavaMethodImpl method); |
900 native Executable asReflectionExecutable(HotSpotResolvedJavaMethodImpl method); |
666 |
901 |
667 /** |
902 /** |
669 * |
904 * |
670 * @param holder the class in which the requested field is declared |
905 * @param holder the class in which the requested field is declared |
671 * @param fieldIndex the {@code fieldDescriptor::index()} denoting the field |
906 * @param fieldIndex the {@code fieldDescriptor::index()} denoting the field |
672 */ |
907 */ |
673 native Field asReflectionField(HotSpotResolvedObjectTypeImpl holder, int fieldIndex); |
908 native Field asReflectionField(HotSpotResolvedObjectTypeImpl holder, int fieldIndex); |
|
909 |
|
910 /** |
|
911 * @see HotSpotJVMCIRuntime#getIntrinsificationTrustPredicate(Class...) |
|
912 */ |
|
913 native boolean isTrustedForIntrinsics(HotSpotResolvedObjectTypeImpl type); |
|
914 |
|
915 /** |
|
916 * Releases the resources backing the global JNI {@code handle}. This is equivalent to the |
|
917 * {@code DeleteGlobalRef} JNI function. |
|
918 */ |
|
919 native void deleteGlobalHandle(long handle); |
|
920 |
|
921 /** |
|
922 * Gets the failed speculations pointed to by {@code *failedSpeculationsAddress}. |
|
923 * |
|
924 * @param currentFailures the known failures at {@code failedSpeculationsAddress} |
|
925 * @return the list of failed speculations with each entry being a single speculation in the |
|
926 * format emitted by {@link HotSpotSpeculationEncoding#toByteArray()} |
|
927 */ |
|
928 native byte[][] getFailedSpeculations(long failedSpeculationsAddress, byte[][] currentFailures); |
|
929 |
|
930 /** |
|
931 * Gets the address of the {@code MethodData::_failed_speculations} field in the |
|
932 * {@code MethodData} associated with {@code method}. This will create and install the |
|
933 * {@code MethodData} if it didn't already exist. |
|
934 */ |
|
935 native long getFailedSpeculationsAddress(HotSpotResolvedJavaMethodImpl method); |
|
936 |
|
937 /** |
|
938 * Frees the failed speculations pointed to by {@code *failedSpeculationsAddress}. |
|
939 */ |
|
940 native void releaseFailedSpeculations(long failedSpeculationsAddress); |
|
941 |
|
942 /** |
|
943 * Adds a speculation to the failed speculations pointed to by |
|
944 * {@code *failedSpeculationsAddress}. |
|
945 * |
|
946 * @return {@code false} if the speculation could not be appended to the list |
|
947 */ |
|
948 native boolean addFailedSpeculation(long failedSpeculationsAddress, byte[] speculation); |
|
949 |
674 } |
950 } |