1.1 --- a/src/share/vm/c1/c1_GraphBuilder.cpp Thu Jul 03 12:59:11 2014 -0700 1.2 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp Wed Jul 02 22:54:18 2014 +0200 1.3 @@ -1993,7 +1993,13 @@ 1.4 if (!UseInlineCaches && is_loaded && code == Bytecodes::_invokevirtual 1.5 && !target->can_be_statically_bound()) { 1.6 // Find a vtable index if one is available 1.7 - vtable_index = target->resolve_vtable_index(calling_klass, callee_holder); 1.8 + // For arrays, callee_holder is Object. Resolving the call with 1.9 + // Object would allow an illegal call to finalize() on an 1.10 + // array. We use holder instead: illegal calls to finalize() won't 1.11 + // be compiled as vtable calls (IC call resolution will catch the 1.12 + // illegal call) and the few legal calls on array types won't be 1.13 + // either. 1.14 + vtable_index = target->resolve_vtable_index(calling_klass, holder); 1.15 } 1.16 #endif 1.17