1.1 --- a/src/share/vm/runtime/sharedRuntime.cpp Wed Oct 16 10:52:41 2013 +0200 1.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp Tue Nov 05 17:38:04 2013 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -577,7 +577,7 @@ 1.11 assert(caller.is_interpreted_frame(), ""); 1.12 int args_size = ArgumentSizeComputer(sig).size() + 1; 1.13 assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack"); 1.14 - oop result = (oop) *caller.interpreter_frame_tos_at(args_size - 1); 1.15 + oop result = cast_to_oop(*caller.interpreter_frame_tos_at(args_size - 1)); 1.16 assert(Universe::heap()->is_in(result) && result->is_oop(), "receiver must be an oop"); 1.17 return result; 1.18 } 1.19 @@ -1051,7 +1051,8 @@ 1.20 1.21 // Find receiver for non-static call 1.22 if (bc != Bytecodes::_invokestatic && 1.23 - bc != Bytecodes::_invokedynamic) { 1.24 + bc != Bytecodes::_invokedynamic && 1.25 + bc != Bytecodes::_invokehandle) { 1.26 // This register map must be update since we need to find the receiver for 1.27 // compiled frames. The receiver might be in a register. 1.28 RegisterMap reg_map2(thread); 1.29 @@ -1078,7 +1079,7 @@ 1.30 1.31 #ifdef ASSERT 1.32 // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls 1.33 - if (bc != Bytecodes::_invokestatic && bc != Bytecodes::_invokedynamic) { 1.34 + if (bc != Bytecodes::_invokestatic && bc != Bytecodes::_invokedynamic && bc != Bytecodes::_invokehandle) { 1.35 assert(receiver.not_null(), "should have thrown exception"); 1.36 KlassHandle receiver_klass(THREAD, receiver->klass()); 1.37 Klass* rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle)); 1.38 @@ -1240,9 +1241,9 @@ 1.39 #endif 1.40 1.41 if (is_virtual) { 1.42 - assert(receiver.not_null(), "sanity check"); 1.43 + assert(receiver.not_null() || invoke_code == Bytecodes::_invokehandle, "sanity check"); 1.44 bool static_bound = call_info.resolved_method()->can_be_statically_bound(); 1.45 - KlassHandle h_klass(THREAD, receiver->klass()); 1.46 + KlassHandle h_klass(THREAD, invoke_code == Bytecodes::_invokehandle ? NULL : receiver->klass()); 1.47 CompiledIC::compute_monomorphic_entry(callee_method, h_klass, 1.48 is_optimized, static_bound, virtual_call_info, 1.49 CHECK_(methodHandle())); 1.50 @@ -1505,8 +1506,11 @@ 1.51 info, CHECK_(methodHandle())); 1.52 inline_cache->set_to_monomorphic(info); 1.53 } else if (!inline_cache->is_megamorphic() && !inline_cache->is_clean()) { 1.54 - // Change to megamorphic 1.55 - inline_cache->set_to_megamorphic(&call_info, bc, CHECK_(methodHandle())); 1.56 + // Potential change to megamorphic 1.57 + bool successful = inline_cache->set_to_megamorphic(&call_info, bc, CHECK_(methodHandle())); 1.58 + if (!successful) { 1.59 + inline_cache->set_to_clean(); 1.60 + } 1.61 } else { 1.62 // Either clean or megamorphic 1.63 } 1.64 @@ -2936,7 +2940,7 @@ 1.65 ObjectSynchronizer::inflate_helper(kptr2->obj()); 1.66 // Now the displaced header is free to move 1.67 buf[i++] = (intptr_t)lock->displaced_header(); 1.68 - buf[i++] = (intptr_t)kptr2->obj(); 1.69 + buf[i++] = cast_from_oop<intptr_t>(kptr2->obj()); 1.70 } 1.71 } 1.72 assert( i - max_locals == active_monitor_count*2, "found the expected number of monitors" );