1 /* 2 * Copyright (c) 2011, 2016, 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.hotspot.HotSpotJVMCIRuntime.runtime; 27 import static jdk.vm.ci.inittimer.InitTimer.timer; 28 29 import java.lang.reflect.Constructor; 30 import java.lang.reflect.Method; 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.common.JVMCIError; 37 import jdk.vm.ci.hotspotvmconfig.HotSpotVMField; 38 import jdk.vm.ci.inittimer.InitTimer; 39 import jdk.vm.ci.meta.JavaType; 40 import jdk.vm.ci.meta.ResolvedJavaMethod; 41 import jdk.vm.ci.meta.ResolvedJavaType; 42 import jdk.internal.misc.Unsafe; 43 44 /** 45 * Calls from Java into HotSpot. The behavior of all the methods in this class that take a native 46 * pointer as an argument (e.g., {@link #getSymbol(long)}) is undefined if the argument does not 47 * denote a valid native object. 48 */ 49 final class CompilerToVM { 50 /** 51 * Initializes the native part of the JVMCI runtime. 52 */ 53 private static native void registerNatives(); 54 55 static { 56 initialize(); 57 } 58 59 @SuppressWarnings("try") 60 private static void initialize() { 61 try (InitTimer t = timer("CompilerToVM.registerNatives")) { 62 registerNatives(); 63 } 64 } 65 66 /** 67 * Gets the {@link CompilerToVM} instance associated with the singleton 68 * {@link HotSpotJVMCIRuntime} instance. 69 */ 70 public static CompilerToVM compilerToVM() { 71 return runtime().getCompilerToVM(); 72 } 73 74 /** 75 * Copies the original bytecode of {@code method} into a new byte array and returns it. 76 * 77 * @return a new byte array containing the original bytecode of {@code method} 78 */ 79 native byte[] getBytecode(HotSpotResolvedJavaMethodImpl method); 80 81 /** 82 * Gets the number of entries in {@code method}'s exception handler table or 0 if it has not 83 * exception handler table. 84 */ 85 native int getExceptionTableLength(HotSpotResolvedJavaMethodImpl method); 86 87 /** 88 * Gets the address of the first entry in {@code method}'s exception handler table. 89 * 90 * Each entry is a native object described by these fields: 91 * 92 * <ul> 93 * <li>{@link HotSpotVMConfig#exceptionTableElementSize}</li> 94 * <li>{@link HotSpotVMConfig#exceptionTableElementStartPcOffset}</li> 95 * <li>{@link HotSpotVMConfig#exceptionTableElementEndPcOffset}</li> 96 * <li>{@link HotSpotVMConfig#exceptionTableElementHandlerPcOffset}</li> 97 * <li>{@link HotSpotVMConfig#exceptionTableElementCatchTypeIndexOffset} 98 * </ul> 99 * 100 * @return 0 if {@code method} has no exception handlers (i.e. 101 * {@code getExceptionTableLength(method) == 0}) 102 */ 103 native long getExceptionTableStart(HotSpotResolvedJavaMethodImpl method); 104 105 /** 106 * Determines if {@code method} can be inlined. A method may not be inlinable for a number of 107 * reasons such as: 108 * <ul> 109 * <li>a CompileOracle directive may prevent inlining or compilation of methods</li> 110 * <li>the method may have a bytecode breakpoint set</li> 111 * <li>the method may have other bytecode features that require special handling by the VM</li> 112 * </ul> 113 */ 114 native boolean canInlineMethod(HotSpotResolvedJavaMethodImpl method); 115 116 /** 117 * Determines if {@code method} should be inlined at any cost. This could be because: 118 * <ul> 119 * <li>a CompileOracle directive may forces inlining of this methods</li> 120 * <li>an annotation forces inlining of this method</li> 121 * </ul> 122 */ 123 native boolean shouldInlineMethod(HotSpotResolvedJavaMethodImpl method); 124 125 /** 126 * Used to implement {@link ResolvedJavaType#findUniqueConcreteMethod(ResolvedJavaMethod)}. 127 * 128 * @param method the method on which to base the search 129 * @param actualHolderType the best known type of receiver 130 * @return the method result or 0 is there is no unique concrete method for {@code method} 131 */ 132 native HotSpotResolvedJavaMethodImpl findUniqueConcreteMethod(HotSpotResolvedObjectTypeImpl actualHolderType, HotSpotResolvedJavaMethodImpl method); 133 134 /** 135 * Gets the implementor for the interface class {@code type}. 136 * 137 * @return the implementor if there is a single implementor, 0 if there is no implementor, or 138 * {@code type} itself if there is more than one implementor 139 */ 140 native HotSpotResolvedObjectTypeImpl getImplementor(HotSpotResolvedObjectTypeImpl type); 141 142 /** 143 * Determines if {@code method} is ignored by security stack walks. 144 */ 145 native boolean methodIsIgnoredBySecurityStackWalk(HotSpotResolvedJavaMethodImpl method); 146 147 /** 148 * Converts a name to a type. 149 * 150 * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format 151 * @param accessingClass the context of resolution (must not be null) 152 * @param resolve force resolution to a {@link ResolvedJavaType}. If true, this method will 153 * either return a {@link ResolvedJavaType} or throw an exception 154 * @return the type for {@code name} or 0 if resolution failed and {@code resolve == false} 155 * @throws LinkageError if {@code resolve == true} and the resolution failed 156 */ 157 native HotSpotResolvedObjectTypeImpl lookupType(String name, Class<?> accessingClass, boolean resolve); 158 159 /** 160 * Resolves the entry at index {@code cpi} in {@code constantPool} to an object. 161 * 162 * The behavior of this method is undefined if {@code cpi} does not denote one of the following 163 * entry types: {@code JVM_CONSTANT_MethodHandle}, {@code JVM_CONSTANT_MethodHandleInError}, 164 * {@code JVM_CONSTANT_MethodType} and {@code JVM_CONSTANT_MethodTypeInError}. 165 */ 166 native Object resolveConstantInPool(HotSpotConstantPool constantPool, int cpi); 167 168 /** 169 * Resolves the entry at index {@code cpi} in {@code constantPool} to an object, looking in the 170 * constant pool cache first. 171 * 172 * The behavior of this method is undefined if {@code cpi} does not denote a 173 * {@code JVM_CONSTANT_String} entry. 174 */ 175 native Object resolvePossiblyCachedConstantInPool(HotSpotConstantPool constantPool, int cpi); 176 177 /** 178 * Gets the {@code JVM_CONSTANT_NameAndType} index from the entry at index {@code cpi} in 179 * {@code constantPool}. 180 * 181 * The behavior of this method is undefined if {@code cpi} does not denote an entry containing a 182 * {@code JVM_CONSTANT_NameAndType} index. 183 */ 184 native int lookupNameAndTypeRefIndexInPool(HotSpotConstantPool constantPool, int cpi); 185 186 /** 187 * Gets the name of the {@code JVM_CONSTANT_NameAndType} entry referenced by another entry 188 * denoted by {@code which} in {@code constantPool}. 189 * 190 * The behavior of this method is undefined if {@code which} does not denote a entry that 191 * references a {@code JVM_CONSTANT_NameAndType} entry. 192 */ 193 native String lookupNameInPool(HotSpotConstantPool constantPool, int which); 194 195 /** 196 * Gets the signature of the {@code JVM_CONSTANT_NameAndType} entry referenced by another entry 197 * denoted by {@code which} in {@code constantPool}. 198 * 199 * The behavior of this method is undefined if {@code which} does not denote a entry that 200 * references a {@code JVM_CONSTANT_NameAndType} entry. 201 */ 202 native String lookupSignatureInPool(HotSpotConstantPool constantPool, int which); 203 204 /** 205 * Gets the {@code JVM_CONSTANT_Class} index from the entry at index {@code cpi} in 206 * {@code constantPool}. 207 * 208 * The behavior of this method is undefined if {@code cpi} does not denote an entry containing a 209 * {@code JVM_CONSTANT_Class} index. 210 */ 211 native int lookupKlassRefIndexInPool(HotSpotConstantPool constantPool, int cpi); 212 213 /** 214 * Looks up a class denoted by the {@code JVM_CONSTANT_Class} entry at index {@code cpi} in 215 * {@code constantPool}. This method does not perform any resolution. 216 * 217 * The behavior of this method is undefined if {@code cpi} does not denote a 218 * {@code JVM_CONSTANT_Class} entry. 219 * 220 * @return the resolved class entry or a String otherwise 221 */ 222 native Object lookupKlassInPool(HotSpotConstantPool constantPool, int cpi); 223 224 /** 225 * Looks up a method denoted by the entry at index {@code cpi} in {@code constantPool}. This 226 * method does not perform any resolution. 227 * 228 * The behavior of this method is undefined if {@code cpi} does not denote an entry representing 229 * a method. 230 * 231 * @param opcode the opcode of the instruction for which the lookup is being performed or 232 * {@code -1}. If non-negative, then resolution checks specific to the bytecode it 233 * denotes are performed if the method is already resolved. Should any of these 234 * checks fail, 0 is returned. 235 * @return the resolved method entry, 0 otherwise 236 */ 237 native HotSpotResolvedJavaMethodImpl lookupMethodInPool(HotSpotConstantPool constantPool, int cpi, byte opcode); 238 239 /** 240 * Ensures that the type referenced by the specified {@code JVM_CONSTANT_InvokeDynamic} entry at 241 * index {@code cpi} in {@code constantPool} is loaded and initialized. 242 * 243 * The behavior of this method is undefined if {@code cpi} does not denote a 244 * {@code JVM_CONSTANT_InvokeDynamic} entry. 245 */ 246 native void resolveInvokeDynamicInPool(HotSpotConstantPool constantPool, int cpi); 247 248 /** 249 * Ensures that the type referenced by the entry for a 250 * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature 251 * polymorphic</a> method at index {@code cpi} in {@code constantPool} is loaded and 252 * initialized. 253 * 254 * The behavior of this method is undefined if {@code cpi} does not denote an entry representing 255 * a signature polymorphic method. 256 */ 257 native void resolveInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi); 258 259 /** 260 * Gets the resolved type denoted by the entry at index {@code cpi} in {@code constantPool}. 261 * 262 * The behavior of this method is undefined if {@code cpi} does not denote an entry representing 263 * a class. 264 * 265 * @throws LinkageError if resolution failed 266 */ 267 native HotSpotResolvedObjectTypeImpl resolveTypeInPool(HotSpotConstantPool constantPool, int cpi) throws LinkageError; 268 269 /** 270 * Looks up and attempts to resolve the {@code JVM_CONSTANT_Field} entry for at index {@code cpi} in 271 * {@code constantPool}. For some opcodes, checks are performed that require the {@code method} 272 * that contains {@code opcode} to be specified. The values returned in {@code info} are: 273 * 274 * <pre> 275 * [(int) flags, // only valid if field is resolved 276 * (int) offset] // only valid if field is resolved 277 * </pre> 278 * 279 * The behavior of this method is undefined if {@code cpi} does not denote a 280 * {@code JVM_CONSTANT_Field} entry. 281 * 282 * @param info an array in which the details of the field are returned 283 * @return the type defining the field if resolution is successful, 0 otherwise 284 */ 285 native HotSpotResolvedObjectTypeImpl resolveFieldInPool(HotSpotConstantPool constantPool, int cpi, HotSpotResolvedJavaMethodImpl method, byte opcode, long[] info); 286 287 /** 288 * Converts {@code cpci} from an index into the cache for {@code constantPool} to an index 289 * directly into {@code constantPool}. 290 * 291 * The behavior of this method is undefined if {@code ccpi} is an invalid constant pool cache 292 * index. 293 */ 294 native int constantPoolRemapInstructionOperandFromCache(HotSpotConstantPool constantPool, int cpci); 295 296 /** 297 * Gets the appendix object (if any) associated with the entry at index {@code cpi} in 298 * {@code constantPool}. 299 */ 300 native Object lookupAppendixInPool(HotSpotConstantPool constantPool, int cpi); 301 302 /** 303 * Installs the result of a compilation into the code cache. 304 * 305 * @param target the target where this code should be installed 306 * @param compiledCode the result of a compilation 307 * @param code the details of the installed CodeBlob are written to this object 308 * @return the outcome of the installation which will be one of 309 * {@link HotSpotVMConfig#codeInstallResultOk}, 310 * {@link HotSpotVMConfig#codeInstallResultCacheFull}, 311 * {@link HotSpotVMConfig#codeInstallResultCodeTooLarge}, 312 * {@link HotSpotVMConfig#codeInstallResultDependenciesFailed} or 313 * {@link HotSpotVMConfig#codeInstallResultDependenciesInvalid}. 314 * @throws JVMCIError if there is something wrong with the compiled code or the associated 315 * metadata. 316 */ 317 native int installCode(TargetDescription target, HotSpotCompiledCode compiledCode, InstalledCode code, HotSpotSpeculationLog speculationLog); 318 319 public native int getMetadata(TargetDescription target, HotSpotCompiledCode compiledCode, HotSpotMetaData metaData); 320 321 /** 322 * Resets all compilation statistics. 323 */ 324 native void resetCompilationStatistics(); 325 326 /** 327 * Initializes the fields of {@code config}. 328 */ 329 native long initializeConfiguration(HotSpotVMConfig config); 330 331 /** 332 * Resolves the implementation of {@code method} for virtual dispatches on objects of dynamic 333 * type {@code exactReceiver}. This resolution process only searches "up" the class hierarchy of 334 * {@code exactReceiver}. 335 * 336 * @param caller the caller or context type used to perform access checks 337 * @return the link-time resolved method (might be abstract) or {@code 0} if it can not be 338 * linked 339 */ 340 native HotSpotResolvedJavaMethodImpl resolveMethod(HotSpotResolvedObjectTypeImpl exactReceiver, HotSpotResolvedJavaMethodImpl method, HotSpotResolvedObjectTypeImpl caller); 341 342 /** 343 * Gets the static initializer of {@code type}. 344 * 345 * @return 0 if {@code type} has no static initializer 346 */ 347 native HotSpotResolvedJavaMethodImpl getClassInitializer(HotSpotResolvedObjectTypeImpl type); 348 349 /** 350 * Determines if {@code type} or any of its currently loaded subclasses overrides 351 * {@code Object.finalize()}. 352 */ 353 native boolean hasFinalizableSubclass(HotSpotResolvedObjectTypeImpl type); 354 355 /** 356 * Gets the method corresponding to {@code holder} and slot number {@code slot} (i.e. 357 * {@link Method#slot} or {@link Constructor#slot}). 358 */ 359 native HotSpotResolvedJavaMethodImpl getResolvedJavaMethodAtSlot(Class<?> holder, int slot); 360 361 /** 362 * Gets the maximum absolute offset of a PC relative call to {@code address} from any position 363 * in the code cache. 364 * 365 * @param address an address that may be called from any code in the code cache 366 * @return -1 if {@code address == 0} 367 */ 368 native long getMaxCallTargetOffset(long address); 369 370 /** 371 * Gets a textual disassembly of {@code codeBlob}. 372 * 373 * @return a non-zero length string containing a disassembly of {@code codeBlob} or null if 374 * {@code codeBlob} could not be disassembled for some reason 375 */ 376 // The HotSpot disassembler seems not to be thread safe so it's better to synchronize its usage 377 synchronized native String disassembleCodeBlob(InstalledCode installedCode); 378 379 /** 380 * Gets a stack trace element for {@code method} at bytecode index {@code bci}. 381 */ 382 native StackTraceElement getStackTraceElement(HotSpotResolvedJavaMethodImpl method, int bci); 383 384 /** 385 * Executes some {@code installedCode} with arguments {@code args}. 386 * 387 * @return the result of executing {@code installedCode} 388 * @throws InvalidInstalledCodeException if {@code installedCode} has been invalidated 389 */ 390 native Object executeInstalledCode(Object[] args, InstalledCode installedCode) throws InvalidInstalledCodeException; 391 392 /** 393 * Gets the line number table for {@code method}. The line number table is encoded as (bci, 394 * source line number) pairs. 395 * 396 * @return the line number table for {@code method} or null if it doesn't have one 397 */ 398 native long[] getLineNumberTable(HotSpotResolvedJavaMethodImpl method); 399 400 /** 401 * Gets the number of entries in the local variable table for {@code method}. 402 * 403 * @return the number of entries in the local variable table for {@code method} 404 */ 405 native int getLocalVariableTableLength(HotSpotResolvedJavaMethodImpl method); 406 407 /** 408 * Gets the address of the first entry in the local variable table for {@code method}. 409 * 410 * Each entry is a native object described by these fields: 411 * 412 * <ul> 413 * <li>{@link HotSpotVMConfig#localVariableTableElementSize}</li> 414 * <li>{@link HotSpotVMConfig#localVariableTableElementLengthOffset}</li> 415 * <li>{@link HotSpotVMConfig#localVariableTableElementNameCpIndexOffset}</li> 416 * <li>{@link HotSpotVMConfig#localVariableTableElementDescriptorCpIndexOffset}</li> 417 * <li>{@link HotSpotVMConfig#localVariableTableElementSignatureCpIndexOffset} 418 * <li>{@link HotSpotVMConfig#localVariableTableElementSlotOffset} 419 * <li>{@link HotSpotVMConfig#localVariableTableElementStartBciOffset} 420 * </ul> 421 * 422 * @return 0 if {@code method} does not have a local variable table 423 */ 424 native long getLocalVariableTableStart(HotSpotResolvedJavaMethodImpl method); 425 426 /** 427 * Determines if {@code method} should not be inlined or compiled. 428 */ 429 native void doNotInlineOrCompile(HotSpotResolvedJavaMethodImpl method); 430 431 /** 432 * Invalidates the profiling information for {@code method} and (re)initializes it such that 433 * profiling restarts upon its next invocation. 434 */ 435 native void reprofile(HotSpotResolvedJavaMethodImpl method); 436 437 /** 438 * Invalidates {@code installedCode} such that {@link InvalidInstalledCodeException} will be 439 * raised the next time {@code installedCode} is executed. 440 */ 441 native void invalidateInstalledCode(InstalledCode installedCode); 442 443 /** 444 * Collects the current values of all JVMCI benchmark counters, summed up over all threads. 445 */ 446 native long[] collectCounters(); 447 448 /** 449 * Determines if {@code metaspaceMethodData} is mature. 450 */ 451 native boolean isMature(long metaspaceMethodData); 452 453 /** 454 * Generate a unique id to identify the result of the compile. 455 */ 456 native int allocateCompileId(HotSpotResolvedJavaMethodImpl method, int entryBCI); 457 458 /** 459 * Determines if {@code method} has OSR compiled code identified by {@code entryBCI} for 460 * compilation level {@code level}. 461 */ 462 native boolean hasCompiledCodeForOSR(HotSpotResolvedJavaMethodImpl method, int entryBCI, int level); 463 464 /** 465 * Gets the value of {@code metaspaceSymbol} as a String. 466 */ 467 native String getSymbol(long metaspaceSymbol); 468 469 /** 470 * Looks for the next Java stack frame matching an entry in {@code methods}. 471 * 472 * @param frame the starting point of the search, where {@code null} refers to the topmost frame 473 * @param methods the methods to look for, where {@code null} means that any frame is returned 474 * @return the frame, or {@code null} if the end of the stack was reached during the search 475 */ 476 native HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, ResolvedJavaMethod[] methods, int initialSkip); 477 478 /** 479 * Materializes all virtual objects within {@code stackFrame} updates its locals. 480 * 481 * @param invalidate if {@code true}, the compiled method for the stack frame will be 482 * invalidated. 483 */ 484 native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate); 485 486 /** 487 * Gets the v-table index for interface method {@code method} in the receiver {@code type} or 488 * {@link HotSpotVMConfig#invalidVtableIndex} if {@code method} is not in {@code type}'s 489 * v-table. 490 * 491 * @throws InternalError if {@code type} is an interface or {@code method} is not held by an 492 * interface or class represented by {@code type} is not initialized 493 */ 494 native int getVtableIndexForInterfaceMethod(HotSpotResolvedObjectTypeImpl type, HotSpotResolvedJavaMethodImpl method); 495 496 /** 497 * Determines if debug info should also be emitted at non-safepoint locations. 498 */ 499 500 native boolean shouldDebugNonSafepoints(); 501 502 /** 503 * Writes {@code length} bytes from {@code bytes} starting at offset {@code offset} to the 504 * HotSpot's log stream. 505 * 506 * @exception NullPointerException if {@code bytes == null} 507 * @exception IndexOutOfBoundsException if copying would cause access of data outside array 508 * bounds 509 */ 510 native void writeDebugOutput(byte[] bytes, int offset, int length); 511 512 /** 513 * Flush HotSpot's log stream. 514 */ 515 native void flushDebugOutput(); 516 517 /** 518 * Read a HotSpot Method* value from the memory location described by {@code base} plus 519 * {@code displacement} and return the {@link HotSpotResolvedJavaMethodImpl} wrapping it. This 520 * method does no checking that the memory location actually contains a valid pointer and may 521 * crash the VM if an invalid location is provided. If the {@code base} is null then 522 * {@code displacement} is used by itself. If {@code base} is a 523 * {@link HotSpotResolvedJavaMethodImpl}, {@link HotSpotConstantPool} or 524 * {@link HotSpotResolvedObjectTypeImpl} then the metaspace pointer is fetched from that object 525 * and added to {@code displacement}. Any other non-null object type causes an 526 * {@link IllegalArgumentException} to be thrown. 527 * 528 * @param base an object to read from or null 529 * @param displacement 530 * @return null or the resolved method for this location 531 */ 532 native HotSpotResolvedJavaMethodImpl getResolvedJavaMethod(Object base, long displacement); 533 534 /** 535 * Read a HotSpot ConstantPool* value from the memory location described by {@code base} plus 536 * {@code displacement} and return the {@link HotSpotConstantPool} wrapping it. This method does 537 * no checking that the memory location actually contains a valid pointer and may crash the VM 538 * if an invalid location is provided. If the {@code base} is null then {@code displacement} is 539 * used by itself. If {@code base} is a {@link HotSpotResolvedJavaMethodImpl}, 540 * {@link HotSpotConstantPool} or {@link HotSpotResolvedObjectTypeImpl} then the metaspace 541 * pointer is fetched from that object and added to {@code displacement}. Any other non-null 542 * object type causes an {@link IllegalArgumentException} to be thrown. 543 * 544 * @param base an object to read from or null 545 * @param displacement 546 * @return null or the resolved method for this location 547 */ 548 native HotSpotConstantPool getConstantPool(Object base, long displacement); 549 550 /** 551 * Read a HotSpot Klass* value from the memory location described by {@code base} plus 552 * {@code displacement} and return the {@link HotSpotResolvedObjectTypeImpl} wrapping it. This 553 * method does no checking that the memory location actually contains a valid pointer and may 554 * crash the VM if an invalid location is provided. If the {@code base} is null then 555 * {@code displacement} is used by itself. If {@code base} is a 556 * {@link HotSpotResolvedJavaMethodImpl}, {@link HotSpotConstantPool} or 557 * {@link HotSpotResolvedObjectTypeImpl} then the metaspace pointer is fetched from that object 558 * and added to {@code displacement}. Any other non-null object type causes an 559 * {@link IllegalArgumentException} to be thrown. 560 * 561 * @param base an object to read from or null 562 * @param displacement 563 * @param compressed true if the location contains a compressed Klass* 564 * @return null or the resolved method for this location 565 */ 566 native HotSpotResolvedObjectTypeImpl getResolvedJavaType(Object base, long displacement, boolean compressed); 567 568 /** 569 * Return the size of the HotSpot ProfileData* pointed at by {@code position}. If 570 * {@code position} is outside the space of the MethodData then an 571 * {@link IllegalArgumentException} is thrown. A {@code position} inside the MethodData but that 572 * isn't pointing at a valid ProfileData will crash the VM. 573 * 574 * @param metaspaceMethodData 575 * @param position 576 * @return the size of the ProfileData item pointed at by {@code position} 577 * @throws IllegalArgumentException if an out of range position is given 578 */ 579 native int methodDataProfileDataSize(long metaspaceMethodData, int position); 580 581 /** 582 * Return the amount of native stack required for the interpreter frames represented by 583 * {@code frame}. This is used when emitting the stack banging code to ensure that there is 584 * enough space for the frames during deoptimization. 585 * 586 * @param frame 587 * @return the number of bytes required for deoptimization of this frame state 588 */ 589 native int interpreterFrameSize(BytecodeFrame frame); 590 }