--- a/hotspot/src/share/vm/oops/constantPool.cpp Thu Nov 01 13:05:47 2012 +0100
+++ b/hotspot/src/share/vm/oops/constantPool.cpp Thu Oct 11 12:25:42 2012 -0400
@@ -1143,16 +1143,21 @@
int from_oplen = operand_array_length(from_cp->operands());
int old_oplen = operand_array_length(to_cp->operands());
if (from_oplen != 0) {
+ ClassLoaderData* loader_data = to_cp->pool_holder()->class_loader_data();
// append my operands to the target's operands array
if (old_oplen == 0) {
- to_cp->set_operands(from_cp->operands()); // reuse; do not merge
+ // Can't just reuse from_cp's operand list because of deallocation issues
+ int len = from_cp->operands()->length();
+ Array<u2>* new_ops = MetadataFactory::new_array<u2>(loader_data, len, CHECK);
+ Copy::conjoint_memory_atomic(
+ from_cp->operands()->adr_at(0), new_ops->adr_at(0), len * sizeof(u2));
+ to_cp->set_operands(new_ops);
} else {
int old_len = to_cp->operands()->length();
int from_len = from_cp->operands()->length();
int old_off = old_oplen * sizeof(u2);
int from_off = from_oplen * sizeof(u2);
// Use the metaspace for the destination constant pool
- ClassLoaderData* loader_data = to_cp->pool_holder()->class_loader_data();
Array<u2>* new_operands = MetadataFactory::new_array<u2>(loader_data, old_len + from_len, CHECK);
int fillp = 0, len = 0;
// first part of dest