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 #ifndef SHARE_VM_INTERPRETER_INTERPRETER_HPP 26 #define SHARE_VM_INTERPRETER_INTERPRETER_HPP 27 28 #include "code/stubs.hpp" 29 #include "interpreter/cppInterpreter.hpp" 30 #include "interpreter/templateInterpreter.hpp" 31 #include "memory/resourceArea.hpp" 32 #ifdef TARGET_ARCH_zero 33 # include "entry_zero.hpp" 34 #endif 35 36 // This file contains the platform-independent parts 37 // of the interpreter and the interpreter generator. 38 39 class InterpreterMacroAssembler; 40 41 //------------------------------------------------------------------------------------------------------------------------ 42 // An InterpreterCodelet is a piece of interpreter code. All 43 // interpreter code is generated into little codelets which 44 // contain extra information for debugging and printing purposes. 45 46 class InterpreterCodelet: public Stub { 47 friend class VMStructs; 48 friend class CodeCacheDumper; // possible extension [do not remove] 49 private: 50 int _size; // the size in bytes 51 const char* _description; // a description of the codelet, for debugging & printing 52 Bytecodes::Code _bytecode; // associated bytecode if any 53 DEBUG_ONLY(CodeStrings _strings;) // Comments for annotating assembler output. 54 99 100 int codelet_size() { 101 // Request the whole code buffer (minus a little for alignment). 102 // The commit call below trims it back for each codelet. 103 int codelet_size = AbstractInterpreter::code()->available_space() - 2*K; 104 105 // Guarantee there's a little bit of code space left. 106 guarantee(codelet_size > 0 && (size_t)codelet_size > 2*K, 107 "not enough space for interpreter generation"); 108 109 return codelet_size; 110 } 111 112 public: 113 CodeletMark(InterpreterMacroAssembler*& masm, 114 const char* description, 115 Bytecodes::Code bytecode = Bytecodes::_illegal); 116 ~CodeletMark(); 117 }; 118 119 // Wrapper classes to produce Interpreter/InterpreterGenerator from either 120 // the c++ interpreter or the template interpreter. 121 122 class Interpreter: public CC_INTERP_ONLY(CppInterpreter) NOT_CC_INTERP(TemplateInterpreter) { 123 124 public: 125 // Debugging/printing 126 static InterpreterCodelet* codelet_containing(address pc) { return (InterpreterCodelet*)_code->stub_containing(pc); } 127 128 #ifdef TARGET_ARCH_x86 129 # include "interpreter_x86.hpp" 130 #endif 131 #ifdef TARGET_ARCH_sparc 132 # include "interpreter_sparc.hpp" 133 #endif 134 #ifdef TARGET_ARCH_zero 135 # include "interpreter_zero.hpp" 136 #endif 137 #ifdef TARGET_ARCH_arm 138 # include "interpreter_arm.hpp" 139 #endif 140 #ifdef TARGET_ARCH_ppc 141 # include "interpreter_ppc.hpp" 142 #endif 143 #ifdef TARGET_ARCH_aarch64 144 # include "interpreter_aarch64.hpp" 145 #endif 146 147 }; 148 149 #endif // SHARE_VM_INTERPRETER_INTERPRETER_HPP | 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 #ifndef SHARE_VM_INTERPRETER_INTERPRETER_HPP 26 #define SHARE_VM_INTERPRETER_INTERPRETER_HPP 27 28 #include "code/stubs.hpp" 29 #include "interpreter/cppInterpreter.hpp" 30 #include "interpreter/templateInterpreter.hpp" 31 #include "memory/resourceArea.hpp" 32 33 // This file contains the platform-independent parts 34 // of the interpreter and the interpreter generator. 35 36 class InterpreterMacroAssembler; 37 38 //------------------------------------------------------------------------------------------------------------------------ 39 // An InterpreterCodelet is a piece of interpreter code. All 40 // interpreter code is generated into little codelets which 41 // contain extra information for debugging and printing purposes. 42 43 class InterpreterCodelet: public Stub { 44 friend class VMStructs; 45 friend class CodeCacheDumper; // possible extension [do not remove] 46 private: 47 int _size; // the size in bytes 48 const char* _description; // a description of the codelet, for debugging & printing 49 Bytecodes::Code _bytecode; // associated bytecode if any 50 DEBUG_ONLY(CodeStrings _strings;) // Comments for annotating assembler output. 51 96 97 int codelet_size() { 98 // Request the whole code buffer (minus a little for alignment). 99 // The commit call below trims it back for each codelet. 100 int codelet_size = AbstractInterpreter::code()->available_space() - 2*K; 101 102 // Guarantee there's a little bit of code space left. 103 guarantee(codelet_size > 0 && (size_t)codelet_size > 2*K, 104 "not enough space for interpreter generation"); 105 106 return codelet_size; 107 } 108 109 public: 110 CodeletMark(InterpreterMacroAssembler*& masm, 111 const char* description, 112 Bytecodes::Code bytecode = Bytecodes::_illegal); 113 ~CodeletMark(); 114 }; 115 116 // Wrapper typedef to use the name Interpreter to mean either 117 // the c++ interpreter or the template interpreter. 118 119 typedef CC_INTERP_ONLY(CppInterpreter) NOT_CC_INTERP(TemplateInterpreter) Interpreter; 120 121 #endif // SHARE_VM_INTERPRETER_INTERPRETER_HPP |