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 *
23 */
24
25 // This file contains the platform-independent parts
26 // of the interpreter and the interpreter generator.
27
28 //------------------------------------------------------------------------------------------------------------------------
29 // An InterpreterCodelet is a piece of interpreter code. All
30 // interpreter code is generated into little codelets which
31 // contain extra information for debugging and printing purposes.
32
33 class InterpreterCodelet: public Stub {
34 friend class VMStructs;
35 private:
36 int _size; // the size in bytes
37 const char* _description; // a description of the codelet, for debugging & printing
38 Bytecodes::Code _bytecode; // associated bytecode if any
39
40 public:
41 // Initialization/finalization
42 void initialize(int size) { _size = size; }
43 void finalize() { ShouldNotCallThis(); }
44
114 (*_masm)->align(wordSize);
115 // make sure all code is in code buffer
116 (*_masm)->flush();
117
118
119 // commit Codelet
120 AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size());
121 // make sure nobody can use _masm outside a CodeletMark lifespan
122 *_masm = NULL;
123 }
124 };
125
126 // Wrapper classes to produce Interpreter/InterpreterGenerator from either
127 // the c++ interpreter or the template interpreter.
128
129 class Interpreter: public CC_INTERP_ONLY(CppInterpreter) NOT_CC_INTERP(TemplateInterpreter) {
130
131 public:
132 // Debugging/printing
133 static InterpreterCodelet* codelet_containing(address pc) { return (InterpreterCodelet*)_code->stub_containing(pc); }
134 #include "incls/_interpreter_pd.hpp.incl"
135 };
|
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 *
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 #ifdef ZERO
32 #ifdef TARGET_ARCH_zero
33 # include "entry_zero.hpp"
34 #endif
35 #endif
36
37 // This file contains the platform-independent parts
38 // of the interpreter and the interpreter generator.
39
40 //------------------------------------------------------------------------------------------------------------------------
41 // An InterpreterCodelet is a piece of interpreter code. All
42 // interpreter code is generated into little codelets which
43 // contain extra information for debugging and printing purposes.
44
45 class InterpreterCodelet: public Stub {
46 friend class VMStructs;
47 private:
48 int _size; // the size in bytes
49 const char* _description; // a description of the codelet, for debugging & printing
50 Bytecodes::Code _bytecode; // associated bytecode if any
51
52 public:
53 // Initialization/finalization
54 void initialize(int size) { _size = size; }
55 void finalize() { ShouldNotCallThis(); }
56
126 (*_masm)->align(wordSize);
127 // make sure all code is in code buffer
128 (*_masm)->flush();
129
130
131 // commit Codelet
132 AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size());
133 // make sure nobody can use _masm outside a CodeletMark lifespan
134 *_masm = NULL;
135 }
136 };
137
138 // Wrapper classes to produce Interpreter/InterpreterGenerator from either
139 // the c++ interpreter or the template interpreter.
140
141 class Interpreter: public CC_INTERP_ONLY(CppInterpreter) NOT_CC_INTERP(TemplateInterpreter) {
142
143 public:
144 // Debugging/printing
145 static InterpreterCodelet* codelet_containing(address pc) { return (InterpreterCodelet*)_code->stub_containing(pc); }
146 #ifdef TARGET_ARCH_x86
147 # include "interpreter_x86.hpp"
148 #endif
149 #ifdef TARGET_ARCH_sparc
150 # include "interpreter_sparc.hpp"
151 #endif
152 #ifdef TARGET_ARCH_zero
153 # include "interpreter_zero.hpp"
154 #endif
155
156 };
157
158 #endif // SHARE_VM_INTERPRETER_INTERPRETER_HPP
|