< prev index next >

src/share/vm/interpreter/templateTable.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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_x86


  32 # include "interp_masm_x86.hpp"
  33 #endif
  34 #ifdef TARGET_ARCH_MODEL_sparc
  35 # include "interp_masm_sparc.hpp"
  36 #endif
  37 #ifdef TARGET_ARCH_MODEL_zero
  38 # include "interp_masm_zero.hpp"
  39 #endif
  40 #ifdef TARGET_ARCH_MODEL_arm
  41 # include "interp_masm_arm.hpp"
  42 #endif
  43 #ifdef TARGET_ARCH_MODEL_ppc_32
  44 # include "interp_masm_ppc_32.hpp"
  45 #endif
  46 #ifdef TARGET_ARCH_MODEL_ppc_64
  47 # include "interp_masm_ppc_64.hpp"
  48 #endif
  49 
  50 #ifndef CC_INTERP
  51 // All the necessary definitions used for (bytecode) template generation. Instead of
  52 // spreading the implementation functionality for each bytecode in the interpreter
  53 // and the snippet generator, a template is assigned to each bytecode which can be
  54 // used to generate the bytecode's implementation if needed.
  55 
  56 
  57 // A Template describes the properties of a code template for a given bytecode
  58 // and provides a generator to generate the code template.
  59 
  60 class Template VALUE_OBJ_CLASS_SPEC {
  61  private:
  62   enum Flags {
  63     uses_bcp_bit,                                // set if template needs the bcp pointing to bytecode
  64     does_dispatch_bit,                           // set if template dispatches on its own
  65     calls_vm_bit,                                // set if template calls the vm
  66     wide_bit                                     // set if template belongs to a wide instruction


 341  static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(bool arg    ), bool arg    );
 342   static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(TosState tos), TosState tos);
 343   static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Operation op), Operation op);
 344   static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Condition cc), Condition cc);
 345 
 346   friend class Template;
 347 
 348   // InterpreterMacroAssembler::is_a(), etc., need TemplateTable::call_VM().
 349   friend class InterpreterMacroAssembler;
 350 
 351  public:
 352   // Initialization
 353   static void initialize();
 354   static void pd_initialize();
 355 
 356   // Templates
 357   static Template* template_for     (Bytecodes::Code code)  { Bytecodes::check     (code); return &_template_table     [code]; }
 358   static Template* template_for_wide(Bytecodes::Code code)  { Bytecodes::wide_check(code); return &_template_table_wide[code]; }
 359 
 360   // Platform specifics
 361 #ifdef TARGET_ARCH_MODEL_x86_32


 362 # include "templateTable_x86_32.hpp"
 363 #endif
 364 #ifdef TARGET_ARCH_MODEL_x86_64
 365 # include "templateTable_x86_64.hpp"
 366 #endif
 367 #ifdef TARGET_ARCH_MODEL_sparc
 368 # include "templateTable_sparc.hpp"
 369 #endif
 370 #ifdef TARGET_ARCH_MODEL_zero
 371 # include "templateTable_zero.hpp"
 372 #endif
 373 #ifdef TARGET_ARCH_MODEL_arm
 374 # include "templateTable_arm.hpp"
 375 #endif
 376 #ifdef TARGET_ARCH_MODEL_ppc_32
 377 # include "templateTable_ppc_32.hpp"
 378 #endif
 379 #ifdef TARGET_ARCH_MODEL_ppc_64
 380 # include "templateTable_ppc_64.hpp"
 381 #endif
 382 
 383 };
 384 #endif /* !CC_INTERP */
 385 
 386 #endif // SHARE_VM_INTERPRETER_TEMPLATETABLE_HPP
   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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 #if defined INTERP_MASM_MD_HPP
  32 # include INTERP_MASM_MD_HPP
  33 #elif defined TARGET_ARCH_x86
  34 # include "interp_masm_x86.hpp"
  35 #elif defined TARGET_ARCH_MODEL_sparc

  36 # include "interp_masm_sparc.hpp"
  37 #elif defined TARGET_ARCH_MODEL_zero

  38 # include "interp_masm_zero.hpp"
  39 #elif defined TARGET_ARCH_MODEL_ppc_64







  40 # include "interp_masm_ppc_64.hpp"
  41 #endif
  42 
  43 #ifndef CC_INTERP
  44 // All the necessary definitions used for (bytecode) template generation. Instead of
  45 // spreading the implementation functionality for each bytecode in the interpreter
  46 // and the snippet generator, a template is assigned to each bytecode which can be
  47 // used to generate the bytecode's implementation if needed.
  48 
  49 
  50 // A Template describes the properties of a code template for a given bytecode
  51 // and provides a generator to generate the code template.
  52 
  53 class Template VALUE_OBJ_CLASS_SPEC {
  54  private:
  55   enum Flags {
  56     uses_bcp_bit,                                // set if template needs the bcp pointing to bytecode
  57     does_dispatch_bit,                           // set if template dispatches on its own
  58     calls_vm_bit,                                // set if template calls the vm
  59     wide_bit                                     // set if template belongs to a wide instruction


 334  static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(bool arg    ), bool arg    );
 335   static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(TosState tos), TosState tos);
 336   static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Operation op), Operation op);
 337   static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Condition cc), Condition cc);
 338 
 339   friend class Template;
 340 
 341   // InterpreterMacroAssembler::is_a(), etc., need TemplateTable::call_VM().
 342   friend class InterpreterMacroAssembler;
 343 
 344  public:
 345   // Initialization
 346   static void initialize();
 347   static void pd_initialize();
 348 
 349   // Templates
 350   static Template* template_for     (Bytecodes::Code code)  { Bytecodes::check     (code); return &_template_table     [code]; }
 351   static Template* template_for_wide(Bytecodes::Code code)  { Bytecodes::wide_check(code); return &_template_table_wide[code]; }
 352 
 353   // Platform specifics
 354 #if defined TEMPLATETABLE_MD_HPP
 355 # include TEMPLATETABLE_MD_HPP
 356 #elif defined TARGET_ARCH_MODEL_x86_32
 357 # include "templateTable_x86_32.hpp"
 358 #elif defined TARGET_ARCH_MODEL_x86_64

 359 # include "templateTable_x86_64.hpp"
 360 #elif defined TARGET_ARCH_MODEL_sparc

 361 # include "templateTable_sparc.hpp"
 362 #elif defined TARGET_ARCH_MODEL_zero

 363 # include "templateTable_zero.hpp"
 364 #elif defined TARGET_ARCH_MODEL_ppc_64







 365 # include "templateTable_ppc_64.hpp"
 366 #endif
 367 
 368 };
 369 #endif /* !CC_INTERP */
 370 
 371 #endif // SHARE_VM_INTERPRETER_TEMPLATETABLE_HPP
< prev index next >