1 /*
2 * Copyright (c) 1997, 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 *
1623 rcx);
1624 __ pop(rcx);
1625 __ pop(rdx);
1626 __ movptr(rax, Address(rcx, Method::method_counters_offset()));
1627 __ testptr(rax, rax);
1628 __ jcc(Assembler::zero, dispatch);
1629 __ bind(has_counters);
1630
1631 if (TieredCompilation) {
1632 Label no_mdo;
1633 int increment = InvocationCounter::count_increment;
1634 int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
1635 if (ProfileInterpreter) {
1636 // Are we profiling?
1637 __ movptr(rbx, Address(rcx, in_bytes(Method::method_data_offset())));
1638 __ testptr(rbx, rbx);
1639 __ jccb(Assembler::zero, no_mdo);
1640 // Increment the MDO backedge counter
1641 const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) +
1642 in_bytes(InvocationCounter::counter_offset()));
1643 __ increment_mask_and_jump(mdo_backedge_counter, increment, mask,
1644 rax, false, Assembler::zero, &backedge_counter_overflow);
1645 __ jmp(dispatch);
1646 }
1647 __ bind(no_mdo);
1648 // Increment backedge counter in MethodCounters*
1649 __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
1650 __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask,
1651 rax, false, Assembler::zero, &backedge_counter_overflow);
1652 } else {
1653 // increment counter
1654 __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
1655 __ movl(rax, Address(rcx, be_offset)); // load backedge counter
1656 __ incrementl(rax, InvocationCounter::count_increment); // increment counter
1657 __ movl(Address(rcx, be_offset), rax); // store counter
1658
1659 __ movl(rax, Address(rcx, inv_offset)); // load invocation counter
1660
1661 __ andl(rax, InvocationCounter::count_mask_value); // and the status bits
1662 __ addl(rax, Address(rcx, be_offset)); // add both counters
1663
1664 if (ProfileInterpreter) {
1665 // Test to see if we should create a method data oop
1666 __ cmp32(rax,
1667 ExternalAddress((address) &InvocationCounter::InterpreterProfileLimit));
1668 __ jcc(Assembler::less, dispatch);
1669
1670 // if no method data exists, go to profile method
1671 __ test_method_data_pointer(rax, profile_method);
|
1 /*
2 * Copyright (c) 1997, 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 *
1623 rcx);
1624 __ pop(rcx);
1625 __ pop(rdx);
1626 __ movptr(rax, Address(rcx, Method::method_counters_offset()));
1627 __ testptr(rax, rax);
1628 __ jcc(Assembler::zero, dispatch);
1629 __ bind(has_counters);
1630
1631 if (TieredCompilation) {
1632 Label no_mdo;
1633 int increment = InvocationCounter::count_increment;
1634 int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
1635 if (ProfileInterpreter) {
1636 // Are we profiling?
1637 __ movptr(rbx, Address(rcx, in_bytes(Method::method_data_offset())));
1638 __ testptr(rbx, rbx);
1639 __ jccb(Assembler::zero, no_mdo);
1640 // Increment the MDO backedge counter
1641 const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) +
1642 in_bytes(InvocationCounter::counter_offset()));
1643 __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, rax, false, Assembler::zero,
1644 UseOnStackReplacement ? &backedge_counter_overflow : NULL);
1645 __ jmp(dispatch);
1646 }
1647 __ bind(no_mdo);
1648 // Increment backedge counter in MethodCounters*
1649 __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
1650 __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask,
1651 rax, false, Assembler::zero,
1652 UseOnStackReplacement ? &backedge_counter_overflow : NULL);
1653 } else {
1654 // increment counter
1655 __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
1656 __ movl(rax, Address(rcx, be_offset)); // load backedge counter
1657 __ incrementl(rax, InvocationCounter::count_increment); // increment counter
1658 __ movl(Address(rcx, be_offset), rax); // store counter
1659
1660 __ movl(rax, Address(rcx, inv_offset)); // load invocation counter
1661
1662 __ andl(rax, InvocationCounter::count_mask_value); // and the status bits
1663 __ addl(rax, Address(rcx, be_offset)); // add both counters
1664
1665 if (ProfileInterpreter) {
1666 // Test to see if we should create a method data oop
1667 __ cmp32(rax,
1668 ExternalAddress((address) &InvocationCounter::InterpreterProfileLimit));
1669 __ jcc(Assembler::less, dispatch);
1670
1671 // if no method data exists, go to profile method
1672 __ test_method_data_pointer(rax, profile_method);
|