< prev index next >

src/share/vm/interpreter/templateInterpreter.hpp

Print this page




  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 
 109   static address    _throw_StackOverflowError_entry;
 110 


 113   static address    _remove_activation_preserving_args_entry;   // continuation address when current frame is being popped
 114 #endif // HOTSWAP
 115 
 116 #ifndef PRODUCT
 117   static EntryPoint _trace_code;
 118 #endif // !PRODUCT
 119   static EntryPoint _return_entry[number_of_return_entries];    // entry points to return to from a call
 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); }








 163   static address*   dispatch_table()                            { return _active_table.table_for(); }
 164   static int        distance_from_dispatch_table(TosState state){ return _active_table.distance_from(state); }
 165   static address*   normal_table(TosState state)                { return _normal_table.table_for(state); }
 166   static address*   normal_table()                              { return _normal_table.table_for(); }
 167 
 168   // Support for invokes
 169   static address*   invoke_return_entry_table()                 { return _invoke_return_entry; }
 170   static address*   invokeinterface_return_entry_table()        { return _invokeinterface_return_entry; }
 171   static address*   invokedynamic_return_entry_table()          { return _invokedynamic_return_entry; }
 172   static int        TosState_as_index(TosState state);
 173 
 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 


  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 BCSetTemplate;
  92   // friend class Interpreter;
  93  public:
  94 
  95   enum MoreConstants {
  96     number_of_return_entries  = number_of_states,               // number of return entry points
  97     number_of_deopt_entries   = number_of_states,               // number of deoptimization entry points
  98     number_of_return_addrs    = number_of_states                // number of return addresses
  99   };
 100 
 101  protected:
 102 
 103   static address    _throw_ArrayIndexOutOfBoundsException_entry;
 104   static address    _throw_ArrayStoreException_entry;
 105   static address    _throw_ArithmeticException_entry;
 106   static address    _throw_ClassCastException_entry;
 107   static address    _throw_NullPointerException_entry;
 108   static address    _throw_exception_entry;
 109 
 110   static address    _throw_StackOverflowError_entry;
 111 


 114   static address    _remove_activation_preserving_args_entry;   // continuation address when current frame is being popped
 115 #endif // HOTSWAP
 116 
 117 #ifndef PRODUCT
 118   static EntryPoint _trace_code;
 119 #endif // !PRODUCT
 120   static EntryPoint _return_entry[number_of_return_entries];    // entry points to return to from a call
 121   static EntryPoint _earlyret_entry;                            // entry point to return early from a call
 122   static EntryPoint _deopt_entry[number_of_deopt_entries];      // entry points to return to from a deoptimization
 123   static EntryPoint _continuation_entry;
 124   static EntryPoint _safept_entry;
 125 
 126   static address _invoke_return_entry[number_of_return_addrs];           // for invokestatic, invokespecial, invokevirtual return entries
 127   static address _invokeinterface_return_entry[number_of_return_addrs];  // for invokeinterface return entries
 128   static address _invokedynamic_return_entry[number_of_return_addrs];    // for invokedynamic return entries
 129 
 130   static DispatchTable _active_table;                           // the active    dispatch table (used by the interpreter for dispatch)
 131   static DispatchTable _normal_table;                           // the normal    dispatch table (used to set the active table in normal mode)
 132   static DispatchTable _safept_table;                           // the safepoint dispatch table (used to set the active table for safepoints)
 133   static address       _wentry_point[DispatchTable::length];    // wide instructions only (vtos tosca always)
 134   static address       _typed_entry_point[Bytecodes::number_of_bcset][DispatchTable::length];
 135   static address       _typed_wentry_point[Bytecodes::number_of_bcset][DispatchTable::length];
 136 
 137 
 138  public:
 139   // Initialization/debugging
 140   static void       initialize();
 141   // this only returns whether a pc is within generated code for the interpreter.
 142   static bool       contains(address pc)                        { return _code != NULL && _code->contains(pc); }
 143   // Debugging/printing
 144   static InterpreterCodelet* codelet_containing(address pc);
 145 
 146 
 147  public:
 148 
 149   static address    remove_activation_early_entry(TosState state) { return _earlyret_entry.entry(state); }
 150 #ifdef HOTSWAP
 151   static address    remove_activation_preserving_args_entry()   { return _remove_activation_preserving_args_entry; }
 152 #endif // HOTSWAP
 153 
 154   static address    remove_activation_entry()                   { return _remove_activation_entry; }
 155   static address    throw_exception_entry()                     { return _throw_exception_entry; }
 156   static address    throw_ArithmeticException_entry()           { return _throw_ArithmeticException_entry; }
 157   static address    throw_NullPointerException_entry()          { return _throw_NullPointerException_entry; }
 158   static address    throw_StackOverflowError_entry()            { return _throw_StackOverflowError_entry; }
 159 
 160   // Code generation
 161 #ifndef PRODUCT
 162   static address    trace_code    (TosState state)              { return _trace_code.entry(state); }
 163 #endif // !PRODUCT
 164   static address    continuation  (TosState state)              { return _continuation_entry.entry(state); }
 165   static address*   dispatch_table(TosState state)              { return _active_table.table_for(state); }
 166   static address*   typed_dispatch_table(Bytecodes::BCSet btype) {
 167     assert(btype > 0 && btype < Bytecodes::number_of_bcset, "Invalid btype");
 168     return _typed_entry_point[btype];
 169   }
 170   static address*   typed_wide_dispatch_table(Bytecodes::BCSet btype) {
 171       assert(btype > 0 && btype < Bytecodes::number_of_bcset, "Invalid btype");
 172       return _typed_wentry_point[btype];
 173     }
 174   static address*   dispatch_table()                            { return _active_table.table_for(); }
 175   static int        distance_from_dispatch_table(TosState state){ return _active_table.distance_from(state); }
 176   static address*   normal_table(TosState state)                { return _normal_table.table_for(state); }
 177   static address*   normal_table()                              { return _normal_table.table_for(); }
 178 
 179   // Support for invokes
 180   static address*   invoke_return_entry_table()                 { return _invoke_return_entry; }
 181   static address*   invokeinterface_return_entry_table()        { return _invokeinterface_return_entry; }
 182   static address*   invokedynamic_return_entry_table()          { return _invokedynamic_return_entry; }
 183   static int        TosState_as_index(TosState state);
 184 
 185   static address* invoke_return_entry_table_for(Bytecodes::Code code);
 186 
 187   static address deopt_entry(TosState state, int length);
 188   static address return_entry(TosState state, int length, Bytecodes::Code code);
 189 
 190   // Safepoint support
 191   static void       notice_safepoints();                        // stops the thread when reaching a safepoint
 192   static void       ignore_safepoints();                        // ignores safepoints
 193 
< prev index next >