src/share/vm/interpreter/templateInterpreter.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8074457 Sdiff src/share/vm/interpreter

src/share/vm/interpreter/templateInterpreter.hpp

Print this page




  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_TEMPLATEINTERPRETER_HPP
  26 #define SHARE_VM_INTERPRETER_TEMPLATEINTERPRETER_HPP
  27 
  28 #include "interpreter/abstractInterpreter.hpp"
  29 #include "interpreter/templateTable.hpp"
  30 
  31 // This file contains the platform-independent parts
  32 // of the template interpreter and the template interpreter generator.
  33 
  34 #ifndef CC_INTERP
  35 
  36 class InterpreterMacroAssembler;

  37 
  38 //------------------------------------------------------------------------------------------------------------------------
  39 // A little wrapper class to group tosca-specific entry points into a unit.
  40 // (tosca = Top-Of-Stack CAche)
  41 
  42 class EntryPoint VALUE_OBJ_CLASS_SPEC {
  43  private:
  44   address _entry[number_of_states];
  45 
  46  public:
  47   // Construction
  48   EntryPoint();
  49   EntryPoint(address bentry, address centry, address sentry, address aentry, address ientry, address lentry, address fentry, address dentry, address ventry);
  50 
  51   // Attributes
  52   address entry(TosState state) const;                // return target address for a given tosca state
  53   void    set_entry(TosState state, address entry);   // set    target address for a given tosca state
  54   void    print();
  55 
  56   // Comparison


  68  private:
  69   address _table[number_of_states][length];           // dispatch tables, indexed by tosca and bytecode
  70 
  71  public:
  72   // Attributes
  73   EntryPoint entry(int i) const;                      // return entry point for a given bytecode i
  74   void       set_entry(int i, EntryPoint& entry);     // set    entry point for a given bytecode i
  75   address*   table_for(TosState state)          { return _table[state]; }
  76   address*   table_for()                        { return table_for((TosState)0); }
  77   int        distance_from(address *table)      { return table - table_for(); }
  78   int        distance_from(TosState state)      { return distance_from(table_for(state)); }
  79 
  80   // Comparison
  81   bool operator == (DispatchTable& y);                // for debugging only
  82 };
  83 
  84 class TemplateInterpreter: public AbstractInterpreter {
  85   friend class VMStructs;
  86   friend class InterpreterMacroAssembler;
  87   friend class TemplateInterpreterGenerator;
  88   friend class InterpreterGenerator;
  89   friend class TemplateTable;
  90   friend class CodeCacheExtensions;
  91   // friend class Interpreter;
  92  public:
  93 
  94   enum MoreConstants {
  95     number_of_return_entries  = number_of_states,               // number of return entry points
  96     number_of_deopt_entries   = number_of_states,               // number of deoptimization entry points
  97     number_of_return_addrs    = number_of_states                // number of return addresses
  98   };
  99 
 100  protected:
 101 
 102   static address    _throw_ArrayIndexOutOfBoundsException_entry;
 103   static address    _throw_ArrayStoreException_entry;
 104   static address    _throw_ArithmeticException_entry;
 105   static address    _throw_ClassCastException_entry;
 106   static address    _throw_NullPointerException_entry;
 107   static address    _throw_exception_entry;
 108 


 120   static EntryPoint _earlyret_entry;                            // entry point to return early from a call
 121   static EntryPoint _deopt_entry[number_of_deopt_entries];      // entry points to return to from a deoptimization
 122   static EntryPoint _continuation_entry;
 123   static EntryPoint _safept_entry;
 124 
 125   static address _invoke_return_entry[number_of_return_addrs];           // for invokestatic, invokespecial, invokevirtual return entries
 126   static address _invokeinterface_return_entry[number_of_return_addrs];  // for invokeinterface return entries
 127   static address _invokedynamic_return_entry[number_of_return_addrs];    // for invokedynamic return entries
 128 
 129   static DispatchTable _active_table;                           // the active    dispatch table (used by the interpreter for dispatch)
 130   static DispatchTable _normal_table;                           // the normal    dispatch table (used to set the active table in normal mode)
 131   static DispatchTable _safept_table;                           // the safepoint dispatch table (used to set the active table for safepoints)
 132   static address       _wentry_point[DispatchTable::length];    // wide instructions only (vtos tosca always)
 133 
 134 
 135  public:
 136   // Initialization/debugging
 137   static void       initialize();
 138   // this only returns whether a pc is within generated code for the interpreter.
 139   static bool       contains(address pc)                        { return _code != NULL && _code->contains(pc); }



 140 
 141  public:
 142 
 143   static address    remove_activation_early_entry(TosState state) { return _earlyret_entry.entry(state); }
 144 #ifdef HOTSWAP
 145   static address    remove_activation_preserving_args_entry()   { return _remove_activation_preserving_args_entry; }
 146 #endif // HOTSWAP
 147 
 148   static address    remove_activation_entry()                   { return _remove_activation_entry; }
 149   static address    throw_exception_entry()                     { return _throw_exception_entry; }
 150   static address    throw_ArithmeticException_entry()           { return _throw_ArithmeticException_entry; }
 151   static address    throw_NullPointerException_entry()          { return _throw_NullPointerException_entry; }
 152   static address    throw_StackOverflowError_entry()            { return _throw_StackOverflowError_entry; }
 153 
 154   // Code generation
 155 #ifndef PRODUCT
 156   static address    trace_code    (TosState state)              { return _trace_code.entry(state); }
 157 #endif // !PRODUCT
 158   static address    continuation  (TosState state)              { return _continuation_entry.entry(state); }
 159   static address*   dispatch_table(TosState state)              { return _active_table.table_for(state); }


 171   static address* invoke_return_entry_table_for(Bytecodes::Code code);
 172 
 173   static address deopt_entry(TosState state, int length);
 174   static address return_entry(TosState state, int length, Bytecodes::Code code);
 175 
 176   // Safepoint support
 177   static void       notice_safepoints();                        // stops the thread when reaching a safepoint
 178   static void       ignore_safepoints();                        // ignores safepoints
 179 
 180   // Deoptimization support
 181   // Compute the entry address for continuation after
 182   static address deopt_continue_after_entry(Method* method,
 183                                             address bcp,
 184                                             int callee_parameters,
 185                                             bool is_top_frame);
 186   // Deoptimization should reexecute this bytecode
 187   static bool    bytecode_should_reexecute(Bytecodes::Code code);
 188   // Compute the address for reexecution
 189   static address deopt_reexecute_entry(Method* method, address bcp);
 190 
 191 #ifdef TARGET_ARCH_x86
 192 # include "templateInterpreter_x86.hpp"
 193 #endif
 194 #ifdef TARGET_ARCH_sparc
 195 # include "templateInterpreter_sparc.hpp"
 196 #endif
 197 #ifdef TARGET_ARCH_zero
 198 # include "templateInterpreter_zero.hpp"
 199 #endif
 200 #ifdef TARGET_ARCH_arm
 201 # include "templateInterpreter_arm.hpp"
 202 #endif
 203 #ifdef TARGET_ARCH_ppc
 204 # include "templateInterpreter_ppc.hpp"
 205 #endif
 206 #ifdef TARGET_ARCH_aarch64
 207 # include "templateInterpreter_aarch64.hpp"
 208 #endif
 209 
 210 
 211 };
 212 
 213 #endif // !CC_INTERP
 214 
 215 #endif // SHARE_VM_INTERPRETER_TEMPLATEINTERPRETER_HPP


  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_TEMPLATEINTERPRETER_HPP
  26 #define SHARE_VM_INTERPRETER_TEMPLATEINTERPRETER_HPP
  27 
  28 #include "interpreter/abstractInterpreter.hpp"
  29 #include "interpreter/templateTable.hpp"
  30 
  31 // This file contains the platform-independent parts
  32 // of the template interpreter and the template interpreter generator.
  33 
  34 #ifndef CC_INTERP
  35 
  36 class InterpreterMacroAssembler;
  37 class InterpreterCodelet;
  38 
  39 //------------------------------------------------------------------------------------------------------------------------
  40 // A little wrapper class to group tosca-specific entry points into a unit.
  41 // (tosca = Top-Of-Stack CAche)
  42 
  43 class EntryPoint VALUE_OBJ_CLASS_SPEC {
  44  private:
  45   address _entry[number_of_states];
  46 
  47  public:
  48   // Construction
  49   EntryPoint();
  50   EntryPoint(address bentry, address centry, address sentry, address aentry, address ientry, address lentry, address fentry, address dentry, address ventry);
  51 
  52   // Attributes
  53   address entry(TosState state) const;                // return target address for a given tosca state
  54   void    set_entry(TosState state, address entry);   // set    target address for a given tosca state
  55   void    print();
  56 
  57   // Comparison


  69  private:
  70   address _table[number_of_states][length];           // dispatch tables, indexed by tosca and bytecode
  71 
  72  public:
  73   // Attributes
  74   EntryPoint entry(int i) const;                      // return entry point for a given bytecode i
  75   void       set_entry(int i, EntryPoint& entry);     // set    entry point for a given bytecode i
  76   address*   table_for(TosState state)          { return _table[state]; }
  77   address*   table_for()                        { return table_for((TosState)0); }
  78   int        distance_from(address *table)      { return table - table_for(); }
  79   int        distance_from(TosState state)      { return distance_from(table_for(state)); }
  80 
  81   // Comparison
  82   bool operator == (DispatchTable& y);                // for debugging only
  83 };
  84 
  85 class TemplateInterpreter: public AbstractInterpreter {
  86   friend class VMStructs;
  87   friend class InterpreterMacroAssembler;
  88   friend class TemplateInterpreterGenerator;

  89   friend class TemplateTable;
  90   friend class CodeCacheExtensions;
  91   // friend class Interpreter;
  92  public:
  93 
  94   enum MoreConstants {
  95     number_of_return_entries  = number_of_states,               // number of return entry points
  96     number_of_deopt_entries   = number_of_states,               // number of deoptimization entry points
  97     number_of_return_addrs    = number_of_states                // number of return addresses
  98   };
  99 
 100  protected:
 101 
 102   static address    _throw_ArrayIndexOutOfBoundsException_entry;
 103   static address    _throw_ArrayStoreException_entry;
 104   static address    _throw_ArithmeticException_entry;
 105   static address    _throw_ClassCastException_entry;
 106   static address    _throw_NullPointerException_entry;
 107   static address    _throw_exception_entry;
 108 


 120   static EntryPoint _earlyret_entry;                            // entry point to return early from a call
 121   static EntryPoint _deopt_entry[number_of_deopt_entries];      // entry points to return to from a deoptimization
 122   static EntryPoint _continuation_entry;
 123   static EntryPoint _safept_entry;
 124 
 125   static address _invoke_return_entry[number_of_return_addrs];           // for invokestatic, invokespecial, invokevirtual return entries
 126   static address _invokeinterface_return_entry[number_of_return_addrs];  // for invokeinterface return entries
 127   static address _invokedynamic_return_entry[number_of_return_addrs];    // for invokedynamic return entries
 128 
 129   static DispatchTable _active_table;                           // the active    dispatch table (used by the interpreter for dispatch)
 130   static DispatchTable _normal_table;                           // the normal    dispatch table (used to set the active table in normal mode)
 131   static DispatchTable _safept_table;                           // the safepoint dispatch table (used to set the active table for safepoints)
 132   static address       _wentry_point[DispatchTable::length];    // wide instructions only (vtos tosca always)
 133 
 134 
 135  public:
 136   // Initialization/debugging
 137   static void       initialize();
 138   // this only returns whether a pc is within generated code for the interpreter.
 139   static bool       contains(address pc)                        { return _code != NULL && _code->contains(pc); }
 140   // Debugging/printing
 141   static InterpreterCodelet* codelet_containing(address pc);
 142 
 143 
 144  public:
 145 
 146   static address    remove_activation_early_entry(TosState state) { return _earlyret_entry.entry(state); }
 147 #ifdef HOTSWAP
 148   static address    remove_activation_preserving_args_entry()   { return _remove_activation_preserving_args_entry; }
 149 #endif // HOTSWAP
 150 
 151   static address    remove_activation_entry()                   { return _remove_activation_entry; }
 152   static address    throw_exception_entry()                     { return _throw_exception_entry; }
 153   static address    throw_ArithmeticException_entry()           { return _throw_ArithmeticException_entry; }
 154   static address    throw_NullPointerException_entry()          { return _throw_NullPointerException_entry; }
 155   static address    throw_StackOverflowError_entry()            { return _throw_StackOverflowError_entry; }
 156 
 157   // Code generation
 158 #ifndef PRODUCT
 159   static address    trace_code    (TosState state)              { return _trace_code.entry(state); }
 160 #endif // !PRODUCT
 161   static address    continuation  (TosState state)              { return _continuation_entry.entry(state); }
 162   static address*   dispatch_table(TosState state)              { return _active_table.table_for(state); }


 174   static address* invoke_return_entry_table_for(Bytecodes::Code code);
 175 
 176   static address deopt_entry(TosState state, int length);
 177   static address return_entry(TosState state, int length, Bytecodes::Code code);
 178 
 179   // Safepoint support
 180   static void       notice_safepoints();                        // stops the thread when reaching a safepoint
 181   static void       ignore_safepoints();                        // ignores safepoints
 182 
 183   // Deoptimization support
 184   // Compute the entry address for continuation after
 185   static address deopt_continue_after_entry(Method* method,
 186                                             address bcp,
 187                                             int callee_parameters,
 188                                             bool is_top_frame);
 189   // Deoptimization should reexecute this bytecode
 190   static bool    bytecode_should_reexecute(Bytecodes::Code code);
 191   // Compute the address for reexecution
 192   static address deopt_reexecute_entry(Method* method, address bcp);
 193 
 194   // Size of interpreter code.  Max size with JVMTI
 195   static int InterpreterCodeSize;
 196 









 197 #ifdef TARGET_ARCH_ppc
 198  public:
 199   // PPC-only: Support abs and sqrt like in compiler.
 200   // For others we can use a normal (native) entry.
 201   static bool math_entry_available(AbstractInterpreter::MethodKind kind);
 202 #endif


 203 };
 204 
 205 #endif // !CC_INTERP
 206 
 207 #endif // SHARE_VM_INTERPRETER_TEMPLATEINTERPRETER_HPP
src/share/vm/interpreter/templateInterpreter.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File