Attachment 'method_access.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 *
  11 method_get_name(Method_Handle method);
  12 
  13 /**
  14  * Function returns method descriptor.
  15  *
  16  * @param method - method handle
  17  *
  18  * @return Method descriptor bytes.
  19  *
  20  * @note Assertion is raised if <i>method</i> is equal to null.
  21  */
  22 const char *
  23 method_get_descriptor(Method_Handle method);
  24 
  25 /**
  26  * Function returns a signature that can be used to iterate over method's arguments
  27  * and query the type of the method result.
  28  *
  29  * @param method - method handle
  30  *
  31  * @return Return a method signature.
  32  *
  33  * @note Assertion is raised if <i>method</i> is equal to null.
  34  */
  35 Method_Signature_Handle
  36 method_get_signature(Method_Handle method);
  37 
  38 /**
  39  * Function returns a class in which the method is declared.
  40  *
  41  * @param method - method handle
  42  *
  43  * @return Return a class in which the method is declared.
  44  *
  45  * @note Assertion is raised if <i>method</i> is equal to null.
  46  */
  47 Class_Handle
  48 method_get_class(Method_Handle method);
  49 
  50 /**
  51  * Function returns a returned java type for the method.
  52  *
  53  * @param method - method handle
  54  *
  55  * @return Return a returned java type.
  56  *
  57  * @note Assertion is raised if <i>method</i> is equal to null.
  58  */
  59 Java_Type
  60 method_get_return_type(Method_Handle method);
  61 
  62 /**
  63  * Function returns access flags for a given method.
  64  *
  65  * @param method - method handle
  66  *
  67  * @return Return access flags.
  68  *
  69  * @note Assertion is raised if <i>method</i> is equal to null.
  70  */
  71 unsigned short
  72 method_get_flags(Method_Handle method);
  73 
  74 /**
  75  * Function checks if a given method is private.
  76  *
  77  * @param method - method handle
  78  *
  79  * @return Return <code>TRUE</code> if a given method is private.
  80  *
  81  * @note Assertion is raised if <i>method</i> is equal to null.
  82  */
  83 Boolean
  84 method_is_private(Method_Handle method);
  85 
  86 /**
  87  * Function checks if a given method is public.
  88  *
  89  * @param method - method handle
  90  *
  91  * @return Return <code>TRUE</code> if a given method is public.
  92  *
  93  * @note Assertion is raised if <i>method</i> is equal to null.
  94  */
  95 Boolean
  96 method_is_public(Method_Handle method);
  97 
  98 /**
  99  * Function checks if a given method is static.
 100  *
 101  * @param method - method handle
 102  *
 103  * @return Return <code>TRUE</code> if a given method is static.
 104  *
 105  * @note Assertion is raised if <i>method</i> is equal to null.
 106  */
 107 Boolean
 108 method_is_static(Method_Handle method);
 109 
 110 /**
 111  * Function checks if a given method is native.
 112  *
 113  * @param method - method handle
 114  *
 115  * @return Return <code>TRUE</code> if a given method is native.
 116  *
 117  * @note Assertion is raised if <i>method</i> is equal to null.
 118  */
 119 Boolean
 120 method_is_native(Method_Handle method);
 121 
 122 /**
 123  * Function checks if a given method is synchronized.
 124  *
 125  * @param method - method handle
 126  *
 127  * @return Return <code>TRUE</code> if a given method is synchronized.
 128  *
 129  * @note Assertion is raised if <i>method</i> is equal to null.
 130  */
 131 Boolean
 132 method_is_synchronized(Method_Handle method);
 133 
 134 /**
 135  * Function checks if a given method is final.
 136  *
 137  * @param method - method handle
 138  *
 139  * @return Return <code>TRUE</code> if a given method is final.
 140  *
 141  * @note Assertion is raised if <i>method</i> is equal to null.
 142  */
 143 Boolean
 144 method_is_final(Method_Handle method);
 145 
 146 /**
 147  * Function checks if a given method is abstract.
 148  *
 149  * @param method - method handle
 150  *
 151  * @return Return <code>TRUE</code> if a given method is abstract.
 152  *
 153  * @note Assertion is raised if <i>method</i> is equal to null.
 154  */
 155 Boolean
 156 method_is_abstract(Method_Handle method);
 157 
 158 /**
 159  * Function checks if a given method is strict.
 160  * Java methods may have a flag set to indicate that floating point operations
 161  * must be performed in the strict mode.
 162  *
 163  * @param method - method handle
 164  *
 165  * @return Return <code>TRUE</code> the <code>ACC_STRICT</code> flag is set for 
 166  *         a Java method and <code>FALSE</code> otherwise.
 167  *
 168  * @note Assertion is raised if <i>method</i> is equal to null.
 169  */
 170 Boolean
 171 method_is_strict(Method_Handle method);
 172 
 173 /**
 174  * Function checks if a given method is a fake method.
 175  *
 176  * @param method - method handle
 177  *
 178  * @return Return <code>TRUE</code> if a given method is a fake method.
 179  *
 180  * @note Assertion is raised if <i>method</i> is equal to null.
 181  */
 182 Boolean
 183 method_is_fake(Method_Handle method);
 184 
 185 /**
 186  * Function checks if a given method is overridden.
 187  *
 188  * @param method - method handle
 189  *
 190  * @return Return <code>TRUE</code> if the method has been overriden in
 191  *         a subclass and <code>FALSE</code> otherwise.
 192  *
 193  * @note Assertion is raised if <i>method</i> is equal to null.
 194  * @note If <i>method_is_overridden</i> returns <code>FALSE</code>, loading
 195  *       of a subclass later in the execution of the program may change invalidate
 196  *       this condition. If a JIT uses <i>method_is_overridden</i> to implement
 197  *       unconditional inlining, it must be prepared to patch the code later
 198  *       (see <i>vm_register_jit_overridden_method_callback</i>).
 199  */
 200 Boolean
 201 method_is_overridden(Method_Handle method);
 202 
 203 /**
 204  * Function returns TRUE if the method should not be inlined.
 205  * There may also be other reasons why a method shouldn't be inlined,
 206  * e.g., native methods can't be inlined and in Java you can't inlined
 207  * methods that are loaded by a different class loader than the caller.
 208  *
 209  * @param method - method handle
 210  *
 211  * @return Return <code>TRUE</code> if the method should not be inlined.
 212  *
 213  * @note Assertion is raised if <i>method</i> is equal to null.
 214  * @note Always <code>FALSE</code> for Java.
 215  */
 216 Boolean
 217 method_is_no_inlining(Method_Handle method);
 218 
 219 /**
 220  * Function sets the number of exception handlers in the code generated by the JIT
 221  * <i>jit</i> for a given method. 
 222  *
 223  * @param method       - method handle
 224  * @param jit          - jit handle
 225  * @param num_handlers - the number of exception handlers
 226  *
 227  * @note The JIT must then call <i>method_set_target_handler_info</i> function
 228  *       for each of the <i>num_handlers</i> exception handlers.
 229  */
 230 void
 231 method_set_num_target_handlers(Method_Handle method, JIT_Handle jit,
 232                                unsigned short num_handlers);
 233 
 234 /**
 235  * Function checks if the local variable is pinned.
 236  *
 237  * @param method - method handle
 238  * @param index  - the local variable index
 239  *
 240  * @return Return <i>TRUE</i> if the local variable is pinned.
 241  */
 242 Boolean
 243 method_vars_is_pinned(Method_Handle method, unsigned short index);
 244 
 245 /**
 246  * Function returns a unique id associated with a method handle.
 247  *
 248  * @param method - method handle
 249  *
 250  * @return Return a unique id associated with a method handle.
 251  */
 252 uint32
 253 method_get_id(Method_Handle method);
 254 
 255 
 256 /**
 257  * The function returns a method handle for an accessible method overriding
 258  * <i>method</i> in <i>klass</i> or in its closest superclass that overrides <i>method</i>.
 259  *
 260  * @param klass  - class handle
 261  * @param method - method handle
 262  *
 263  * @return Return a method handle for an accessible method overriding <i>method</i>.
 264  */
 265 Method_Handle
 266 method_find_overridden_method(Class_Handle klass, Method_Handle method);
 267 
 268 
 269 /**
 270  * Function returns the type info of the local variable.
 271  *
 272  * @param method - method handle
 273  * @param index  - the local variable number
 274  *
 275  * @return Return the type info of the local variable.
 276  *
 277  * @note Since local variables are not typed in Java, this function
 278  *       always returns NULL for Java methods.
 279  */
 280 Type_Info_Handle
 281 method_vars_get_type_info(Method_Handle method, unsigned short index);
 282 
 283 /**
 284  * Function returns the number of arguments defined for the method.
 285  * This number automatically includes the this pointer (if present).
 286  *
 287  * @param method_signature - method signature handle
 288  *
 289  * @return Return the number of arguments defined for the method.
 290  */
 291 unsigned char
 292 method_args_get_number(Method_Signature_Handle method_signature);
 293 
 294 /**
 295  * Function initializes the ChaMethodIterator <i>iterator</i>, to iterate over all
 296  * methods that match the method signature and descend from <i>klass</i>
 297  * (including <i>klass</i> itself).
 298  *
 299  * @param iterator - class iterator
 300  * @param method - method handle
 301  * @param klass - class handle
 302  *
 303  * @return Return <code>TRUE</code> if iteration is supported over <i>klass</i>,
 304  *         <code>FALSE</code> if not.
 305  *
 306  * @note Reference to internal type ChaMethodIterator.
 307  */
 308 Boolean
 309 method_iterator_initialize(ChaMethodIterator *iterator, Method_Handle method,
 310                            Class_Handle klass);
 311 
 312 /**
 313  * Function advances the iterator.
 314  *
 315  * @param iterator - class iterator
 316  *
 317  * @note Reference to internal type ChaMethodIterator.
 318  */
 319 void
 320 method_iterator_advance(ChaMethodIterator *iterator);
 321 
 322 /**
 323  * Function returns the current method of the iterator.
 324  * NULL is returned if there are no more methods.
 325  *
 326  * @param iterator - class iterator
 327  *
 328  * @return Return the current method of the iterator.
 329  *
 330  * @note Reference to internal type ChaMethodIterator.
 331  */
 332 Method_Handle
 333 method_iterator_get_current(ChaMethodIterator *iterator);
 334 
 335 /**
 336  * Function returns the number of exception a given method can throw.
 337  *
 338  * @param method - method handle
 339  *
 340  * @return Return the number of exception.
 341  *
 342  * @note Replaces method_number_throws function.
 343  */
 344 unsigned short
 345 
 346 method_get_num_throws(Method_Handle method);
 347 
 348 
 349 /**
 350  * Function returns the exception class a given method can throw.
 351  *
 352  * @param method - method handle
 353  * @param index  - the exception number
 354  *
 355  * @return Return the exception class a given method can throw.
 356  */
 357 Class_Handle
 358 method_get_throws(Method_Handle method, unsigned short index);
 359 
 360 
 361 /**
 362  * Function returns number of method exception handlers.
 363  *
 364  * @param method - method handle
 365  *
 366  * @return Number of method exception handlers.
 367  *
 368  * @note Assertion is raised if method is equal to null.
 369  * @note Replaces method_get_exc_handler_number function.
 370  */
 371 unsigned short
 372 
 373 method_get_exc_handler_number(Method_Handle method);
 374 
 375 
 376 
 377 /**
 378  * Function obtains method exception handle info.
 379  *
 380  * @param method     - method handle
 381  * @param index      - exception handle index number
 382  * @param start_pc   - resulting pointer to exception handle start program count
 383  * @param end_pc     - resulting pointer to exception handle end program count
 384  * @param handler_pc - resulting pointer to exception handle program count
 385  * @param catch_type - resulting pointer to constant pool entry index
 386  *
 387  * @note Assertion is raised if method is equal to null or
 388  *       exception handle index is out of range or
 389  *       any pointer is equal to null.
 390  * @note Replaces method_get_exc_handler_info function.
 391  */
 392 void
 393 method_get_handler_info( method_handler method, unsigned short index,
 394                          unsigned short *start_pc, unsigned short *end_pc,
 395                          unsigned short *handler_pc, unsigned short *catch_type );
 396 
 397 /**
 398  * Function returns the type info for return value.
 399  *
 400  * @param method_signature - method signature handle
 401  *
 402  * @return Return the type info for return value.
 403  */
 404 Type_Info_Handle
 405 method_ret_type_get_type_info(Method_Signature_Handle method_signature);
 406 
 407 /**
 408  * Function returns the type info for argument.
 409  *
 410  * @param method_signature - method signature handle
 411  * @param index            - argument index
 412  *
 413  * @return Return the type info for argument.
 414  */
 415 Type_Info_Handle
 416 method_args_get_type_info(Method_Signature_Handle method_signature, unsigned index);
 417 
 418 /**
 419  * Function returns the method argument list.
 420  *
 421  * @param method - method handle
 422  *
 423  * @return Return the method argument list.
 424  */
 425 Arg_List_Iterator
 426 method_get_argument_list(Method_Handle method);
 427 
 428 /**
 429  * Function moves the iterator to the next argument in the list.
 430  *
 431  * @param iterator - argument list iterator
 432  *
 433  * @return Return the moved iterator.
 434  *
 435  * @note Replaces advance_arg_iterator function.
 436  */
 437 Arg_List_Iterator
 438 method_advance_arg_iterator(Arg_List_Iterator iterator);
 439 
 440 /**
 441  * Function returns Java type of the argument pointed by the iterator.
 442  *
 443  * @param iterator - argument list iterator
 444  *
 445  * @return Return Java type of the argument.
 446  *
 447  * @note Replaces curr_arg function.
 448  */
 449 Java_Type
 450 method_current_arg(Arg_List_Iterator iterator);
 451 
 452 
 453 /**
 454  * Function returns the method bytecode size.
 455  *
 456  * @param method - method handle
 457  *
 458  * @return Return the method bytecode size.
 459  *
 460  * @note Replaces method_get_code_length function.
 461  */
 462 size_t
 463 
 464 method_get_bytecode_size(Method_Handle method);
 465 
 466 
 467 
 468 /*
 469  * Function returns the method bytecode array.
 470  *
 471  * @param method - method handle
 472  *
 473  * @return Return the method bytecode array.
 474  *
 475  * @note Assertion is raised if method is equal to null.
 476  * @note Reference to type Byte.
 477  * @note Replaces method_get_bytecode function.
 478  */
 479 const Byte *
 480 
 481 method_get_bytecode_addr(Method_Handle method);
 482 
 483 
 484 
 485 /**
 486  * Function returns maximal local variables number of a given method.
 487  *
 488  * @param method - method handle
 489  *
 490  * @return Maximal local variables number of method.
 491  *
 492  * @note Assertion is raised if method is equal to null.
 493  * @note Replaces method_get_max_local and method_vars_get_number functions.
 494  */
 495 unsigned short
 496 
 497 method_get_max_locals(Method_Handle method);
 498 
 499 
 500 
 501 /**
 502  * Function returns maximal stack deep of method.
 503  *
 504  * @param method - method handler
 505  *
 506  * @return Maximal stack deep of method.
 507  *
 508  * @note Assertion is raised if method is equal to null.
 509  */
 510 unsigned short
 511 
 512 method_get_max_stack(Method_Handle method);
 513 
 514 
 515 
 516 /**
 517 
 518  * Function returns the offset in bytes from the start of
 519  * the vtable to the entry for a given method.
 520 
 521  *
 522  * @param method - method handler
 523  *
 524  * @return Return the offset in bytes from the start of the vtable
 525  *         to the entry for a given method.
 526 
 527  */
 528 
 529 unsigned
 530 method_get_offset(Method_Handle method);
 531 
 532 /**
 533  * Function return the address where the code pointer for a given method is.
 534  * A simple JIT that doesn't support recompilation (see e.g.
 535  * <i>vm_register_jit_recompiled_method_callback</i>) can only generate
 536  * code with indirect branches through the address provided by
 537  * <i>method_get_indirect_address</i> function.
 538  *
 539  * @param method - method handler
 540  *
 541  * @return Return the address where the code pointer for a given method is.
 542 
 543  */
 544 void *
 545 method_get_indirect_address(Method_Handle method);
 546 
 547 /**
 548  * This function allows allocation of multiple chunks of code with different
 549  * heat values. The JIT is responsible for specifying ids that are unique
 550  * within the same method.
 551  * The first instruction of the chunk with id=0 is the entry point of the method.
 552  * If the CAA_Allocate argument is specified, memory is allocated and a pointer
 553  * to it is returned. If the CAA_Simulate argument is specified, no memory is
 554  * actually allocated and the VM returns an address that would have been
 555  * allocated if CAA_Allocate was specified and all the other arguments were
 556  * the same. The VM may return NULL when CAA_Simulate is specified. This may
 557  * for instance happen if multiple heat values were mapped to the same code
 558  * pool or if the specified size would require a new code pool.
 559  *
 560  * @param method    - method handle
 561  * @param jit       - jit handle
 562  * @param size      - allocated code block size
 563  * @param alignment - memory block aligment
 564  * @param heat      - ?
 565  * @param id        - ?
 566  * @param action    - result return action
 567  *
 568  * @return Pointer to allocated code block.
 569  *
 570  * @note Reference to type Byte.
 571  */
 572 Byte *
 573 method_allocate_code_block(Method_Handle method, JIT_Handle jit, size_t size,
 574                            size_t alignment, unsigned heat, int id,
 575                            Code_Allocation_Action action);
 576 
 577 /**
 578  * Function allocates the "read-write" data block for this method.
 579  * This memory block cannot be retrieved later. The intention is to
 580  * use the data block for data that may be needed during the program
 581  * execution (e.g. tables for switch statements).
 582  *
 583  * Separation of data allocated by <i>method_allocate_data_block</i> and
 584  * <i>method_allocate_info_block</i> may help improve locality of references
 585  * to data accessed during execution of compiled code and data accessed during
 586  * stack unwinding.
 587  *
 588  * @param method    - method handle
 589  * @param jit       - jit handle
 590  * @param size      - allocated code block size
 591  * @param alignment - memory block aligment
 592  *
 593  * @return Pointer to allocated data block.
 594  *
 595  * @note Reference to type Byte.
 596  *
 597  * @see method_allocate_info_block
 598  */
 599 Byte *
 600 method_allocate_data_block(Method_Handle method, JIT_Handle jit, size_t size,
 601                            size_t alignment);
 602 
 603 /**
 604  * Function allocates an info block for this method.
 605  * An info block can be later retrieved by the JIT. The JIT may
 606  * for instance store GC maps for root set enumeration and stack
 607  * unwinding in the onfo block.
 608  *
 609  * @param method    - method handle
 610  * @param jit       - jit handle
 611  * @param size      - allocated code block size
 612  *
 613  * @return Pointer to allocated info block.
 614  *
 615  * @note Reference to type Byte.
 616  *
 617  * @see method_allocate_data_block
 618  */
 619 Byte *
 620 method_allocate_info_block(Method_Handle method, JIT_Handle jit, size_t size);
 621 
 622 /**
 623  * Function retrieves the memory block allocated earlier by
 624  * <i>method_allocate_data_block</i> function.
 625  * A pair <method, jit> uniquely identifies a JIT info block.
 626  *
 627  * @param method    - method handle
 628  * @param jit       - jit handle
 629  *
 630  * @return Pointer to allocated data block.
 631  *
 632  * @note Reference to type Byte.
 633  */
 634 Byte *
 635 method_get_data_block_jit(Method_Handle method, JIT_Handle jit);
 636 
 637 /**
 638  * Function retrieves the memory block allocated earlier by
 639  * <i>method_allocate_info_block</i> function.
 640  * A pair <method, jit> uniquely identifies a JIT info block.
 641  *
 642  * @param method    - method handle
 643  * @param jit       - jit handle
 644  *
 645  * @return Pointer to allocated info block.
 646  *
 647  * @note Reference to type Byte.
 648  */
 649 Byte *
 650 method_get_info_block_jit(Method_Handle method, JIT_Handle 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.