< prev index next >

src/cpu/x86/vm/templateTable_x86_64.cpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 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  *


1648     __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::build_method_counters),
1649                rcx);
1650     __ pop(rcx);
1651     __ pop(rdx);
1652     __ movptr(rax, Address(rcx, Method::method_counters_offset()));
1653     __ jcc(Assembler::zero, dispatch);
1654     __ bind(has_counters);
1655 
1656     if (TieredCompilation) {
1657       Label no_mdo;
1658       int increment = InvocationCounter::count_increment;
1659       int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
1660       if (ProfileInterpreter) {
1661         // Are we profiling?
1662         __ movptr(rbx, Address(rcx, in_bytes(Method::method_data_offset())));
1663         __ testptr(rbx, rbx);
1664         __ jccb(Assembler::zero, no_mdo);
1665         // Increment the MDO backedge counter
1666         const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) +
1667                                            in_bytes(InvocationCounter::counter_offset()));
1668         __ increment_mask_and_jump(mdo_backedge_counter, increment, mask,
1669                                    rax, false, Assembler::zero, &backedge_counter_overflow);
1670         __ jmp(dispatch);
1671       }
1672       __ bind(no_mdo);
1673       // Increment backedge counter in MethodCounters*
1674       __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
1675       __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask,
1676                                  rax, false, Assembler::zero, &backedge_counter_overflow);

1677     } else {
1678       // increment counter
1679       __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
1680       __ movl(rax, Address(rcx, be_offset));        // load backedge counter
1681       __ incrementl(rax, InvocationCounter::count_increment); // increment counter
1682       __ movl(Address(rcx, be_offset), rax);        // store counter
1683 
1684       __ movl(rax, Address(rcx, inv_offset));    // load invocation counter
1685 
1686       __ andl(rax, InvocationCounter::count_mask_value); // and the status bits
1687       __ addl(rax, Address(rcx, be_offset));        // add both counters
1688 
1689       if (ProfileInterpreter) {
1690         // Test to see if we should create a method data oop
1691         __ cmp32(rax,
1692                  ExternalAddress((address) &InvocationCounter::InterpreterProfileLimit));
1693         __ jcc(Assembler::less, dispatch);
1694 
1695         // if no method data exists, go to profile method
1696         __ test_method_data_pointer(rax, profile_method);


   1 /*
   2  * Copyright (c) 2003, 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  *


1648     __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::build_method_counters),
1649                rcx);
1650     __ pop(rcx);
1651     __ pop(rdx);
1652     __ movptr(rax, Address(rcx, Method::method_counters_offset()));
1653     __ jcc(Assembler::zero, dispatch);
1654     __ bind(has_counters);
1655 
1656     if (TieredCompilation) {
1657       Label no_mdo;
1658       int increment = InvocationCounter::count_increment;
1659       int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
1660       if (ProfileInterpreter) {
1661         // Are we profiling?
1662         __ movptr(rbx, Address(rcx, in_bytes(Method::method_data_offset())));
1663         __ testptr(rbx, rbx);
1664         __ jccb(Assembler::zero, no_mdo);
1665         // Increment the MDO backedge counter
1666         const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) +
1667                                            in_bytes(InvocationCounter::counter_offset()));
1668         __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, rax, false, Assembler::zero,
1669                                    UseOnStackReplacement ? &backedge_counter_overflow : NULL);
1670         __ jmp(dispatch);
1671       }
1672       __ bind(no_mdo);
1673       // Increment backedge counter in MethodCounters*
1674       __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
1675       __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask,
1676                                  rax, false, Assembler::zero,
1677                                  UseOnStackReplacement ? &backedge_counter_overflow : NULL);
1678     } else {
1679       // increment counter
1680       __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
1681       __ movl(rax, Address(rcx, be_offset));        // load backedge counter
1682       __ incrementl(rax, InvocationCounter::count_increment); // increment counter
1683       __ movl(Address(rcx, be_offset), rax);        // store counter
1684 
1685       __ movl(rax, Address(rcx, inv_offset));    // load invocation counter
1686 
1687       __ andl(rax, InvocationCounter::count_mask_value); // and the status bits
1688       __ addl(rax, Address(rcx, be_offset));        // add both counters
1689 
1690       if (ProfileInterpreter) {
1691         // Test to see if we should create a method data oop
1692         __ cmp32(rax,
1693                  ExternalAddress((address) &InvocationCounter::InterpreterProfileLimit));
1694         __ jcc(Assembler::less, dispatch);
1695 
1696         // if no method data exists, go to profile method
1697         __ test_method_data_pointer(rax, profile_method);


< prev index next >