1650 __ cmpptr(recv_addr, (intptr_t)NULL_WORD);
1651 __ jccb(Assembler::notEqual, next_test);
1652 __ movptr(recv_addr, recv);
1653 __ movptr(Address(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i))), DataLayout::counter_increment);
1654 __ jmp(*update_done);
1655 __ bind(next_test);
1656 }
1657 }
1658
1659 void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, Label* failure, Label* obj_is_null) {
1660 // we always need a stub for the failure case.
1661 CodeStub* stub = op->stub();
1662 Register obj = op->object()->as_register();
1663 Register k_RInfo = op->tmp1()->as_register();
1664 Register klass_RInfo = op->tmp2()->as_register();
1665 Register dst = op->result_opr()->as_register();
1666 ciKlass* k = op->klass();
1667 Register Rtmp1 = noreg;
1668
1669 // check if it needs to be profiled
1670 ciMethodData* md;
1671 ciProfileData* data;
1672
1673 if (op->should_profile()) {
1674 ciMethod* method = op->profiled_method();
1675 assert(method != NULL, "Should have method");
1676 int bci = op->profiled_bci();
1677 md = method->method_data_or_null();
1678 assert(md != NULL, "Sanity");
1679 data = md->bci_to_data(bci);
1680 assert(data != NULL, "need data for type check");
1681 assert(data->is_ReceiverTypeData(), "need ReceiverTypeData for type check");
1682 }
1683 Label profile_cast_success, profile_cast_failure;
1684 Label *success_target = op->should_profile() ? &profile_cast_success : success;
1685 Label *failure_target = op->should_profile() ? &profile_cast_failure : failure;
1686
1687 if (obj == k_RInfo) {
1688 k_RInfo = dst;
1689 } else if (obj == klass_RInfo) {
1690 klass_RInfo = dst;
1691 }
1810 Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()));
1811 __ subptr(counter_addr, DataLayout::counter_increment);
1812 __ jmp(*failure);
1813 }
1814 __ jmp(*success);
1815 }
1816
1817
1818 void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
1819 LIR_Code code = op->code();
1820 if (code == lir_store_check) {
1821 Register value = op->object()->as_register();
1822 Register array = op->array()->as_register();
1823 Register k_RInfo = op->tmp1()->as_register();
1824 Register klass_RInfo = op->tmp2()->as_register();
1825 Register Rtmp1 = op->tmp3()->as_register();
1826
1827 CodeStub* stub = op->stub();
1828
1829 // check if it needs to be profiled
1830 ciMethodData* md;
1831 ciProfileData* data;
1832
1833 if (op->should_profile()) {
1834 ciMethod* method = op->profiled_method();
1835 assert(method != NULL, "Should have method");
1836 int bci = op->profiled_bci();
1837 md = method->method_data_or_null();
1838 assert(md != NULL, "Sanity");
1839 data = md->bci_to_data(bci);
1840 assert(data != NULL, "need data for type check");
1841 assert(data->is_ReceiverTypeData(), "need ReceiverTypeData for type check");
1842 }
1843 Label profile_cast_success, profile_cast_failure, done;
1844 Label *success_target = op->should_profile() ? &profile_cast_success : &done;
1845 Label *failure_target = op->should_profile() ? &profile_cast_failure : stub->entry();
1846
1847 __ cmpptr(value, (int32_t)NULL_WORD);
1848 if (op->should_profile()) {
1849 Label not_null;
1850 __ jccb(Assembler::notEqual, not_null);
1851 // Object is null; update MDO and exit
3169 __ movptr (dst_pos, Address(rsp, 1*BytesPerWord));
3170 __ movptr (length, Address(rsp, 2*BytesPerWord));
3171 __ movptr (src_pos, Address(rsp, 3*BytesPerWord));
3172 __ movptr (src, Address(rsp, 4*BytesPerWord));
3173
3174 if (copyfunc_addr != NULL) {
3175 __ subl(length, tmp);
3176 __ addl(src_pos, tmp);
3177 __ addl(dst_pos, tmp);
3178 }
3179 __ jmp(*stub->entry());
3180
3181 __ bind(*stub->continuation());
3182 return;
3183 }
3184
3185 assert(default_type != NULL && default_type->is_array_klass() && default_type->is_loaded(), "must be true at this point");
3186
3187 int elem_size = type2aelembytes(basic_type);
3188 int shift_amount;
3189 Address::ScaleFactor scale;
3190
3191 switch (elem_size) {
3192 case 1 :
3193 shift_amount = 0;
3194 scale = Address::times_1;
3195 break;
3196 case 2 :
3197 shift_amount = 1;
3198 scale = Address::times_2;
3199 break;
3200 case 4 :
3201 shift_amount = 2;
3202 scale = Address::times_4;
3203 break;
3204 case 8 :
3205 shift_amount = 3;
3206 scale = Address::times_8;
3207 break;
3208 default:
3209 ShouldNotReachHere();
|
1650 __ cmpptr(recv_addr, (intptr_t)NULL_WORD);
1651 __ jccb(Assembler::notEqual, next_test);
1652 __ movptr(recv_addr, recv);
1653 __ movptr(Address(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i))), DataLayout::counter_increment);
1654 __ jmp(*update_done);
1655 __ bind(next_test);
1656 }
1657 }
1658
1659 void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, Label* failure, Label* obj_is_null) {
1660 // we always need a stub for the failure case.
1661 CodeStub* stub = op->stub();
1662 Register obj = op->object()->as_register();
1663 Register k_RInfo = op->tmp1()->as_register();
1664 Register klass_RInfo = op->tmp2()->as_register();
1665 Register dst = op->result_opr()->as_register();
1666 ciKlass* k = op->klass();
1667 Register Rtmp1 = noreg;
1668
1669 // check if it needs to be profiled
1670 ciMethodData* md = NULL;
1671 ciProfileData* data = NULL;
1672
1673 if (op->should_profile()) {
1674 ciMethod* method = op->profiled_method();
1675 assert(method != NULL, "Should have method");
1676 int bci = op->profiled_bci();
1677 md = method->method_data_or_null();
1678 assert(md != NULL, "Sanity");
1679 data = md->bci_to_data(bci);
1680 assert(data != NULL, "need data for type check");
1681 assert(data->is_ReceiverTypeData(), "need ReceiverTypeData for type check");
1682 }
1683 Label profile_cast_success, profile_cast_failure;
1684 Label *success_target = op->should_profile() ? &profile_cast_success : success;
1685 Label *failure_target = op->should_profile() ? &profile_cast_failure : failure;
1686
1687 if (obj == k_RInfo) {
1688 k_RInfo = dst;
1689 } else if (obj == klass_RInfo) {
1690 klass_RInfo = dst;
1691 }
1810 Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()));
1811 __ subptr(counter_addr, DataLayout::counter_increment);
1812 __ jmp(*failure);
1813 }
1814 __ jmp(*success);
1815 }
1816
1817
1818 void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
1819 LIR_Code code = op->code();
1820 if (code == lir_store_check) {
1821 Register value = op->object()->as_register();
1822 Register array = op->array()->as_register();
1823 Register k_RInfo = op->tmp1()->as_register();
1824 Register klass_RInfo = op->tmp2()->as_register();
1825 Register Rtmp1 = op->tmp3()->as_register();
1826
1827 CodeStub* stub = op->stub();
1828
1829 // check if it needs to be profiled
1830 ciMethodData* md = NULL;
1831 ciProfileData* data = NULL;
1832
1833 if (op->should_profile()) {
1834 ciMethod* method = op->profiled_method();
1835 assert(method != NULL, "Should have method");
1836 int bci = op->profiled_bci();
1837 md = method->method_data_or_null();
1838 assert(md != NULL, "Sanity");
1839 data = md->bci_to_data(bci);
1840 assert(data != NULL, "need data for type check");
1841 assert(data->is_ReceiverTypeData(), "need ReceiverTypeData for type check");
1842 }
1843 Label profile_cast_success, profile_cast_failure, done;
1844 Label *success_target = op->should_profile() ? &profile_cast_success : &done;
1845 Label *failure_target = op->should_profile() ? &profile_cast_failure : stub->entry();
1846
1847 __ cmpptr(value, (int32_t)NULL_WORD);
1848 if (op->should_profile()) {
1849 Label not_null;
1850 __ jccb(Assembler::notEqual, not_null);
1851 // Object is null; update MDO and exit
3169 __ movptr (dst_pos, Address(rsp, 1*BytesPerWord));
3170 __ movptr (length, Address(rsp, 2*BytesPerWord));
3171 __ movptr (src_pos, Address(rsp, 3*BytesPerWord));
3172 __ movptr (src, Address(rsp, 4*BytesPerWord));
3173
3174 if (copyfunc_addr != NULL) {
3175 __ subl(length, tmp);
3176 __ addl(src_pos, tmp);
3177 __ addl(dst_pos, tmp);
3178 }
3179 __ jmp(*stub->entry());
3180
3181 __ bind(*stub->continuation());
3182 return;
3183 }
3184
3185 assert(default_type != NULL && default_type->is_array_klass() && default_type->is_loaded(), "must be true at this point");
3186
3187 int elem_size = type2aelembytes(basic_type);
3188 int shift_amount;
3189 Address::ScaleFactor scale = Address::no_scale;
3190
3191 switch (elem_size) {
3192 case 1 :
3193 shift_amount = 0;
3194 scale = Address::times_1;
3195 break;
3196 case 2 :
3197 shift_amount = 1;
3198 scale = Address::times_2;
3199 break;
3200 case 4 :
3201 shift_amount = 2;
3202 scale = Address::times_4;
3203 break;
3204 case 8 :
3205 shift_amount = 3;
3206 scale = Address::times_8;
3207 break;
3208 default:
3209 ShouldNotReachHere();
|