8218004: Clean up terminology for shared methods within the JVM for indy and condy support
Summary: Remove "invoke_dynamic" from the name of several ConstantPool bootstrap helper methods that are shared by both indy and condy.
Reviewed-by: coleenp, dholmes, mchung
--- a/src/hotspot/share/classfile/classFileParser.cpp Wed Feb 13 11:18:14 2019 -0800
+++ b/src/hotspot/share/classfile/classFileParser.cpp Wed Feb 13 14:20:40 2019 -0500
@@ -564,7 +564,7 @@
}
case JVM_CONSTANT_Dynamic: {
const int name_and_type_ref_index =
- cp->invoke_dynamic_name_and_type_ref_index_at(index);
+ cp->bootstrap_name_and_type_ref_index_at(index);
check_property(valid_cp_range(name_and_type_ref_index, length) &&
cp->tag_at(name_and_type_ref_index).is_name_and_type(),
@@ -579,7 +579,7 @@
}
case JVM_CONSTANT_InvokeDynamic: {
const int name_and_type_ref_index =
- cp->invoke_dynamic_name_and_type_ref_index_at(index);
+ cp->bootstrap_name_and_type_ref_index_at(index);
check_property(valid_cp_range(name_and_type_ref_index, length) &&
cp->tag_at(name_and_type_ref_index).is_name_and_type(),
--- a/src/hotspot/share/interpreter/bytecodeTracer.cpp Wed Feb 13 11:18:14 2019 -0800
+++ b/src/hotspot/share/interpreter/bytecodeTracer.cpp Wed Feb 13 14:20:40 2019 -0500
@@ -382,7 +382,7 @@
st->print_cr(" %d <%s.%s%s%s> ", i, klass->as_C_string(), name->as_C_string(), sep, signature->as_C_string());
} else {
if (tag.is_dynamic_constant() || tag.is_invoke_dynamic()) {
- int bsm = constants->invoke_dynamic_bootstrap_method_ref_index_at(i);
+ int bsm = constants->bootstrap_method_ref_index_at(i);
st->print(" bsm=%d", bsm);
}
st->print_cr(" %d <%s%s%s>", i, name->as_C_string(), sep, signature->as_C_string());
--- a/src/hotspot/share/oops/constantPool.cpp Wed Feb 13 11:18:14 2019 -0800
+++ b/src/hotspot/share/oops/constantPool.cpp Wed Feb 13 14:20:40 2019 -0500
@@ -625,26 +625,22 @@
if (!uncached && cache() != NULL) {
if (ConstantPool::is_invokedynamic_index(which)) {
// Invokedynamic index is index into the constant pool cache
- int pool_index = invokedynamic_cp_cache_entry_at(which)->constant_pool_index();
- pool_index = invoke_dynamic_name_and_type_ref_index_at(pool_index);
+ int pool_index = invokedynamic_bootstrap_ref_index_at(which);
+ pool_index = bootstrap_name_and_type_ref_index_at(pool_index);
assert(tag_at(pool_index).is_name_and_type(), "");
return pool_index;
}
// change byte-ordering and go via cache
i = remap_instruction_operand_from_cache(which);
} else {
- if (tag_at(which).is_invoke_dynamic() ||
- tag_at(which).is_dynamic_constant() ||
- tag_at(which).is_dynamic_constant_in_error()) {
- int pool_index = invoke_dynamic_name_and_type_ref_index_at(which);
+ if (tag_at(which).has_bootstrap()) {
+ int pool_index = bootstrap_name_and_type_ref_index_at(which);
assert(tag_at(pool_index).is_name_and_type(), "");
return pool_index;
}
}
assert(tag_at(i).is_field_or_method(), "Corrupted constant pool");
- assert(!tag_at(i).is_invoke_dynamic() &&
- !tag_at(i).is_dynamic_constant() &&
- !tag_at(i).is_dynamic_constant_in_error(), "Must be handled above");
+ assert(!tag_at(i).has_bootstrap(), "Must be handled above");
jint ref_index = *int_at_addr(i);
return extract_high_short_from_int(ref_index);
}
@@ -654,7 +650,7 @@
if (!uncached && cache() != NULL) {
if (ConstantPool::is_invokedynamic_index(which)) {
// Invokedynamic index is index into resolved_references
- pool_index = invokedynamic_cp_cache_entry_at(which)->constant_pool_index();
+ pool_index = invokedynamic_bootstrap_ref_index_at(which);
} else {
// change byte-ordering and go via cache
pool_index = remap_instruction_operand_from_cache(which);
@@ -1128,14 +1124,14 @@
// JVM_CONSTANT_Dynamic is an ordered pair of [bootm, name&ftype], plus optional arguments
// In both cases, the bootm, being a JVM_CONSTANT_MethodHandle, has its own cache entry.
// It is accompanied by the optional arguments.
- int bsm_index = this_cp->invoke_dynamic_bootstrap_method_ref_index_at(index);
+ int bsm_index = this_cp->bootstrap_method_ref_index_at(index);
oop bsm_oop = this_cp->resolve_possibly_cached_constant_at(bsm_index, CHECK_NULL);
if (!java_lang_invoke_MethodHandle::is_instance(bsm_oop)) {
THROW_MSG_NULL(vmSymbols::java_lang_LinkageError(), "BSM not an MethodHandle");
}
// Extract the optional static arguments.
- argc = this_cp->invoke_dynamic_argument_count_at(index);
+ argc = this_cp->bootstrap_argument_count_at(index);
// if there are no static arguments, return the bsm by itself:
if (argc == 0 && UseBootstrapCallInfo < 2) return bsm_oop;
@@ -1177,7 +1173,7 @@
if (!use_BSCI && this_cp->tag_at(index).is_dynamic_constant()) {
bool found_unresolved_condy = false;
for (int i = 0; i < argc; i++) {
- int arg_index = this_cp->invoke_dynamic_argument_index_at(index, i);
+ int arg_index = this_cp->bootstrap_argument_index_at(index, i);
if (this_cp->tag_at(arg_index).is_dynamic_constant()) {
// potential recursion point condy -> condy
bool found_it = false;
@@ -1197,7 +1193,7 @@
bool all_resolved = true;
for (int i = 0; i < argc; i++) {
bool found_it = false;
- int arg_index = this_cp->invoke_dynamic_argument_index_at(index, i);
+ int arg_index = this_cp->bootstrap_argument_index_at(index, i);
this_cp->find_cached_constant_at(arg_index, found_it, CHECK_NULL);
if (!found_it) { all_resolved = false; break; }
}
@@ -1244,7 +1240,7 @@
!(this_cp->tag_at(index).is_invoke_dynamic() ||
this_cp->tag_at(index).is_dynamic_constant()) ||
(0 > start_arg || start_arg > end_arg) ||
- (end_arg > (argc = this_cp->invoke_dynamic_argument_count_at(index))) ||
+ (end_arg > (argc = this_cp->bootstrap_argument_count_at(index))) ||
(0 > pos || pos > limit) ||
(info.is_null() || limit > info->length())) {
// An index or something else went wrong; throw an error.
@@ -1255,7 +1251,7 @@
// now we can loop safely
int info_i = pos;
for (int i = start_arg; i < end_arg; i++) {
- int arg_index = this_cp->invoke_dynamic_argument_index_at(index, i);
+ int arg_index = this_cp->bootstrap_argument_index_at(index, i);
oop arg_oop;
if (must_resolve) {
arg_oop = this_cp->resolve_possibly_cached_constant_at(arg_index, CHECK);
@@ -1454,10 +1450,10 @@
case JVM_CONSTANT_Dynamic:
{
- int k1 = invoke_dynamic_name_and_type_ref_index_at(index1);
- int k2 = cp2->invoke_dynamic_name_and_type_ref_index_at(index2);
- int i1 = invoke_dynamic_bootstrap_specifier_index(index1);
- int i2 = cp2->invoke_dynamic_bootstrap_specifier_index(index2);
+ int k1 = bootstrap_name_and_type_ref_index_at(index1);
+ int k2 = cp2->bootstrap_name_and_type_ref_index_at(index2);
+ int i1 = bootstrap_methods_attribute_index(index1);
+ int i2 = cp2->bootstrap_methods_attribute_index(index2);
// separate statements and variables because CHECK_false is used
bool match_entry = compare_entry_to(k1, cp2, k2, CHECK_false);
bool match_operand = compare_operand_to(i1, cp2, i2, CHECK_false);
@@ -1466,10 +1462,10 @@
case JVM_CONSTANT_InvokeDynamic:
{
- int k1 = invoke_dynamic_name_and_type_ref_index_at(index1);
- int k2 = cp2->invoke_dynamic_name_and_type_ref_index_at(index2);
- int i1 = invoke_dynamic_bootstrap_specifier_index(index1);
- int i2 = cp2->invoke_dynamic_bootstrap_specifier_index(index2);
+ int k1 = bootstrap_name_and_type_ref_index_at(index1);
+ int k2 = cp2->bootstrap_name_and_type_ref_index_at(index2);
+ int i1 = bootstrap_methods_attribute_index(index1);
+ int i2 = cp2->bootstrap_methods_attribute_index(index2);
// separate statements and variables because CHECK_false is used
bool match_entry = compare_entry_to(k1, cp2, k2, CHECK_false);
bool match_operand = compare_operand_to(i1, cp2, i2, CHECK_false);
@@ -1793,16 +1789,16 @@
case JVM_CONSTANT_Dynamic:
case JVM_CONSTANT_DynamicInError:
{
- int k1 = from_cp->invoke_dynamic_bootstrap_specifier_index(from_i);
- int k2 = from_cp->invoke_dynamic_name_and_type_ref_index_at(from_i);
+ int k1 = from_cp->bootstrap_methods_attribute_index(from_i);
+ int k2 = from_cp->bootstrap_name_and_type_ref_index_at(from_i);
k1 += operand_array_length(to_cp->operands()); // to_cp might already have operands
to_cp->dynamic_constant_at_put(to_i, k1, k2);
} break;
case JVM_CONSTANT_InvokeDynamic:
{
- int k1 = from_cp->invoke_dynamic_bootstrap_specifier_index(from_i);
- int k2 = from_cp->invoke_dynamic_name_and_type_ref_index_at(from_i);
+ int k1 = from_cp->bootstrap_methods_attribute_index(from_i);
+ int k2 = from_cp->bootstrap_name_and_type_ref_index_at(from_i);
k1 += operand_array_length(to_cp->operands()); // to_cp might already have operands
to_cp->invoke_dynamic_at_put(to_i, k1, k2);
} break;
@@ -2252,7 +2248,7 @@
*bytes = tag;
idx1 = extract_low_short_from_int(*int_at_addr(idx));
idx2 = extract_high_short_from_int(*int_at_addr(idx));
- assert(idx2 == invoke_dynamic_name_and_type_ref_index_at(idx), "correct half of u4");
+ assert(idx2 == bootstrap_name_and_type_ref_index_at(idx), "correct half of u4");
Bytes::put_Java_u2((address) (bytes+1), idx1);
Bytes::put_Java_u2((address) (bytes+3), idx2);
DBG(printf("JVM_CONSTANT_Dynamic: %hd %hd", idx1, idx2));
@@ -2262,7 +2258,7 @@
*bytes = tag;
idx1 = extract_low_short_from_int(*int_at_addr(idx));
idx2 = extract_high_short_from_int(*int_at_addr(idx));
- assert(idx2 == invoke_dynamic_name_and_type_ref_index_at(idx), "correct half of u4");
+ assert(idx2 == bootstrap_name_and_type_ref_index_at(idx), "correct half of u4");
Bytes::put_Java_u2((address) (bytes+1), idx1);
Bytes::put_Java_u2((address) (bytes+3), idx2);
DBG(printf("JVM_CONSTANT_InvokeDynamic: %hd %hd", idx1, idx2));
@@ -2443,12 +2439,12 @@
case JVM_CONSTANT_Dynamic :
case JVM_CONSTANT_DynamicInError :
{
- st->print("bootstrap_method_index=%d", invoke_dynamic_bootstrap_method_ref_index_at(index));
- st->print(" type_index=%d", invoke_dynamic_name_and_type_ref_index_at(index));
- int argc = invoke_dynamic_argument_count_at(index);
+ st->print("bootstrap_method_index=%d", bootstrap_method_ref_index_at(index));
+ st->print(" type_index=%d", bootstrap_name_and_type_ref_index_at(index));
+ int argc = bootstrap_argument_count_at(index);
if (argc > 0) {
for (int arg_i = 0; arg_i < argc; arg_i++) {
- int arg = invoke_dynamic_argument_index_at(index, arg_i);
+ int arg = bootstrap_argument_index_at(index, arg_i);
st->print((arg_i == 0 ? " arguments={%d" : ", %d"), arg);
}
st->print("}");
@@ -2457,12 +2453,12 @@
break;
case JVM_CONSTANT_InvokeDynamic :
{
- st->print("bootstrap_method_index=%d", invoke_dynamic_bootstrap_method_ref_index_at(index));
- st->print(" name_and_type_index=%d", invoke_dynamic_name_and_type_ref_index_at(index));
- int argc = invoke_dynamic_argument_count_at(index);
+ st->print("bootstrap_method_index=%d", bootstrap_method_ref_index_at(index));
+ st->print(" name_and_type_index=%d", bootstrap_name_and_type_ref_index_at(index));
+ int argc = bootstrap_argument_count_at(index);
if (argc > 0) {
for (int arg_i = 0; arg_i < argc; arg_i++) {
- int arg = invoke_dynamic_argument_index_at(index, arg_i);
+ int arg = bootstrap_argument_index_at(index, arg_i);
st->print((arg_i == 0 ? " arguments={%d" : ", %d"), arg);
}
st->print("}");
--- a/src/hotspot/share/oops/constantPool.hpp Wed Feb 13 11:18:14 2019 -0800
+++ b/src/hotspot/share/oops/constantPool.hpp Wed Feb 13 14:20:40 2019 -0500
@@ -246,16 +246,22 @@
// The invokedynamic points at a CP cache entry. This entry points back
// at the original CP entry (CONSTANT_InvokeDynamic) and also (via f2) at an entry
// in the resolved_references array (which provides the appendix argument).
- int invokedynamic_cp_cache_index(int index) const {
- assert (is_invokedynamic_index(index), "should be a invokedynamic index");
- int cache_index = decode_invokedynamic_index(index);
+ int invokedynamic_cp_cache_index(int indy_index) const {
+ assert(is_invokedynamic_index(indy_index), "should be a invokedynamic index");
+ int cache_index = decode_invokedynamic_index(indy_index);
return cache_index;
}
- ConstantPoolCacheEntry* invokedynamic_cp_cache_entry_at(int index) const {
+ ConstantPoolCacheEntry* invokedynamic_cp_cache_entry_at(int indy_index) const {
// decode index that invokedynamic points to.
- int cp_cache_index = invokedynamic_cp_cache_index(index);
+ int cp_cache_index = invokedynamic_cp_cache_index(indy_index);
return cache()->entry_at(cp_cache_index);
}
+ // Given the per-instruction index of an indy instruction, report the
+ // main constant pool entry for its bootstrap specifier.
+ // From there, uncached_name/signature_ref_at will get the name/type.
+ int invokedynamic_bootstrap_ref_index_at(int indy_index) const {
+ return invokedynamic_cp_cache_entry_at(indy_index)->constant_pool_index();
+ }
// Assembly code support
static int tags_offset_in_bytes() { return offset_of(ConstantPool, _tags); }
@@ -294,14 +300,14 @@
*int_at_addr(which) = ref_index;
}
- void dynamic_constant_at_put(int which, int bootstrap_specifier_index, int name_and_type_index) {
+ void dynamic_constant_at_put(int which, int bsms_attribute_index, int name_and_type_index) {
tag_at_put(which, JVM_CONSTANT_Dynamic);
- *int_at_addr(which) = ((jint) name_and_type_index<<16) | bootstrap_specifier_index;
+ *int_at_addr(which) = ((jint) name_and_type_index<<16) | bsms_attribute_index;
}
- void invoke_dynamic_at_put(int which, int bootstrap_specifier_index, int name_and_type_index) {
+ void invoke_dynamic_at_put(int which, int bsms_attribute_index, int name_and_type_index) {
tag_at_put(which, JVM_CONSTANT_InvokeDynamic);
- *int_at_addr(which) = ((jint) name_and_type_index<<16) | bootstrap_specifier_index;
+ *int_at_addr(which) = ((jint) name_and_type_index<<16) | bsms_attribute_index;
}
void unresolved_string_at_put(int which, Symbol* s) {
@@ -534,26 +540,22 @@
return symbol_at(sym);
}
- int invoke_dynamic_name_and_type_ref_index_at(int which) {
- assert(tag_at(which).is_invoke_dynamic() ||
- tag_at(which).is_dynamic_constant() ||
- tag_at(which).is_dynamic_constant_in_error(), "Corrupted constant pool");
+ int bootstrap_name_and_type_ref_index_at(int which) {
+ assert(tag_at(which).has_bootstrap(), "Corrupted constant pool");
return extract_high_short_from_int(*int_at_addr(which));
}
- int invoke_dynamic_bootstrap_specifier_index(int which) {
- assert(tag_at(which).is_invoke_dynamic() ||
- tag_at(which).is_dynamic_constant() ||
- tag_at(which).is_dynamic_constant_in_error(), "Corrupted constant pool");
+ int bootstrap_methods_attribute_index(int which) {
+ assert(tag_at(which).has_bootstrap(), "Corrupted constant pool");
return extract_low_short_from_int(*int_at_addr(which));
}
- int invoke_dynamic_operand_base(int which) {
- int bootstrap_specifier_index = invoke_dynamic_bootstrap_specifier_index(which);
- return operand_offset_at(operands(), bootstrap_specifier_index);
+ int bootstrap_operand_base(int which) {
+ int bsms_attribute_index = bootstrap_methods_attribute_index(which);
+ return operand_offset_at(operands(), bsms_attribute_index);
}
// The first part of the operands array consists of an index into the second part.
// Extract a 32-bit index value from the first part.
- static int operand_offset_at(Array<u2>* operands, int bootstrap_specifier_index) {
- int n = (bootstrap_specifier_index * 2);
+ static int operand_offset_at(Array<u2>* operands, int bsms_attribute_index) {
+ int n = (bsms_attribute_index * 2);
assert(n >= 0 && n+2 <= operands->length(), "oob");
// The first 32-bit index points to the beginning of the second part
// of the operands array. Make sure this index is in the first part.
@@ -566,8 +568,8 @@
assert(offset == 0 || offset >= second_part && offset <= operands->length(), "oob (3)");
return offset;
}
- static void operand_offset_at_put(Array<u2>* operands, int bootstrap_specifier_index, int offset) {
- int n = bootstrap_specifier_index * 2;
+ static void operand_offset_at_put(Array<u2>* operands, int bsms_attribute_index, int offset) {
+ int n = bsms_attribute_index * 2;
assert(n >= 0 && n+2 <= operands->length(), "oob");
operands->at_put(n+0, extract_low_short_from_int(offset));
operands->at_put(n+1, extract_high_short_from_int(offset));
@@ -580,20 +582,23 @@
#ifdef ASSERT
// operand tuples fit together exactly, end to end
- static int operand_limit_at(Array<u2>* operands, int bootstrap_specifier_index) {
- int nextidx = bootstrap_specifier_index + 1;
+ static int operand_limit_at(Array<u2>* operands, int bsms_attribute_index) {
+ int nextidx = bsms_attribute_index + 1;
if (nextidx == operand_array_length(operands))
return operands->length();
else
return operand_offset_at(operands, nextidx);
}
- int invoke_dynamic_operand_limit(int which) {
- int bootstrap_specifier_index = invoke_dynamic_bootstrap_specifier_index(which);
- return operand_limit_at(operands(), bootstrap_specifier_index);
+ int bootstrap_operand_limit(int which) {
+ int bsms_attribute_index = bootstrap_methods_attribute_index(which);
+ return operand_limit_at(operands(), bsms_attribute_index);
}
#endif //ASSERT
- // layout of InvokeDynamic and Dynamic bootstrap method specifier (in second part of operands array):
+ // Layout of InvokeDynamic and Dynamic bootstrap method specifier
+ // data in second part of operands array. This encodes one record in
+ // the BootstrapMethods attribute. The whole specifier also includes
+ // the name and type information from the main constant pool entry.
enum {
_indy_bsm_offset = 0, // CONSTANT_MethodHandle bsm
_indy_argc_offset = 1, // u2 argc
@@ -602,35 +607,35 @@
// These functions are used in RedefineClasses for CP merge
- int operand_offset_at(int bootstrap_specifier_index) {
- assert(0 <= bootstrap_specifier_index &&
- bootstrap_specifier_index < operand_array_length(operands()),
+ int operand_offset_at(int bsms_attribute_index) {
+ assert(0 <= bsms_attribute_index &&
+ bsms_attribute_index < operand_array_length(operands()),
"Corrupted CP operands");
- return operand_offset_at(operands(), bootstrap_specifier_index);
+ return operand_offset_at(operands(), bsms_attribute_index);
}
- int operand_bootstrap_method_ref_index_at(int bootstrap_specifier_index) {
- int offset = operand_offset_at(bootstrap_specifier_index);
+ int operand_bootstrap_method_ref_index_at(int bsms_attribute_index) {
+ int offset = operand_offset_at(bsms_attribute_index);
return operands()->at(offset + _indy_bsm_offset);
}
- int operand_argument_count_at(int bootstrap_specifier_index) {
- int offset = operand_offset_at(bootstrap_specifier_index);
+ int operand_argument_count_at(int bsms_attribute_index) {
+ int offset = operand_offset_at(bsms_attribute_index);
int argc = operands()->at(offset + _indy_argc_offset);
return argc;
}
- int operand_argument_index_at(int bootstrap_specifier_index, int j) {
- int offset = operand_offset_at(bootstrap_specifier_index);
+ int operand_argument_index_at(int bsms_attribute_index, int j) {
+ int offset = operand_offset_at(bsms_attribute_index);
return operands()->at(offset + _indy_argv_offset + j);
}
- int operand_next_offset_at(int bootstrap_specifier_index) {
- int offset = operand_offset_at(bootstrap_specifier_index) + _indy_argv_offset
- + operand_argument_count_at(bootstrap_specifier_index);
+ int operand_next_offset_at(int bsms_attribute_index) {
+ int offset = operand_offset_at(bsms_attribute_index) + _indy_argv_offset
+ + operand_argument_count_at(bsms_attribute_index);
return offset;
}
- // Compare a bootsrap specifier in the operands arrays
- bool compare_operand_to(int bootstrap_specifier_index1, const constantPoolHandle& cp2,
- int bootstrap_specifier_index2, TRAPS);
- // Find a bootsrap specifier in the operands array
- int find_matching_operand(int bootstrap_specifier_index, const constantPoolHandle& search_cp,
+ // Compare a bootstrap specifier data in the operands arrays
+ bool compare_operand_to(int bsms_attribute_index1, const constantPoolHandle& cp2,
+ int bsms_attribute_index2, TRAPS);
+ // Find a bootstrap specifier data in the operands array
+ int find_matching_operand(int bsms_attribute_index, const constantPoolHandle& search_cp,
int operands_cur_len, TRAPS);
// Resize the operands array with delta_len and delta_size
void resize_operands(int delta_len, int delta_size, TRAPS);
@@ -639,26 +644,22 @@
// Shrink the operands array to a smaller array with new_len length
void shrink_operands(int new_len, TRAPS);
- int invoke_dynamic_bootstrap_method_ref_index_at(int which) {
- assert(tag_at(which).is_invoke_dynamic() ||
- tag_at(which).is_dynamic_constant() ||
- tag_at(which).is_dynamic_constant_in_error(), "Corrupted constant pool");
- int op_base = invoke_dynamic_operand_base(which);
+ int bootstrap_method_ref_index_at(int which) {
+ assert(tag_at(which).has_bootstrap(), "Corrupted constant pool");
+ int op_base = bootstrap_operand_base(which);
return operands()->at(op_base + _indy_bsm_offset);
}
- int invoke_dynamic_argument_count_at(int which) {
- assert(tag_at(which).is_invoke_dynamic() ||
- tag_at(which).is_dynamic_constant() ||
- tag_at(which).is_dynamic_constant_in_error(), "Corrupted constant pool");
- int op_base = invoke_dynamic_operand_base(which);
+ int bootstrap_argument_count_at(int which) {
+ assert(tag_at(which).has_bootstrap(), "Corrupted constant pool");
+ int op_base = bootstrap_operand_base(which);
int argc = operands()->at(op_base + _indy_argc_offset);
DEBUG_ONLY(int end_offset = op_base + _indy_argv_offset + argc;
- int next_offset = invoke_dynamic_operand_limit(which));
+ int next_offset = bootstrap_operand_limit(which));
assert(end_offset == next_offset, "matched ending");
return argc;
}
- int invoke_dynamic_argument_index_at(int which, int j) {
- int op_base = invoke_dynamic_operand_base(which);
+ int bootstrap_argument_index_at(int which, int j) {
+ int op_base = bootstrap_operand_base(which);
DEBUG_ONLY(int argc = operands()->at(op_base + _indy_argc_offset));
assert((uint)j < (uint)argc, "oob");
return operands()->at(op_base + _indy_argv_offset + j);
--- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp Wed Feb 13 11:18:14 2019 -0800
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp Wed Feb 13 14:20:40 2019 -0500
@@ -512,11 +512,11 @@
case JVM_CONSTANT_InvokeDynamic:
{
// Index of the bootstrap specifier in the operands array
- int old_bs_i = scratch_cp->invoke_dynamic_bootstrap_specifier_index(scratch_i);
+ int old_bs_i = scratch_cp->bootstrap_methods_attribute_index(scratch_i);
int new_bs_i = find_or_append_operand(scratch_cp, old_bs_i, merge_cp_p,
merge_cp_length_p, THREAD);
// The bootstrap method NameAndType_info index
- int old_ref_i = scratch_cp->invoke_dynamic_name_and_type_ref_index_at(scratch_i);
+ int old_ref_i = scratch_cp->bootstrap_name_and_type_ref_index_at(scratch_i);
int new_ref_i = find_or_append_indirect_entry(scratch_cp, old_ref_i, merge_cp_p,
merge_cp_length_p, THREAD);
if (new_bs_i != old_bs_i) {
--- a/src/hotspot/share/prims/methodComparator.cpp Wed Feb 13 11:18:14 2019 -0800
+++ b/src/hotspot/share/prims/methodComparator.cpp Wed Feb 13 14:20:40 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -123,17 +123,17 @@
int cpi_old = _old_cp->cache()->entry_at(cpci_old)->constant_pool_index();
int cpi_new = _new_cp->cache()->entry_at(cpci_new)->constant_pool_index();
- int bsm_old = _old_cp->invoke_dynamic_bootstrap_method_ref_index_at(cpi_old);
- int bsm_new = _new_cp->invoke_dynamic_bootstrap_method_ref_index_at(cpi_new);
+ int bsm_old = _old_cp->bootstrap_method_ref_index_at(cpi_old);
+ int bsm_new = _new_cp->bootstrap_method_ref_index_at(cpi_new);
if (!pool_constants_same(bsm_old, bsm_new))
return false;
- int cnt_old = _old_cp->invoke_dynamic_argument_count_at(cpi_old);
- int cnt_new = _new_cp->invoke_dynamic_argument_count_at(cpi_new);
+ int cnt_old = _old_cp->bootstrap_argument_count_at(cpi_old);
+ int cnt_new = _new_cp->bootstrap_argument_count_at(cpi_new);
if (cnt_old != cnt_new)
return false;
for (int arg_i = 0; arg_i < cnt_old; arg_i++) {
- int idx_old = _old_cp->invoke_dynamic_argument_index_at(cpi_old, arg_i);
- int idx_new = _new_cp->invoke_dynamic_argument_index_at(cpi_new, arg_i);
+ int idx_old = _old_cp->bootstrap_argument_index_at(cpi_old, arg_i);
+ int idx_new = _new_cp->bootstrap_argument_index_at(cpi_new, arg_i);
if (!pool_constants_same(idx_old, idx_new))
return false;
}
--- a/src/hotspot/share/prims/methodHandles.cpp Wed Feb 13 11:18:14 2019 -0800
+++ b/src/hotspot/share/prims/methodHandles.cpp Wed Feb 13 14:20:40 2019 -0500
@@ -1427,7 +1427,7 @@
if (bss_index_in_pool <= 0 ||
bss_index_in_pool >= caller->constants()->length() ||
index_info->int_at(0)
- != caller->constants()->invoke_dynamic_argument_count_at(bss_index_in_pool)) {
+ != caller->constants()->bootstrap_argument_count_at(bss_index_in_pool)) {
THROW_MSG(vmSymbols::java_lang_InternalError(), "bad index info (1)");
}
objArrayHandle buf(THREAD, (objArrayOop) JNIHandles::resolve(buf_jh));
@@ -1439,7 +1439,7 @@
switch (pseudo_index) {
case -4: // bootstrap method
{
- int bsm_index = caller->constants()->invoke_dynamic_bootstrap_method_ref_index_at(bss_index_in_pool);
+ int bsm_index = caller->constants()->bootstrap_method_ref_index_at(bss_index_in_pool);
pseudo_arg = caller->constants()->resolve_possibly_cached_constant_at(bsm_index, CHECK);
break;
}
@@ -1464,7 +1464,7 @@
}
case -1: // argument count
{
- int argc = caller->constants()->invoke_dynamic_argument_count_at(bss_index_in_pool);
+ int argc = caller->constants()->bootstrap_argument_count_at(bss_index_in_pool);
jvalue argc_value; argc_value.i = (jint)argc;
pseudo_arg = java_lang_boxing_object::create(T_INT, &argc_value, CHECK);
break;
--- a/src/hotspot/share/utilities/constantTag.hpp Wed Feb 13 11:18:14 2019 -0800
+++ b/src/hotspot/share/utilities/constantTag.hpp Wed Feb 13 14:20:40 2019 -0500
@@ -100,6 +100,12 @@
bool is_dynamic_constant() const { return _tag == JVM_CONSTANT_Dynamic; }
bool is_invoke_dynamic() const { return _tag == JVM_CONSTANT_InvokeDynamic; }
+ bool has_bootstrap() const {
+ return (_tag == JVM_CONSTANT_Dynamic ||
+ _tag == JVM_CONSTANT_DynamicInError ||
+ _tag == JVM_CONSTANT_InvokeDynamic);
+ }
+
bool is_loadable_constant() const {
return ((_tag >= JVM_CONSTANT_Integer && _tag <= JVM_CONSTANT_String) ||
is_method_type() || is_method_handle() || is_dynamic_constant() ||
--- a/src/hotspot/share/utilities/exceptions.cpp Wed Feb 13 11:18:14 2019 -0800
+++ b/src/hotspot/share/utilities/exceptions.cpp Wed Feb 13 14:20:40 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -411,7 +411,7 @@
// Pass through an Error, including BootstrapMethodError, any other form
// of linkage error, or say ThreadDeath/OutOfMemoryError
if (TraceMethodHandles) {
- tty->print_cr("[constant/invoke]dynamic passes through an Error for " INTPTR_FORMAT, p2i((void *)exception));
+ tty->print_cr("bootstrap method invocation wraps BSME around " INTPTR_FORMAT, p2i((void *)exception));
exception->print();
}
return;