3785 *constant_addr = cb.consts()->target(*labels.at(i), (address) constant_addr); |
3785 *constant_addr = cb.consts()->target(*labels.at(i), (address) constant_addr); |
3786 cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type); |
3786 cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type); |
3787 } |
3787 } |
3788 } |
3788 } |
3789 |
3789 |
|
3790 //----------------------------static_subtype_check----------------------------- |
|
3791 // Shortcut important common cases when superklass is exact: |
|
3792 // (0) superklass is java.lang.Object (can occur in reflective code) |
|
3793 // (1) subklass is already limited to a subtype of superklass => always ok |
|
3794 // (2) subklass does not overlap with superklass => always fail |
|
3795 // (3) superklass has NO subtypes and we can check with a simple compare. |
|
3796 int Compile::static_subtype_check(ciKlass* superk, ciKlass* subk) { |
|
3797 if (StressReflectiveCode) { |
|
3798 return SSC_full_test; // Let caller generate the general case. |
|
3799 } |
|
3800 |
|
3801 if (superk == env()->Object_klass()) { |
|
3802 return SSC_always_true; // (0) this test cannot fail |
|
3803 } |
|
3804 |
|
3805 ciType* superelem = superk; |
|
3806 if (superelem->is_array_klass()) |
|
3807 superelem = superelem->as_array_klass()->base_element_type(); |
|
3808 |
|
3809 if (!subk->is_interface()) { // cannot trust static interface types yet |
|
3810 if (subk->is_subtype_of(superk)) { |
|
3811 return SSC_always_true; // (1) false path dead; no dynamic test needed |
|
3812 } |
|
3813 if (!(superelem->is_klass() && superelem->as_klass()->is_interface()) && |
|
3814 !superk->is_subtype_of(subk)) { |
|
3815 return SSC_always_false; |
|
3816 } |
|
3817 } |
|
3818 |
|
3819 // If casting to an instance klass, it must have no subtypes |
|
3820 if (superk->is_interface()) { |
|
3821 // Cannot trust interfaces yet. |
|
3822 // %%% S.B. superk->nof_implementors() == 1 |
|
3823 } else if (superelem->is_instance_klass()) { |
|
3824 ciInstanceKlass* ik = superelem->as_instance_klass(); |
|
3825 if (!ik->has_subklass() && !ik->is_interface()) { |
|
3826 if (!ik->is_final()) { |
|
3827 // Add a dependency if there is a chance of a later subclass. |
|
3828 dependencies()->assert_leaf_type(ik); |
|
3829 } |
|
3830 return SSC_easy_test; // (3) caller can do a simple ptr comparison |
|
3831 } |
|
3832 } else { |
|
3833 // A primitive array type has no subtypes. |
|
3834 return SSC_easy_test; // (3) caller can do a simple ptr comparison |
|
3835 } |
|
3836 |
|
3837 return SSC_full_test; |
|
3838 } |
|
3839 |
3790 // The message about the current inlining is accumulated in |
3840 // The message about the current inlining is accumulated in |
3791 // _print_inlining_stream and transfered into the _print_inlining_list |
3841 // _print_inlining_stream and transfered into the _print_inlining_list |
3792 // once we know whether inlining succeeds or not. For regular |
3842 // once we know whether inlining succeeds or not. For regular |
3793 // inlining, messages are appended to the buffer pointed by |
3843 // inlining, messages are appended to the buffer pointed by |
3794 // _print_inlining_idx in the _print_inlining_list. For late inlining, |
3844 // _print_inlining_idx in the _print_inlining_list. For late inlining, |