hotspot/src/share/vm/interpreter/rewriter.hpp
changeset 13929 8da0dc50a6e4
parent 13728 882756847a04
child 15099 b31d40895bbb
--- a/hotspot/src/share/vm/interpreter/rewriter.hpp	Fri Sep 28 14:36:20 2012 -0700
+++ b/hotspot/src/share/vm/interpreter/rewriter.hpp	Mon Oct 01 14:50:10 2012 -0700
@@ -113,12 +113,19 @@
     return ref_index;
   }
 
-  // add a new entry to the resolved_references map (for invokedynamic only)
-  int add_invokedynamic_resolved_references_entry(int cp_index, int cache_index) {
+  // add a new entries to the resolved_references map (for invokedynamic and invokehandle only)
+  int add_invokedynamic_resolved_references_entries(int cp_index, int cache_index) {
     assert(_resolved_reference_limit >= 0, "must add indy refs after first iteration");
-    int ref_index = _resolved_references_map.append(cp_index);  // many-to-one
-    assert(ref_index >= _resolved_reference_limit, "");
-    _invokedynamic_references_map.at_put_grow(ref_index, cache_index, -1);
+    int ref_index = -1;
+    for (int entry = 0; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) {
+      const int index = _resolved_references_map.append(cp_index);  // many-to-one
+      assert(index >= _resolved_reference_limit, "");
+      if (entry == 0) {
+        ref_index = index;
+      }
+      assert((index - entry) == ref_index, "entries must be consecutive");
+      _invokedynamic_references_map.at_put_grow(index, cache_index, -1);
+    }
     return ref_index;
   }
 
@@ -127,15 +134,6 @@
     return cp_index;
   }
 
-  // invokedynamic support - append the cpCache entry (encoded) in object map.
-  // The resolved_references_map should still be in ascending order
-  // The resolved_references has the invokedynamic call site objects appended after
-  // the objects that are resolved in the constant pool.
-  int add_callsite_entry(int main_cpc_entry) {
-    int ref_index = _resolved_references_map.append(main_cpc_entry);
-    return ref_index;
-  }
-
   // Access the contents of _cp_cache_map to determine CP cache layout.
   int cp_cache_entry_pool_index(int cache_index) {
     int cp_index = _cp_cache_map[cache_index];