446 |
446 |
447 // vtable index |
447 // vtable index |
448 enum VtableIndexFlag { |
448 enum VtableIndexFlag { |
449 // Valid vtable indexes are non-negative (>= 0). |
449 // Valid vtable indexes are non-negative (>= 0). |
450 // These few negative values are used as sentinels. |
450 // These few negative values are used as sentinels. |
451 highest_unused_vtable_index_value = -5, |
451 itable_index_max = -10, // first itable index, growing downward |
|
452 pending_itable_index = -9, // itable index will be assigned |
452 invalid_vtable_index = -4, // distinct from any valid vtable index |
453 invalid_vtable_index = -4, // distinct from any valid vtable index |
453 garbage_vtable_index = -3, // not yet linked; no vtable layout yet |
454 garbage_vtable_index = -3, // not yet linked; no vtable layout yet |
454 nonvirtual_vtable_index = -2 // there is no need for vtable dispatch |
455 nonvirtual_vtable_index = -2 // there is no need for vtable dispatch |
455 // 6330203 Note: Do not use -1, which was overloaded with many meanings. |
456 // 6330203 Note: Do not use -1, which was overloaded with many meanings. |
456 }; |
457 }; |
457 DEBUG_ONLY(bool valid_vtable_index() const { return _vtable_index >= nonvirtual_vtable_index; }) |
458 DEBUG_ONLY(bool valid_vtable_index() const { return _vtable_index >= nonvirtual_vtable_index; }) |
458 int vtable_index() const { assert(valid_vtable_index(), ""); |
459 bool has_vtable_index() const { return _vtable_index >= 0; } |
459 return _vtable_index; } |
460 int vtable_index() const { return _vtable_index; } |
460 void set_vtable_index(int index) { _vtable_index = index; } |
461 void set_vtable_index(int index) { _vtable_index = index; } |
|
462 DEBUG_ONLY(bool valid_itable_index() const { return _vtable_index <= pending_itable_index; }) |
|
463 bool has_itable_index() const { return _vtable_index <= itable_index_max; } |
|
464 int itable_index() const { assert(valid_itable_index(), ""); |
|
465 return itable_index_max - _vtable_index; } |
|
466 void set_itable_index(int index) { _vtable_index = itable_index_max - index; assert(valid_itable_index(), ""); } |
461 |
467 |
462 // interpreter entry |
468 // interpreter entry |
463 address interpreter_entry() const { return _i2i_entry; } |
469 address interpreter_entry() const { return _i2i_entry; } |
464 // Only used when first initialize so we can set _i2i_entry and _from_interpreted_entry |
470 // Only used when first initialize so we can set _i2i_entry and _from_interpreted_entry |
465 void set_interpreter_entry(address entry) { _i2i_entry = entry; _from_interpreted_entry = entry; } |
471 void set_interpreter_entry(address entry) { _i2i_entry = entry; _from_interpreted_entry = entry; } |
558 // returns true if this is a vanilla constructor |
564 // returns true if this is a vanilla constructor |
559 bool is_vanilla_constructor() const; |
565 bool is_vanilla_constructor() const; |
560 |
566 |
561 // checks method and its method holder |
567 // checks method and its method holder |
562 bool is_final_method() const; |
568 bool is_final_method() const; |
563 bool is_strict_method() const; |
569 bool is_final_method(AccessFlags class_access_flags) const; |
564 |
570 |
565 // true if method needs no dynamic dispatch (final and/or no vtable entry) |
571 // true if method needs no dynamic dispatch (final and/or no vtable entry) |
566 bool can_be_statically_bound() const; |
572 bool can_be_statically_bound() const; |
|
573 bool can_be_statically_bound(AccessFlags class_access_flags) const; |
567 |
574 |
568 // returns true if the method has any backward branches. |
575 // returns true if the method has any backward branches. |
569 bool has_loops() { |
576 bool has_loops() { |
570 return access_flags().loops_flag_init() ? access_flags().has_loops() : compute_has_loops_flag(); |
577 return access_flags().loops_flag_init() ? access_flags().has_loops() : compute_has_loops_flag(); |
571 }; |
578 }; |
737 // NOTE that this function can be called from a signal handler |
744 // NOTE that this function can be called from a signal handler |
738 // (see AsyncGetCallTrace support for Forte Analyzer) and this |
745 // (see AsyncGetCallTrace support for Forte Analyzer) and this |
739 // needs to be async-safe. No allocation should be done and |
746 // needs to be async-safe. No allocation should be done and |
740 // so handles are not used to avoid deadlock. |
747 // so handles are not used to avoid deadlock. |
741 jmethodID find_jmethod_id_or_null() { return method_holder()->jmethod_id_or_null(this); } |
748 jmethodID find_jmethod_id_or_null() { return method_holder()->jmethod_id_or_null(this); } |
742 |
|
743 // JNI static invoke cached itable index accessors |
|
744 int cached_itable_index() { return method_holder()->cached_itable_index(method_idnum()); } |
|
745 void set_cached_itable_index(int index) { method_holder()->set_cached_itable_index(method_idnum(), index); } |
|
746 |
749 |
747 // Support for inlining of intrinsic methods |
750 // Support for inlining of intrinsic methods |
748 vmIntrinsics::ID intrinsic_id() const { return (vmIntrinsics::ID) _intrinsic_id; } |
751 vmIntrinsics::ID intrinsic_id() const { return (vmIntrinsics::ID) _intrinsic_id; } |
749 void set_intrinsic_id(vmIntrinsics::ID id) { _intrinsic_id = (u1) id; } |
752 void set_intrinsic_id(vmIntrinsics::ID id) { _intrinsic_id = (u1) id; } |
750 |
753 |