< prev index next >

src/hotspot/share/oops/cpCache.cpp

Print this page
rev 52749 : Bootstrap method consolidation
* clean up and simplify JDK support code for BSM invocation
* simplify JVM bootstrap handshake: use BootstrapCallInfo only
* remove unused JVM paths and data fields
* move bootstrap argument processing from MethodHandleNatives to ConstantPool
* remove ConstantGroup; merge argument access into BootstrapCallInfo
* adjust BSM argument access: remove copyArguments, add argumentRef API
* add metadata-free BSM modes, including symbolic arguments from CP

@@ -379,28 +379,27 @@
     return;
   }
 
   const methodHandle adapter = call_info.resolved_method();
   const Handle appendix      = call_info.resolved_appendix();
-  const Handle method_type   = call_info.resolved_method_type();
   const bool has_appendix    = appendix.not_null();
-  const bool has_method_type = method_type.not_null();
+  const bool has_local_sig   = call_info.has_local_signature();
+  assert(has_local_sig, "MHs and indy are always sig-poly");
 
   // Write the flags.
   set_method_flags(as_TosState(adapter->result_type()),
                    ((has_appendix    ? 1 : 0) << has_appendix_shift   ) |
-                   ((has_method_type ? 1 : 0) << has_method_type_shift) |
+                   ((has_local_sig   ? 1 : 0) << has_local_signature_shift ) |
                    (                   1      << is_final_shift       ),
                    adapter->size_of_parameters());
 
   if (TraceInvokeDynamic) {
     ttyLocker ttyl;
-    tty->print_cr("set_method_handle bc=%d appendix=" PTR_FORMAT "%s method_type=" PTR_FORMAT "%s method=" PTR_FORMAT " ",
+    tty->print_cr("set_method_handle bc=%d appendix=" PTR_FORMAT "%s method=" PTR_FORMAT "%s ",
                   invoke_code,
                   p2i(appendix()),    (has_appendix    ? "" : " (unused)"),
-                  p2i(method_type()), (has_method_type ? "" : " (unused)"),
-                  p2i(adapter()));
+                  p2i(adapter()),     (has_local_sig   ? " (local signature)" : ""));
     adapter->print();
     if (has_appendix)  appendix()->print();
   }
 
   // Method handle invokes and invokedynamic sites use both cp cache words.

@@ -422,34 +421,29 @@
   // This allows us to create fewer Methods, while keeping type safety.
   //
 
   // Store appendix, if any.
   if (has_appendix) {
-    const int appendix_index = f2_as_index() + _indy_resolved_references_appendix_offset;
+    const int appendix_index = f2_as_index();
     assert(appendix_index >= 0 && appendix_index < resolved_references->length(), "oob");
     assert(resolved_references->obj_at(appendix_index) == NULL, "init just once");
     resolved_references->obj_at_put(appendix_index, appendix());
   }
 
-  // Store MethodType, if any.
-  if (has_method_type) {
-    const int method_type_index = f2_as_index() + _indy_resolved_references_method_type_offset;
-    assert(method_type_index >= 0 && method_type_index < resolved_references->length(), "oob");
-    assert(resolved_references->obj_at(method_type_index) == NULL, "init just once");
-    resolved_references->obj_at_put(method_type_index, method_type());
-  }
-
   release_set_f1(adapter());  // This must be the last one to set (see NOTE above)!
 
   // The interpreter assembly code does not check byte_2,
   // but it is used by is_resolved, method_if_resolved, etc.
   set_bytecode_1(invoke_code);
   NOT_PRODUCT(verify(tty));
   if (TraceInvokeDynamic) {
     ttyLocker ttyl;
     this->print(tty, 0);
   }
+
+  assert(has_appendix == this->has_appendix(), "proper storage of appendix flag");
+  assert(has_local_sig == this->has_local_signature(), "proper storage of signature flag");
 }
 
 bool ConstantPoolCacheEntry::save_and_throw_indy_exc(
   const constantPoolHandle& cpool, int cpool_index, int index, constantTag tag, TRAPS) {
 

@@ -531,20 +525,11 @@
 
 
 oop ConstantPoolCacheEntry::appendix_if_resolved(const constantPoolHandle& cpool) {
   if (!has_appendix())
     return NULL;
-  const int ref_index = f2_as_index() + _indy_resolved_references_appendix_offset;
-  objArrayOop resolved_references = cpool->resolved_references();
-  return resolved_references->obj_at(ref_index);
-}
-
-
-oop ConstantPoolCacheEntry::method_type_if_resolved(const constantPoolHandle& cpool) {
-  if (!has_method_type())
-    return NULL;
-  const int ref_index = f2_as_index() + _indy_resolved_references_method_type_offset;
+  const int ref_index = f2_as_index();
   objArrayOop resolved_references = cpool->resolved_references();
   return resolved_references->obj_at(ref_index);
 }
 
 

@@ -667,11 +652,11 @@
     ConstantPoolCache(length, index_map, invokedynamic_index_map, invokedynamic_map);
 }
 
 void ConstantPoolCache::initialize(const intArray& inverse_index_map,
                                    const intArray& invokedynamic_inverse_index_map,
-                                   const intArray& invokedynamic_references_map) {
+                                   const intArray& appendix_references_map) {
   for (int i = 0; i < inverse_index_map.length(); i++) {
     ConstantPoolCacheEntry* e = entry_at(i);
     int original_index = inverse_index_map.at(i);
     e->initialize_entry(original_index);
     assert(entry_at(i) == e, "sanity");

@@ -685,23 +670,14 @@
     int original_index = invokedynamic_inverse_index_map.at(i);
     e->initialize_entry(original_index);
     assert(entry_at(offset) == e, "sanity");
   }
 
-  for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) {
-    const int cpci = invokedynamic_references_map.at(ref);
+  for (int ref = 0; ref < appendix_references_map.length(); ref++) {
+    const int cpci = appendix_references_map.at(ref);
     if (cpci >= 0) {
-#ifdef ASSERT
-      // invokedynamic and invokehandle have more entries; check if they
-      // all point to the same constant pool cache entry.
-      for (int entry = 1; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) {
-        const int cpci_next = invokedynamic_references_map.at(ref + entry);
-        assert(cpci == cpci_next, "%d == %d", cpci, cpci_next);
-      }
-#endif
       entry_at(cpci)->initialize_resolved_reference_index(ref);
-      ref += ConstantPoolCacheEntry::_indy_resolved_references_entries - 1;  // skip extra entries
     }
   }
 }
 
 void ConstantPoolCache::verify_just_initialized() {
< prev index next >