src/hotspot/share/c1/c1_GraphBuilder.cpp
changeset 48826 c4d9d1b08e2e
parent 48310 0dc66cdf4720
child 48856 c866eaca24cb
equal deleted inserted replaced
48825:ef8a98bc71f8 48826:c4d9d1b08e2e
   872 
   872 
   873 
   873 
   874 void GraphBuilder::load_constant() {
   874 void GraphBuilder::load_constant() {
   875   ciConstant con = stream()->get_constant();
   875   ciConstant con = stream()->get_constant();
   876   if (con.basic_type() == T_ILLEGAL) {
   876   if (con.basic_type() == T_ILLEGAL) {
       
   877     // FIXME: an unresolved Dynamic constant can get here,
       
   878     // and that should not terminate the whole compilation.
   877     BAILOUT("could not resolve a constant");
   879     BAILOUT("could not resolve a constant");
   878   } else {
   880   } else {
   879     ValueType* t = illegalType;
   881     ValueType* t = illegalType;
   880     ValueStack* patch_state = NULL;
   882     ValueStack* patch_state = NULL;
   881     switch (con.basic_type()) {
   883     switch (con.basic_type()) {
   891       case T_OBJECT :
   893       case T_OBJECT :
   892        {
   894        {
   893         ciObject* obj = con.as_object();
   895         ciObject* obj = con.as_object();
   894         if (!obj->is_loaded()
   896         if (!obj->is_loaded()
   895             || (PatchALot && obj->klass() != ciEnv::current()->String_klass())) {
   897             || (PatchALot && obj->klass() != ciEnv::current()->String_klass())) {
       
   898           // A Class, MethodType, MethodHandle, or String.
       
   899           // Unloaded condy nodes show up as T_ILLEGAL, above.
   896           patch_state = copy_state_before();
   900           patch_state = copy_state_before();
   897           t = new ObjectConstant(obj);
   901           t = new ObjectConstant(obj);
   898         } else {
   902         } else {
   899           assert(obj->is_instance(), "must be java_mirror of klass");
   903           // Might be a Class, MethodType, MethodHandle, or Dynamic constant
   900           t = new InstanceConstant(obj->as_instance());
   904           // result, which might turn out to be an array.
       
   905           if (obj->is_null_object())
       
   906             t = objectNull;
       
   907           else if (obj->is_array())
       
   908             t = new ArrayConstant(obj->as_array());
       
   909           else
       
   910             t = new InstanceConstant(obj->as_instance());
   901         }
   911         }
   902         break;
   912         break;
   903        }
   913        }
   904       default       : ShouldNotReachHere();
   914       default       : ShouldNotReachHere();
   905     }
   915     }