< prev index next >

src/cpu/x86/vm/c1_LIRAssembler_x86.cpp

Print this page
rev 9088 : 8139040: Fix initializations before ShouldNotReachHere() etc. and enable -Wuninitialized on linux.


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


1978   } else if (op->code() == lir_cas_long) {
1979     Register addr = (op->addr()->is_single_cpu() ? op->addr()->as_register() : op->addr()->as_register_lo());
1980     Register newval = op->new_value()->as_register_lo();
1981     Register cmpval = op->cmp_value()->as_register_lo();
1982     assert(cmpval == rax, "wrong register");
1983     assert(newval != NULL, "new val must be register");
1984     assert(cmpval != newval, "cmp and new values must be in different registers");
1985     assert(cmpval != addr, "cmp and addr must be in different registers");
1986     assert(newval != addr, "new value and addr must be in different registers");
1987     if (os::is_MP()) {
1988       __ lock();
1989     }
1990     __ cmpxchgq(newval, Address(addr, 0));
1991 #endif // _LP64
1992   } else {
1993     Unimplemented();
1994   }
1995 }
1996 
1997 void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, BasicType type) {
1998   Assembler::Condition acond, ncond;
1999   switch (condition) {
2000     case lir_cond_equal:        acond = Assembler::equal;        ncond = Assembler::notEqual;     break;
2001     case lir_cond_notEqual:     acond = Assembler::notEqual;     ncond = Assembler::equal;        break;
2002     case lir_cond_less:         acond = Assembler::less;         ncond = Assembler::greaterEqual; break;
2003     case lir_cond_lessEqual:    acond = Assembler::lessEqual;    ncond = Assembler::greater;      break;
2004     case lir_cond_greaterEqual: acond = Assembler::greaterEqual; ncond = Assembler::less;         break;
2005     case lir_cond_greater:      acond = Assembler::greater;      ncond = Assembler::lessEqual;    break;
2006     case lir_cond_belowEqual:   acond = Assembler::belowEqual;   ncond = Assembler::above;        break;
2007     case lir_cond_aboveEqual:   acond = Assembler::aboveEqual;   ncond = Assembler::below;        break;
2008     default:                    ShouldNotReachHere();
2009   }
2010 
2011   if (opr1->is_cpu_register()) {
2012     reg2reg(opr1, result);
2013   } else if (opr1->is_stack()) {
2014     stack2reg(opr1, result, result->type());
2015   } else if (opr1->is_constant()) {
2016     const2reg(opr1, result, lir_patch_none, NULL);
2017   } else {
2018     ShouldNotReachHere();


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


1978   } else if (op->code() == lir_cas_long) {
1979     Register addr = (op->addr()->is_single_cpu() ? op->addr()->as_register() : op->addr()->as_register_lo());
1980     Register newval = op->new_value()->as_register_lo();
1981     Register cmpval = op->cmp_value()->as_register_lo();
1982     assert(cmpval == rax, "wrong register");
1983     assert(newval != NULL, "new val must be register");
1984     assert(cmpval != newval, "cmp and new values must be in different registers");
1985     assert(cmpval != addr, "cmp and addr must be in different registers");
1986     assert(newval != addr, "new value and addr must be in different registers");
1987     if (os::is_MP()) {
1988       __ lock();
1989     }
1990     __ cmpxchgq(newval, Address(addr, 0));
1991 #endif // _LP64
1992   } else {
1993     Unimplemented();
1994   }
1995 }
1996 
1997 void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, BasicType type) {
1998   Assembler::Condition acond = Assembler::equal, ncond = Assembler::notEqual;
1999   switch (condition) {
2000     case lir_cond_equal:        acond = Assembler::equal;        ncond = Assembler::notEqual;     break;
2001     case lir_cond_notEqual:     acond = Assembler::notEqual;     ncond = Assembler::equal;        break;
2002     case lir_cond_less:         acond = Assembler::less;         ncond = Assembler::greaterEqual; break;
2003     case lir_cond_lessEqual:    acond = Assembler::lessEqual;    ncond = Assembler::greater;      break;
2004     case lir_cond_greaterEqual: acond = Assembler::greaterEqual; ncond = Assembler::less;         break;
2005     case lir_cond_greater:      acond = Assembler::greater;      ncond = Assembler::lessEqual;    break;
2006     case lir_cond_belowEqual:   acond = Assembler::belowEqual;   ncond = Assembler::above;        break;
2007     case lir_cond_aboveEqual:   acond = Assembler::aboveEqual;   ncond = Assembler::below;        break;
2008     default:                    ShouldNotReachHere();
2009   }
2010 
2011   if (opr1->is_cpu_register()) {
2012     reg2reg(opr1, result);
2013   } else if (opr1->is_stack()) {
2014     stack2reg(opr1, result, result->type());
2015   } else if (opr1->is_constant()) {
2016     const2reg(opr1, result, lir_patch_none, NULL);
2017   } else {
2018     ShouldNotReachHere();


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();


< prev index next >