1.1 --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp Thu Jan 17 10:25:16 2013 -0500 1.2 +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp Thu Jan 17 13:40:31 2013 -0500 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -1334,20 +1334,8 @@ 1.11 return JVMTI_ERROR_INTERNAL; 1.12 } 1.13 1.14 - int orig_length = old_cp->orig_length(); 1.15 - if (orig_length == 0) { 1.16 - // This old_cp is an actual original constant pool. We save 1.17 - // the original length in the merged constant pool so that 1.18 - // merge_constant_pools() can be more efficient. If a constant 1.19 - // pool has a non-zero orig_length() value, then that constant 1.20 - // pool was created by a merge operation in RedefineClasses. 1.21 - merge_cp->set_orig_length(old_cp->length()); 1.22 - } else { 1.23 - // This old_cp is a merged constant pool from a previous 1.24 - // RedefineClasses() calls so just copy the orig_length() 1.25 - // value. 1.26 - merge_cp->set_orig_length(old_cp->orig_length()); 1.27 - } 1.28 + // Update the version number of the constant pool 1.29 + merge_cp->increment_and_save_version(old_cp->version()); 1.30 1.31 ResourceMark rm(THREAD); 1.32 _index_map_count = 0; 1.33 @@ -2417,18 +2405,19 @@ 1.34 int scratch_cp_length, TRAPS) { 1.35 assert(scratch_cp->length() >= scratch_cp_length, "sanity check"); 1.36 1.37 - // scratch_cp is a merged constant pool and has enough space for a 1.38 - // worst case merge situation. We want to associate the minimum 1.39 - // sized constant pool with the klass to save space. 1.40 - constantPoolHandle smaller_cp(THREAD, 1.41 - ConstantPool::allocate(loader_data, scratch_cp_length, 1.42 - THREAD)); 1.43 - // preserve orig_length() value in the smaller copy 1.44 - int orig_length = scratch_cp->orig_length(); 1.45 - assert(orig_length != 0, "sanity check"); 1.46 - smaller_cp->set_orig_length(orig_length); 1.47 - scratch_cp->copy_cp_to(1, scratch_cp_length - 1, smaller_cp, 1, THREAD); 1.48 - scratch_cp = smaller_cp; 1.49 + // scratch_cp is a merged constant pool and has enough space for a 1.50 + // worst case merge situation. We want to associate the minimum 1.51 + // sized constant pool with the klass to save space. 1.52 + constantPoolHandle smaller_cp(THREAD, 1.53 + ConstantPool::allocate(loader_data, scratch_cp_length, THREAD)); 1.54 + 1.55 + // preserve version() value in the smaller copy 1.56 + int version = scratch_cp->version(); 1.57 + assert(version != 0, "sanity check"); 1.58 + smaller_cp->set_version(version); 1.59 + 1.60 + scratch_cp->copy_cp_to(1, scratch_cp_length - 1, smaller_cp, 1, THREAD); 1.61 + scratch_cp = smaller_cp; 1.62 1.63 // attach new constant pool to klass 1.64 scratch_cp->set_pool_holder(scratch_class());