--- 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