1141 } |
1141 } |
1142 |
1142 |
1143 int from_oplen = operand_array_length(from_cp->operands()); |
1143 int from_oplen = operand_array_length(from_cp->operands()); |
1144 int old_oplen = operand_array_length(to_cp->operands()); |
1144 int old_oplen = operand_array_length(to_cp->operands()); |
1145 if (from_oplen != 0) { |
1145 if (from_oplen != 0) { |
|
1146 ClassLoaderData* loader_data = to_cp->pool_holder()->class_loader_data(); |
1146 // append my operands to the target's operands array |
1147 // append my operands to the target's operands array |
1147 if (old_oplen == 0) { |
1148 if (old_oplen == 0) { |
1148 to_cp->set_operands(from_cp->operands()); // reuse; do not merge |
1149 // Can't just reuse from_cp's operand list because of deallocation issues |
|
1150 int len = from_cp->operands()->length(); |
|
1151 Array<u2>* new_ops = MetadataFactory::new_array<u2>(loader_data, len, CHECK); |
|
1152 Copy::conjoint_memory_atomic( |
|
1153 from_cp->operands()->adr_at(0), new_ops->adr_at(0), len * sizeof(u2)); |
|
1154 to_cp->set_operands(new_ops); |
1149 } else { |
1155 } else { |
1150 int old_len = to_cp->operands()->length(); |
1156 int old_len = to_cp->operands()->length(); |
1151 int from_len = from_cp->operands()->length(); |
1157 int from_len = from_cp->operands()->length(); |
1152 int old_off = old_oplen * sizeof(u2); |
1158 int old_off = old_oplen * sizeof(u2); |
1153 int from_off = from_oplen * sizeof(u2); |
1159 int from_off = from_oplen * sizeof(u2); |
1154 // Use the metaspace for the destination constant pool |
1160 // Use the metaspace for the destination constant pool |
1155 ClassLoaderData* loader_data = to_cp->pool_holder()->class_loader_data(); |
|
1156 Array<u2>* new_operands = MetadataFactory::new_array<u2>(loader_data, old_len + from_len, CHECK); |
1161 Array<u2>* new_operands = MetadataFactory::new_array<u2>(loader_data, old_len + from_len, CHECK); |
1157 int fillp = 0, len = 0; |
1162 int fillp = 0, len = 0; |
1158 // first part of dest |
1163 // first part of dest |
1159 Copy::conjoint_memory_atomic(to_cp->operands()->adr_at(0), |
1164 Copy::conjoint_memory_atomic(to_cp->operands()->adr_at(0), |
1160 new_operands->adr_at(fillp), |
1165 new_operands->adr_at(fillp), |