1 /*
2 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
3485 // done
3486 } else if (op->code() == lir_unlock) {
3487 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
3488 __ unlock_object(hdr, obj, lock, *op->stub()->entry());
3489 } else {
3490 Unimplemented();
3491 }
3492 __ bind(*op->stub()->continuation());
3493 }
3494
3495
3496 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
3497 ciMethod* method = op->profiled_method();
3498 int bci = op->profiled_bci();
3499 ciMethod* callee = op->profiled_callee();
3500
3501 // Update counter for all call types
3502 ciMethodData* md = method->method_data_or_null();
3503 assert(md != NULL, "Sanity");
3504 ciProfileData* data = md->bci_to_data(bci);
3505 assert(data->is_CounterData(), "need CounterData for calls");
3506 assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
3507 Register mdo = op->mdo()->as_register();
3508 __ mov_metadata(mdo, md->constant_encoding());
3509 Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()));
3510 // Perform additional virtual call profiling for invokevirtual and
3511 // invokeinterface bytecodes
3512 if (op->should_profile_receiver_type()) {
3513 assert(op->recv()->is_single_cpu(), "recv must be allocated");
3514 Register recv = op->recv()->as_register();
3515 assert_different_registers(mdo, recv);
3516 assert(data->is_VirtualCallData(), "need VirtualCallData for virtual calls");
3517 ciKlass* known_klass = op->known_holder();
3518 if (C1OptimizeVirtualCallProfiling && known_klass != NULL) {
3519 // We know the type that will be seen at this call site; we can
3520 // statically update the MethodData* rather than needing to do
3521 // dynamic tests on the receiver type
3522
3523 // NOTE: we should probably put a lock around this search to
3524 // avoid collisions by concurrent compilations
3525 ciVirtualCallData* vc_data = (ciVirtualCallData*) data;
|
1 /*
2 * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
3485 // done
3486 } else if (op->code() == lir_unlock) {
3487 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
3488 __ unlock_object(hdr, obj, lock, *op->stub()->entry());
3489 } else {
3490 Unimplemented();
3491 }
3492 __ bind(*op->stub()->continuation());
3493 }
3494
3495
3496 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
3497 ciMethod* method = op->profiled_method();
3498 int bci = op->profiled_bci();
3499 ciMethod* callee = op->profiled_callee();
3500
3501 // Update counter for all call types
3502 ciMethodData* md = method->method_data_or_null();
3503 assert(md != NULL, "Sanity");
3504 ciProfileData* data = md->bci_to_data(bci);
3505 assert(data != NULL && data->is_CounterData(), "need CounterData for calls");
3506 assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
3507 Register mdo = op->mdo()->as_register();
3508 __ mov_metadata(mdo, md->constant_encoding());
3509 Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()));
3510 // Perform additional virtual call profiling for invokevirtual and
3511 // invokeinterface bytecodes
3512 if (op->should_profile_receiver_type()) {
3513 assert(op->recv()->is_single_cpu(), "recv must be allocated");
3514 Register recv = op->recv()->as_register();
3515 assert_different_registers(mdo, recv);
3516 assert(data->is_VirtualCallData(), "need VirtualCallData for virtual calls");
3517 ciKlass* known_klass = op->known_holder();
3518 if (C1OptimizeVirtualCallProfiling && known_klass != NULL) {
3519 // We know the type that will be seen at this call site; we can
3520 // statically update the MethodData* rather than needing to do
3521 // dynamic tests on the receiver type
3522
3523 // NOTE: we should probably put a lock around this search to
3524 // avoid collisions by concurrent compilations
3525 ciVirtualCallData* vc_data = (ciVirtualCallData*) data;
|