< prev index next >

src/hotspot/share/gc/parallel/gcTaskThread.hpp

8221260: Initialize more class members on construction, remove some unused ones
Reviewed-by:

29 // Forward declarations of classes defined here.                                                                           
30 class GCTaskThread;                                                                                                        
31 class GCTaskTimeStamp;                                                                                                     
32 
33 // Declarations of classes referenced in this file via pointer.                                                            
34 class GCTaskManager;                                                                                                       
35 
36 class GCTaskThread : public WorkerThread {                                                                                 
37   friend class GCTaskManager;                                                                                              
38 private:                                                                                                                   
39   // Instance state.                                                                                                       
40   GCTaskManager* _manager;              // Manager for worker.                                                             
41   const uint     _processor_id;         // Which processor the worker is on.                                               
42 
43   GCTaskTimeStamp* _time_stamps;                                                                                           
44   uint _time_stamp_index;                                                                                                  
45 
46   GCTaskTimeStamp* time_stamp_at(uint index);                                                                              
47   void add_task_timestamp(const char* name, jlong t_entry, jlong t_exit);                                                  
48 
49   bool _is_working;                     // True if participating in GC tasks                                               
50                                                                                                                            
51   // Factory create and destroy methods.                                                                                   
52   static GCTaskThread* create(GCTaskManager* manager,                                                                      
53                               uint           which,                                                                        
54                               uint           processor_id) {                                                               
55     return new GCTaskThread(manager, which, processor_id);                                                                 
56   }                                                                                                                        
57  public:                                                                                                                   
58 
59   static void destroy(GCTaskThread* manager) {                                                                             
60     if (manager != NULL) {                                                                                                 
61       delete manager;                                                                                                      
62     }                                                                                                                      
63   }                                                                                                                        
64   // Methods from Thread.                                                                                                  
65   bool is_GC_task_thread() const {                                                                                         
66     return true;                                                                                                           
67   }                                                                                                                        
68   virtual void run();                                                                                                      
69 
70   void print_task_time_stamps();                                                                                           
71 
72 protected:                                                                                                                 
73   // Constructor.  Clients use factory, but there could be subclasses.                                                     
74   GCTaskThread(GCTaskManager* manager, uint which, uint processor_id);                                                     
75   // Destructor: virtual destructor because of virtual methods.                                                            
76   virtual ~GCTaskThread();                                                                                                 
77   // Accessors.                                                                                                            
78   GCTaskManager* manager() const {                                                                                         
79     return _manager;                                                                                                       
80   }                                                                                                                        
81   uint which() const {                                                                                                     
82     return id();                                                                                                           
83   }                                                                                                                        
84   uint processor_id() const {                                                                                              
85     return _processor_id;                                                                                                  
86   }                                                                                                                        
87   void set_is_working(bool v) { _is_working = v; }                                                                         
88 };                                                                                                                         
89 
90 class GCTaskTimeStamp : public CHeapObj<mtGC>                                                                              
91 {                                                                                                                          
92  private:                                                                                                                  
93   jlong  _entry_time;                                                                                                      
94   jlong  _exit_time;                                                                                                       
95   const char*  _name;                                                                                                      
96 
97  public:                                                                                                                   
98   jlong entry_time()              { return _entry_time; }                                                                  
99   jlong exit_time()               { return _exit_time; }                                                                   
100   const char* name() const        { return _name; }                                                                        
101 
102   void set_entry_time(jlong time) { _entry_time = time; }                                                                  
103   void set_exit_time(jlong time)  { _exit_time = time; }                                                                   
104   void set_name(const char* name) { _name = name; }                                                                        
105 };                                                                                                                         
106 

29 // Forward declarations of classes defined here.
30 class GCTaskThread;
31 class GCTaskTimeStamp;
32 
33 // Declarations of classes referenced in this file via pointer.
34 class GCTaskManager;
35 
36 class GCTaskThread : public WorkerThread {
37   friend class GCTaskManager;
38 private:
39   // Instance state.
40   GCTaskManager* _manager;              // Manager for worker.
41   const uint     _processor_id;         // Which processor the worker is on.
42 
43   GCTaskTimeStamp* _time_stamps;
44   uint _time_stamp_index;
45 
46   GCTaskTimeStamp* time_stamp_at(uint index);
47   void add_task_timestamp(const char* name, jlong t_entry, jlong t_exit);
48 


49   // Factory create and destroy methods.
50   static GCTaskThread* create(GCTaskManager* manager,
51                               uint           which,
52                               uint           processor_id) {
53     return new GCTaskThread(manager, which, processor_id);
54   }
55  public:
56 
57   static void destroy(GCTaskThread* manager) {
58     if (manager != NULL) {
59       delete manager;
60     }
61   }
62   // Methods from Thread.
63   bool is_GC_task_thread() const {
64     return true;
65   }
66   virtual void run();
67 
68   void print_task_time_stamps();
69 
70 protected:
71   // Constructor.  Clients use factory, but there could be subclasses.
72   GCTaskThread(GCTaskManager* manager, uint which, uint processor_id);
73   // Destructor: virtual destructor because of virtual methods.
74   virtual ~GCTaskThread();
75   // Accessors.
76   GCTaskManager* manager() const {
77     return _manager;
78   }
79   uint which() const {
80     return id();
81   }
82   uint processor_id() const {
83     return _processor_id;
84   }

85 };
86 
87 class GCTaskTimeStamp : public CHeapObj<mtGC>
88 {
89  private:
90   jlong  _entry_time;
91   jlong  _exit_time;
92   const char*  _name;
93 
94  public:
95   jlong entry_time()              { return _entry_time; }
96   jlong exit_time()               { return _exit_time; }
97   const char* name() const        { return _name; }
98 
99   void set_entry_time(jlong time) { _entry_time = time; }
100   void set_exit_time(jlong time)  { _exit_time = time; }
101   void set_name(const char* name) { _name = name; }
102 };
103 
< prev index next >