src/hotspot/share/oops/constantPool.cpp
changeset 53745 a535ba736cab
parent 53590 ce36f8180d03
child 53746 bdccafc038a2
--- 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("}");