< prev index next >

src/share/vm/ci/ciTypeFlow.cpp

Print this page




 530 
 531   return different;
 532 }
 533 
 534 // ------------------------------------------------------------------
 535 // ciTypeFlow::StateVector::push_translate
 536 void ciTypeFlow::StateVector::push_translate(ciType* type) {
 537   BasicType basic_type = type->basic_type();
 538   if (basic_type == T_BOOLEAN || basic_type == T_CHAR ||
 539       basic_type == T_BYTE    || basic_type == T_SHORT) {
 540     push_int();
 541   } else {
 542     push(type);
 543     if (type->is_two_word()) {
 544       push(half_type(type));
 545     }
 546   }
 547 }
 548 
 549 // ------------------------------------------------------------------
 550 // ciTypeFlow::StateVector::do_aaload
 551 void ciTypeFlow::StateVector::do_aaload(ciBytecodeStream* str) {
 552   pop_int();
 553   ciObjArrayKlass* array_klass = pop_objArray();
 554   if (array_klass == NULL) {
 555     // Did aaload on a null reference; push a null and ignore the exception.
 556     // This instruction will never continue normally.  All we have to do
 557     // is report a value that will meet correctly with any downstream
 558     // reference types on paths that will truly be executed.  This null type
 559     // meets with any reference type to yield that same reference type.
 560     // (The compiler will generate an unconditional exception here.)
 561     push(null_type());
 562     return;
 563   }
 564   if (!array_klass->is_loaded()) {
 565     // Only fails for some -Xcomp runs
 566     trap(str, array_klass,
 567          Deoptimization::make_trap_request
 568          (Deoptimization::Reason_unloaded,
 569           Deoptimization::Action_reinterpret));
 570     return;
 571   }
 572   ciKlass* element_klass = array_klass->element_klass();
 573   if (!element_klass->is_loaded() && element_klass->is_instance_klass()) {
 574     Untested("unloaded array element class in ciTypeFlow");
 575     trap(str, element_klass,


 889     // class later.
 890     push_null();
 891   }
 892 }
 893 
 894 
 895 // ------------------------------------------------------------------
 896 // ciTypeFlow::StateVector::apply_one_bytecode
 897 //
 898 // Apply the effect of one bytecode to this StateVector
 899 bool ciTypeFlow::StateVector::apply_one_bytecode(ciBytecodeStream* str) {
 900   _trap_bci = -1;
 901   _trap_index = 0;
 902 
 903   if (CITraceTypeFlow) {
 904     tty->print_cr(">> Interpreting bytecode %d:%s", str->cur_bci(),
 905                   Bytecodes::name(str->cur_bc()));
 906   }
 907 
 908   switch(str->cur_bc()) {
 909   case Bytecodes::_aaload: do_aaload(str);                       break;

 910 

 911   case Bytecodes::_aastore:
 912     {
 913       pop_object();
 914       pop_int();
 915       pop_objArray();
 916       break;
 917     }
 918   case Bytecodes::_aconst_null:
 919     {
 920       push_null();
 921       break;
 922     }
 923   case Bytecodes::_vload:
 924   case Bytecodes::_aload:   load_local_object(str->get_index());    break;
 925   case Bytecodes::_aload_0: load_local_object(0);                   break;
 926   case Bytecodes::_aload_1: load_local_object(1);                   break;
 927   case Bytecodes::_aload_2: load_local_object(2);                   break;
 928   case Bytecodes::_aload_3: load_local_object(3);                   break;
 929 
 930   case Bytecodes::_anewarray:
 931     {
 932       pop_int();
 933       bool will_link;
 934       ciKlass* element_klass = str->get_klass(will_link);
 935       if (!will_link) {
 936         trap(str, element_klass, str->get_klass_index());
 937       } else {
 938         push_object(ciObjArrayKlass::make(element_klass));
 939       }
 940       break;
 941     }
 942   case Bytecodes::_areturn:
 943   case Bytecodes::_vreturn:
 944   case Bytecodes::_ifnonnull:
 945   case Bytecodes::_ifnull:
 946     {
 947       pop_object();
 948       break;
 949     }
 950   case Bytecodes::_monitorenter:
 951     {
 952       pop_object();
 953       set_monitor_count(monitor_count() + 1);
 954       break;
 955     }
 956   case Bytecodes::_monitorexit:
 957     {
 958       pop_object();




 530 
 531   return different;
 532 }
 533 
 534 // ------------------------------------------------------------------
 535 // ciTypeFlow::StateVector::push_translate
 536 void ciTypeFlow::StateVector::push_translate(ciType* type) {
 537   BasicType basic_type = type->basic_type();
 538   if (basic_type == T_BOOLEAN || basic_type == T_CHAR ||
 539       basic_type == T_BYTE    || basic_type == T_SHORT) {
 540     push_int();
 541   } else {
 542     push(type);
 543     if (type->is_two_word()) {
 544       push(half_type(type));
 545     }
 546   }
 547 }
 548 
 549 // ------------------------------------------------------------------
 550 // ciTypeFlow::StateVector::do_aload
 551 void ciTypeFlow::StateVector::do_aload(ciBytecodeStream* str) {
 552   pop_int();
 553   ciArrayKlass* array_klass = pop_objOrValueArray();
 554   if (array_klass == NULL) {
 555     // Did aload on a null reference; push a null and ignore the exception.
 556     // This instruction will never continue normally.  All we have to do
 557     // is report a value that will meet correctly with any downstream
 558     // reference types on paths that will truly be executed.  This null type
 559     // meets with any reference type to yield that same reference type.
 560     // (The compiler will generate an unconditional exception here.)
 561     push(null_type());
 562     return;
 563   }
 564   if (!array_klass->is_loaded()) {
 565     // Only fails for some -Xcomp runs
 566     trap(str, array_klass,
 567          Deoptimization::make_trap_request
 568          (Deoptimization::Reason_unloaded,
 569           Deoptimization::Action_reinterpret));
 570     return;
 571   }
 572   ciKlass* element_klass = array_klass->element_klass();
 573   if (!element_klass->is_loaded() && element_klass->is_instance_klass()) {
 574     Untested("unloaded array element class in ciTypeFlow");
 575     trap(str, element_klass,


 889     // class later.
 890     push_null();
 891   }
 892 }
 893 
 894 
 895 // ------------------------------------------------------------------
 896 // ciTypeFlow::StateVector::apply_one_bytecode
 897 //
 898 // Apply the effect of one bytecode to this StateVector
 899 bool ciTypeFlow::StateVector::apply_one_bytecode(ciBytecodeStream* str) {
 900   _trap_bci = -1;
 901   _trap_index = 0;
 902 
 903   if (CITraceTypeFlow) {
 904     tty->print_cr(">> Interpreting bytecode %d:%s", str->cur_bci(),
 905                   Bytecodes::name(str->cur_bc()));
 906   }
 907 
 908   switch(str->cur_bc()) {
 909   case Bytecodes::_vaload:
 910   case Bytecodes::_aaload: do_aload(str);                           break;
 911 
 912   case Bytecodes::_vastore:
 913   case Bytecodes::_aastore:
 914     {
 915       pop_object();
 916       pop_int();
 917       pop_objOrValueArray();
 918       break;
 919     }
 920   case Bytecodes::_aconst_null:
 921     {
 922       push_null();
 923       break;
 924     }
 925   case Bytecodes::_vload:
 926   case Bytecodes::_aload:   load_local_object(str->get_index());    break;
 927   case Bytecodes::_aload_0: load_local_object(0);                   break;
 928   case Bytecodes::_aload_1: load_local_object(1);                   break;
 929   case Bytecodes::_aload_2: load_local_object(2);                   break;
 930   case Bytecodes::_aload_3: load_local_object(3);                   break;
 931 
 932   case Bytecodes::_anewarray:
 933     {
 934       pop_int();
 935       bool will_link;
 936       ciKlass* element_klass = str->get_klass(will_link);
 937       if (!will_link) {
 938         trap(str, element_klass, str->get_klass_index());
 939       } else {
 940         push_object(ciArrayKlass::make(element_klass));
 941       }
 942       break;
 943     }
 944   case Bytecodes::_areturn:
 945   case Bytecodes::_vreturn:
 946   case Bytecodes::_ifnonnull:
 947   case Bytecodes::_ifnull:
 948     {
 949       pop_object();
 950       break;
 951     }
 952   case Bytecodes::_monitorenter:
 953     {
 954       pop_object();
 955       set_monitor_count(monitor_count() + 1);
 956       break;
 957     }
 958   case Bytecodes::_monitorexit:
 959     {
 960       pop_object();


< prev index next >