Merge

Fri, 25 Jan 2013 13:47:52 -0800

author
minqi
date
Fri, 25 Jan 2013 13:47:52 -0800
changeset 4495
8d1fb417a42d
parent 4492
8b46b0196eb0
parent 4494
4a0dd3799a44
child 4496
cf8470eaf7e5

Merge

src/share/vm/prims/jvmtiRedefineClasses.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/oops/constantPool.cpp	Fri Jan 25 10:04:08 2013 -0500
     1.2 +++ b/src/share/vm/oops/constantPool.cpp	Fri Jan 25 13:47:52 2013 -0800
     1.3 @@ -1098,32 +1098,9 @@
     1.4  } // end compare_entry_to()
     1.5  
     1.6  
     1.7 -// Copy this constant pool's entries at start_i to end_i (inclusive)
     1.8 -// to the constant pool to_cp's entries starting at to_i. A total of
     1.9 -// (end_i - start_i) + 1 entries are copied.
    1.10 -void ConstantPool::copy_cp_to_impl(constantPoolHandle from_cp, int start_i, int end_i,
    1.11 -       constantPoolHandle to_cp, int to_i, TRAPS) {
    1.12 -
    1.13 -  int dest_i = to_i;  // leave original alone for debug purposes
    1.14 -
    1.15 -  for (int src_i = start_i; src_i <= end_i; /* see loop bottom */ ) {
    1.16 -    copy_entry_to(from_cp, src_i, to_cp, dest_i, CHECK);
    1.17 -
    1.18 -    switch (from_cp->tag_at(src_i).value()) {
    1.19 -    case JVM_CONSTANT_Double:
    1.20 -    case JVM_CONSTANT_Long:
    1.21 -      // double and long take two constant pool entries
    1.22 -      src_i += 2;
    1.23 -      dest_i += 2;
    1.24 -      break;
    1.25 -
    1.26 -    default:
    1.27 -      // all others take one constant pool entry
    1.28 -      src_i++;
    1.29 -      dest_i++;
    1.30 -      break;
    1.31 -    }
    1.32 -  }
    1.33 +void ConstantPool::copy_operands(constantPoolHandle from_cp,
    1.34 +                                 constantPoolHandle to_cp,
    1.35 +                                 TRAPS) {
    1.36  
    1.37    int from_oplen = operand_array_length(from_cp->operands());
    1.38    int old_oplen  = operand_array_length(to_cp->operands());
    1.39 @@ -1179,8 +1156,39 @@
    1.40        to_cp->set_operands(new_operands);
    1.41      }
    1.42    }
    1.43 +} // end copy_operands()
    1.44  
    1.45 -} // end copy_cp_to()
    1.46 +
    1.47 +// Copy this constant pool's entries at start_i to end_i (inclusive)
    1.48 +// to the constant pool to_cp's entries starting at to_i. A total of
    1.49 +// (end_i - start_i) + 1 entries are copied.
    1.50 +void ConstantPool::copy_cp_to_impl(constantPoolHandle from_cp, int start_i, int end_i,
    1.51 +       constantPoolHandle to_cp, int to_i, TRAPS) {
    1.52 +
    1.53 +
    1.54 +  int dest_i = to_i;  // leave original alone for debug purposes
    1.55 +
    1.56 +  for (int src_i = start_i; src_i <= end_i; /* see loop bottom */ ) {
    1.57 +    copy_entry_to(from_cp, src_i, to_cp, dest_i, CHECK);
    1.58 +
    1.59 +    switch (from_cp->tag_at(src_i).value()) {
    1.60 +    case JVM_CONSTANT_Double:
    1.61 +    case JVM_CONSTANT_Long:
    1.62 +      // double and long take two constant pool entries
    1.63 +      src_i += 2;
    1.64 +      dest_i += 2;
    1.65 +      break;
    1.66 +
    1.67 +    default:
    1.68 +      // all others take one constant pool entry
    1.69 +      src_i++;
    1.70 +      dest_i++;
    1.71 +      break;
    1.72 +    }
    1.73 +  }
    1.74 +  copy_operands(from_cp, to_cp, CHECK);
    1.75 +
    1.76 +} // end copy_cp_to_impl()
    1.77  
    1.78  
    1.79  // Copy this constant pool's entry at from_i to the constant pool
     2.1 --- a/src/share/vm/oops/constantPool.hpp	Fri Jan 25 10:04:08 2013 -0500
     2.2 +++ b/src/share/vm/oops/constantPool.hpp	Fri Jan 25 13:47:52 2013 -0800
     2.3 @@ -781,6 +781,7 @@
     2.4    }
     2.5    static void copy_cp_to_impl(constantPoolHandle from_cp, int start_i, int end_i, constantPoolHandle to_cp, int to_i, TRAPS);
     2.6    static void copy_entry_to(constantPoolHandle from_cp, int from_i, constantPoolHandle to_cp, int to_i, TRAPS);
     2.7 +  static void copy_operands(constantPoolHandle from_cp, constantPoolHandle to_cp, TRAPS);
     2.8    int  find_matching_entry(int pattern_i, constantPoolHandle search_cp, TRAPS);
     2.9    int  version() const                    { return _saved._version; }
    2.10    void set_version(int version)           { _saved._version = version; }
     3.1 --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri Jan 25 10:04:08 2013 -0500
     3.2 +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri Jan 25 13:47:52 2013 -0800
     3.3 @@ -1122,6 +1122,8 @@
     3.4        }
     3.5      } // end for each old_cp entry
     3.6  
     3.7 +    ConstantPool::copy_operands(old_cp, *merge_cp_p, CHECK_0);
     3.8 +
     3.9      // We don't need to sanity check that *merge_cp_length_p is within
    3.10      // *merge_cp_p bounds since we have the minimum on-entry check above.
    3.11      (*merge_cp_length_p) = old_i;
    3.12 @@ -1305,8 +1307,12 @@
    3.13    _index_map_count = 0;
    3.14    _index_map_p = new intArray(scratch_cp->length(), -1);
    3.15  
    3.16 +  // reference to the cp holder is needed for copy_operands()
    3.17 +  merge_cp->set_pool_holder(scratch_class());
    3.18    bool result = merge_constant_pools(old_cp, scratch_cp, &merge_cp,
    3.19                    &merge_cp_length, THREAD);
    3.20 +  merge_cp->set_pool_holder(NULL);
    3.21 +
    3.22    if (!result) {
    3.23      // The merge can fail due to memory allocation failure or due
    3.24      // to robustness checks.
    3.25 @@ -2380,13 +2386,14 @@
    3.26    assert(version != 0, "sanity check");
    3.27    smaller_cp->set_version(version);
    3.28  
    3.29 +  // attach klass to new constant pool
    3.30 +  // reference to the cp holder is needed for copy_operands()
    3.31 +  smaller_cp->set_pool_holder(scratch_class());
    3.32 +
    3.33    scratch_cp->copy_cp_to(1, scratch_cp_length - 1, smaller_cp, 1, THREAD);
    3.34    scratch_cp = smaller_cp;
    3.35  
    3.36    // attach new constant pool to klass
    3.37 -  scratch_cp->set_pool_holder(scratch_class());
    3.38 -
    3.39 -  // attach klass to new constant pool
    3.40    scratch_class->set_constants(scratch_cp());
    3.41  
    3.42    int i;  // for portability

mercurial