8025185: MethodHandleInError and MethodTypeInError not handled in ConstantPool::compare_entry_to and copy_entry_to

Wed, 09 Oct 2013 21:45:28 -0400

author
coleenp
date
Wed, 09 Oct 2013 21:45:28 -0400
changeset 5884
b4a4fdc1f464
parent 5847
cc4f5f8d885e
child 5885
e831448418ac

8025185: MethodHandleInError and MethodTypeInError not handled in ConstantPool::compare_entry_to and copy_entry_to
Summary: Add missing cases.
Reviewed-by: sspitsyn, dcubed

src/share/vm/oops/constantPool.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/oops/constantPool.cpp	Sun Oct 06 16:13:50 2013 +0200
     1.2 +++ b/src/share/vm/oops/constantPool.cpp	Wed Oct 09 21:45:28 2013 -0400
     1.3 @@ -864,6 +864,19 @@
     1.4  }
     1.5  
     1.6  
     1.7 +jbyte normalize_error_tag(jbyte tag) {
     1.8 +  switch (tag) {
     1.9 +  case JVM_CONSTANT_UnresolvedClassInError:
    1.10 +    return JVM_CONSTANT_UnresolvedClass;
    1.11 +  case JVM_CONSTANT_MethodHandleInError:
    1.12 +    return JVM_CONSTANT_MethodHandle;
    1.13 +  case JVM_CONSTANT_MethodTypeInError:
    1.14 +    return JVM_CONSTANT_MethodType;
    1.15 +  default:
    1.16 +    return tag;
    1.17 +  }
    1.18 +}
    1.19 +
    1.20  // Compare this constant pool's entry at index1 to the constant pool
    1.21  // cp2's entry at index2.
    1.22  bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2,
    1.23 @@ -873,14 +886,10 @@
    1.24    jbyte t2 = cp2->tag_at(index2).value();
    1.25  
    1.26  
    1.27 -  // JVM_CONSTANT_UnresolvedClassInError is equal to JVM_CONSTANT_UnresolvedClass
    1.28 -  // when comparing
    1.29 -  if (t1 == JVM_CONSTANT_UnresolvedClassInError) {
    1.30 -    t1 = JVM_CONSTANT_UnresolvedClass;
    1.31 -  }
    1.32 -  if (t2 == JVM_CONSTANT_UnresolvedClassInError) {
    1.33 -    t2 = JVM_CONSTANT_UnresolvedClass;
    1.34 -  }
    1.35 +  // JVM_CONSTANT_UnresolvedClassInError tag is equal to JVM_CONSTANT_UnresolvedClass
    1.36 +  // when comparing (and the other error tags)
    1.37 +  t1 = normalize_error_tag(t1);
    1.38 +  t2 = normalize_error_tag(t2);
    1.39  
    1.40    if (t1 != t2) {
    1.41      // Not the same entry type so there is nothing else to check. Note
    1.42 @@ -1001,8 +1010,8 @@
    1.43  
    1.44    case JVM_CONSTANT_MethodType:
    1.45    {
    1.46 -    int k1 = method_type_index_at(index1);
    1.47 -    int k2 = cp2->method_type_index_at(index2);
    1.48 +    int k1 = method_type_index_at_error_ok(index1);
    1.49 +    int k2 = cp2->method_type_index_at_error_ok(index2);
    1.50      bool match = compare_entry_to(k1, cp2, k2, CHECK_false);
    1.51      if (match) {
    1.52        return true;
    1.53 @@ -1011,11 +1020,11 @@
    1.54  
    1.55    case JVM_CONSTANT_MethodHandle:
    1.56    {
    1.57 -    int k1 = method_handle_ref_kind_at(index1);
    1.58 -    int k2 = cp2->method_handle_ref_kind_at(index2);
    1.59 +    int k1 = method_handle_ref_kind_at_error_ok(index1);
    1.60 +    int k2 = cp2->method_handle_ref_kind_at_error_ok(index2);
    1.61      if (k1 == k2) {
    1.62 -      int i1 = method_handle_index_at(index1);
    1.63 -      int i2 = cp2->method_handle_index_at(index2);
    1.64 +      int i1 = method_handle_index_at_error_ok(index1);
    1.65 +      int i2 = cp2->method_handle_index_at_error_ok(index2);
    1.66        bool match = compare_entry_to(i1, cp2, i2, CHECK_false);
    1.67        if (match) {
    1.68          return true;
    1.69 @@ -1329,14 +1338,6 @@
    1.70      }
    1.71    } break;
    1.72  
    1.73 -  case JVM_CONSTANT_UnresolvedClassInError:
    1.74 -  {
    1.75 -    Symbol* k = from_cp->unresolved_klass_at(from_i);
    1.76 -    to_cp->unresolved_klass_at_put(to_i, k);
    1.77 -    to_cp->tag_at_put(to_i, JVM_CONSTANT_UnresolvedClassInError);
    1.78 -  } break;
    1.79 -
    1.80 -
    1.81    case JVM_CONSTANT_String:
    1.82    {
    1.83      Symbol* s = from_cp->unresolved_string_at(from_i);
    1.84 @@ -1352,15 +1353,17 @@
    1.85    } break;
    1.86  
    1.87    case JVM_CONSTANT_MethodType:
    1.88 +  case JVM_CONSTANT_MethodTypeInError:
    1.89    {
    1.90 -    jint k = from_cp->method_type_index_at(from_i);
    1.91 +    jint k = from_cp->method_type_index_at_error_ok(from_i);
    1.92      to_cp->method_type_index_at_put(to_i, k);
    1.93    } break;
    1.94  
    1.95    case JVM_CONSTANT_MethodHandle:
    1.96 +  case JVM_CONSTANT_MethodHandleInError:
    1.97    {
    1.98 -    int k1 = from_cp->method_handle_ref_kind_at(from_i);
    1.99 -    int k2 = from_cp->method_handle_index_at(from_i);
   1.100 +    int k1 = from_cp->method_handle_ref_kind_at_error_ok(from_i);
   1.101 +    int k2 = from_cp->method_handle_index_at_error_ok(from_i);
   1.102      to_cp->method_handle_index_at_put(to_i, k1, k2);
   1.103    } break;
   1.104  

mercurial