39 class CompileTask : public CHeapObj<mtCompiler> { 40 friend class VMStructs; 41 friend class JVMCIVMStructs; 42 43 private: 44 static CompileTask* _task_free_list; 45 #ifdef ASSERT 46 static int _num_allocated_tasks; 47 #endif 48 49 Monitor* _lock; 50 uint _compile_id; 51 Method* _method; 52 jobject _method_holder; 53 int _osr_bci; 54 bool _is_complete; 55 bool _is_success; 56 bool _is_blocking; 57 #if INCLUDE_JVMCI 58 bool _has_waiter; 59 #endif 60 int _comp_level; 61 int _num_inlined_bytecodes; 62 nmethodLocker* _code_handle; // holder of eventual result 63 CompileTask* _next, *_prev; 64 bool _is_free; 65 // Fields used for logging why the compilation was initiated: 66 jlong _time_queued; // in units of os::elapsed_counter() 67 Method* _hot_method; // which method actually triggered this task 68 jobject _hot_method_holder; 69 int _hot_count; // information about its invocation counter 70 const char* _comment; // more info about the task 71 const char* _failure_reason; 72 73 public: 74 CompileTask() { 75 _lock = new Monitor(Mutex::nonleaf+2, "CompileTaskLock"); 76 } 77 78 void initialize(int compile_id, const methodHandle& method, int osr_bci, int comp_level, 79 const methodHandle& hot_method, int hot_count, const char* comment, 80 bool is_blocking); 81 82 static CompileTask* allocate(); 83 static void free(CompileTask* task); 84 85 int compile_id() const { return _compile_id; } 86 Method* method() const { return _method; } 87 Method* hot_method() const { return _hot_method; } 88 int osr_bci() const { return _osr_bci; } 89 bool is_complete() const { return _is_complete; } 90 bool is_blocking() const { return _is_blocking; } 91 bool is_success() const { return _is_success; } 92 #if INCLUDE_JVMCI 93 bool has_waiter() const { return _has_waiter; } 94 void clear_waiter() { _has_waiter = false; } 95 #endif 96 97 nmethodLocker* code_handle() const { return _code_handle; } 98 void set_code_handle(nmethodLocker* l) { _code_handle = l; } 99 nmethod* code() const; // _code_handle->code() 100 void set_code(nmethod* nm); // _code_handle->set_code(nm) 101 102 Monitor* lock() const { return _lock; } 103 104 void mark_complete() { _is_complete = true; } 105 void mark_success() { _is_success = true; } 106 107 int comp_level() { return _comp_level;} 108 void set_comp_level(int comp_level) { _comp_level = comp_level;} 109 110 int num_inlined_bytecodes() const { return _num_inlined_bytecodes; } 111 void set_num_inlined_bytecodes(int n) { _num_inlined_bytecodes = n; } 112 113 CompileTask* next() const { return _next; } 114 void set_next(CompileTask* next) { _next = next; } | 39 class CompileTask : public CHeapObj<mtCompiler> { 40 friend class VMStructs; 41 friend class JVMCIVMStructs; 42 43 private: 44 static CompileTask* _task_free_list; 45 #ifdef ASSERT 46 static int _num_allocated_tasks; 47 #endif 48 49 Monitor* _lock; 50 uint _compile_id; 51 Method* _method; 52 jobject _method_holder; 53 int _osr_bci; 54 bool _is_complete; 55 bool _is_success; 56 bool _is_blocking; 57 #if INCLUDE_JVMCI 58 bool _has_waiter; 59 // Compiler thread for a blocking JVMCI compilation 60 CompilerThread* _jvmci_compiler_thread; 61 #endif 62 int _comp_level; 63 int _num_inlined_bytecodes; 64 nmethodLocker* _code_handle; // holder of eventual result 65 CompileTask* _next, *_prev; 66 bool _is_free; 67 // Fields used for logging why the compilation was initiated: 68 jlong _time_queued; // in units of os::elapsed_counter() 69 Method* _hot_method; // which method actually triggered this task 70 jobject _hot_method_holder; 71 int _hot_count; // information about its invocation counter 72 const char* _comment; // more info about the task 73 const char* _failure_reason; 74 75 public: 76 CompileTask() { 77 _lock = new Monitor(Mutex::nonleaf+2, "CompileTaskLock"); 78 } 79 80 void initialize(int compile_id, const methodHandle& method, int osr_bci, int comp_level, 81 const methodHandle& hot_method, int hot_count, const char* comment, 82 bool is_blocking); 83 84 static CompileTask* allocate(); 85 static void free(CompileTask* task); 86 87 int compile_id() const { return _compile_id; } 88 Method* method() const { return _method; } 89 Method* hot_method() const { return _hot_method; } 90 int osr_bci() const { return _osr_bci; } 91 bool is_complete() const { return _is_complete; } 92 bool is_blocking() const { return _is_blocking; } 93 bool is_success() const { return _is_success; } 94 #if INCLUDE_JVMCI 95 bool has_waiter() const { return _has_waiter; } 96 void clear_waiter() { _has_waiter = false; } 97 CompilerThread* jvmci_compiler_thread() const { return _jvmci_compiler_thread; } 98 void set_jvmci_compiler_thread(CompilerThread* t) { 99 assert(is_blocking(), "must be"); 100 assert((t == NULL) != (_jvmci_compiler_thread == NULL), "must be"); 101 _jvmci_compiler_thread = t; 102 } 103 #endif 104 105 nmethodLocker* code_handle() const { return _code_handle; } 106 void set_code_handle(nmethodLocker* l) { _code_handle = l; } 107 nmethod* code() const; // _code_handle->code() 108 void set_code(nmethod* nm); // _code_handle->set_code(nm) 109 110 Monitor* lock() const { return _lock; } 111 112 void mark_complete() { _is_complete = true; } 113 void mark_success() { _is_success = true; } 114 115 int comp_level() { return _comp_level;} 116 void set_comp_level(int comp_level) { _comp_level = comp_level;} 117 118 int num_inlined_bytecodes() const { return _num_inlined_bytecodes; } 119 void set_num_inlined_bytecodes(int n) { _num_inlined_bytecodes = n; } 120 121 CompileTask* next() const { return _next; } 122 void set_next(CompileTask* next) { _next = next; } |