811 // Do I want to check this type? 812 // assert(type->is_subtype_of(field_type), "bad type for field value"); 813 if (field_type->is_two_word()) { 814 ciType* type2 = pop_value(); 815 assert(type2->is_two_word(), "must be 2nd half"); 816 assert(type == half_type(type2), "must be 2nd half"); 817 } 818 } 819 } 820 821 // ------------------------------------------------------------------ 822 // ciTypeFlow::StateVector::do_ret 823 void ciTypeFlow::StateVector::do_ret(ciBytecodeStream* str) { 824 Cell index = local(str->get_index()); 825 826 ciType* address = type_at(index); 827 assert(address->is_return_address(), "bad return address"); 828 set_type_at(index, bottom_type()); 829 } 830 831 // ------------------------------------------------------------------ 832 // ciTypeFlow::StateVector::trap 833 // 834 // Stop interpretation of this path with a trap. 835 void ciTypeFlow::StateVector::trap(ciBytecodeStream* str, ciKlass* klass, int index) { 836 _trap_bci = str->cur_bci(); 837 _trap_index = index; 838 839 // Log information about this trap: 840 CompileLog* log = outer()->env()->log(); 841 if (log != NULL) { 842 int mid = log->identify(outer()->method()); 843 int kid = (klass == NULL)? -1: log->identify(klass); 844 log->begin_elem("uncommon_trap method='%d' bci='%d'", mid, str->cur_bci()); 845 char buf[100]; 846 log->print(" %s", Deoptimization::format_trap_request(buf, sizeof(buf), 847 index)); 848 if (kid >= 0) 849 log->print(" klass='%d'", kid); 850 log->end_elem(); 1461 case Bytecodes::_pop2: 1462 { 1463 pop(); 1464 pop(); 1465 break; 1466 } 1467 1468 case Bytecodes::_putfield: do_putfield(str); break; 1469 case Bytecodes::_putstatic: do_putstatic(str); break; 1470 1471 case Bytecodes::_ret: do_ret(str); break; 1472 1473 case Bytecodes::_swap: 1474 { 1475 ciType* value1 = pop_value(); 1476 ciType* value2 = pop_value(); 1477 push(value1); 1478 push(value2); 1479 break; 1480 } 1481 case Bytecodes::_wide: 1482 default: 1483 { 1484 // The iterator should skip this. 1485 ShouldNotReachHere(); 1486 break; 1487 } 1488 } 1489 1490 if (CITraceTypeFlow) { 1491 print_on(tty); 1492 } 1493 1494 return (_trap_bci != -1); 1495 } 1496 1497 #ifndef PRODUCT 1498 // ------------------------------------------------------------------ 1499 // ciTypeFlow::StateVector::print_cell_on 1500 void ciTypeFlow::StateVector::print_cell_on(outputStream* st, Cell c) const { | 811 // Do I want to check this type? 812 // assert(type->is_subtype_of(field_type), "bad type for field value"); 813 if (field_type->is_two_word()) { 814 ciType* type2 = pop_value(); 815 assert(type2->is_two_word(), "must be 2nd half"); 816 assert(type == half_type(type2), "must be 2nd half"); 817 } 818 } 819 } 820 821 // ------------------------------------------------------------------ 822 // ciTypeFlow::StateVector::do_ret 823 void ciTypeFlow::StateVector::do_ret(ciBytecodeStream* str) { 824 Cell index = local(str->get_index()); 825 826 ciType* address = type_at(index); 827 assert(address->is_return_address(), "bad return address"); 828 set_type_at(index, bottom_type()); 829 } 830 831 void ciTypeFlow::StateVector::do_vunbox(ciBytecodeStream* str) { 832 bool will_link; 833 ciKlass* klass = str->get_klass(will_link); 834 // TODO: Handle case when class is not loaded. 835 guarantee(will_link, "Class to which the value-capable class will unbox to must be loaded for JIT compilation"); 836 assert(klass->is_valuetype(), "must be value type"); 837 pop_object(); 838 push_object(klass->as_value_klass()); 839 } 840 841 void ciTypeFlow::StateVector::do_vbox(ciBytecodeStream* str) { 842 bool will_link; 843 ciKlass* klass = str->get_klass(will_link); 844 // TODO: Handle case when class is not loaded. 845 guarantee(will_link, "Class to which value type will box to must be loaded for JIT compilation"); 846 assert(klass->is_instance_klass(), "must be an instance class"); 847 pop_object(); 848 push_object(klass->as_instance_klass()); 849 } 850 851 // ------------------------------------------------------------------ 852 // ciTypeFlow::StateVector::trap 853 // 854 // Stop interpretation of this path with a trap. 855 void ciTypeFlow::StateVector::trap(ciBytecodeStream* str, ciKlass* klass, int index) { 856 _trap_bci = str->cur_bci(); 857 _trap_index = index; 858 859 // Log information about this trap: 860 CompileLog* log = outer()->env()->log(); 861 if (log != NULL) { 862 int mid = log->identify(outer()->method()); 863 int kid = (klass == NULL)? -1: log->identify(klass); 864 log->begin_elem("uncommon_trap method='%d' bci='%d'", mid, str->cur_bci()); 865 char buf[100]; 866 log->print(" %s", Deoptimization::format_trap_request(buf, sizeof(buf), 867 index)); 868 if (kid >= 0) 869 log->print(" klass='%d'", kid); 870 log->end_elem(); 1481 case Bytecodes::_pop2: 1482 { 1483 pop(); 1484 pop(); 1485 break; 1486 } 1487 1488 case Bytecodes::_putfield: do_putfield(str); break; 1489 case Bytecodes::_putstatic: do_putstatic(str); break; 1490 1491 case Bytecodes::_ret: do_ret(str); break; 1492 1493 case Bytecodes::_swap: 1494 { 1495 ciType* value1 = pop_value(); 1496 ciType* value2 = pop_value(); 1497 push(value1); 1498 push(value2); 1499 break; 1500 } 1501 case Bytecodes::_vunbox: 1502 { 1503 do_vunbox(str); 1504 break; 1505 } 1506 case Bytecodes::_vbox: 1507 { 1508 do_vbox(str); 1509 break; 1510 } 1511 case Bytecodes::_wide: 1512 default: 1513 { 1514 // The iterator should skip this. 1515 ShouldNotReachHere(); 1516 break; 1517 } 1518 } 1519 1520 if (CITraceTypeFlow) { 1521 print_on(tty); 1522 } 1523 1524 return (_trap_bci != -1); 1525 } 1526 1527 #ifndef PRODUCT 1528 // ------------------------------------------------------------------ 1529 // ciTypeFlow::StateVector::print_cell_on 1530 void ciTypeFlow::StateVector::print_cell_on(outputStream* st, Cell c) const { |