Mercurial > hg > truffle
comparison src/share/vm/runtime/sharedRuntime.cpp @ 12355:cefad50507d8
Merge with hs25-b53
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 11 Oct 2013 10:38:03 +0200 |
parents | 6b0fd0964b87 a5ac0873476c |
children | 02f27ecb4f3a |
comparison
equal
deleted
inserted
replaced
12058:ccb4f2af2319 | 12355:cefad50507d8 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
581 | 581 |
582 oop SharedRuntime::retrieve_receiver( Symbol* sig, frame caller ) { | 582 oop SharedRuntime::retrieve_receiver( Symbol* sig, frame caller ) { |
583 assert(caller.is_interpreted_frame(), ""); | 583 assert(caller.is_interpreted_frame(), ""); |
584 int args_size = ArgumentSizeComputer(sig).size() + 1; | 584 int args_size = ArgumentSizeComputer(sig).size() + 1; |
585 assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack"); | 585 assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack"); |
586 oop result = (oop) *caller.interpreter_frame_tos_at(args_size - 1); | 586 oop result = cast_to_oop(*caller.interpreter_frame_tos_at(args_size - 1)); |
587 assert(Universe::heap()->is_in(result) && result->is_oop(), "receiver must be an oop"); | 587 assert(Universe::heap()->is_in(result) && result->is_oop(), "receiver must be an oop"); |
588 return result; | 588 return result; |
589 } | 589 } |
590 | 590 |
591 | 591 |
1111 bc = bytecode.invoke_code(); | 1111 bc = bytecode.invoke_code(); |
1112 int bytecode_index = bytecode.index(); | 1112 int bytecode_index = bytecode.index(); |
1113 | 1113 |
1114 // Find receiver for non-static call | 1114 // Find receiver for non-static call |
1115 if (bc != Bytecodes::_invokestatic && | 1115 if (bc != Bytecodes::_invokestatic && |
1116 bc != Bytecodes::_invokedynamic) { | 1116 bc != Bytecodes::_invokedynamic && |
1117 bc != Bytecodes::_invokehandle) { | |
1117 // This register map must be update since we need to find the receiver for | 1118 // This register map must be update since we need to find the receiver for |
1118 // compiled frames. The receiver might be in a register. | 1119 // compiled frames. The receiver might be in a register. |
1119 RegisterMap reg_map2(thread); | 1120 RegisterMap reg_map2(thread); |
1120 frame stubFrame = thread->last_frame(); | 1121 frame stubFrame = thread->last_frame(); |
1121 // Caller-frame is a compiled frame | 1122 // Caller-frame is a compiled frame |
1138 assert(receiver.is_null() || receiver->is_oop(), "wrong receiver"); | 1139 assert(receiver.is_null() || receiver->is_oop(), "wrong receiver"); |
1139 LinkResolver::resolve_invoke(callinfo, receiver, constants, bytecode_index, bc, CHECK_(nullHandle)); | 1140 LinkResolver::resolve_invoke(callinfo, receiver, constants, bytecode_index, bc, CHECK_(nullHandle)); |
1140 | 1141 |
1141 #ifdef ASSERT | 1142 #ifdef ASSERT |
1142 // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls | 1143 // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls |
1143 if (bc != Bytecodes::_invokestatic && bc != Bytecodes::_invokedynamic) { | 1144 if (bc != Bytecodes::_invokestatic && bc != Bytecodes::_invokedynamic && bc != Bytecodes::_invokehandle) { |
1144 assert(receiver.not_null(), "should have thrown exception"); | 1145 assert(receiver.not_null(), "should have thrown exception"); |
1145 KlassHandle receiver_klass(THREAD, receiver->klass()); | 1146 KlassHandle receiver_klass(THREAD, receiver->klass()); |
1146 Klass* rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle)); | 1147 Klass* rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle)); |
1147 // klass is already loaded | 1148 // klass is already loaded |
1148 KlassHandle static_receiver_klass(THREAD, rk); | 1149 KlassHandle static_receiver_klass(THREAD, rk); |
1300 #ifdef ASSERT | 1301 #ifdef ASSERT |
1301 address dest_entry_point = callee_nm == NULL ? 0 : callee_nm->entry_point(); // used below | 1302 address dest_entry_point = callee_nm == NULL ? 0 : callee_nm->entry_point(); // used below |
1302 #endif | 1303 #endif |
1303 | 1304 |
1304 if (is_virtual) { | 1305 if (is_virtual) { |
1305 assert(receiver.not_null(), "sanity check"); | 1306 assert(receiver.not_null() || invoke_code == Bytecodes::_invokehandle, "sanity check"); |
1306 bool static_bound = call_info.resolved_method()->can_be_statically_bound(); | 1307 bool static_bound = call_info.resolved_method()->can_be_statically_bound(); |
1307 KlassHandle h_klass(THREAD, receiver->klass()); | 1308 KlassHandle h_klass(THREAD, invoke_code == Bytecodes::_invokehandle ? NULL : receiver->klass()); |
1308 CompiledIC::compute_monomorphic_entry(callee_method, h_klass, | 1309 CompiledIC::compute_monomorphic_entry(callee_method, h_klass, |
1309 is_optimized, static_bound, virtual_call_info, | 1310 is_optimized, static_bound, virtual_call_info, |
1310 CHECK_(methodHandle())); | 1311 CHECK_(methodHandle())); |
1311 } else { | 1312 } else { |
1312 // static call | 1313 // static call |
1565 inline_cache->is_optimized(), | 1566 inline_cache->is_optimized(), |
1566 false, | 1567 false, |
1567 info, CHECK_(methodHandle())); | 1568 info, CHECK_(methodHandle())); |
1568 inline_cache->set_to_monomorphic(info); | 1569 inline_cache->set_to_monomorphic(info); |
1569 } else if (!inline_cache->is_megamorphic() && !inline_cache->is_clean()) { | 1570 } else if (!inline_cache->is_megamorphic() && !inline_cache->is_clean()) { |
1570 // Change to megamorphic | 1571 // Potential change to megamorphic |
1571 inline_cache->set_to_megamorphic(&call_info, bc, CHECK_(methodHandle())); | 1572 bool successful = inline_cache->set_to_megamorphic(&call_info, bc, CHECK_(methodHandle())); |
1573 if (!successful) { | |
1574 inline_cache->set_to_clean(); | |
1575 } | |
1572 } else { | 1576 } else { |
1573 // Either clean or megamorphic | 1577 // Either clean or megamorphic |
1574 } | 1578 } |
1575 } | 1579 } |
1576 } // Release CompiledIC_lock | 1580 } // Release CompiledIC_lock |
2931 // Inflate so the displaced header becomes position-independent | 2935 // Inflate so the displaced header becomes position-independent |
2932 if (lock->displaced_header()->is_unlocked()) | 2936 if (lock->displaced_header()->is_unlocked()) |
2933 ObjectSynchronizer::inflate_helper(kptr2->obj()); | 2937 ObjectSynchronizer::inflate_helper(kptr2->obj()); |
2934 // Now the displaced header is free to move | 2938 // Now the displaced header is free to move |
2935 buf[i++] = (intptr_t)lock->displaced_header(); | 2939 buf[i++] = (intptr_t)lock->displaced_header(); |
2936 buf[i++] = (intptr_t)kptr2->obj(); | 2940 buf[i++] = cast_from_oop<intptr_t>(kptr2->obj()); |
2937 } | 2941 } |
2938 } | 2942 } |
2939 assert( i - max_locals == active_monitor_count*2, "found the expected number of monitors" ); | 2943 assert( i - max_locals == active_monitor_count*2, "found the expected number of monitors" ); |
2940 | 2944 |
2941 return buf; | 2945 return buf; |