src/share/vm/c1/c1_GraphBuilder.cpp

changeset 3970
977007096840
parent 3969
1d7922586cf6
child 4002
09aad8452938
     1.1 --- a/src/share/vm/c1/c1_GraphBuilder.cpp	Tue Jul 24 10:51:00 2012 -0700
     1.2 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Jul 27 16:14:15 2012 -0700
     1.3 @@ -1569,31 +1569,33 @@
     1.4        ObjectType* obj_type = obj->type()->as_ObjectType();
     1.5        if (obj_type->is_constant() && !PatchALot) {
     1.6          ciObject* const_oop = obj_type->constant_value();
     1.7 -        if (field->is_constant()) {
     1.8 -          ciConstant field_val = field->constant_value_of(const_oop);
     1.9 -          BasicType field_type = field_val.basic_type();
    1.10 -          switch (field_type) {
    1.11 -          case T_ARRAY:
    1.12 -          case T_OBJECT:
    1.13 -            if (field_val.as_object()->should_be_constant()) {
    1.14 +        if (!const_oop->is_null_object()) {
    1.15 +          if (field->is_constant()) {
    1.16 +            ciConstant field_val = field->constant_value_of(const_oop);
    1.17 +            BasicType field_type = field_val.basic_type();
    1.18 +            switch (field_type) {
    1.19 +            case T_ARRAY:
    1.20 +            case T_OBJECT:
    1.21 +              if (field_val.as_object()->should_be_constant()) {
    1.22 +                constant = new Constant(as_ValueType(field_val));
    1.23 +              }
    1.24 +              break;
    1.25 +            default:
    1.26                constant = new Constant(as_ValueType(field_val));
    1.27              }
    1.28 -            break;
    1.29 -          default:
    1.30 -            constant = new Constant(as_ValueType(field_val));
    1.31 -          }
    1.32 -        } else {
    1.33 -          // For constant CallSites treat the target field as a compile time constant.
    1.34 -          if (const_oop->is_call_site()) {
    1.35 -            ciCallSite* call_site = const_oop->as_call_site();
    1.36 -            if (field->is_call_site_target()) {
    1.37 -              ciMethodHandle* target = call_site->get_target();
    1.38 -              if (target != NULL) {  // just in case
    1.39 -                ciConstant field_val(T_OBJECT, target);
    1.40 -                constant = new Constant(as_ValueType(field_val));
    1.41 -                // Add a dependence for invalidation of the optimization.
    1.42 -                if (!call_site->is_constant_call_site()) {
    1.43 -                  dependency_recorder()->assert_call_site_target_value(call_site, target);
    1.44 +          } else {
    1.45 +            // For CallSite objects treat the target field as a compile time constant.
    1.46 +            if (const_oop->is_call_site()) {
    1.47 +              ciCallSite* call_site = const_oop->as_call_site();
    1.48 +              if (field->is_call_site_target()) {
    1.49 +                ciMethodHandle* target = call_site->get_target();
    1.50 +                if (target != NULL) {  // just in case
    1.51 +                  ciConstant field_val(T_OBJECT, target);
    1.52 +                  constant = new Constant(as_ValueType(field_val));
    1.53 +                  // Add a dependence for invalidation of the optimization.
    1.54 +                  if (!call_site->is_constant_call_site()) {
    1.55 +                    dependency_recorder()->assert_call_site_target_value(call_site, target);
    1.56 +                  }
    1.57                  }
    1.58                }
    1.59              }

mercurial