< prev index next >

src/hotspot/share/c1/c1_Instruction.cpp

Print this page


  97 }
  98 
  99 
 100 void Instruction::state_values_do(ValueVisitor* f) {
 101   if (state_before() != NULL) {
 102     state_before()->values_do(f);
 103   }
 104   if (exception_state() != NULL){
 105     exception_state()->values_do(f);
 106   }
 107 }
 108 
 109 ciType* Instruction::exact_type() const {
 110   ciType* t =  declared_type();
 111   if (t != NULL && t->is_klass()) {
 112     return t->as_klass()->exact_klass();
 113   }
 114   return NULL;
 115 }
 116 


 117 bool Instruction::is_flattened_array() const {
 118   if (ValueArrayFlatten) {
 119     ciType* type = declared_type();
 120     if (type != NULL && type->is_value_array_klass()) {
 121       ciValueKlass* element_klass = type->as_value_array_klass()->element_klass()->as_value_klass();
 122       if (!element_klass->is_loaded() || element_klass->flatten_array()) {
 123         // Assume that all unloaded value arrays are not flattenable. If they
 124         // turn out to be flattenable, we deoptimize on aaload/aastore.

 125         return true;






































 126       }
 127     }
 128   }
 129 
 130   return false;
 131 }
 132 
 133 #ifndef PRODUCT
 134 void Instruction::check_state(ValueStack* state) {
 135   if (state != NULL) {
 136     state->verify();
 137   }
 138 }
 139 
 140 
 141 void Instruction::print() {
 142   InstructionPrinter ip;
 143   print(ip);
 144 }
 145 




  97 }
  98 
  99 
 100 void Instruction::state_values_do(ValueVisitor* f) {
 101   if (state_before() != NULL) {
 102     state_before()->values_do(f);
 103   }
 104   if (exception_state() != NULL){
 105     exception_state()->values_do(f);
 106   }
 107 }
 108 
 109 ciType* Instruction::exact_type() const {
 110   ciType* t =  declared_type();
 111   if (t != NULL && t->is_klass()) {
 112     return t->as_klass()->exact_klass();
 113   }
 114   return NULL;
 115 }
 116 
 117 
 118 // FIXME -- make this obsolete. Use maybe_flattened_array() or check_flattened_array() instead.
 119 bool Instruction::is_flattened_array() const {
 120   if (ValueArrayFlatten) {
 121     ciType* type = declared_type();
 122     if (type != NULL && type->is_value_array_klass()) {
 123       ciValueKlass* element_klass = type->as_value_array_klass()->element_klass()->as_value_klass();
 124       if (!element_klass->is_loaded() || element_klass->flatten_array()) {
 125         // Assume that all unloaded value arrays are not flattenable. If they
 126         // turn out to be flattenable, we deoptimize on aaload/aastore.
 127         // ^^^^ uugh -- this is ugly!
 128         return true;
 129       }
 130     }
 131   }
 132 
 133   return false;
 134 }
 135 
 136 bool Instruction::is_loaded_flattened_array() const {
 137   if (ValueArrayFlatten) {
 138     ciType* type = declared_type();
 139     if (type != NULL && type->is_value_array_klass()) {
 140       ciValueKlass* element_klass = type->as_value_array_klass()->element_klass()->as_value_klass();
 141       if (element_klass->is_loaded() && element_klass->flatten_array()) {
 142         return true;
 143       }
 144     }
 145   }
 146 
 147   return false;
 148 }
 149 
 150 bool Instruction::maybe_flattened_array() const {
 151   if (ValueArrayFlatten) {
 152     ciType* type = declared_type();
 153     if (type != NULL) {
 154       if (type->is_value_array_klass()) {
 155         ciValueKlass* element_klass = type->as_value_array_klass()->element_klass()->as_value_klass();
 156         if (!element_klass->is_loaded() || element_klass->flatten_array()) {
 157           // For unloaded value arrays, we will add a runtime check for flat-ness.
 158           return true;
 159         }
 160       } else if (type->is_obj_array_klass()) {
 161         ciKlass* element_klass = type->as_obj_array_klass()->element_klass();
 162         if (element_klass->is_java_lang_Object()) {
 163           // Array covariance (ValueType[] <: Object[])
 164           // We will add a runtime check for flat-ness.
 165           return true;
 166         }
 167       }
 168     }
 169   }
 170 
 171   return false;
 172 }
 173 
 174 #ifndef PRODUCT
 175 void Instruction::check_state(ValueStack* state) {
 176   if (state != NULL) {
 177     state->verify();
 178   }
 179 }
 180 
 181 
 182 void Instruction::print() {
 183   InstructionPrinter ip;
 184   print(ip);
 185 }
 186 


< prev index next >