1980 inline CompilerThread* JavaThread::as_CompilerThread() { 1981 assert(is_Compiler_thread(), "just checking"); 1982 return (CompilerThread*)this; 1983 } 1984 1985 // Dedicated thread to sweep the code cache 1986 class CodeCacheSweeperThread : public JavaThread { 1987 nmethod* _scanned_nmethod; // nmethod being scanned by the sweeper 1988 public: 1989 CodeCacheSweeperThread(); 1990 // Track the nmethod currently being scanned by the sweeper 1991 void set_scanned_nmethod(nmethod* nm) { 1992 assert(_scanned_nmethod == NULL || nm == NULL, "should reset to NULL before writing a new value"); 1993 _scanned_nmethod = nm; 1994 } 1995 1996 // Hide sweeper thread from external view. 1997 bool is_hidden_from_external_view() const { return true; } 1998 1999 bool is_Code_cache_sweeper_thread() const { return true; } 2000 // GC support 2001 // Apply "f->do_oop" to all root oops in "this". 2002 // Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames 2003 void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf); 2004 }; 2005 2006 // A thread used for Compilation. 2007 class CompilerThread : public JavaThread { 2008 friend class VMStructs; 2009 private: 2010 CompilerCounters* _counters; 2011 2012 ciEnv* _env; 2013 CompileLog* _log; 2014 CompileTask* _task; 2015 CompileQueue* _queue; 2016 BufferBlob* _buffer_blob; 2017 2018 AbstractCompiler* _compiler; 2019 2020 public: 2021 2022 static CompilerThread* current(); 2023 | 1980 inline CompilerThread* JavaThread::as_CompilerThread() { 1981 assert(is_Compiler_thread(), "just checking"); 1982 return (CompilerThread*)this; 1983 } 1984 1985 // Dedicated thread to sweep the code cache 1986 class CodeCacheSweeperThread : public JavaThread { 1987 nmethod* _scanned_nmethod; // nmethod being scanned by the sweeper 1988 public: 1989 CodeCacheSweeperThread(); 1990 // Track the nmethod currently being scanned by the sweeper 1991 void set_scanned_nmethod(nmethod* nm) { 1992 assert(_scanned_nmethod == NULL || nm == NULL, "should reset to NULL before writing a new value"); 1993 _scanned_nmethod = nm; 1994 } 1995 1996 // Hide sweeper thread from external view. 1997 bool is_hidden_from_external_view() const { return true; } 1998 1999 bool is_Code_cache_sweeper_thread() const { return true; } 2000 2001 // Prevent GC from unloading _scanned_nmethod 2002 void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf); 2003 void nmethods_do(CodeBlobClosure* cf); 2004 }; 2005 2006 // A thread used for Compilation. 2007 class CompilerThread : public JavaThread { 2008 friend class VMStructs; 2009 private: 2010 CompilerCounters* _counters; 2011 2012 ciEnv* _env; 2013 CompileLog* _log; 2014 CompileTask* _task; 2015 CompileQueue* _queue; 2016 BufferBlob* _buffer_blob; 2017 2018 AbstractCompiler* _compiler; 2019 2020 public: 2021 2022 static CompilerThread* current(); 2023 |