495 } |
495 } |
496 (*merge_cp_length_p)++; |
496 (*merge_cp_length_p)++; |
497 } break; |
497 } break; |
498 |
498 |
499 // this is an indirect CP entry so it needs special handling |
499 // this is an indirect CP entry so it needs special handling |
|
500 case JVM_CONSTANT_Dynamic: // fall through |
500 case JVM_CONSTANT_InvokeDynamic: |
501 case JVM_CONSTANT_InvokeDynamic: |
501 { |
502 { |
502 // Index of the bootstrap specifier in the operands array |
503 // Index of the bootstrap specifier in the operands array |
503 int old_bs_i = scratch_cp->invoke_dynamic_bootstrap_specifier_index(scratch_i); |
504 int old_bs_i = scratch_cp->invoke_dynamic_bootstrap_specifier_index(scratch_i); |
504 int new_bs_i = find_or_append_operand(scratch_cp, old_bs_i, merge_cp_p, |
505 int new_bs_i = find_or_append_operand(scratch_cp, old_bs_i, merge_cp_p, |
507 int old_ref_i = scratch_cp->invoke_dynamic_name_and_type_ref_index_at(scratch_i); |
508 int old_ref_i = scratch_cp->invoke_dynamic_name_and_type_ref_index_at(scratch_i); |
508 int new_ref_i = find_or_append_indirect_entry(scratch_cp, old_ref_i, merge_cp_p, |
509 int new_ref_i = find_or_append_indirect_entry(scratch_cp, old_ref_i, merge_cp_p, |
509 merge_cp_length_p, THREAD); |
510 merge_cp_length_p, THREAD); |
510 if (new_bs_i != old_bs_i) { |
511 if (new_bs_i != old_bs_i) { |
511 log_trace(redefine, class, constantpool) |
512 log_trace(redefine, class, constantpool) |
512 ("InvokeDynamic entry@%d bootstrap_method_attr_index change: %d to %d", |
513 ("Dynamic entry@%d bootstrap_method_attr_index change: %d to %d", |
513 *merge_cp_length_p, old_bs_i, new_bs_i); |
514 *merge_cp_length_p, old_bs_i, new_bs_i); |
514 } |
515 } |
515 if (new_ref_i != old_ref_i) { |
516 if (new_ref_i != old_ref_i) { |
516 log_trace(redefine, class, constantpool) |
517 log_trace(redefine, class, constantpool) |
517 ("InvokeDynamic entry@%d name_and_type_index change: %d to %d", *merge_cp_length_p, old_ref_i, new_ref_i); |
518 ("Dynamic entry@%d name_and_type_index change: %d to %d", *merge_cp_length_p, old_ref_i, new_ref_i); |
518 } |
519 } |
519 |
520 |
520 (*merge_cp_p)->invoke_dynamic_at_put(*merge_cp_length_p, new_bs_i, new_ref_i); |
521 if (scratch_cp->tag_at(scratch_i).is_dynamic_constant()) |
|
522 (*merge_cp_p)->dynamic_constant_at_put(*merge_cp_length_p, new_bs_i, new_ref_i); |
|
523 else |
|
524 (*merge_cp_p)->invoke_dynamic_at_put(*merge_cp_length_p, new_bs_i, new_ref_i); |
521 if (scratch_i != *merge_cp_length_p) { |
525 if (scratch_i != *merge_cp_length_p) { |
522 // The new entry in *merge_cp_p is at a different index than |
526 // The new entry in *merge_cp_p is at a different index than |
523 // the new entry in scratch_cp so we need to map the index values. |
527 // the new entry in scratch_cp so we need to map the index values. |
524 map_index(scratch_cp, scratch_i, *merge_cp_length_p); |
528 map_index(scratch_cp, scratch_i, *merge_cp_length_p); |
525 } |
529 } |