hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
changeset 38060 954c9575f653
parent 38033 996ce936543f
parent 37480 291ee208fb72
child 38144 0976c0c5c5d3
equal deleted inserted replaced
38059:86ab3f0a9f87 38060:954c9575f653
   974   if (CSEArrayLength ||
   974   if (CSEArrayLength ||
   975       (array->as_AccessField() && array->as_AccessField()->field()->is_constant()) ||
   975       (array->as_AccessField() && array->as_AccessField()->field()->is_constant()) ||
   976       (array->as_NewArray() && array->as_NewArray()->length() && array->as_NewArray()->length()->type()->is_constant())) {
   976       (array->as_NewArray() && array->as_NewArray()->length() && array->as_NewArray()->length()->type()->is_constant())) {
   977     length = append(new ArrayLength(array, state_before));
   977     length = append(new ArrayLength(array, state_before));
   978   }
   978   }
   979   StoreIndexed* result = new StoreIndexed(array, index, length, type, value, state_before);
   979   ciType* array_type = array->declared_type();
       
   980   bool check_boolean = false;
       
   981   if (array_type != NULL) {
       
   982     if (array_type->is_loaded() &&
       
   983       array_type->as_array_klass()->element_type()->basic_type() == T_BOOLEAN) {
       
   984       assert(type == T_BYTE, "boolean store uses bastore");
       
   985       Value mask = append(new Constant(new IntConstant(1)));
       
   986       value = append(new LogicOp(Bytecodes::_iand, value, mask));
       
   987     }
       
   988   } else if (type == T_BYTE) {
       
   989     check_boolean = true;
       
   990   }
       
   991   StoreIndexed* result = new StoreIndexed(array, index, length, type, value, state_before, check_boolean);
   980   append(result);
   992   append(result);
   981   _memory->store_value(value);
   993   _memory->store_value(value);
   982 
   994 
   983   if (type == T_OBJECT && is_profiling()) {
   995   if (type == T_OBJECT && is_profiling()) {
   984     // Note that we'd collect profile data in this method if we wanted it.
   996     // Note that we'd collect profile data in this method if we wanted it.
  1441                               || (support_IRIW_for_not_multiple_copy_atomic_cpu && scope()->wrote_volatile())
  1453                               || (support_IRIW_for_not_multiple_copy_atomic_cpu && scope()->wrote_volatile())
  1442      )){
  1454      )){
  1443     need_mem_bar = true;
  1455     need_mem_bar = true;
  1444   }
  1456   }
  1445 
  1457 
       
  1458   BasicType bt = method()->return_type()->basic_type();
       
  1459   switch (bt) {
       
  1460     case T_BYTE:
       
  1461     {
       
  1462       Value shift = append(new Constant(new IntConstant(24)));
       
  1463       x = append(new ShiftOp(Bytecodes::_ishl, x, shift));
       
  1464       x = append(new ShiftOp(Bytecodes::_ishr, x, shift));
       
  1465       break;
       
  1466     }
       
  1467     case T_SHORT:
       
  1468     {
       
  1469       Value shift = append(new Constant(new IntConstant(16)));
       
  1470       x = append(new ShiftOp(Bytecodes::_ishl, x, shift));
       
  1471       x = append(new ShiftOp(Bytecodes::_ishr, x, shift));
       
  1472       break;
       
  1473     }
       
  1474     case T_CHAR:
       
  1475     {
       
  1476       Value mask = append(new Constant(new IntConstant(0xFFFF)));
       
  1477       x = append(new LogicOp(Bytecodes::_iand, x, mask));
       
  1478       break;
       
  1479     }
       
  1480     case T_BOOLEAN:
       
  1481     {
       
  1482       Value mask = append(new Constant(new IntConstant(1)));
       
  1483       x = append(new LogicOp(Bytecodes::_iand, x, mask));
       
  1484       break;
       
  1485     }
       
  1486   }
       
  1487 
  1446   // Check to see whether we are inlining. If so, Return
  1488   // Check to see whether we are inlining. If so, Return
  1447   // instructions become Gotos to the continuation point.
  1489   // instructions become Gotos to the continuation point.
  1448   if (continuation() != NULL) {
  1490   if (continuation() != NULL) {
  1449     assert(!method()->is_synchronized() || InlineSynchronizedMethods, "can not inline synchronized methods yet");
  1491     assert(!method()->is_synchronized() || InlineSynchronizedMethods, "can not inline synchronized methods yet");
  1450 
  1492 
  1609     }
  1651     }
  1610     case Bytecodes::_putstatic: {
  1652     case Bytecodes::_putstatic: {
  1611       Value val = pop(type);
  1653       Value val = pop(type);
  1612       if (state_before == NULL) {
  1654       if (state_before == NULL) {
  1613         state_before = copy_state_for_exception();
  1655         state_before = copy_state_for_exception();
       
  1656       }
       
  1657       if (field->type()->basic_type() == T_BOOLEAN) {
       
  1658         Value mask = append(new Constant(new IntConstant(1)));
       
  1659         val = append(new LogicOp(Bytecodes::_iand, val, mask));
  1614       }
  1660       }
  1615       append(new StoreField(append(obj), offset, field, val, true, state_before, needs_patching));
  1661       append(new StoreField(append(obj), offset, field, val, true, state_before, needs_patching));
  1616       break;
  1662       break;
  1617     }
  1663     }
  1618     case Bytecodes::_getfield: {
  1664     case Bytecodes::_getfield: {
  1657     case Bytecodes::_putfield: {
  1703     case Bytecodes::_putfield: {
  1658       Value val = pop(type);
  1704       Value val = pop(type);
  1659       obj = apop();
  1705       obj = apop();
  1660       if (state_before == NULL) {
  1706       if (state_before == NULL) {
  1661         state_before = copy_state_for_exception();
  1707         state_before = copy_state_for_exception();
       
  1708       }
       
  1709       if (field->type()->basic_type() == T_BOOLEAN) {
       
  1710         Value mask = append(new Constant(new IntConstant(1)));
       
  1711         val = append(new LogicOp(Bytecodes::_iand, val, mask));
  1662       }
  1712       }
  1663       StoreField* store = new StoreField(obj, offset, field, val, false, state_before, needs_patching);
  1713       StoreField* store = new StoreField(obj, offset, field, val, false, state_before, needs_patching);
  1664       if (!needs_patching) store = _memory->store(store);
  1714       if (!needs_patching) store = _memory->store(store);
  1665       if (store != NULL) {
  1715       if (store != NULL) {
  1666         append(store);
  1716         append(store);
  4120   null_check(args->at(0));
  4170   null_check(args->at(0));
  4121   Instruction* offset = args->at(2);
  4171   Instruction* offset = args->at(2);
  4122 #ifndef _LP64
  4172 #ifndef _LP64
  4123   offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT)));
  4173   offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT)));
  4124 #endif
  4174 #endif
  4125   Instruction* op = append(new UnsafePutObject(t, args->at(1), offset, args->at(3), is_volatile));
  4175   Value val = args->at(3);
       
  4176   if (t == T_BOOLEAN) {
       
  4177     Value mask = append(new Constant(new IntConstant(1)));
       
  4178     val = append(new LogicOp(Bytecodes::_iand, val, mask));
       
  4179   }
       
  4180   Instruction* op = append(new UnsafePutObject(t, args->at(1), offset, val, is_volatile));
  4126   compilation()->set_has_unsafe_access(true);
  4181   compilation()->set_has_unsafe_access(true);
  4127   kill_all();
  4182   kill_all();
  4128 }
  4183 }
  4129 
  4184 
  4130 
  4185 
  4194   Values* args = state()->pop_arguments(callee->arg_size());
  4249   Values* args = state()->pop_arguments(callee->arg_size());
  4195   Value array = args->at(0);
  4250   Value array = args->at(0);
  4196   Value index = args->at(1);
  4251   Value index = args->at(1);
  4197   if (is_store) {
  4252   if (is_store) {
  4198     Value value = args->at(2);
  4253     Value value = args->at(2);
  4199     Instruction* store = append(new StoreIndexed(array, index, NULL, T_CHAR, value, state_before));
  4254     Instruction* store = append(new StoreIndexed(array, index, NULL, T_CHAR, value, state_before, false));
  4200     store->set_flag(Instruction::NeedsRangeCheckFlag, false);
  4255     store->set_flag(Instruction::NeedsRangeCheckFlag, false);
  4201     _memory->store_value(value);
  4256     _memory->store_value(value);
  4202   } else {
  4257   } else {
  4203     Instruction* load = append(new LoadIndexed(array, index, NULL, T_CHAR, state_before));
  4258     Instruction* load = append(new LoadIndexed(array, index, NULL, T_CHAR, state_before));
  4204     load->set_flag(Instruction::NeedsRangeCheckFlag, false);
  4259     load->set_flag(Instruction::NeedsRangeCheckFlag, false);