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 CC_INTERP
26 // All the necessary definitions used for (bytecode) template generation. Instead of
27 // spreading the implementation functionality for each bytecode in the interpreter
28 // and the snippet generator, a template is assigned to each bytecode which can be
29 // used to generate the bytecode's implementation if needed.
30
31
32 // A Template describes the properties of a code template for a given bytecode
33 // and provides a generator to generate the code template.
34
35 class Template VALUE_OBJ_CLASS_SPEC {
36 private:
37 enum Flags {
38 uses_bcp_bit, // set if template needs the bcp pointing to bytecode
39 does_dispatch_bit, // set if template dispatches on its own
40 calls_vm_bit, // set if template calls the vm
41 wide_bit // set if template belongs to a wide instruction
42 };
43
44 typedef void (*generator)(int arg);
316 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(bool arg ), bool arg );
317 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(TosState tos), TosState tos);
318 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Operation op), Operation op);
319 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Condition cc), Condition cc);
320
321 friend class Template;
322
323 // InterpreterMacroAssembler::is_a(), etc., need TemplateTable::call_VM().
324 friend class InterpreterMacroAssembler;
325
326 public:
327 // Initialization
328 static void initialize();
329 static void pd_initialize();
330
331 // Templates
332 static Template* template_for (Bytecodes::Code code) { Bytecodes::check (code); return &_template_table [code]; }
333 static Template* template_for_wide(Bytecodes::Code code) { Bytecodes::wide_check(code); return &_template_table_wide[code]; }
334
335 // Platform specifics
336 #include "incls/_templateTable_pd.hpp.incl"
337 };
338 #endif /* !CC_INTERP */
|
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_TEMPLATETABLE_HPP
26 #define SHARE_VM_INTERPRETER_TEMPLATETABLE_HPP
27
28 #include "interpreter/bytecodes.hpp"
29 #include "memory/allocation.hpp"
30 #include "runtime/frame.hpp"
31 #ifdef TARGET_ARCH_MODEL_x86_32
32 # include "interp_masm_x86_32.hpp"
33 #endif
34 #ifdef TARGET_ARCH_MODEL_x86_64
35 # include "interp_masm_x86_64.hpp"
36 #endif
37 #ifdef TARGET_ARCH_MODEL_sparc
38 # include "interp_masm_sparc.hpp"
39 #endif
40 #ifdef TARGET_ARCH_MODEL_zero
41 # include "interp_masm_zero.hpp"
42 #endif
43
44 #ifndef CC_INTERP
45 // All the necessary definitions used for (bytecode) template generation. Instead of
46 // spreading the implementation functionality for each bytecode in the interpreter
47 // and the snippet generator, a template is assigned to each bytecode which can be
48 // used to generate the bytecode's implementation if needed.
49
50
51 // A Template describes the properties of a code template for a given bytecode
52 // and provides a generator to generate the code template.
53
54 class Template VALUE_OBJ_CLASS_SPEC {
55 private:
56 enum Flags {
57 uses_bcp_bit, // set if template needs the bcp pointing to bytecode
58 does_dispatch_bit, // set if template dispatches on its own
59 calls_vm_bit, // set if template calls the vm
60 wide_bit // set if template belongs to a wide instruction
61 };
62
63 typedef void (*generator)(int arg);
335 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(bool arg ), bool arg );
336 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(TosState tos), TosState tos);
337 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Operation op), Operation op);
338 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Condition cc), Condition cc);
339
340 friend class Template;
341
342 // InterpreterMacroAssembler::is_a(), etc., need TemplateTable::call_VM().
343 friend class InterpreterMacroAssembler;
344
345 public:
346 // Initialization
347 static void initialize();
348 static void pd_initialize();
349
350 // Templates
351 static Template* template_for (Bytecodes::Code code) { Bytecodes::check (code); return &_template_table [code]; }
352 static Template* template_for_wide(Bytecodes::Code code) { Bytecodes::wide_check(code); return &_template_table_wide[code]; }
353
354 // Platform specifics
355 #ifdef TARGET_ARCH_MODEL_x86_32
356 # include "templateTable_x86_32.hpp"
357 #endif
358 #ifdef TARGET_ARCH_MODEL_x86_64
359 # include "templateTable_x86_64.hpp"
360 #endif
361 #ifdef TARGET_ARCH_MODEL_sparc
362 # include "templateTable_sparc.hpp"
363 #endif
364 #ifdef TARGET_ARCH_MODEL_zero
365 # include "templateTable_zero.hpp"
366 #endif
367
368 };
369 #endif /* !CC_INTERP */
370
371 #endif // SHARE_VM_INTERPRETER_TEMPLATETABLE_HPP
|