hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
changeset 25494 c18718ecf276
parent 24933 c16c7a4ac386
child 25716 fc9bd7814b10
child 25641 d99065e4572b
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Tue Jul 01 13:09:40 2014 +0400
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Wed Jul 02 22:54:18 2014 +0200
@@ -1997,7 +1997,13 @@
   if (!UseInlineCaches && is_loaded && code == Bytecodes::_invokevirtual
       && !target->can_be_statically_bound()) {
     // Find a vtable index if one is available
-    vtable_index = target->resolve_vtable_index(calling_klass, callee_holder);
+    // For arrays, callee_holder is Object. Resolving the call with
+    // Object would allow an illegal call to finalize() on an
+    // array. We use holder instead: illegal calls to finalize() won't
+    // be compiled as vtable calls (IC call resolution will catch the
+    // illegal call) and the few legal calls on array types won't be
+    // either.
+    vtable_index = target->resolve_vtable_index(calling_klass, holder);
   }
 #endif