Mercurial > hg > graal-jvmci-8
comparison src/share/vm/utilities/yieldingWorkgroup.hpp @ 4728:441e946dc1af
7121618: Change type of number of GC workers to unsigned int.
Summary: Change variables representing the number of GC workers to uint from int and size_t. Change the parameter in work(int i) to work(uint worker_id).
Reviewed-by: brutisso, tonyp
author | jmasa |
---|---|
date | Wed, 14 Dec 2011 13:34:57 -0800 |
parents | bca17e38de00 |
children | 32164d89fe9c |
comparison
equal
deleted
inserted
replaced
4727:67fdcb391461 | 4728:441e946dc1af |
---|---|
69 FlexibleGangTask(const char* name): AbstractGangTask(name), | 69 FlexibleGangTask(const char* name): AbstractGangTask(name), |
70 _requested_size(0) {} | 70 _requested_size(0) {} |
71 | 71 |
72 // The abstract work method. | 72 // The abstract work method. |
73 // The argument tells you which member of the gang you are. | 73 // The argument tells you which member of the gang you are. |
74 virtual void work(int i) = 0; | 74 virtual void work(uint worker_id) = 0; |
75 | 75 |
76 int requested_size() const { return _requested_size; } | 76 int requested_size() const { return _requested_size; } |
77 int actual_size() const { return _actual_size; } | 77 int actual_size() const { return _actual_size; } |
78 | 78 |
79 void set_requested_size(int sz) { _requested_size = sz; } | 79 void set_requested_size(int sz) { _requested_size = sz; } |
126 } | 126 } |
127 | 127 |
128 public: | 128 public: |
129 // The abstract work method. | 129 // The abstract work method. |
130 // The argument tells you which member of the gang you are. | 130 // The argument tells you which member of the gang you are. |
131 virtual void work(int i) = 0; | 131 virtual void work(uint worker_id) = 0; |
132 | 132 |
133 // Subclasses should call the parent's yield() method | 133 // Subclasses should call the parent's yield() method |
134 // after having done any work specific to the subclass. | 134 // after having done any work specific to the subclass. |
135 virtual void yield(); | 135 virtual void yield(); |
136 | 136 |
157 // being the thread that orchestrates the WorkGang via run_task(). | 157 // being the thread that orchestrates the WorkGang via run_task(). |
158 class YieldingFlexibleWorkGang: public FlexibleWorkGang { | 158 class YieldingFlexibleWorkGang: public FlexibleWorkGang { |
159 // Here's the public interface to this class. | 159 // Here's the public interface to this class. |
160 public: | 160 public: |
161 // Constructor and destructor. | 161 // Constructor and destructor. |
162 YieldingFlexibleWorkGang(const char* name, int workers, | 162 YieldingFlexibleWorkGang(const char* name, uint workers, |
163 bool are_GC_task_threads); | 163 bool are_GC_task_threads); |
164 | 164 |
165 YieldingFlexibleGangTask* yielding_task() const { | 165 YieldingFlexibleGangTask* yielding_task() const { |
166 assert(task() == NULL || task()->is_YieldingFlexibleGang_task(), | 166 assert(task() == NULL || task()->is_YieldingFlexibleGang_task(), |
167 "Incorrect cast"); | 167 "Incorrect cast"); |
168 return (YieldingFlexibleGangTask*)task(); | 168 return (YieldingFlexibleGangTask*)task(); |
169 } | 169 } |
170 // Allocate a worker and return a pointer to it. | 170 // Allocate a worker and return a pointer to it. |
171 GangWorker* allocate_worker(int which); | 171 GangWorker* allocate_worker(uint which); |
172 | 172 |
173 // Run a task; returns when the task is done, or the workers yield, | 173 // Run a task; returns when the task is done, or the workers yield, |
174 // or the task is aborted, or the work gang is terminated via stop(). | 174 // or the task is aborted, or the work gang is terminated via stop(). |
175 // A task that has been yielded can be continued via this same interface | 175 // A task that has been yielded can be continued via this same interface |
176 // by using the same task repeatedly as the argument to the call. | 176 // by using the same task repeatedly as the argument to the call. |
197 // stations, whence they are ready for the next task dispatched | 197 // stations, whence they are ready for the next task dispatched |
198 // by the overseer. | 198 // by the overseer. |
199 void abort(); | 199 void abort(); |
200 | 200 |
201 private: | 201 private: |
202 int _yielded_workers; | 202 uint _yielded_workers; |
203 void wait_for_gang(); | 203 void wait_for_gang(); |
204 | 204 |
205 public: | 205 public: |
206 // Accessors for fields | 206 // Accessors for fields |
207 int yielded_workers() const { | 207 uint yielded_workers() const { |
208 return _yielded_workers; | 208 return _yielded_workers; |
209 } | 209 } |
210 | 210 |
211 private: | 211 private: |
212 friend class YieldingFlexibleGangWorker; | 212 friend class YieldingFlexibleGangWorker; |