hotspot/src/share/vm/runtime/thread.hpp
changeset 22838 82c7497fbad4
parent 22827 07d991d45a51
parent 20707 b3b658c6d1f8
child 22859 7b88983393b7
equal deleted inserted replaced
22837:feba5d4126b8 22838:82c7497fbad4
   111   // int         _exception_line;                   // line information for exception (debugging only)
   111   // int         _exception_line;                   // line information for exception (debugging only)
   112  protected:
   112  protected:
   113   // Support for forcing alignment of thread objects for biased locking
   113   // Support for forcing alignment of thread objects for biased locking
   114   void*       _real_malloc_address;
   114   void*       _real_malloc_address;
   115  public:
   115  public:
   116   void* operator new(size_t size) { return allocate(size, true); }
   116   void* operator new(size_t size) throw() { return allocate(size, true); }
   117   void* operator new(size_t size, const std::nothrow_t& nothrow_constant) { return allocate(size, false); }
   117   void* operator new(size_t size, const std::nothrow_t& nothrow_constant) throw() {
       
   118     return allocate(size, false); }
   118   void  operator delete(void* p);
   119   void  operator delete(void* p);
   119 
   120 
   120  protected:
   121  protected:
   121    static void* allocate(size_t size, bool throw_excpt, MEMFLAGS flags = mtThread);
   122    static void* allocate(size_t size, bool throw_excpt, MEMFLAGS flags = mtThread);
   122  private:
   123  private:
   924   volatile oop     _exception_oop;               // Exception thrown in compiled code
   925   volatile oop     _exception_oop;               // Exception thrown in compiled code
   925   volatile address _exception_pc;                // PC where exception happened
   926   volatile address _exception_pc;                // PC where exception happened
   926   volatile address _exception_handler_pc;        // PC for handler of exception
   927   volatile address _exception_handler_pc;        // PC for handler of exception
   927   volatile int     _is_method_handle_return;     // true (== 1) if the current exception PC is a MethodHandle call site.
   928   volatile int     _is_method_handle_return;     // true (== 1) if the current exception PC is a MethodHandle call site.
   928 
   929 
   929   // support for compilation
       
   930   bool    _is_compiling;                         // is true if a compilation is active inthis thread (one compilation per thread possible)
       
   931 
       
   932   // support for JNI critical regions
   930   // support for JNI critical regions
   933   jint    _jni_active_critical;                  // count of entries into JNI critical region
   931   jint    _jni_active_critical;                  // count of entries into JNI critical region
   934 
   932 
   935   // For deadlock detection.
   933   // For deadlock detection.
   936   int _depth_first_number;
   934   int _depth_first_number;
  1005 
  1003 
  1006   void cleanup_failed_attach_current_thread();
  1004   void cleanup_failed_attach_current_thread();
  1007 
  1005 
  1008   // Testers
  1006   // Testers
  1009   virtual bool is_Java_thread() const            { return true;  }
  1007   virtual bool is_Java_thread() const            { return true;  }
  1010 
       
  1011   // compilation
       
  1012   void set_is_compiling(bool f)                  { _is_compiling = f; }
       
  1013   bool is_compiling() const                      { return _is_compiling; }
       
  1014 
  1008 
  1015   // Thread chain operations
  1009   // Thread chain operations
  1016   JavaThread* next() const                       { return _next; }
  1010   JavaThread* next() const                       { return _next; }
  1017   void set_next(JavaThread* p)                   { _next = p; }
  1011   void set_next(JavaThread* p)                   { _next = p; }
  1018 
  1012 
  1279   oop      exception_oop() const                 { return _exception_oop; }
  1273   oop      exception_oop() const                 { return _exception_oop; }
  1280   address  exception_pc() const                  { return _exception_pc; }
  1274   address  exception_pc() const                  { return _exception_pc; }
  1281   address  exception_handler_pc() const          { return _exception_handler_pc; }
  1275   address  exception_handler_pc() const          { return _exception_handler_pc; }
  1282   bool     is_method_handle_return() const       { return _is_method_handle_return == 1; }
  1276   bool     is_method_handle_return() const       { return _is_method_handle_return == 1; }
  1283 
  1277 
  1284   void set_exception_oop(oop o)                  { _exception_oop = o; }
  1278   void set_exception_oop(oop o)                  { (void)const_cast<oop&>(_exception_oop = o); }
  1285   void set_exception_pc(address a)               { _exception_pc = a; }
  1279   void set_exception_pc(address a)               { _exception_pc = a; }
  1286   void set_exception_handler_pc(address a)       { _exception_handler_pc = a; }
  1280   void set_exception_handler_pc(address a)       { _exception_handler_pc = a; }
  1287   void set_is_method_handle_return(bool value)   { _is_method_handle_return = value ? 1 : 0; }
  1281   void set_is_method_handle_return(bool value)   { _is_method_handle_return = value ? 1 : 0; }
       
  1282 
       
  1283   void clear_exception_oop_and_pc() {
       
  1284     set_exception_oop(NULL);
       
  1285     set_exception_pc(NULL);
       
  1286   }
  1288 
  1287 
  1289   // Stack overflow support
  1288   // Stack overflow support
  1290   inline size_t stack_available(address cur_sp);
  1289   inline size_t stack_available(address cur_sp);
  1291   address stack_yellow_zone_base()
  1290   address stack_yellow_zone_base()
  1292     { return (address)(stack_base() - (stack_size() - (stack_red_zone_size() + stack_yellow_zone_size()))); }
  1291     { return (address)(stack_base() - (stack_size() - (stack_red_zone_size() + stack_yellow_zone_size()))); }
  1824 class CompilerThread : public JavaThread {
  1823 class CompilerThread : public JavaThread {
  1825   friend class VMStructs;
  1824   friend class VMStructs;
  1826  private:
  1825  private:
  1827   CompilerCounters* _counters;
  1826   CompilerCounters* _counters;
  1828 
  1827 
  1829   ciEnv*        _env;
  1828   ciEnv*            _env;
  1830   CompileLog*   _log;
  1829   CompileLog*       _log;
  1831   CompileTask*  _task;
  1830   CompileTask*      _task;
  1832   CompileQueue* _queue;
  1831   CompileQueue*     _queue;
  1833   BufferBlob*   _buffer_blob;
  1832   BufferBlob*       _buffer_blob;
  1834 
  1833 
  1835   nmethod*      _scanned_nmethod;  // nmethod being scanned by the sweeper
  1834   nmethod*          _scanned_nmethod;  // nmethod being scanned by the sweeper
       
  1835   AbstractCompiler* _compiler;
  1836 
  1836 
  1837  public:
  1837  public:
  1838 
  1838 
  1839   static CompilerThread* current();
  1839   static CompilerThread* current();
  1840 
  1840 
  1842 
  1842 
  1843   bool is_Compiler_thread() const                { return true; }
  1843   bool is_Compiler_thread() const                { return true; }
  1844   // Hide this compiler thread from external view.
  1844   // Hide this compiler thread from external view.
  1845   bool is_hidden_from_external_view() const      { return true; }
  1845   bool is_hidden_from_external_view() const      { return true; }
  1846 
  1846 
  1847   CompileQueue* queue()                          { return _queue; }
  1847   void set_compiler(AbstractCompiler* c)         { _compiler = c; }
  1848   CompilerCounters* counters()                   { return _counters; }
  1848   AbstractCompiler* compiler() const             { return _compiler; }
       
  1849 
       
  1850   CompileQueue* queue()        const             { return _queue; }
       
  1851   CompilerCounters* counters() const             { return _counters; }
  1849 
  1852 
  1850   // Get/set the thread's compilation environment.
  1853   // Get/set the thread's compilation environment.
  1851   ciEnv*        env()                            { return _env; }
  1854   ciEnv*        env()                            { return _env; }
  1852   void          set_env(ciEnv* env)              { _env = env; }
  1855   void          set_env(ciEnv* env)              { _env = env; }
  1853 
  1856 
  1854   BufferBlob*   get_buffer_blob()                { return _buffer_blob; }
  1857   BufferBlob*   get_buffer_blob() const          { return _buffer_blob; }
  1855   void          set_buffer_blob(BufferBlob* b)   { _buffer_blob = b; };
  1858   void          set_buffer_blob(BufferBlob* b)   { _buffer_blob = b; };
  1856 
  1859 
  1857   // Get/set the thread's logging information
  1860   // Get/set the thread's logging information
  1858   CompileLog*   log()                            { return _log; }
  1861   CompileLog*   log()                            { return _log; }
  1859   void          init_log(CompileLog* log) {
  1862   void          init_log(CompileLog* log) {