1 /*
2 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2016, 2017, SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
2698 __ lock_object(hdr, obj, lock, *op->stub()->entry());
2699 // done
2700 } else if (op->code() == lir_unlock) {
2701 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
2702 __ unlock_object(hdr, obj, lock, *op->stub()->entry());
2703 } else {
2704 ShouldNotReachHere();
2705 }
2706 __ bind(*op->stub()->continuation());
2707 }
2708
2709 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
2710 ciMethod* method = op->profiled_method();
2711 int bci = op->profiled_bci();
2712 ciMethod* callee = op->profiled_callee();
2713
2714 // Update counter for all call types.
2715 ciMethodData* md = method->method_data_or_null();
2716 assert(md != NULL, "Sanity");
2717 ciProfileData* data = md->bci_to_data(bci);
2718 assert(data->is_CounterData(), "need CounterData for calls");
2719 assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
2720 Register mdo = op->mdo()->as_register();
2721 assert(op->tmp1()->is_double_cpu(), "tmp1 must be allocated");
2722 Register tmp1 = op->tmp1()->as_register_lo();
2723 metadata2reg(md->constant_encoding(), mdo);
2724
2725 Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()));
2726 // Perform additional virtual call profiling for invokevirtual and
2727 // invokeinterface bytecodes
2728 if (op->should_profile_receiver_type()) {
2729 assert(op->recv()->is_single_cpu(), "recv must be allocated");
2730 Register recv = op->recv()->as_register();
2731 assert_different_registers(mdo, tmp1, recv);
2732 assert(data->is_VirtualCallData(), "need VirtualCallData for virtual calls");
2733 ciKlass* known_klass = op->known_holder();
2734 if (C1OptimizeVirtualCallProfiling && known_klass != NULL) {
2735 // We know the type that will be seen at this call site; we can
2736 // statically update the MethodData* rather than needing to do
2737 // dynamic tests on the receiver type.
2738
|
1 /*
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2016, 2017, SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
2698 __ lock_object(hdr, obj, lock, *op->stub()->entry());
2699 // done
2700 } else if (op->code() == lir_unlock) {
2701 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
2702 __ unlock_object(hdr, obj, lock, *op->stub()->entry());
2703 } else {
2704 ShouldNotReachHere();
2705 }
2706 __ bind(*op->stub()->continuation());
2707 }
2708
2709 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
2710 ciMethod* method = op->profiled_method();
2711 int bci = op->profiled_bci();
2712 ciMethod* callee = op->profiled_callee();
2713
2714 // Update counter for all call types.
2715 ciMethodData* md = method->method_data_or_null();
2716 assert(md != NULL, "Sanity");
2717 ciProfileData* data = md->bci_to_data(bci);
2718 assert(data != NULL && data->is_CounterData(), "need CounterData for calls");
2719 assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
2720 Register mdo = op->mdo()->as_register();
2721 assert(op->tmp1()->is_double_cpu(), "tmp1 must be allocated");
2722 Register tmp1 = op->tmp1()->as_register_lo();
2723 metadata2reg(md->constant_encoding(), mdo);
2724
2725 Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()));
2726 // Perform additional virtual call profiling for invokevirtual and
2727 // invokeinterface bytecodes
2728 if (op->should_profile_receiver_type()) {
2729 assert(op->recv()->is_single_cpu(), "recv must be allocated");
2730 Register recv = op->recv()->as_register();
2731 assert_different_registers(mdo, tmp1, recv);
2732 assert(data->is_VirtualCallData(), "need VirtualCallData for virtual calls");
2733 ciKlass* known_klass = op->known_holder();
2734 if (C1OptimizeVirtualCallProfiling && known_klass != NULL) {
2735 // We know the type that will be seen at this call site; we can
2736 // statically update the MethodData* rather than needing to do
2737 // dynamic tests on the receiver type.
2738
|