templateInterpreterGenerator.hpp revision 1879:f95d63e2154a
190380Smsmith/* 290380Smsmith * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 390380Smsmith * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 490380Smsmith * 590380Smsmith * This code is free software; you can redistribute it and/or modify it 690380Smsmith * under the terms of the GNU General Public License version 2 only, as 798146Siwasaki * published by the Free Software Foundation. 898146Siwasaki * 998146Siwasaki * This code is distributed in the hope that it will be useful, but WITHOUT 1098146Siwasaki * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1198146Siwasaki * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1290380Smsmith * version 2 for more details (a copy is included in the LICENSE file that 13193529Sjkim * accompanied this code). 14193529Sjkim * 1590380Smsmith * You should have received a copy of the GNU General Public License version 16123333Snjl * 2 along with this work; if not, write to the Free Software Foundation, 17193529Sjkim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18193529Sjkim * 19193529Sjkim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20193529Sjkim * or visit www.oracle.com if you need additional information or have any 2190380Smsmith * questions. 22217365Sjkim * 23217365Sjkim */ 24193529Sjkim 25197104Sjkim#ifndef SHARE_VM_INTERPRETER_TEMPLATEINTERPRETERGENERATOR_HPP 26213806Sjkim#define SHARE_VM_INTERPRETER_TEMPLATEINTERPRETERGENERATOR_HPP 27213806Sjkim 28193529Sjkim// This file contains the platform-independent parts 29151946Sjkim// of the template interpreter generator. 30193529Sjkim 31193529Sjkim#ifndef CC_INTERP 32193529Sjkim 33193529Sjkimclass TemplateInterpreterGenerator: public AbstractInterpreterGenerator { 34193529Sjkim protected: 35197104Sjkim 36197104Sjkim // entry points for shared code sequence 37213806Sjkim address _unimplemented_bytecode; 38213806Sjkim address _illegal_bytecode_sequence; 39193529Sjkim 4090380Smsmith // shared code sequences 4190380Smsmith // Converter for native abi result to tosca result 4290380Smsmith address generate_result_handler_for(BasicType type); 43193529Sjkim address generate_slow_signature_handler(); 4490380Smsmith address generate_error_exit(const char* msg); 4590380Smsmith address generate_StackOverflowError_handler(); 4690380Smsmith address generate_exception_handler(const char* name, const char* message) { 4790380Smsmith return generate_exception_handler_common(name, message, false); 4890380Smsmith } 4990380Smsmith address generate_klass_exception_handler(const char* name) { 5090380Smsmith return generate_exception_handler_common(name, NULL, true); 5190380Smsmith } 5290380Smsmith address generate_exception_handler_common(const char* name, const char* message, bool pass_oop); 5390380Smsmith address generate_ClassCastException_handler(); 54209746Sjkim address generate_WrongMethodType_handler(); 5590380Smsmith address generate_ArrayIndexOutOfBounds_handler(const char* name); 5690380Smsmith address generate_continuation_for(TosState state); 57151946Sjkim address generate_return_entry_for(TosState state, int step); 5890380Smsmith address generate_earlyret_entry_for(TosState state); 5990380Smsmith address generate_deopt_entry_for(TosState state, int step); 60193529Sjkim address generate_safept_entry_for(TosState state, address runtime_entry); 61123333Snjl void generate_throw_exception(); 62123333Snjl 63209746Sjkim // entry point generator 64123333Snjl// address generate_method_entry(AbstractInterpreter::MethodKind kind); 65193529Sjkim 66209746Sjkim // Instruction generation 6790380Smsmith void generate_and_dispatch (Template* t, TosState tos_out = ilgl); 68151604Sobrien void set_vtos_entry_points (Template* t, address& bep, address& cep, address& sep, address& aep, address& iep, address& lep, address& fep, address& dep, address& vep); 69151946Sjkim void set_short_entry_points(Template* t, address& bep, address& cep, address& sep, address& aep, address& iep, address& lep, address& fep, address& dep, address& vep); 70220663Sjkim void set_wide_entry_point (Template* t, address& wep); 71193529Sjkim 72151946Sjkim void set_entry_points(Bytecodes::Code code); 73151946Sjkim void set_unimplemented(int i); 74209746Sjkim void set_entry_points_for_all_bytes(); 75151946Sjkim void set_safepoints_for_all_bytes(); 76151946Sjkim 77193529Sjkim // Helpers for generate_and_dispatch 78209746Sjkim address generate_trace_code(TosState state) PRODUCT_RETURN0; 79193529Sjkim void count_bytecode() PRODUCT_RETURN; 80193529Sjkim void histogram_bytecode(Template* t) PRODUCT_RETURN; 81151604Sobrien void histogram_bytecode_pair(Template* t) PRODUCT_RETURN; 8290380Smsmith void trace_bytecode(Template* t) PRODUCT_RETURN; 8390380Smsmith void stop_interpreter_at() PRODUCT_RETURN; 8498146Siwasaki 85114244Snjl void generate_all(); 86114244Snjl 87114244Snjl public: 88151946Sjkim TemplateInterpreterGenerator(StubQueue* _code); 89151946Sjkim 90151946Sjkim#ifdef TARGET_ARCH_x86 91151946Sjkim# include "templateInterpreterGenerator_x86.hpp" 92#endif 93#ifdef TARGET_ARCH_sparc 94# include "templateInterpreterGenerator_sparc.hpp" 95#endif 96#ifdef TARGET_ARCH_zero 97# include "templateInterpreterGenerator_zero.hpp" 98#endif 99 100 101}; 102 103#endif // !CC_INTERP 104 105#endif // SHARE_VM_INTERPRETER_TEMPLATEINTERPRETERGENERATOR_HPP 106