diff src/share/vm/interpreter/bytecode.cpp @ 726:be93aad57795

6655646: dynamic languages need dynamically linked call sites Summary: invokedynamic instruction (JSR 292 RI) Reviewed-by: twisti, never
author jrose
date Tue, 21 Apr 2009 23:21:04 -0700
parents a61af66fc99e
children bd02caa94611
line wrap: on
line diff
--- a/src/share/vm/interpreter/bytecode.cpp	Mon Apr 20 14:48:03 2009 -0700
+++ b/src/share/vm/interpreter/bytecode.cpp	Tue Apr 21 23:21:04 2009 -0700
@@ -34,12 +34,6 @@
 }
 
 
-void Bytecode::set_fast_index(int i) {
-  assert(0 <= i && i < 0x10000, "illegal index value");
-  Bytes::put_native_u2(addr_at(1), (jushort)i);
-}
-
-
 bool Bytecode::check_must_rewrite() const {
   assert(Bytecodes::can_rewrite(code()), "post-check only");
 
@@ -118,7 +112,12 @@
 
 
 int Bytecode_invoke::index() const {
-  return Bytes::get_Java_u2(bcp() + 1);
+  // Note:  Rewriter::rewrite changes the Java_u2 of an invokedynamic to a native_u4,
+  // at the same time it allocates per-call-site CP cache entries.
+  if (has_giant_index())
+    return Bytes::get_native_u4(bcp() + 1);
+  else
+    return Bytes::get_Java_u2(bcp() + 1);
 }