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