Mercurial > hg > truffle
comparison src/share/vm/runtime/sharedRuntime.cpp @ 14422:2b8e28fdf503
Merge
author | kvn |
---|---|
date | Tue, 05 Nov 2013 17:38:04 -0800 |
parents | cfd05ec74089 a5ac0873476c |
children | 1174c8abbdb6 |
comparison
equal
deleted
inserted
replaced
14421:3068270ba476 | 14422:2b8e28fdf503 |
---|---|
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. |
575 | 575 |
576 oop SharedRuntime::retrieve_receiver( Symbol* sig, frame caller ) { | 576 oop SharedRuntime::retrieve_receiver( Symbol* sig, frame caller ) { |
577 assert(caller.is_interpreted_frame(), ""); | 577 assert(caller.is_interpreted_frame(), ""); |
578 int args_size = ArgumentSizeComputer(sig).size() + 1; | 578 int args_size = ArgumentSizeComputer(sig).size() + 1; |
579 assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack"); | 579 assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack"); |
580 oop result = (oop) *caller.interpreter_frame_tos_at(args_size - 1); | 580 oop result = cast_to_oop(*caller.interpreter_frame_tos_at(args_size - 1)); |
581 assert(Universe::heap()->is_in(result) && result->is_oop(), "receiver must be an oop"); | 581 assert(Universe::heap()->is_in(result) && result->is_oop(), "receiver must be an oop"); |
582 return result; | 582 return result; |
583 } | 583 } |
584 | 584 |
585 | 585 |
1049 bc = bytecode.invoke_code(); | 1049 bc = bytecode.invoke_code(); |
1050 int bytecode_index = bytecode.index(); | 1050 int bytecode_index = bytecode.index(); |
1051 | 1051 |
1052 // Find receiver for non-static call | 1052 // Find receiver for non-static call |
1053 if (bc != Bytecodes::_invokestatic && | 1053 if (bc != Bytecodes::_invokestatic && |
1054 bc != Bytecodes::_invokedynamic) { | 1054 bc != Bytecodes::_invokedynamic && |
1055 bc != Bytecodes::_invokehandle) { | |
1055 // This register map must be update since we need to find the receiver for | 1056 // This register map must be update since we need to find the receiver for |
1056 // compiled frames. The receiver might be in a register. | 1057 // compiled frames. The receiver might be in a register. |
1057 RegisterMap reg_map2(thread); | 1058 RegisterMap reg_map2(thread); |
1058 frame stubFrame = thread->last_frame(); | 1059 frame stubFrame = thread->last_frame(); |
1059 // Caller-frame is a compiled frame | 1060 // Caller-frame is a compiled frame |
1076 assert(receiver.is_null() || receiver->is_oop(), "wrong receiver"); | 1077 assert(receiver.is_null() || receiver->is_oop(), "wrong receiver"); |
1077 LinkResolver::resolve_invoke(callinfo, receiver, constants, bytecode_index, bc, CHECK_(nullHandle)); | 1078 LinkResolver::resolve_invoke(callinfo, receiver, constants, bytecode_index, bc, CHECK_(nullHandle)); |
1078 | 1079 |
1079 #ifdef ASSERT | 1080 #ifdef ASSERT |
1080 // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls | 1081 // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls |
1081 if (bc != Bytecodes::_invokestatic && bc != Bytecodes::_invokedynamic) { | 1082 if (bc != Bytecodes::_invokestatic && bc != Bytecodes::_invokedynamic && bc != Bytecodes::_invokehandle) { |
1082 assert(receiver.not_null(), "should have thrown exception"); | 1083 assert(receiver.not_null(), "should have thrown exception"); |
1083 KlassHandle receiver_klass(THREAD, receiver->klass()); | 1084 KlassHandle receiver_klass(THREAD, receiver->klass()); |
1084 Klass* rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle)); | 1085 Klass* rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle)); |
1085 // klass is already loaded | 1086 // klass is already loaded |
1086 KlassHandle static_receiver_klass(THREAD, rk); | 1087 KlassHandle static_receiver_klass(THREAD, rk); |
1238 #ifdef ASSERT | 1239 #ifdef ASSERT |
1239 address dest_entry_point = callee_nm == NULL ? 0 : callee_nm->entry_point(); // used below | 1240 address dest_entry_point = callee_nm == NULL ? 0 : callee_nm->entry_point(); // used below |
1240 #endif | 1241 #endif |
1241 | 1242 |
1242 if (is_virtual) { | 1243 if (is_virtual) { |
1243 assert(receiver.not_null(), "sanity check"); | 1244 assert(receiver.not_null() || invoke_code == Bytecodes::_invokehandle, "sanity check"); |
1244 bool static_bound = call_info.resolved_method()->can_be_statically_bound(); | 1245 bool static_bound = call_info.resolved_method()->can_be_statically_bound(); |
1245 KlassHandle h_klass(THREAD, receiver->klass()); | 1246 KlassHandle h_klass(THREAD, invoke_code == Bytecodes::_invokehandle ? NULL : receiver->klass()); |
1246 CompiledIC::compute_monomorphic_entry(callee_method, h_klass, | 1247 CompiledIC::compute_monomorphic_entry(callee_method, h_klass, |
1247 is_optimized, static_bound, virtual_call_info, | 1248 is_optimized, static_bound, virtual_call_info, |
1248 CHECK_(methodHandle())); | 1249 CHECK_(methodHandle())); |
1249 } else { | 1250 } else { |
1250 // static call | 1251 // static call |
1503 inline_cache->is_optimized(), | 1504 inline_cache->is_optimized(), |
1504 false, | 1505 false, |
1505 info, CHECK_(methodHandle())); | 1506 info, CHECK_(methodHandle())); |
1506 inline_cache->set_to_monomorphic(info); | 1507 inline_cache->set_to_monomorphic(info); |
1507 } else if (!inline_cache->is_megamorphic() && !inline_cache->is_clean()) { | 1508 } else if (!inline_cache->is_megamorphic() && !inline_cache->is_clean()) { |
1508 // Change to megamorphic | 1509 // Potential change to megamorphic |
1509 inline_cache->set_to_megamorphic(&call_info, bc, CHECK_(methodHandle())); | 1510 bool successful = inline_cache->set_to_megamorphic(&call_info, bc, CHECK_(methodHandle())); |
1511 if (!successful) { | |
1512 inline_cache->set_to_clean(); | |
1513 } | |
1510 } else { | 1514 } else { |
1511 // Either clean or megamorphic | 1515 // Either clean or megamorphic |
1512 } | 1516 } |
1513 } | 1517 } |
1514 } // Release CompiledIC_lock | 1518 } // Release CompiledIC_lock |
2934 // Inflate so the displaced header becomes position-independent | 2938 // Inflate so the displaced header becomes position-independent |
2935 if (lock->displaced_header()->is_unlocked()) | 2939 if (lock->displaced_header()->is_unlocked()) |
2936 ObjectSynchronizer::inflate_helper(kptr2->obj()); | 2940 ObjectSynchronizer::inflate_helper(kptr2->obj()); |
2937 // Now the displaced header is free to move | 2941 // Now the displaced header is free to move |
2938 buf[i++] = (intptr_t)lock->displaced_header(); | 2942 buf[i++] = (intptr_t)lock->displaced_header(); |
2939 buf[i++] = (intptr_t)kptr2->obj(); | 2943 buf[i++] = cast_from_oop<intptr_t>(kptr2->obj()); |
2940 } | 2944 } |
2941 } | 2945 } |
2942 assert( i - max_locals == active_monitor_count*2, "found the expected number of monitors" ); | 2946 assert( i - max_locals == active_monitor_count*2, "found the expected number of monitors" ); |
2943 | 2947 |
2944 return buf; | 2948 return buf; |