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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.hpp"
27 #include "gc/shared/barrierSetAssembler.hpp"
28 #include "interpreter/bytecodeHistogram.hpp"
29 #include "interpreter/interp_masm.hpp"
30 #include "interpreter/interpreter.hpp"
31 #include "interpreter/interpreterRuntime.hpp"
32 #include "interpreter/templateInterpreterGenerator.hpp"
33 #include "interpreter/templateTable.hpp"
34 #include "oops/arrayOop.hpp"
35 #include "oops/methodData.hpp"
36 #include "oops/method.hpp"
37 #include "oops/oop.inline.hpp"
38 #include "prims/jvmtiExport.hpp"
39 #include "prims/jvmtiThreadState.hpp"
40 #include "runtime/arguments.hpp"
41 #include "runtime/deoptimization.hpp"
42 #include "runtime/frame.inline.hpp"
43 #include "runtime/sharedRuntime.hpp"
44 #include "runtime/stubRoutines.hpp"
45 #include "runtime/synchronizer.hpp"
46 #include "runtime/timer.hpp"
47 #include "runtime/vframeArray.hpp"
48 #include "utilities/debug.hpp"
49 #include "utilities/macros.hpp"
50
51 #define __ _masm->
52
53 // Size of interpreter code. Increase if too small. Interpreter will
54 // fail with a guarantee ("not enough space for interpreter generation");
55 // if too small.
56 // Run with +PrintInterpreter to get the VM to print out the size.
57 // Max size with JVMTI
58 #ifdef AMD64
59 int TemplateInterpreter::InterpreterCodeSize = JVMCI_ONLY(268) NOT_JVMCI(256) * 1024;
60 #else
61 int TemplateInterpreter::InterpreterCodeSize = 224 * 1024;
62 #endif // AMD64
63
64 // Global Register Names
65 static const Register rbcp = LP64_ONLY(r13) NOT_LP64(rsi);
66 static const Register rlocals = LP64_ONLY(r14) NOT_LP64(rdi);
67
68 const int method_offset = frame::interpreter_frame_method_offset * wordSize;
69 const int bcp_offset = frame::interpreter_frame_bcp_offset * wordSize;
70 const int locals_offset = frame::interpreter_frame_locals_offset * wordSize;
71
1757
1758 return entry;
1759 } // end of ForceEarlyReturn support
1760
1761
1762 //-----------------------------------------------------------------------------
1763 // Helper for vtos entry point generation
1764
1765 void TemplateInterpreterGenerator::set_vtos_entry_points(Template* t,
1766 address& bep,
1767 address& cep,
1768 address& sep,
1769 address& aep,
1770 address& iep,
1771 address& lep,
1772 address& fep,
1773 address& dep,
1774 address& vep) {
1775 assert(t->is_valid() && t->tos_in() == vtos, "illegal template");
1776 Label L;
1777 aep = __ pc(); __ push_ptr(); __ jmp(L);
1778 #ifndef _LP64
1779 fep = __ pc(); __ push(ftos); __ jmp(L);
1780 dep = __ pc(); __ push(dtos); __ jmp(L);
1781 #else
1782 fep = __ pc(); __ push_f(xmm0); __ jmp(L);
1783 dep = __ pc(); __ push_d(xmm0); __ jmp(L);
1784 #endif // _LP64
1785 lep = __ pc(); __ push_l(); __ jmp(L);
1786 bep = cep = sep =
1787 iep = __ pc(); __ push_i();
1788 vep = __ pc();
1789 __ bind(L);
1790 generate_and_dispatch(t);
1791 }
1792
1793 //-----------------------------------------------------------------------------
1794
1795 // Non-product code
1796 #ifndef PRODUCT
1797
1798 address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
1799 address entry = __ pc();
1800
1801 #ifndef _LP64
1802 // prepare expression stack
1803 __ pop(rcx); // pop return address so expression stack is 'pure'
1804 __ push(state); // save tosca
1805
1806 // pass tosca registers as arguments & call tracer
1807 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), rcx, rax, rdx);
1808 __ mov(rcx, rax); // make sure return address is not destroyed by pop(state)
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.hpp"
27 #include "compiler/disassembler.hpp"
28 #include "gc/shared/barrierSetAssembler.hpp"
29 #include "interpreter/bytecodeHistogram.hpp"
30 #include "interpreter/interp_masm.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "interpreter/interpreterRuntime.hpp"
33 #include "interpreter/templateInterpreterGenerator.hpp"
34 #include "interpreter/templateTable.hpp"
35 #include "oops/arrayOop.hpp"
36 #include "oops/methodData.hpp"
37 #include "oops/method.hpp"
38 #include "oops/oop.inline.hpp"
39 #include "prims/jvmtiExport.hpp"
40 #include "prims/jvmtiThreadState.hpp"
41 #include "runtime/arguments.hpp"
42 #include "runtime/deoptimization.hpp"
43 #include "runtime/frame.inline.hpp"
44 #include "runtime/sharedRuntime.hpp"
45 #include "runtime/stubRoutines.hpp"
46 #include "runtime/synchronizer.hpp"
47 #include "runtime/timer.hpp"
48 #include "runtime/vframeArray.hpp"
49 #include "utilities/debug.hpp"
50 #include "utilities/macros.hpp"
51
52 #define __ Disassembler::hook<InterpreterMacroAssembler>(__FILE__, __LINE__, _masm)->
53
54 // Size of interpreter code. Increase if too small. Interpreter will
55 // fail with a guarantee ("not enough space for interpreter generation");
56 // if too small.
57 // Run with +PrintInterpreter to get the VM to print out the size.
58 // Max size with JVMTI
59 #ifdef AMD64
60 int TemplateInterpreter::InterpreterCodeSize = JVMCI_ONLY(268) NOT_JVMCI(256) * 1024;
61 #else
62 int TemplateInterpreter::InterpreterCodeSize = 224 * 1024;
63 #endif // AMD64
64
65 // Global Register Names
66 static const Register rbcp = LP64_ONLY(r13) NOT_LP64(rsi);
67 static const Register rlocals = LP64_ONLY(r14) NOT_LP64(rdi);
68
69 const int method_offset = frame::interpreter_frame_method_offset * wordSize;
70 const int bcp_offset = frame::interpreter_frame_bcp_offset * wordSize;
71 const int locals_offset = frame::interpreter_frame_locals_offset * wordSize;
72
1758
1759 return entry;
1760 } // end of ForceEarlyReturn support
1761
1762
1763 //-----------------------------------------------------------------------------
1764 // Helper for vtos entry point generation
1765
1766 void TemplateInterpreterGenerator::set_vtos_entry_points(Template* t,
1767 address& bep,
1768 address& cep,
1769 address& sep,
1770 address& aep,
1771 address& iep,
1772 address& lep,
1773 address& fep,
1774 address& dep,
1775 address& vep) {
1776 assert(t->is_valid() && t->tos_in() == vtos, "illegal template");
1777 Label L;
1778 aep = __ pc(); // atos entry point
1779 __ push_ptr();
1780 __ jmp(L);
1781 #ifndef _LP64
1782 fep = __ pc(); // ftos entry point
1783 __ push(ftos);
1784 __ jmp(L);
1785 dep = __ pc(); // dtos entry point
1786 __ push(dtos);
1787 __ jmp(L);
1788 #else
1789 fep = __ pc(); // ftos entry point
1790 __ push_f(xmm0);
1791 __ jmp(L);
1792 dep = __ pc(); // dtos entry point
1793 __ push_d(xmm0);
1794 __ jmp(L);
1795 #endif // _LP64
1796 lep = __ pc(); // ltos entry point
1797 __ push_l();
1798 __ jmp(L);
1799 bep = cep = sep = iep = __ pc(); // [bcsi]tos entry point
1800 __ push_i();
1801 vep = __ pc(); // vtos entry point
1802 __ bind(L);
1803 generate_and_dispatch(t);
1804 }
1805
1806 //-----------------------------------------------------------------------------
1807
1808 // Non-product code
1809 #ifndef PRODUCT
1810
1811 address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
1812 address entry = __ pc();
1813
1814 #ifndef _LP64
1815 // prepare expression stack
1816 __ pop(rcx); // pop return address so expression stack is 'pure'
1817 __ push(state); // save tosca
1818
1819 // pass tosca registers as arguments & call tracer
1820 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), rcx, rax, rdx);
1821 __ mov(rcx, rax); // make sure return address is not destroyed by pop(state)
|