Attachment 'method_access_java_conv.txt'

Download

   1 /**
   2  * Function returns method name.
   3  *
   4  * @param method - method handle
   5  *
   6  * @return Method name bytes.
   7  *
   8  * @note Assertion is raised if <i>method</i> is equal to null.
   9  */
  10 const char * methodGetName(MethodHandle method);
  11 
  12 /**
  13  * Function returns method descriptor.
  14  *
  15  * @param method - method handle
  16  *
  17  * @return Method descriptor bytes.
  18  *
  19  * @note Assertion is raised if <i>method</i> is equal to null.
  20  */
  21 const char * methodGetDescriptor(MethodHandle method);
  22 
  23 /**
  24  * Function returns a signature that can be used to iterate over method's arguments
  25  * and query the type of the method result.
  26  *
  27  * @param method - method handle
  28  *
  29  * @return Return a method signature.
  30  *
  31  * @note Assertion is raised if <i>method</i> is equal to null.
  32  */
  33 MethodSignatureHandle methodGetSignature(MethodHandle method);
  34 
  35 /**
  36  * Function returns a class in which the method is declared.
  37  *
  38  * @param method - method handle
  39  *
  40  * @return Return a class in which the method is declared.
  41  *
  42  * @note Assertion is raised if <i>method</i> is equal to null.
  43  */
  44 ClassHandle methodGetClass(MethodHandle method);
  45 
  46 /**
  47  * Function returns a returned java type for the method.
  48  *
  49  * @param method - method handle
  50  *
  51  * @return Return a returned java type.
  52  *
  53  * @note Assertion is raised if <i>method</i> is equal to null.
  54  */
  55 JavaType methodGetReturnType(MethodHandle method);
  56 
  57 /**
  58  * Function returns access flags for a given method.
  59  *
  60  * @param method - method handle
  61  *
  62  * @return Return access flags.
  63  *
  64  * @note Assertion is raised if <i>method</i> is equal to null.
  65  */
  66 unsigned short methodGetFlags(MethodHandle method);
  67 
  68 /**
  69  * Function checks if a given method is private.
  70  *
  71  * @param method - method handle
  72  *
  73  * @return Return <code>TRUE</code> if a given method is private.
  74  *
  75  * @note Assertion is raised if <i>method</i> is equal to null.
  76  */
  77 Boolean methodIsPrivate(MethodHandle method);
  78 
  79 /**
  80  * Function checks if a given method is public.
  81  *
  82  * @param method - method handle
  83  *
  84  * @return Return <code>TRUE</code> if a given method is public.
  85  *
  86  * @note Assertion is raised if <i>method</i> is equal to null.
  87  */
  88 Boolean methodIsPublic(MethodHandle method);
  89 
  90 /**
  91  * Function checks if a given method is static.
  92  *
  93  * @param method - method handle
  94  *
  95  * @return Return <code>TRUE</code> if a given method is static.
  96  *
  97  * @note Assertion is raised if <i>method</i> is equal to null.
  98  */
  99 Boolean methodIsStatic(MethodHandle method);
 100 
 101 /**
 102  * Function checks if a given method is native.
 103  *
 104  * @param method - method handle
 105  *
 106  * @return Return <code>TRUE</code> if a given method is native.
 107  *
 108  * @note Assertion is raised if <i>method</i> is equal to null.
 109  */
 110 Boolean methodIsNative(MethodHandle method);
 111 
 112 /**
 113  * Function checks if a given method is synchronized.
 114  *
 115  * @param method - method handle
 116  *
 117  * @return Return <code>TRUE</code> if a given method is synchronized.
 118  *
 119  * @note Assertion is raised if <i>method</i> is equal to null.
 120  */
 121 Boolean methodIsSynchronized(MethodHandle method);
 122 
 123 /**
 124  * Function checks if a given method is final.
 125  *
 126  * @param method - method handle
 127  *
 128  * @return Return <code>TRUE</code> if a given method is final.
 129  *
 130  * @note Assertion is raised if <i>method</i> is equal to null.
 131  */
 132 Boolean methodIsFinal(MethodHandle method);
 133 
 134 /**
 135  * Function checks if a given method is abstract.
 136  *
 137  * @param method - method handle
 138  *
 139  * @return Return <code>TRUE</code> if a given method is abstract.
 140  *
 141  * @note Assertion is raised if <i>method</i> is equal to null.
 142  */
 143 Boolean methodIsAbstract(MethodHandle method);
 144 
 145 /**
 146  * Function checks if a given method is strict.
 147  * Java methods may have a flag set to indicate that floating point operations
 148  * must be performed in the strict mode.
 149  *
 150  * @param method - method handle
 151  *
 152  * @return Return <code>TRUE</code> the <code>ACC_STRICT</code> flag is set for 
 153  *         a Java method and <code>FALSE</code> otherwise.
 154  *
 155  * @note Assertion is raised if <i>method</i> is equal to null.
 156  */
 157 Boolean methodIsStrict(MethodHandle method);
 158 
 159 /**
 160  * Function checks if a given method is a fake method.
 161  *
 162  * @param method - method handle
 163  *
 164  * @return Return <code>TRUE</code> if a given method is a fake method.
 165  *
 166  * @note Assertion is raised if <i>method</i> is equal to null.
 167  */
 168 Boolean methodIsFake(MethodHandle method);
 169 
 170 /**
 171  * Function checks if a given method is overridden.
 172  *
 173  * @param method - method handle
 174  *
 175  * @return Return <code>TRUE</code> if the method has been overriden in
 176  *         a subclass and <code>FALSE</code> otherwise.
 177  *
 178  * @note Assertion is raised if <i>method</i> is equal to null.
 179  * @note If <i>methodIsOverridden</i> returns <code>FALSE</code>, loading
 180  *       of a subclass later in the execution of the program may change invalidate
 181  *       this condition. If a JIT uses <i>methodIsOverridden</i> to implement
 182  *       unconditional inlining, it must be prepared to patch the code later
 183  *       (see <i>vmRegisterJitOverriddenMethodCallback</i>).
 184  */
 185 Boolean methodIsOverridden(MethodHandle method);
 186 
 187 /**
 188  * Function returns TRUE if the method should not be inlined.
 189  * There may also be other reasons why a method shouldn't be inlined,
 190  * e.g., native methods can't be inlined and in Java you can't inlined
 191  * methods that are loaded by a different class loader than the caller.
 192  *
 193  * @param method - method handle
 194  *
 195  * @return Return <code>TRUE</code> if the method should not be inlined.
 196  *
 197  * @note Assertion is raised if <i>method</i> is equal to null.
 198  * @note Always <code>FALSE</code> for Java.
 199  */
 200 Boolean methodIsNoInlining(Method_Handle method);
 201 
 202 /**
 203  * Function sets the number of exception handlers in the code generated by the JIT
 204  * <i>jit</i> for a given method. 
 205  *
 206  * @param method       - method handle
 207  * @param jit          - jit handle
 208  * @param num_handlers - the number of exception handlers
 209  *
 210  * @note The JIT must then call <i>methodSetTargetHandlerInfo</i> function
 211  *       for each of the <i>numHandlers</i> exception handlers.
 212  */
 213 void methodSetNumTargetHandlers(MethodHandle method, JitHandle jit,
 214                                unsigned short numHandlers);
 215 
 216 /**
 217  * Function checks if the local variable is pinned.
 218  *
 219  * @param method - method handle
 220  * @param index  - the local variable index
 221  *
 222  * @return Return <i>TRUE</i> if the local variable is pinned.
 223  */
 224 Boolean methodVarsIsPinned(MethodHandle method, unsigned short index);
 225 
 226 /**
 227  * Function returns a unique id associated with a method handle.
 228  *
 229  * @param method - method handle
 230  *
 231  * @return Return a unique id associated with a method handle.
 232  */
 233 uint32 methodGetId(MethodHandle method);
 234 
 235 
 236 /**
 237  * The function returns a method handle for an accessible method overriding
 238  * <i>method</i> in <i>klass</i> or in its closest superclass that overrides <i>method</i>.
 239  *
 240  * @param klass  - class handle
 241  * @param method - method handle
 242  *
 243  * @return Return a method handle for an accessible method overriding <i>method</i>.
 244  */
 245 MethodHandle methodFindOverriddenMethod(ClassHandle klass, MethodHandle method);
 246 
 247 
 248 /**
 249  * Function returns the type info of the local variable.
 250  *
 251  * @param method - method handle
 252  * @param index  - the local variable number
 253  *
 254  * @return Return the type info of the local variable.
 255  *
 256  * @note Since local variables are not typed in Java, this function
 257  *       always returns NULL for Java methods.
 258  */
 259 TypeInfoHandle methodVarsGetTypeInfo(MethodHandle method, unsigned short index);
 260 
 261 /**
 262  * Function returns the number of arguments defined for the method.
 263  * This number automatically includes the this pointer (if present).
 264  *
 265  * @param methodSignature - method signature handle
 266  *
 267  * @return Return the number of arguments defined for the method.
 268  */
 269 unsigned char methodArgsGetNumber(MethodSignatureHandle methodSignature);
 270 
 271 /**
 272  * Function initializes the ChaMethodIterator <i>iterator</i>, to iterate over all
 273  * methods that match the method signature and descend from <i>klass</i>
 274  * (including <i>klass</i> itself).
 275  *
 276  * @param iterator - class iterator
 277  * @param method - method handle
 278  * @param klass - class handle
 279  *
 280  * @return Return <code>TRUE</code> if iteration is supported over <i>klass</i>,
 281  *         <code>FALSE</code> if not.
 282  *
 283  * @note Reference to internal type ChaMethodIterator.
 284  */
 285 Boolean methodIteratorInitialize(ChaMethodIterator *iterator, MethodHandle method,
 286                                  ClassHandle klass);
 287 
 288 /**
 289  * Function advances the iterator.
 290  *
 291  * @param iterator - class iterator
 292  *
 293  * @note Reference to internal type ChaMethodIterator.
 294  */
 295 void methodIteratorAdvance(ChaMethodIterator *iterator);
 296 
 297 /**
 298  * Function returns the current method of the iterator.
 299  * NULL is returned if there are no more methods.
 300  *
 301  * @param iterator - class iterator
 302  *
 303  * @return Return the current method of the iterator.
 304  *
 305  * @note Reference to internal type ChaMethodIterator.
 306  */
 307 MethodHandle methodIteratorGetCurrent(ChaMethodIterator *iterator);
 308 
 309 /**
 310  * Function returns the number of exceptions a given method can throw.
 311  *
 312  * @param method - method handle
 313  *
 314  * @return Return the number of exceptions.
 315  *
 316  * @note Replaces methodNumberThrows function.
 317  */
 318 unsigned short methodGetNumThrows(MethodHandle method);
 319 
 320 
 321 /**
 322  * Function returns the exception class a given method can throw.
 323  *
 324  * @param method - method handle
 325  * @param index  - the exception number
 326  *
 327  * @return Return the exception class a given method can throw.
 328  */
 329 ClassHandle methodGetThrows(MethodHandle method, unsigned short index);
 330 
 331 
 332 /**
 333  * Function returns number of method exception handlers.
 334  *
 335  * @param method - method handle
 336  *
 337  * @return Number of method exception handlers.
 338  *
 339  * @note Assertion is raised if method is equal to null.
 340  * @note Replaces methodGetExcHandlerNumber function.
 341  */
 342 unsigned short methodGetExcHandlerNumber(MethodHandle method);
 343 
 344 
 345 
 346 /**
 347  * Function obtains method exception handle info.
 348  *
 349  * @param method     - method handle
 350  * @param index      - exception handle index number
 351  * @param startPc    - resulting pointer to exception handle start program count
 352  * @param endPc      - resulting pointer to exception handle end program count
 353  * @param handlerPc  - resulting pointer to exception handle program count
 354  * @param catchType  - resulting pointer to constant pool entry index
 355  *
 356  * @note Assertion is raised if method is equal to null or
 357  *       exception handle index is out of range or
 358  *       any pointer is equal to null.
 359  * @note Replaces methodGetExcHandlerInfo function.
 360  */
 361 void methodGetHandlerInfo(MethodHandler method, unsigned short index,
 362                           unsigned short *startPc, unsigned short *endPc,
 363                           unsigned short *handlerPc, unsigned short *catchType );
 364 
 365 /**
 366  * Function returns the type info for return value.
 367  *
 368  * @param methodSignature - method signature handle
 369  *
 370  * @return Return the type info for return value.
 371  */
 372 TypeInfoHandle methodRetTypeGetTypeInfo(MethodSignatureHandle methodSignature);
 373 
 374 /**
 375  * Function returns the type info for argument.
 376  *
 377  * @param methodSignature  - method signature handle
 378  * @param index            - argument index
 379  *
 380  * @return Return the type info for argument.
 381  */
 382 TypeInfoHandle methodArgsGetTypeInfo(MethodSignatureHandle methodSignature, unsigned index);
 383 
 384 /**
 385  * Function returns the method argument list.
 386  *
 387  * @param method - method handle
 388  *
 389  * @return Return the method argument list.
 390  */
 391 ArgListIterator methodGetArgumentList(MethodHandle method);
 392 
 393 /**
 394  * Function moves the iterator to the next argument in the list.
 395  *
 396  * @param iterator - argument list iterator
 397  *
 398  * @return Return the moved iterator.
 399  *
 400  * @note Replaces advanceArgIterator function.
 401  */
 402 ArgListIterator methodAdvanceArgIterator(ArgListIterator iterator);
 403 
 404 /**
 405  * Function returns Java type of the argument pointed by the iterator.
 406  *
 407  * @param iterator - argument list iterator
 408  *
 409  * @return Return Java type of the argument.
 410  *
 411  * @note Replaces currArg function.
 412  */
 413 JavaType methodCurrentArg(ArgListIterator iterator);
 414 
 415 /**
 416  * Function returns the method bytecode size.
 417  *
 418  * @param method - method handle
 419  *
 420  * @return Return the method bytecode size.
 421  *
 422  * @note Replaces methodGetCodeLength function.
 423  */
 424 size_t methodGetBytecodeSize(MethodHandle method);
 425 
 426 /*
 427  * Function returns the method bytecode array.
 428  *
 429  * @param method - method handle
 430  *
 431  * @return Return the method bytecode array.
 432  *
 433  * @note Assertion is raised if method is equal to null.
 434  * @note Reference to type Byte.
 435  * @note Replaces methodGetBytecode function.
 436  */
 437 const Byte * methodGetBytecodeAddr(MethodHandle method);
 438 
 439 /**
 440  * Function returns maximal local variables number of a given method.
 441  *
 442  * @param method - method handle
 443  *
 444  * @return Maximal local variables number of method.
 445  *
 446  * @note Assertion is raised if method is equal to null.
 447  * @note Replaces methodGetMaxLocal and methodVarsGetNumber functions.
 448  */
 449 unsigned short methodGetMaxLocals(MethodHandle method);
 450 
 451 /**
 452  * Function returns maximal stack deep of method.
 453  *
 454  * @param method - method handler
 455  *
 456  * @return Maximal stack deep of method.
 457  *
 458  * @note Assertion is raised if method is equal to null.
 459  */
 460 unsigned short methodGetMaxStack(MethodHandle method);
 461 
 462 /**
 463  * Function returns the offset in bytes from the start of
 464  * the vtable to the entry for a given method.
 465  *
 466  * @param method - method handler
 467  *
 468  * @return Return the offset in bytes from the start of the vtable
 469  *         to the entry for a given method.
 470  */
 471 unsigned methodGetOffset(MethodHandle method);
 472 
 473 /**
 474  * Function return the address where the code pointer for a given method is.
 475  * A simple JIT that doesn't support recompilation (see e.g.
 476  * <i>vmRegisterJitRecompiledMethodCallback</i>) can only generate
 477  * code with indirect branches through the address provided by
 478  * <i>methodGetIndirectAddress</i> function.
 479  *
 480  * @param method - method handler
 481  *
 482  * @return Return the address where the code pointer for a given method is.
 483  */
 484 void * methodGetIndirectAddress(MethodHandle method);
 485 
 486 /**
 487  * This function allows allocation of multiple chunks of code with different
 488  * heat values. The JIT is responsible for specifying ids that are unique
 489  * within the same method.
 490  * The first instruction of the chunk with id=0 is the entry point of the method.
 491  * If the CAAAllocate argument is specified, memory is allocated and a pointer
 492  * to it is returned. If the CAASimulate argument is specified, no memory is
 493  * actually allocated and the VM returns an address that would have been
 494  * allocated if CAAAllocate was specified and all the other arguments were
 495  * the same. The VM may return NULL when CAASimulate is specified. This may
 496  * for instance happen if multiple heat values were mapped to the same code
 497  * pool or if the specified size would require a new code pool.
 498  *
 499  * @param method    - method handle
 500  * @param jit       - jit handle
 501  * @param size      - allocated code block size
 502  * @param alignment - memory block aligment
 503  * @param heat      - ?
 504  * @param id        - ?
 505  * @param action    - result return action
 506  *
 507  * @return Pointer to allocated code block.
 508  *
 509  * @note Reference to type Byte.
 510  */
 511 Byte * methodAllocateCodeBlock(Method_Handle method, JitHandle jit, size_t size,
 512                                size_t alignment, unsigned heat, int id,
 513                                CodeAllocationAction action);
 514 
 515 /**
 516  * Function allocates the "read-write" data block for this method.
 517  * This memory block cannot be retrieved later. The intention is to
 518  * use the data block for data that may be needed during the program
 519  * execution (e.g. tables for switch statements).
 520  *
 521  * Separation of data allocated by <i>methodAllocateDataBlock</i> and
 522  * <i>methodAllocateInfoBlock</i> may help improve locality of references
 523  * to data accessed during execution of compiled code and data accessed during
 524  * stack unwinding.
 525  *
 526  * @param method    - method handle
 527  * @param jit       - jit handle
 528  * @param size      - allocated code block size
 529  * @param alignment - memory block aligment
 530  *
 531  * @return Pointer to allocated data block.
 532  *
 533  * @note Reference to type Byte.
 534  *
 535  * @see methodAllocateInfoBlock
 536  */
 537 Byte * methodAllocateDataBlock(MethodHandle method, JitHandle jit, size_t size,
 538                                size_t alignment);
 539 
 540 /**
 541  * Function allocates an info block for this method.
 542  * An info block can be later retrieved by the JIT. The JIT may
 543  * for instance store GC maps for root set enumeration and stack
 544  * unwinding in the info block.
 545  *
 546  * @param method    - method handle
 547  * @param jit       - jit handle
 548  * @param size      - allocated code block size
 549  *
 550  * @return Pointer to allocated info block.
 551  *
 552  * @note Reference to type Byte.
 553  *
 554  * @see methodAllocateDataBlock
 555  */
 556 Byte * methodAllocateInfoBlock(MethodHandle method, JitHandle jit, size_t size);
 557 
 558 /**
 559  * Function retrieves the memory block allocated earlier by
 560  * <i>methodAllocateDataBlock</i> function.
 561  * A pair <method, jit> uniquely identifies a JIT info block.
 562  *
 563  * @param method    - method handle
 564  * @param jit       - jit handle
 565  *
 566  * @return Pointer to allocated data block.
 567  *
 568  * @note Reference to type Byte.
 569  */
 570 Byte * methodGetDataBlockJit(MethodHandle method, JitHandle jit);
 571 
 572 /**
 573  * Function retrieves the memory block allocated earlier by
 574  * <i>methodAllocateInfoBlock</i> function.
 575  * A pair <method, jit> uniquely identifies a JIT info block.
 576  *
 577  * @param method    - method handle
 578  * @param jit       - jit handle
 579  *
 580  * @return Pointer to allocated info block.
 581  *
 582  * @note Reference to type Byte.
 583  */
 584 Byte * methodGetInfoBlockJit(MethodHandle method, JitHandle jit);

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.