< prev index next >

src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp

Print this page
rev 48494 : 8195112: x86 (32 bit): implementation for Thread-local handshakes
Reviewed-by:


 126     return true;
 127   }
 128   return false;
 129 }
 130 
 131 
 132 bool LIRGenerator::can_inline_as_constant(Value v) const {
 133   if (v->type()->tag() == longTag) return false;
 134   return v->type()->tag() != objectTag ||
 135     (v->type()->is_constant() && v->type()->as_ObjectType()->constant_value()->is_null_object());
 136 }
 137 
 138 
 139 bool LIRGenerator::can_inline_as_constant(LIR_Const* c) const {
 140   if (c->type() == T_LONG) return false;
 141   return c->type() != T_OBJECT || c->as_jobject() == NULL;
 142 }
 143 
 144 
 145 LIR_Opr LIRGenerator::safepoint_poll_register() {

 146   return LIR_OprFact::illegalOpr;
 147 }
 148 
 149 
 150 LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
 151                                             int shift, int disp, BasicType type) {
 152   assert(base->is_register(), "must be");
 153   if (index->is_constant()) {
 154     return new LIR_Address(base,
 155                            ((intx)(index->as_constant_ptr()->as_jint()) << shift) + disp,
 156                            type);
 157   } else {
 158     return new LIR_Address(base, index, (LIR_Address::Scale)shift, disp, type);
 159   }
 160 }
 161 
 162 
 163 LIR_Address* LIRGenerator::emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr,
 164                                               BasicType type, bool needs_card_mark) {
 165   int offset_in_bytes = arrayOopDesc::base_offset_in_bytes(type);


1496       xin = &yitem;
1497       yin = &xitem;
1498     }
1499     xin->set_destroys_register();
1500   }
1501   xin->load_item();
1502   if (tag == longTag && yin->is_constant() && yin->get_jlong_constant() == 0 && (cond == If::eql || cond == If::neq)) {
1503     // inline long zero
1504     yin->dont_load_item();
1505   } else if (tag == longTag || tag == floatTag || tag == doubleTag) {
1506     // longs cannot handle constants at right side
1507     yin->load_item();
1508   } else {
1509     yin->dont_load_item();
1510   }
1511 
1512   // add safepoint before generating condition code so it can be recomputed
1513   if (x->is_safepoint()) {
1514     // increment backedge counter if needed
1515     increment_backedge_counter(state_for(x, x->state_before()), x->profiled_bci());
1516     __ safepoint(LIR_OprFact::illegalOpr, state_for(x, x->state_before()));
1517   }
1518   set_no_result(x);
1519 
1520   LIR_Opr left = xin->result();
1521   LIR_Opr right = yin->result();
1522   __ cmp(lir_cond(cond), left, right);
1523   // Generate branch profiling. Profiling code doesn't kill flags.
1524   profile_branch(x, cond);
1525   move_to_phi(x->state());
1526   if (x->x()->type()->is_float_kind()) {
1527     __ branch(lir_cond(cond), right->type(), x->tsux(), x->usux());
1528   } else {
1529     __ branch(lir_cond(cond), right->type(), x->tsux());
1530   }
1531   assert(x->default_sux() == x->fsux(), "wrong destination above");
1532   __ jump(x->default_sux());
1533 }
1534 
1535 
1536 LIR_Opr LIRGenerator::getThreadPointer() {




 126     return true;
 127   }
 128   return false;
 129 }
 130 
 131 
 132 bool LIRGenerator::can_inline_as_constant(Value v) const {
 133   if (v->type()->tag() == longTag) return false;
 134   return v->type()->tag() != objectTag ||
 135     (v->type()->is_constant() && v->type()->as_ObjectType()->constant_value()->is_null_object());
 136 }
 137 
 138 
 139 bool LIRGenerator::can_inline_as_constant(LIR_Const* c) const {
 140   if (c->type() == T_LONG) return false;
 141   return c->type() != T_OBJECT || c->as_jobject() == NULL;
 142 }
 143 
 144 
 145 LIR_Opr LIRGenerator::safepoint_poll_register() {
 146   NOT_AMD64( if (SafepointMechanism::uses_thread_local_poll()) { return new_register(T_ADDRESS); } )
 147   return LIR_OprFact::illegalOpr;
 148 }
 149 
 150 
 151 LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
 152                                             int shift, int disp, BasicType type) {
 153   assert(base->is_register(), "must be");
 154   if (index->is_constant()) {
 155     return new LIR_Address(base,
 156                            ((intx)(index->as_constant_ptr()->as_jint()) << shift) + disp,
 157                            type);
 158   } else {
 159     return new LIR_Address(base, index, (LIR_Address::Scale)shift, disp, type);
 160   }
 161 }
 162 
 163 
 164 LIR_Address* LIRGenerator::emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr,
 165                                               BasicType type, bool needs_card_mark) {
 166   int offset_in_bytes = arrayOopDesc::base_offset_in_bytes(type);


1497       xin = &yitem;
1498       yin = &xitem;
1499     }
1500     xin->set_destroys_register();
1501   }
1502   xin->load_item();
1503   if (tag == longTag && yin->is_constant() && yin->get_jlong_constant() == 0 && (cond == If::eql || cond == If::neq)) {
1504     // inline long zero
1505     yin->dont_load_item();
1506   } else if (tag == longTag || tag == floatTag || tag == doubleTag) {
1507     // longs cannot handle constants at right side
1508     yin->load_item();
1509   } else {
1510     yin->dont_load_item();
1511   }
1512 
1513   // add safepoint before generating condition code so it can be recomputed
1514   if (x->is_safepoint()) {
1515     // increment backedge counter if needed
1516     increment_backedge_counter(state_for(x, x->state_before()), x->profiled_bci());
1517     __ safepoint(safepoint_poll_register(), state_for(x, x->state_before()));
1518   }
1519   set_no_result(x);
1520 
1521   LIR_Opr left = xin->result();
1522   LIR_Opr right = yin->result();
1523   __ cmp(lir_cond(cond), left, right);
1524   // Generate branch profiling. Profiling code doesn't kill flags.
1525   profile_branch(x, cond);
1526   move_to_phi(x->state());
1527   if (x->x()->type()->is_float_kind()) {
1528     __ branch(lir_cond(cond), right->type(), x->tsux(), x->usux());
1529   } else {
1530     __ branch(lir_cond(cond), right->type(), x->tsux());
1531   }
1532   assert(x->default_sux() == x->fsux(), "wrong destination above");
1533   __ jump(x->default_sux());
1534 }
1535 
1536 
1537 LIR_Opr LIRGenerator::getThreadPointer() {


< prev index next >