1 /* 2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package jdk.vm.ci.hotspot; 25 26 import static jdk.vm.ci.common.InitTimer.timer; 27 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; 28 29 import java.lang.reflect.Executable; 30 import java.lang.reflect.Field; 31 32 import jdk.vm.ci.code.BytecodeFrame; 33 import jdk.vm.ci.code.InstalledCode; 34 import jdk.vm.ci.code.InvalidInstalledCodeException; 35 import jdk.vm.ci.code.TargetDescription; 36 import jdk.vm.ci.code.stack.InspectedFrameVisitor; 37 import jdk.vm.ci.common.InitTimer; 38 import jdk.vm.ci.common.JVMCIError; 39 import jdk.vm.ci.meta.JavaType; 40 import jdk.vm.ci.meta.ResolvedJavaMethod; 41 import jdk.vm.ci.meta.ResolvedJavaType; 42 43 /** 44 * Calls from Java into HotSpot. The behavior of all the methods in this class that take a native 45 * pointer as an argument (e.g., {@link #getSymbol(long)}) is undefined if the argument does not 46 * denote a valid native object. 47 */ 48 final class CompilerToVM { 49 /** 50 * Initializes the native part of the JVMCI runtime. 51 */ 52 private static native void registerNatives(); 53 54 static { 55 initialize(); 56 } 57 58 @SuppressWarnings("try") 59 private static void initialize() { 60 try (InitTimer t = timer("CompilerToVM.registerNatives")) { 61 registerNatives(); 62 } 63 } 64 65 /** 66 * Gets the {@link CompilerToVM} instance associated with the singleton 67 * {@link HotSpotJVMCIRuntime} instance. 68 */ 69 public static CompilerToVM compilerToVM() { 70 return runtime().getCompilerToVM(); 71 } 72 73 /** 74 * Copies the original bytecode of {@code method} into a new byte array and returns it. 75 * 76 * @return a new byte array containing the original bytecode of {@code method} 77 */ 78 native byte[] getBytecode(HotSpotResolvedJavaMethodImpl method); 79 80 /** 81 * Gets the number of entries in {@code method}'s exception handler table or 0 if it has no 82 * exception handler table. 83 */ 84 native int getExceptionTableLength(HotSpotResolvedJavaMethodImpl method); 135 native HotSpotResolvedJavaMethodImpl findUniqueConcreteMethod(HotSpotResolvedObjectTypeImpl actualHolderType, HotSpotResolvedJavaMethodImpl method); 136 137 /** 138 * Gets the implementor for the interface class {@code type}. 139 * 140 * @return the implementor if there is a single implementor, {@code null} if there is no 141 * implementor, or {@code type} itself if there is more than one implementor 142 * @throws IllegalArgumentException if type is not an interface type 143 */ 144 native HotSpotResolvedObjectTypeImpl getImplementor(HotSpotResolvedObjectTypeImpl type); 145 146 /** 147 * Determines if {@code method} is ignored by security stack walks. 148 */ 149 native boolean methodIsIgnoredBySecurityStackWalk(HotSpotResolvedJavaMethodImpl method); 150 151 /** 152 * Converts a name to a type. 153 * 154 * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format 155 * @param accessingClass the context of resolution (must not be null) 156 * @param resolve force resolution to a {@link ResolvedJavaType}. If true, this method will 157 * 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} 159 * @throws ClassNotFoundException if {@code resolve == true} and the resolution failed 160 */ 161 native HotSpotResolvedObjectTypeImpl lookupType(String name, Class<?> accessingClass, boolean resolve) throws ClassNotFoundException; 162 163 /** 164 * Resolves the entry at index {@code cpi} in {@code constantPool} to an object. 165 * 166 * 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}, 168 * {@code JVM_CONSTANT_MethodType} and {@code JVM_CONSTANT_MethodTypeInError}. 169 */ 170 native Object resolveConstantInPool(HotSpotConstantPool constantPool, int cpi); 171 172 /** 173 * Resolves the entry at index {@code cpi} in {@code constantPool} to an object, looking in the 174 * constant pool cache first. 175 * 176 * The behavior of this method is undefined if {@code cpi} does not denote a 177 * {@code JVM_CONSTANT_String} entry. 178 */ 179 native Object resolvePossiblyCachedConstantInPool(HotSpotConstantPool constantPool, int cpi); 180 181 /** 182 * Gets the {@code JVM_CONSTANT_NameAndType} index from the entry at index {@code cpi} in 183 * {@code constantPool}. 184 * 185 * The behavior of this method is undefined if {@code cpi} does not denote an entry containing a 186 * {@code JVM_CONSTANT_NameAndType} index. 187 */ 188 native int lookupNameAndTypeRefIndexInPool(HotSpotConstantPool constantPool, int cpi); 189 190 /** 191 * Gets the name of the {@code JVM_CONSTANT_NameAndType} entry referenced by another entry 192 * denoted by {@code which} in {@code constantPool}. 193 * 194 * The behavior of this method is undefined if {@code which} does not denote a entry that 195 * references a {@code JVM_CONSTANT_NameAndType} entry. 196 */ 197 native String lookupNameInPool(HotSpotConstantPool constantPool, int which); 198 199 /** 301 * {@code JVM_CONSTANT_Field} entry. 302 * 303 * @param info an array in which the details of the field are returned 304 * @return the type defining the field if resolution is successful, 0 otherwise 305 */ 306 native HotSpotResolvedObjectTypeImpl resolveFieldInPool(HotSpotConstantPool constantPool, int cpi, HotSpotResolvedJavaMethodImpl method, byte opcode, int[] info); 307 308 /** 309 * Converts {@code cpci} from an index into the cache for {@code constantPool} to an index 310 * directly into {@code constantPool}. 311 * 312 * The behavior of this method is undefined if {@code ccpi} is an invalid constant pool cache 313 * index. 314 */ 315 native int constantPoolRemapInstructionOperandFromCache(HotSpotConstantPool constantPool, int cpci); 316 317 /** 318 * Gets the appendix object (if any) associated with the entry at index {@code cpi} in 319 * {@code constantPool}. 320 */ 321 native Object lookupAppendixInPool(HotSpotConstantPool constantPool, int cpi); 322 323 /** 324 * Installs the result of a compilation into the code cache. 325 * 326 * @param target the target where this code should be installed 327 * @param compiledCode the result of a compilation 328 * @param code the details of the installed CodeBlob are written to this object 329 * @return the outcome of the installation which will be one of 330 * {@link HotSpotVMConfig#codeInstallResultOk}, 331 * {@link HotSpotVMConfig#codeInstallResultCacheFull}, 332 * {@link HotSpotVMConfig#codeInstallResultCodeTooLarge}, 333 * {@link HotSpotVMConfig#codeInstallResultDependenciesFailed} or 334 * {@link HotSpotVMConfig#codeInstallResultDependenciesInvalid}. 335 * @throws JVMCIError if there is something wrong with the compiled code or the associated 336 * metadata. 337 */ 338 native int installCode(TargetDescription target, HotSpotCompiledCode compiledCode, InstalledCode code, HotSpotSpeculationLog speculationLog); 339 340 /** 341 * Generates the VM metadata for some compiled code and copies them into {@code metaData}. This 342 * method does not install anything into the code cache. 343 * 344 * @param target the target where this code would be installed 345 * @param compiledCode the result of a compilation 346 * @param metaData the metadata is written to this object 347 * @return the outcome of the installation which will be one of 348 * {@link HotSpotVMConfig#codeInstallResultOk}, 349 * {@link HotSpotVMConfig#codeInstallResultCacheFull}, 350 * {@link HotSpotVMConfig#codeInstallResultCodeTooLarge}, 351 * {@link HotSpotVMConfig#codeInstallResultDependenciesFailed} or 352 * {@link HotSpotVMConfig#codeInstallResultDependenciesInvalid}. 353 * @throws JVMCIError if there is something wrong with the compiled code or the metadata 354 */ 355 native int getMetadata(TargetDescription target, HotSpotCompiledCode compiledCode, HotSpotMetaData metaData); 356 357 /** 358 * Resets all compilation statistics. 416 */ 417 native long getMaxCallTargetOffset(long address); 418 419 /** 420 * Gets a textual disassembly of {@code codeBlob}. 421 * 422 * @return a non-zero length string containing a disassembly of {@code codeBlob} or null if 423 * {@code codeBlob} could not be disassembled for some reason 424 */ 425 // The HotSpot disassembler seems not to be thread safe so it's better to synchronize its usage 426 synchronized native String disassembleCodeBlob(InstalledCode installedCode); 427 428 /** 429 * Gets a stack trace element for {@code method} at bytecode index {@code bci}. 430 */ 431 native StackTraceElement getStackTraceElement(HotSpotResolvedJavaMethodImpl method, int bci); 432 433 /** 434 * Executes some {@code installedCode} with arguments {@code args}. 435 * 436 * @return the result of executing {@code installedCode} 437 * @throws InvalidInstalledCodeException if {@code installedCode} has been invalidated 438 */ 439 native Object executeInstalledCode(Object[] args, InstalledCode installedCode) throws InvalidInstalledCodeException; 440 441 /** 442 * Gets the line number table for {@code method}. The line number table is encoded as (bci, 443 * source line number) pairs. 444 * 445 * @return the line number table for {@code method} or null if it doesn't have one 446 */ 447 native long[] getLineNumberTable(HotSpotResolvedJavaMethodImpl method); 448 449 /** 450 * Gets the number of entries in the local variable table for {@code method}. 451 * 452 * @return the number of entries in the local variable table for {@code method} 453 */ 454 native int getLocalVariableTableLength(HotSpotResolvedJavaMethodImpl method); 455 456 /** 457 * Gets the address of the first entry in the local variable table for {@code method}. 458 * 459 * Each entry is a native object described by these fields: 460 * 461 * <ul> 462 * <li>{@link HotSpotVMConfig#localVariableTableElementSize}</li> 463 * <li>{@link HotSpotVMConfig#localVariableTableElementLengthOffset}</li> 464 * <li>{@link HotSpotVMConfig#localVariableTableElementNameCpIndexOffset}</li> 465 * <li>{@link HotSpotVMConfig#localVariableTableElementDescriptorCpIndexOffset}</li> 466 * <li>{@link HotSpotVMConfig#localVariableTableElementSlotOffset} 467 * <li>{@link HotSpotVMConfig#localVariableTableElementStartBciOffset} 468 * </ul> 469 * 470 * @return 0 if {@code method} does not have a local variable table 471 */ 472 native long getLocalVariableTableStart(HotSpotResolvedJavaMethodImpl method); 473 474 /** 475 * Sets flags on {@code method} indicating that it should never be inlined or compiled by the 476 * VM. 477 */ 478 native void setNotInlinableOrCompilable(HotSpotResolvedJavaMethodImpl method); 479 480 /** 481 * Invalidates the profiling information for {@code method} and (re)initializes it such that 482 * profiling restarts upon its next invocation. 483 */ 484 native void reprofile(HotSpotResolvedJavaMethodImpl method); 485 486 /** 487 * Invalidates {@code installedCode} such that {@link InvalidInstalledCodeException} will be 488 * raised the next time {@code installedCode} is executed. 489 */ 490 native void invalidateInstalledCode(InstalledCode installedCode); 491 492 /** 493 * Collects the current values of all JVMCI benchmark counters, summed up over all threads. 494 */ 495 native long[] collectCounters(); 496 497 /** 498 * Determines if {@code metaspaceMethodData} is mature. 499 */ 500 native boolean isMature(long metaspaceMethodData); 501 502 /** 503 * Generate a unique id to identify the result of the compile. 504 */ 505 native int allocateCompileId(HotSpotResolvedJavaMethodImpl method, int entryBCI); 506 507 /** 508 * Determines if {@code method} has OSR compiled code identified by {@code entryBCI} for 509 * compilation level {@code level}. 510 */ 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 572 * @param displacement 573 * @return null or the resolved method for this location 574 */ 575 native HotSpotResolvedJavaMethodImpl getResolvedJavaMethod(Object base, long displacement); 576 577 /** 578 * Gets the {@code ConstantPool*} associated with {@code object} and returns a 579 * {@link HotSpotConstantPool} wrapping it. 580 * 581 * @param object a {@link HotSpotResolvedJavaMethodImpl} or 582 * {@link HotSpotResolvedObjectTypeImpl} object 583 * @return a {@link HotSpotConstantPool} wrapping the {@code ConstantPool*} associated with 584 * {@code object} 585 * @throws NullPointerException if {@code object == null} 586 * @throws IllegalArgumentException if {@code object} is neither a 587 * {@link HotSpotResolvedJavaMethodImpl} nor a {@link HotSpotResolvedObjectTypeImpl} 588 */ 589 native HotSpotConstantPool getConstantPool(Object object); 590 591 /** 592 * Read a HotSpot Klass* value from the memory location described by {@code base} plus 593 * {@code displacement} and return the {@link HotSpotResolvedObjectTypeImpl} wrapping it. This 594 * method does no checking that the memory location actually contains a valid pointer and may 595 * crash the VM if an invalid location is provided. If the {@code base} is null then 596 * {@code displacement} is used by itself. If {@code base} is a 597 * {@link HotSpotResolvedJavaMethodImpl}, {@link HotSpotConstantPool} or 598 * {@link HotSpotResolvedObjectTypeImpl} then the metaspace pointer is fetched from that object 599 * and added to {@code displacement}. Any other non-null object type causes an 600 * {@link IllegalArgumentException} to be thrown. 601 * 602 * @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 */ 644 native void compileToBytecode(Object lambdaForm); 645 646 /** 647 * Gets the value of the VM flag named {@code name}. 648 * 649 * @param name name of a VM option 650 * @return {@code this} if the named VM option doesn't exist, a {@link String} or {@code null} 651 * if its type is {@code ccstr} or {@code ccstrlist}, a {@link Double} if its type is 652 * {@code double}, a {@link Boolean} if its type is {@code bool} otherwise a 653 * {@link Long} 654 */ 655 native Object getFlagValue(String name); 656 657 /** 658 * Gets the host class for {@code type}. 659 */ 660 native HotSpotResolvedObjectTypeImpl getHostClass(HotSpotResolvedObjectTypeImpl type); 661 662 /** 663 * Gets a {@link Executable} corresponding to {@code method}. 664 */ 665 native Executable asReflectionExecutable(HotSpotResolvedJavaMethodImpl method); 666 667 /** 668 * Gets a {@link Field} denoted by {@code holder} and {@code index}. 669 * 670 * @param holder the class in which the requested field is declared 671 * @param fieldIndex the {@code fieldDescriptor::index()} denoting the field 672 */ 673 native Field asReflectionField(HotSpotResolvedObjectTypeImpl holder, int fieldIndex); 674 } | 1 /* 2 * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package jdk.vm.ci.hotspot; 25 26 import static jdk.vm.ci.common.InitTimer.timer; 27 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; 28 29 import java.lang.reflect.Executable; 30 import java.lang.reflect.Field; 31 32 import jdk.vm.ci.code.BytecodeFrame; 33 import jdk.vm.ci.code.InstalledCode; 34 import jdk.vm.ci.code.InvalidInstalledCodeException; 35 import jdk.vm.ci.code.TargetDescription; 36 import jdk.vm.ci.code.stack.InspectedFrameVisitor; 37 import jdk.vm.ci.common.InitTimer; 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; 43 import jdk.vm.ci.meta.JavaType; 44 import jdk.vm.ci.meta.ResolvedJavaMethod; 45 import jdk.vm.ci.meta.ResolvedJavaType; 46 47 /** 48 * Calls from Java into HotSpot. The behavior of all the methods in this class that take a native 49 * pointer as an argument (e.g., {@link #getSymbol(long)}) is undefined if the argument does not 50 * denote a valid native object. 51 */ 52 final class CompilerToVM { 53 /** 54 * Initializes the native part of the JVMCI runtime. 55 */ 56 private static native void registerNatives(); 57 58 /** 59 * These values mirror the equivalent values from {@link Unsafe} but are approriate for the JVM 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 82 83 @SuppressWarnings("try") 84 CompilerToVM() { 85 try (InitTimer t = timer("CompilerToVM.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); 105 } 106 } 107 108 native int arrayBaseOffset(JavaKind kind); 109 110 native int arrayIndexScale(JavaKind kind); 111 112 /** 113 * Gets the {@link CompilerToVM} instance associated with the singleton 114 * {@link HotSpotJVMCIRuntime} instance. 115 */ 116 public static CompilerToVM compilerToVM() { 117 return runtime().getCompilerToVM(); 118 } 119 120 /** 121 * Copies the original bytecode of {@code method} into a new byte array and returns it. 122 * 123 * @return a new byte array containing the original bytecode of {@code method} 124 */ 125 native byte[] getBytecode(HotSpotResolvedJavaMethodImpl method); 126 127 /** 128 * Gets the number of entries in {@code method}'s exception handler table or 0 if it has no 129 * exception handler table. 130 */ 131 native int getExceptionTableLength(HotSpotResolvedJavaMethodImpl method); 182 native HotSpotResolvedJavaMethodImpl findUniqueConcreteMethod(HotSpotResolvedObjectTypeImpl actualHolderType, HotSpotResolvedJavaMethodImpl method); 183 184 /** 185 * Gets the implementor for the interface class {@code type}. 186 * 187 * @return the implementor if there is a single implementor, {@code null} if there is no 188 * implementor, or {@code type} itself if there is more than one implementor 189 * @throws IllegalArgumentException if type is not an interface type 190 */ 191 native HotSpotResolvedObjectTypeImpl getImplementor(HotSpotResolvedObjectTypeImpl type); 192 193 /** 194 * Determines if {@code method} is ignored by security stack walks. 195 */ 196 native boolean methodIsIgnoredBySecurityStackWalk(HotSpotResolvedJavaMethodImpl method); 197 198 /** 199 * Converts a name to a type. 200 * 201 * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format 202 * @param accessingClass the context of resolution. A value of {@code null} implies that the 203 * class should be resolved with the class loader. 204 * @param resolve force resolution to a {@link ResolvedJavaType}. If true, this method will 205 * either return a {@link ResolvedJavaType} or throw an exception 206 * @return the type for {@code name} or 0 if resolution failed and {@code resolve == false} 207 * @throws ClassNotFoundException if {@code resolve == true} and the resolution failed 208 */ 209 native HotSpotResolvedJavaType lookupType(String name, HotSpotResolvedObjectTypeImpl accessingClass, boolean resolve) throws ClassNotFoundException; 210 211 native HotSpotResolvedJavaType lookupClass(Class<?> javaClass); 212 213 /** 214 * Resolves the entry at index {@code cpi} in {@code constantPool} to an object. 215 * 216 * The behavior of this method is undefined if {@code cpi} does not denote one of the following 217 * entry types: {@code JVM_CONSTANT_MethodHandle}, {@code JVM_CONSTANT_MethodHandleInError}, 218 * {@code JVM_CONSTANT_MethodType} and {@code JVM_CONSTANT_MethodTypeInError}. 219 */ 220 native HotSpotObjectConstantImpl resolveConstantInPool(HotSpotConstantPool constantPool, int cpi); 221 222 /** 223 * Resolves the entry at index {@code cpi} in {@code constantPool} to an object, looking in the 224 * constant pool cache first. 225 * 226 * The behavior of this method is undefined if {@code cpi} does not denote a 227 * {@code JVM_CONSTANT_String} entry. 228 */ 229 native HotSpotObjectConstantImpl resolvePossiblyCachedConstantInPool(HotSpotConstantPool constantPool, int cpi); 230 231 /** 232 * Gets the {@code JVM_CONSTANT_NameAndType} index from the entry at index {@code cpi} in 233 * {@code constantPool}. 234 * 235 * The behavior of this method is undefined if {@code cpi} does not denote an entry containing a 236 * {@code JVM_CONSTANT_NameAndType} index. 237 */ 238 native int lookupNameAndTypeRefIndexInPool(HotSpotConstantPool constantPool, int cpi); 239 240 /** 241 * Gets the name of the {@code JVM_CONSTANT_NameAndType} entry referenced by another entry 242 * denoted by {@code which} in {@code constantPool}. 243 * 244 * The behavior of this method is undefined if {@code which} does not denote a entry that 245 * references a {@code JVM_CONSTANT_NameAndType} entry. 246 */ 247 native String lookupNameInPool(HotSpotConstantPool constantPool, int which); 248 249 /** 351 * {@code JVM_CONSTANT_Field} entry. 352 * 353 * @param info an array in which the details of the field are returned 354 * @return the type defining the field if resolution is successful, 0 otherwise 355 */ 356 native HotSpotResolvedObjectTypeImpl resolveFieldInPool(HotSpotConstantPool constantPool, int cpi, HotSpotResolvedJavaMethodImpl method, byte opcode, int[] info); 357 358 /** 359 * Converts {@code cpci} from an index into the cache for {@code constantPool} to an index 360 * directly into {@code constantPool}. 361 * 362 * The behavior of this method is undefined if {@code ccpi} is an invalid constant pool cache 363 * index. 364 */ 365 native int constantPoolRemapInstructionOperandFromCache(HotSpotConstantPool constantPool, int cpci); 366 367 /** 368 * Gets the appendix object (if any) associated with the entry at index {@code cpi} in 369 * {@code constantPool}. 370 */ 371 native HotSpotObjectConstantImpl lookupAppendixInPool(HotSpotConstantPool constantPool, int cpi); 372 373 /** 374 * Installs the result of a compilation into the code cache. 375 * 376 * @param target the target where this code should be installed 377 * @param compiledCode the result of a compilation 378 * @param code the details of the installed CodeBlob are written to this object 379 * @return the outcome of the installation which will be one of 380 * {@link HotSpotVMConfig#codeInstallResultOk}, 381 * {@link HotSpotVMConfig#codeInstallResultCacheFull}, 382 * {@link HotSpotVMConfig#codeInstallResultCodeTooLarge}, 383 * {@link HotSpotVMConfig#codeInstallResultDependenciesFailed} or 384 * {@link HotSpotVMConfig#codeInstallResultDependenciesInvalid}. 385 * @throws JVMCIError if there is something wrong with the compiled code or the associated 386 * metadata. 387 */ 388 native int installCode(TargetDescription target, HotSpotCompiledCode compiledCode, InstalledCode code, long failedSpeculationsAddress, byte[] speculations); 389 390 /** 391 * Generates the VM metadata for some compiled code and copies them into {@code metaData}. This 392 * method does not install anything into the code cache. 393 * 394 * @param target the target where this code would be installed 395 * @param compiledCode the result of a compilation 396 * @param metaData the metadata is written to this object 397 * @return the outcome of the installation which will be one of 398 * {@link HotSpotVMConfig#codeInstallResultOk}, 399 * {@link HotSpotVMConfig#codeInstallResultCacheFull}, 400 * {@link HotSpotVMConfig#codeInstallResultCodeTooLarge}, 401 * {@link HotSpotVMConfig#codeInstallResultDependenciesFailed} or 402 * {@link HotSpotVMConfig#codeInstallResultDependenciesInvalid}. 403 * @throws JVMCIError if there is something wrong with the compiled code or the metadata 404 */ 405 native int getMetadata(TargetDescription target, HotSpotCompiledCode compiledCode, HotSpotMetaData metaData); 406 407 /** 408 * Resets all compilation statistics. 466 */ 467 native long getMaxCallTargetOffset(long address); 468 469 /** 470 * Gets a textual disassembly of {@code codeBlob}. 471 * 472 * @return a non-zero length string containing a disassembly of {@code codeBlob} or null if 473 * {@code codeBlob} could not be disassembled for some reason 474 */ 475 // The HotSpot disassembler seems not to be thread safe so it's better to synchronize its usage 476 synchronized native String disassembleCodeBlob(InstalledCode installedCode); 477 478 /** 479 * Gets a stack trace element for {@code method} at bytecode index {@code bci}. 480 */ 481 native StackTraceElement getStackTraceElement(HotSpotResolvedJavaMethodImpl method, int bci); 482 483 /** 484 * Executes some {@code installedCode} with arguments {@code args}. 485 * 486 * @return the result of executing {@code nmethodMirror} 487 * @throws InvalidInstalledCodeException if {@code nmethodMirror} has been invalidated 488 */ 489 native Object executeHotSpotNmethod(Object[] args, HotSpotNmethod nmethodMirror) throws InvalidInstalledCodeException; 490 491 /** 492 * Gets the line number table for {@code method}. The line number table is encoded as (bci, 493 * source line number) pairs. 494 * 495 * @return the line number table for {@code method} or null if it doesn't have one 496 */ 497 native long[] getLineNumberTable(HotSpotResolvedJavaMethodImpl method); 498 499 /** 500 * Gets the number of entries in the local variable table for {@code method}. 501 * 502 * @return the number of entries in the local variable table for {@code method} 503 */ 504 native int getLocalVariableTableLength(HotSpotResolvedJavaMethodImpl method); 505 506 /** 507 * Gets the address of the first entry in the local variable table for {@code method}. 508 * 509 * Each entry is a native object described by these fields: 510 * 511 * <ul> 512 * <li>{@link HotSpotVMConfig#localVariableTableElementSize}</li> 513 * <li>{@link HotSpotVMConfig#localVariableTableElementLengthOffset}</li> 514 * <li>{@link HotSpotVMConfig#localVariableTableElementNameCpIndexOffset}</li> 515 * <li>{@link HotSpotVMConfig#localVariableTableElementDescriptorCpIndexOffset}</li> 516 * <li>{@link HotSpotVMConfig#localVariableTableElementSlotOffset} 517 * <li>{@link HotSpotVMConfig#localVariableTableElementStartBciOffset} 518 * </ul> 519 * 520 * @return 0 if {@code method} does not have a local variable table 521 */ 522 native long getLocalVariableTableStart(HotSpotResolvedJavaMethodImpl method); 523 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 /** 538 * Sets flags on {@code method} indicating that it should never be inlined or compiled by the 539 * VM. 540 */ 541 native void setNotInlinableOrCompilable(HotSpotResolvedJavaMethodImpl method); 542 543 /** 544 * Invalidates the profiling information for {@code method} and (re)initializes it such that 545 * profiling restarts upon its next invocation. 546 */ 547 native void reprofile(HotSpotResolvedJavaMethodImpl method); 548 549 /** 550 * Invalidates {@code nmethodMirror} such that {@link InvalidInstalledCodeException} will be 551 * raised the next time {@code nmethodMirror} is {@linkplain #executeHotSpotNmethod executed}. 552 * The {@code nmethod} associated with {@code nmethodMirror} is also made non-entrant and any 553 * current activations of the {@code nmethod} are deoptimized. 554 */ 555 native void invalidateHotSpotNmethod(HotSpotNmethod nmethodMirror); 556 557 /** 558 * Collects the current values of all JVMCI benchmark counters, summed up over all threads. 559 */ 560 native long[] collectCounters(); 561 562 /** 563 * Determines if {@code metaspaceMethodData} is mature. 564 */ 565 native boolean isMature(long metaspaceMethodData); 566 567 /** 568 * Generate a unique id to identify the result of the compile. 569 */ 570 native int allocateCompileId(HotSpotResolvedJavaMethodImpl method, int entryBCI); 571 572 /** 573 * Determines if {@code method} has OSR compiled code identified by {@code entryBCI} for 574 * compilation level {@code level}. 575 */ 620 /** 621 * Flush HotSpot's log stream. 622 */ 623 native void flushDebugOutput(); 624 625 /** 626 * Read a HotSpot Method* value from the memory location described by {@code base} plus 627 * {@code displacement} and return the {@link HotSpotResolvedJavaMethodImpl} wrapping it. This 628 * method does no checking that the memory location actually contains a valid pointer and may 629 * crash the VM if an invalid location is provided. If the {@code base} is null then 630 * {@code displacement} is used by itself. If {@code base} is a 631 * {@link HotSpotResolvedJavaMethodImpl}, {@link HotSpotConstantPool} or 632 * {@link HotSpotResolvedObjectTypeImpl} then the metaspace pointer is fetched from that object 633 * and added to {@code displacement}. Any other non-null object type causes an 634 * {@link IllegalArgumentException} to be thrown. 635 * 636 * @param base an object to read from or null 637 * @param displacement 638 * @return null or the resolved method for this location 639 */ 640 native HotSpotResolvedJavaMethodImpl getResolvedJavaMethod(HotSpotObjectConstantImpl base, long displacement); 641 642 /** 643 * Gets the {@code ConstantPool*} associated with {@code object} and returns a 644 * {@link HotSpotConstantPool} wrapping it. 645 * 646 * @param object a {@link HotSpotResolvedJavaMethodImpl} or 647 * {@link HotSpotResolvedObjectTypeImpl} object 648 * @return a {@link HotSpotConstantPool} wrapping the {@code ConstantPool*} associated with 649 * {@code object} 650 * @throws NullPointerException if {@code object == null} 651 * @throws IllegalArgumentException if {@code object} is neither a 652 * {@link HotSpotResolvedJavaMethodImpl} nor a {@link HotSpotResolvedObjectTypeImpl} 653 */ 654 native HotSpotConstantPool getConstantPool(MetaspaceObject object); 655 656 /** 657 * Read a HotSpot Klass* value from the memory location described by {@code base} plus 658 * {@code displacement} and return the {@link HotSpotResolvedObjectTypeImpl} wrapping it. This 659 * method does no checking that the memory location actually contains a valid pointer and may 660 * crash the VM if an invalid location is provided. If the {@code base} is null then 661 * {@code displacement} is used by itself. If {@code base} is a 662 * {@link HotSpotResolvedJavaMethodImpl}, {@link HotSpotConstantPool} or 663 * {@link HotSpotResolvedObjectTypeImpl} then the metaspace pointer is fetched from that object 664 * and added to {@code displacement}. Any other non-null object type causes an 665 * {@link IllegalArgumentException} to be thrown. 666 * 667 * @param base an object to read from or null 668 * @param displacement 669 * @param compressed true if the location contains a compressed Klass* 670 * @return null or the resolved method for this location 671 */ 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 } 685 686 /** 687 * Return the size of the HotSpot ProfileData* pointed at by {@code position}. If 688 * {@code position} is outside the space of the MethodData then an 689 * {@link IllegalArgumentException} is thrown. A {@code position} inside the MethodData but that 690 * isn't pointing at a valid ProfileData will crash the VM. 691 * 692 * @param metaspaceMethodData 693 * @param position 694 * @return the size of the ProfileData item pointed at by {@code position} 695 * @throws IllegalArgumentException if an out of range position is given 696 */ 697 native int methodDataProfileDataSize(long metaspaceMethodData, int position); 698 699 /** 700 * Gets the fingerprint for a given Klass*. 701 * 702 * @param metaspaceKlass 703 * @return the value of the fingerprint (zero for arrays and synthetic classes). 704 */ 705 native long getFingerprint(long metaspaceKlass); 706 707 /** 708 * Return the amount of native stack required for the interpreter frames represented by 709 * {@code frame}. This is used when emitting the stack banging code to ensure that there is 710 * enough space for the frames during deoptimization. 711 * 712 * @param frame 713 * @return the number of bytes required for deoptimization of this frame state 714 */ 715 native int interpreterFrameSize(BytecodeFrame frame); 716 717 /** 718 * Invokes non-public method {@code java.lang.invoke.LambdaForm.compileToBytecode()} on 719 * {@code lambdaForm} (which must be a {@code java.lang.invoke.LambdaForm} instance). 720 */ 721 native void compileToBytecode(HotSpotObjectConstantImpl lambdaForm); 722 723 /** 724 * Gets the value of the VM flag named {@code name}. 725 * 726 * @param name name of a VM option 727 * @return {@code this} if the named VM option doesn't exist, a {@link String} or {@code null} 728 * if its type is {@code ccstr} or {@code ccstrlist}, a {@link Double} if its type is 729 * {@code double}, a {@link Boolean} if its type is {@code bool} otherwise a 730 * {@link Long} 731 */ 732 native Object getFlagValue(String name); 733 734 /** 735 * Gets the host class for {@code type}. 736 */ 737 native HotSpotResolvedObjectTypeImpl getHostClass(HotSpotResolvedObjectTypeImpl type); 738 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 /** 898 * Gets a {@link Executable} corresponding to {@code method}. 899 */ 900 native Executable asReflectionExecutable(HotSpotResolvedJavaMethodImpl method); 901 902 /** 903 * Gets a {@link Field} denoted by {@code holder} and {@code index}. 904 * 905 * @param holder the class in which the requested field is declared 906 * @param fieldIndex the {@code fieldDescriptor::index()} denoting the field 907 */ 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 950 } |