1 /*
2 * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2016, 2024 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.
1667 // Pop the native method's interpreter frame.
1668 __ pop_interpreter_frame(Z_R14 /*return_pc*/, Z_ARG2/*tmp1*/, Z_ARG3/*tmp2*/);
1669
1670 // Return to caller.
1671 __ z_br(Z_R14);
1672
1673 if (inc_counter) {
1674 // Handle overflow of counter and compile method.
1675 __ bind(invocation_counter_overflow);
1676 generate_counter_overflow(continue_after_compile);
1677 }
1678
1679 BLOCK_COMMENT("} native_entry");
1680
1681 return entry_point;
1682 }
1683
1684 //
1685 // Generic interpreted method entry to template interpreter.
1686 //
1687 address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
1688 address entry_point = __ pc();
1689
1690 bool inc_counter = UseCompiler || CountCompiledCalls;
1691
1692 // Interpreter entry for ordinary Java methods.
1693 //
1694 // Registers alive
1695 // Z_SP - stack pointer
1696 // Z_thread - JavaThread*
1697 // Z_method - callee's method (method to be invoked)
1698 // Z_esp - operand (or expression) stack pointer of caller. one slot above last arg.
1699 // Z_R10 - sender sp (before modifications, e.g. by c2i adapter
1700 // and as well by generate_fixed_frame below)
1701 // Z_R14 - return address to caller (call_stub or c2i_adapter)
1702 //
1703 // Registers updated
1704 // Z_SP - stack pointer
1705 // Z_fp - callee's framepointer
1706 // Z_esp - callee's operand stack pointer
1707 // points to the slot above the value on top
1788 __ z_mvi(do_not_unlock_if_synchronized, false);
1789
1790 // Check for synchronized methods.
1791 // Must happen AFTER invocation_counter check and stack overflow check,
1792 // so method is not locked if overflows.
1793 if (synchronized) {
1794 // Allocate monitor and lock method.
1795 lock_method();
1796 } else {
1797 #ifdef ASSERT
1798 { Label L;
1799 __ get_method(Z_R1_scratch);
1800 __ testbit_ushort(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
1801 __ z_bfalse(L);
1802 reentry = __ stop_chain_static(reentry, "method needs synchronization");
1803 __ bind(L);
1804 }
1805 #endif // ASSERT
1806 }
1807
1808 // start execution
1809
1810 #ifdef ASSERT
1811 __ verify_esp(Z_esp, Z_R1_scratch);
1812 #endif
1813
1814 // jvmti support
1815 __ notify_method_entry();
1816
1817 // Start executing instructions.
1818 __ dispatch_next(vtos);
1819 // Dispatch_next does not return.
1820 DEBUG_ONLY(__ should_not_reach_here());
1821
1822 // Invocation counter overflow.
1823 if (inc_counter) {
1824 // Handle invocation counter overflow.
1825 __ bind(invocation_counter_overflow);
1826 generate_counter_overflow(Lcontinue);
1827 }
|
1 /*
2 * Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2016, 2024 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.
1667 // Pop the native method's interpreter frame.
1668 __ pop_interpreter_frame(Z_R14 /*return_pc*/, Z_ARG2/*tmp1*/, Z_ARG3/*tmp2*/);
1669
1670 // Return to caller.
1671 __ z_br(Z_R14);
1672
1673 if (inc_counter) {
1674 // Handle overflow of counter and compile method.
1675 __ bind(invocation_counter_overflow);
1676 generate_counter_overflow(continue_after_compile);
1677 }
1678
1679 BLOCK_COMMENT("} native_entry");
1680
1681 return entry_point;
1682 }
1683
1684 //
1685 // Generic interpreted method entry to template interpreter.
1686 //
1687 address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized, bool object_init) {
1688 address entry_point = __ pc();
1689
1690 bool inc_counter = UseCompiler || CountCompiledCalls;
1691
1692 // Interpreter entry for ordinary Java methods.
1693 //
1694 // Registers alive
1695 // Z_SP - stack pointer
1696 // Z_thread - JavaThread*
1697 // Z_method - callee's method (method to be invoked)
1698 // Z_esp - operand (or expression) stack pointer of caller. one slot above last arg.
1699 // Z_R10 - sender sp (before modifications, e.g. by c2i adapter
1700 // and as well by generate_fixed_frame below)
1701 // Z_R14 - return address to caller (call_stub or c2i_adapter)
1702 //
1703 // Registers updated
1704 // Z_SP - stack pointer
1705 // Z_fp - callee's framepointer
1706 // Z_esp - callee's operand stack pointer
1707 // points to the slot above the value on top
1788 __ z_mvi(do_not_unlock_if_synchronized, false);
1789
1790 // Check for synchronized methods.
1791 // Must happen AFTER invocation_counter check and stack overflow check,
1792 // so method is not locked if overflows.
1793 if (synchronized) {
1794 // Allocate monitor and lock method.
1795 lock_method();
1796 } else {
1797 #ifdef ASSERT
1798 { Label L;
1799 __ get_method(Z_R1_scratch);
1800 __ testbit_ushort(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
1801 __ z_bfalse(L);
1802 reentry = __ stop_chain_static(reentry, "method needs synchronization");
1803 __ bind(L);
1804 }
1805 #endif // ASSERT
1806 }
1807
1808 // If object_init == true, we should insert a StoreStore barrier here to
1809 // prevent strict fields initial default values from being observable.
1810 // However, s390 is a TSO platform, so if `this` escapes, strict fields
1811 // initialized values are guaranteed to be the ones observed, so the
1812 // barrier can be elided.
1813
1814 // start execution
1815
1816 #ifdef ASSERT
1817 __ verify_esp(Z_esp, Z_R1_scratch);
1818 #endif
1819
1820 // jvmti support
1821 __ notify_method_entry();
1822
1823 // Start executing instructions.
1824 __ dispatch_next(vtos);
1825 // Dispatch_next does not return.
1826 DEBUG_ONLY(__ should_not_reach_here());
1827
1828 // Invocation counter overflow.
1829 if (inc_counter) {
1830 // Handle invocation counter overflow.
1831 __ bind(invocation_counter_overflow);
1832 generate_counter_overflow(Lcontinue);
1833 }
|