2012 bool is_Code_cache_sweeper_thread() const { return true; }
2013
2014 // Prevent GC from unloading _scanned_compiled_method
2015 void oops_do(OopClosure* f, CodeBlobClosure* cf);
2016 void nmethods_do(CodeBlobClosure* cf);
2017 };
2018
2019 // A thread used for Compilation.
2020 class CompilerThread : public JavaThread {
2021 friend class VMStructs;
2022 private:
2023 CompilerCounters* _counters;
2024
2025 ciEnv* _env;
2026 CompileLog* _log;
2027 CompileTask* volatile _task; // print_threads_compiling can read this concurrently.
2028 CompileQueue* _queue;
2029 BufferBlob* _buffer_blob;
2030
2031 AbstractCompiler* _compiler;
2032
2033 public:
2034
2035 static CompilerThread* current();
2036
2037 CompilerThread(CompileQueue* queue, CompilerCounters* counters);
2038
2039 bool is_Compiler_thread() const { return true; }
2040
2041 virtual bool can_call_java() const;
2042
2043 // Hide native compiler threads from external view.
2044 bool is_hidden_from_external_view() const { return !can_call_java(); }
2045
2046 void set_compiler(AbstractCompiler* c) { _compiler = c; }
2047 AbstractCompiler* compiler() const { return _compiler; }
2048
2049 CompileQueue* queue() const { return _queue; }
2050 CompilerCounters* counters() const { return _counters; }
2051
2052 // Get/set the thread's compilation environment.
2053 ciEnv* env() { return _env; }
2054 void set_env(ciEnv* env) { _env = env; }
2055
2056 BufferBlob* get_buffer_blob() const { return _buffer_blob; }
2057 void set_buffer_blob(BufferBlob* b) { _buffer_blob = b; }
2058
2059 // Get/set the thread's logging information
2060 CompileLog* log() { return _log; }
2061 void init_log(CompileLog* log) {
2062 // Set once, for good.
2063 assert(_log == NULL, "set only once");
2064 _log = log;
2065 }
2066
2067 #ifndef PRODUCT
2068 private:
2069 IdealGraphPrinter *_ideal_graph_printer;
2070 public:
2071 IdealGraphPrinter *ideal_graph_printer() { return _ideal_graph_printer; }
2072 void set_ideal_graph_printer(IdealGraphPrinter *n) { _ideal_graph_printer = n; }
2073 #endif
2074
2075 // Get/set the thread's current task
2076 CompileTask* task() { return _task; }
2077 void set_task(CompileTask* task) { _task = task; }
2078 };
2079
2080 inline CompilerThread* CompilerThread::current() {
2081 return JavaThread::current()->as_CompilerThread();
2082 }
2083
2084 // The active thread queue. It also keeps track of the current used
|
2012 bool is_Code_cache_sweeper_thread() const { return true; }
2013
2014 // Prevent GC from unloading _scanned_compiled_method
2015 void oops_do(OopClosure* f, CodeBlobClosure* cf);
2016 void nmethods_do(CodeBlobClosure* cf);
2017 };
2018
2019 // A thread used for Compilation.
2020 class CompilerThread : public JavaThread {
2021 friend class VMStructs;
2022 private:
2023 CompilerCounters* _counters;
2024
2025 ciEnv* _env;
2026 CompileLog* _log;
2027 CompileTask* volatile _task; // print_threads_compiling can read this concurrently.
2028 CompileQueue* _queue;
2029 BufferBlob* _buffer_blob;
2030
2031 AbstractCompiler* _compiler;
2032 TimeStamp _idle_time;
2033
2034 public:
2035
2036 static CompilerThread* current();
2037
2038 CompilerThread(CompileQueue* queue, CompilerCounters* counters);
2039 ~CompilerThread();
2040
2041 bool is_Compiler_thread() const { return true; }
2042
2043 virtual bool can_call_java() const;
2044
2045 // Hide native compiler threads from external view.
2046 bool is_hidden_from_external_view() const { return !can_call_java(); }
2047
2048 void set_compiler(AbstractCompiler* c) { _compiler = c; }
2049 AbstractCompiler* compiler() const { return _compiler; }
2050
2051 CompileQueue* queue() const { return _queue; }
2052 CompilerCounters* counters() const { return _counters; }
2053
2054 // Get/set the thread's compilation environment.
2055 ciEnv* env() { return _env; }
2056 void set_env(ciEnv* env) { _env = env; }
2057
2058 BufferBlob* get_buffer_blob() const { return _buffer_blob; }
2059 void set_buffer_blob(BufferBlob* b) { _buffer_blob = b; }
2060
2061 // Get/set the thread's logging information
2062 CompileLog* log() { return _log; }
2063 void init_log(CompileLog* log) {
2064 // Set once, for good.
2065 assert(_log == NULL, "set only once");
2066 _log = log;
2067 }
2068
2069 void start_idle_timer() { _idle_time.update(); }
2070 jlong idle_time_millis() {
2071 return TimeHelper::counter_to_millis(_idle_time.ticks_since_update());
2072 }
2073
2074 #ifndef PRODUCT
2075 private:
2076 IdealGraphPrinter *_ideal_graph_printer;
2077 public:
2078 IdealGraphPrinter *ideal_graph_printer() { return _ideal_graph_printer; }
2079 void set_ideal_graph_printer(IdealGraphPrinter *n) { _ideal_graph_printer = n; }
2080 #endif
2081
2082 // Get/set the thread's current task
2083 CompileTask* task() { return _task; }
2084 void set_task(CompileTask* task) { _task = task; }
2085 };
2086
2087 inline CompilerThread* CompilerThread::current() {
2088 return JavaThread::current()->as_CompilerThread();
2089 }
2090
2091 // The active thread queue. It also keeps track of the current used
|