< prev index next >

src/cpu/x86/vm/c1_LIRGenerator_x86.cpp

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


 178 #endif // _LP64
 179     addr =  new LIR_Address(array_opr,
 180                             index_opr,
 181                             LIR_Address::scale(type),
 182                             offset_in_bytes, type);
 183   }
 184   if (needs_card_mark) {
 185     // This store will need a precise card mark, so go ahead and
 186     // compute the full adddres instead of computing once for the
 187     // store and again for the card mark.
 188     LIR_Opr tmp = new_pointer_register();
 189     __ leal(LIR_OprFact::address(addr), tmp);
 190     return new LIR_Address(tmp, type);
 191   } else {
 192     return addr;
 193   }
 194 }
 195 
 196 
 197 LIR_Opr LIRGenerator::load_immediate(int x, BasicType type) {
 198   LIR_Opr r;
 199   if (type == T_LONG) {
 200     r = LIR_OprFact::longConst(x);
 201   } else if (type == T_INT) {
 202     r = LIR_OprFact::intConst(x);
 203   } else {
 204     ShouldNotReachHere();
 205   }
 206   return r;
 207 }
 208 
 209 void LIRGenerator::increment_counter(address counter, BasicType type, int step) {
 210   LIR_Opr pointer = new_pointer_register();
 211   __ move(LIR_OprFact::intptrConst(counter), pointer);
 212   LIR_Address* addr = new LIR_Address(pointer, type);
 213   increment_counter(addr, step);
 214 }
 215 
 216 
 217 void LIRGenerator::increment_counter(LIR_Address* addr, int step) {
 218   __ add((LIR_Opr)addr, LIR_OprFact::intConst(step), (LIR_Opr)addr);


 467     // the check for division by zero destroys the right operand
 468     right.set_destroys_register();
 469 
 470     BasicTypeList signature(2);
 471     signature.append(T_LONG);
 472     signature.append(T_LONG);
 473     CallingConvention* cc = frame_map()->c_calling_convention(&signature);
 474 
 475     // check for division by zero (destroys registers of right operand!)
 476     CodeEmitInfo* info = state_for(x);
 477 
 478     const LIR_Opr result_reg = result_register_for(x->type());
 479     left.load_item_force(cc->at(1));
 480     right.load_item();
 481 
 482     __ move(right.result(), cc->at(0));
 483 
 484     __ cmp(lir_cond_equal, right.result(), LIR_OprFact::longConst(0));
 485     __ branch(lir_cond_equal, T_LONG, new DivByZeroStub(info));
 486 
 487     address entry;
 488     switch (x->op()) {
 489     case Bytecodes::_lrem:
 490       entry = CAST_FROM_FN_PTR(address, SharedRuntime::lrem);
 491       break; // check if dividend is 0 is done elsewhere
 492     case Bytecodes::_ldiv:
 493       entry = CAST_FROM_FN_PTR(address, SharedRuntime::ldiv);
 494       break; // check if dividend is 0 is done elsewhere
 495     case Bytecodes::_lmul:
 496       entry = CAST_FROM_FN_PTR(address, SharedRuntime::lmul);
 497       break;
 498     default:
 499       ShouldNotReachHere();
 500     }
 501 
 502     LIR_Opr result = rlock_result(x);
 503     __ call_runtime_leaf(entry, getThreadTemp(), result_reg, cc->args());
 504     __ move(result_reg, result);
 505   } else if (x->op() == Bytecodes::_lmul) {
 506     // missing test if instr is commutative and if we should swap
 507     LIRItem left(x->x(), this);


1007     default: {
1008       ShouldNotReachHere();
1009     }
1010   }
1011 }
1012 
1013 // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f
1014 // _i2b, _i2c, _i2s
1015 LIR_Opr fixed_register_for(BasicType type) {
1016   switch (type) {
1017     case T_FLOAT:  return FrameMap::fpu0_float_opr;
1018     case T_DOUBLE: return FrameMap::fpu0_double_opr;
1019     case T_INT:    return FrameMap::rax_opr;
1020     case T_LONG:   return FrameMap::long0_opr;
1021     default:       ShouldNotReachHere(); return LIR_OprFact::illegalOpr;
1022   }
1023 }
1024 
1025 void LIRGenerator::do_Convert(Convert* x) {
1026   // flags that vary for the different operations and different SSE-settings
1027   bool fixed_input, fixed_result, round_result, needs_stub;
1028 
1029   switch (x->op()) {
1030     case Bytecodes::_i2l: // fall through
1031     case Bytecodes::_l2i: // fall through
1032     case Bytecodes::_i2b: // fall through
1033     case Bytecodes::_i2c: // fall through
1034     case Bytecodes::_i2s: fixed_input = false;       fixed_result = false;       round_result = false;      needs_stub = false; break;
1035 
1036     case Bytecodes::_f2d: fixed_input = UseSSE == 1; fixed_result = false;       round_result = false;      needs_stub = false; break;
1037     case Bytecodes::_d2f: fixed_input = false;       fixed_result = UseSSE == 1; round_result = UseSSE < 1; needs_stub = false; break;
1038     case Bytecodes::_i2f: fixed_input = false;       fixed_result = false;       round_result = UseSSE < 1; needs_stub = false; break;
1039     case Bytecodes::_i2d: fixed_input = false;       fixed_result = false;       round_result = false;      needs_stub = false; break;
1040     case Bytecodes::_f2i: fixed_input = false;       fixed_result = false;       round_result = false;      needs_stub = true;  break;
1041     case Bytecodes::_d2i: fixed_input = false;       fixed_result = false;       round_result = false;      needs_stub = true;  break;
1042     case Bytecodes::_l2f: fixed_input = false;       fixed_result = UseSSE >= 1; round_result = UseSSE < 1; needs_stub = false; break;
1043     case Bytecodes::_l2d: fixed_input = false;       fixed_result = UseSSE >= 2; round_result = UseSSE < 2; needs_stub = false; break;
1044     case Bytecodes::_f2l: fixed_input = true;        fixed_result = true;        round_result = false;      needs_stub = false; break;
1045     case Bytecodes::_d2l: fixed_input = true;        fixed_result = true;        round_result = false;      needs_stub = false; break;
1046     default: ShouldNotReachHere();
1047   }




 178 #endif // _LP64
 179     addr =  new LIR_Address(array_opr,
 180                             index_opr,
 181                             LIR_Address::scale(type),
 182                             offset_in_bytes, type);
 183   }
 184   if (needs_card_mark) {
 185     // This store will need a precise card mark, so go ahead and
 186     // compute the full adddres instead of computing once for the
 187     // store and again for the card mark.
 188     LIR_Opr tmp = new_pointer_register();
 189     __ leal(LIR_OprFact::address(addr), tmp);
 190     return new LIR_Address(tmp, type);
 191   } else {
 192     return addr;
 193   }
 194 }
 195 
 196 
 197 LIR_Opr LIRGenerator::load_immediate(int x, BasicType type) {
 198   LIR_Opr r = NULL;
 199   if (type == T_LONG) {
 200     r = LIR_OprFact::longConst(x);
 201   } else if (type == T_INT) {
 202     r = LIR_OprFact::intConst(x);
 203   } else {
 204     ShouldNotReachHere();
 205   }
 206   return r;
 207 }
 208 
 209 void LIRGenerator::increment_counter(address counter, BasicType type, int step) {
 210   LIR_Opr pointer = new_pointer_register();
 211   __ move(LIR_OprFact::intptrConst(counter), pointer);
 212   LIR_Address* addr = new LIR_Address(pointer, type);
 213   increment_counter(addr, step);
 214 }
 215 
 216 
 217 void LIRGenerator::increment_counter(LIR_Address* addr, int step) {
 218   __ add((LIR_Opr)addr, LIR_OprFact::intConst(step), (LIR_Opr)addr);


 467     // the check for division by zero destroys the right operand
 468     right.set_destroys_register();
 469 
 470     BasicTypeList signature(2);
 471     signature.append(T_LONG);
 472     signature.append(T_LONG);
 473     CallingConvention* cc = frame_map()->c_calling_convention(&signature);
 474 
 475     // check for division by zero (destroys registers of right operand!)
 476     CodeEmitInfo* info = state_for(x);
 477 
 478     const LIR_Opr result_reg = result_register_for(x->type());
 479     left.load_item_force(cc->at(1));
 480     right.load_item();
 481 
 482     __ move(right.result(), cc->at(0));
 483 
 484     __ cmp(lir_cond_equal, right.result(), LIR_OprFact::longConst(0));
 485     __ branch(lir_cond_equal, T_LONG, new DivByZeroStub(info));
 486 
 487     address entry = NULL;
 488     switch (x->op()) {
 489     case Bytecodes::_lrem:
 490       entry = CAST_FROM_FN_PTR(address, SharedRuntime::lrem);
 491       break; // check if dividend is 0 is done elsewhere
 492     case Bytecodes::_ldiv:
 493       entry = CAST_FROM_FN_PTR(address, SharedRuntime::ldiv);
 494       break; // check if dividend is 0 is done elsewhere
 495     case Bytecodes::_lmul:
 496       entry = CAST_FROM_FN_PTR(address, SharedRuntime::lmul);
 497       break;
 498     default:
 499       ShouldNotReachHere();
 500     }
 501 
 502     LIR_Opr result = rlock_result(x);
 503     __ call_runtime_leaf(entry, getThreadTemp(), result_reg, cc->args());
 504     __ move(result_reg, result);
 505   } else if (x->op() == Bytecodes::_lmul) {
 506     // missing test if instr is commutative and if we should swap
 507     LIRItem left(x->x(), this);


1007     default: {
1008       ShouldNotReachHere();
1009     }
1010   }
1011 }
1012 
1013 // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f
1014 // _i2b, _i2c, _i2s
1015 LIR_Opr fixed_register_for(BasicType type) {
1016   switch (type) {
1017     case T_FLOAT:  return FrameMap::fpu0_float_opr;
1018     case T_DOUBLE: return FrameMap::fpu0_double_opr;
1019     case T_INT:    return FrameMap::rax_opr;
1020     case T_LONG:   return FrameMap::long0_opr;
1021     default:       ShouldNotReachHere(); return LIR_OprFact::illegalOpr;
1022   }
1023 }
1024 
1025 void LIRGenerator::do_Convert(Convert* x) {
1026   // flags that vary for the different operations and different SSE-settings
1027   bool fixed_input = false, fixed_result = false, round_result = false, needs_stub = false;
1028 
1029   switch (x->op()) {
1030     case Bytecodes::_i2l: // fall through
1031     case Bytecodes::_l2i: // fall through
1032     case Bytecodes::_i2b: // fall through
1033     case Bytecodes::_i2c: // fall through
1034     case Bytecodes::_i2s: fixed_input = false;       fixed_result = false;       round_result = false;      needs_stub = false; break;
1035 
1036     case Bytecodes::_f2d: fixed_input = UseSSE == 1; fixed_result = false;       round_result = false;      needs_stub = false; break;
1037     case Bytecodes::_d2f: fixed_input = false;       fixed_result = UseSSE == 1; round_result = UseSSE < 1; needs_stub = false; break;
1038     case Bytecodes::_i2f: fixed_input = false;       fixed_result = false;       round_result = UseSSE < 1; needs_stub = false; break;
1039     case Bytecodes::_i2d: fixed_input = false;       fixed_result = false;       round_result = false;      needs_stub = false; break;
1040     case Bytecodes::_f2i: fixed_input = false;       fixed_result = false;       round_result = false;      needs_stub = true;  break;
1041     case Bytecodes::_d2i: fixed_input = false;       fixed_result = false;       round_result = false;      needs_stub = true;  break;
1042     case Bytecodes::_l2f: fixed_input = false;       fixed_result = UseSSE >= 1; round_result = UseSSE < 1; needs_stub = false; break;
1043     case Bytecodes::_l2d: fixed_input = false;       fixed_result = UseSSE >= 2; round_result = UseSSE < 2; needs_stub = false; break;
1044     case Bytecodes::_f2l: fixed_input = true;        fixed_result = true;        round_result = false;      needs_stub = false; break;
1045     case Bytecodes::_d2l: fixed_input = true;        fixed_result = true;        round_result = false;      needs_stub = false; break;
1046     default: ShouldNotReachHere();
1047   }


< prev index next >