20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 /* |
|
26 * This file has been modified by Loongson Technology in 2015. These |
|
27 * modifications are Copyright (c) 2015 Loongson Technology, and are made |
|
28 * available on the same license terms set forth above. |
|
29 */ |
|
30 |
|
31 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKMANAGER_HPP |
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKMANAGER_HPP |
32 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKMANAGER_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKMANAGER_HPP |
33 |
27 |
34 #include "runtime/mutex.hpp" |
28 #include "runtime/mutex.hpp" |
35 #include "utilities/growableArray.hpp" |
29 #include "utilities/growableArray.hpp" |
78 }; |
72 }; |
79 private: |
73 private: |
80 // Instance state. |
74 // Instance state. |
81 const Kind::kind _kind; // For runtime type checking. |
75 const Kind::kind _kind; // For runtime type checking. |
82 const uint _affinity; // Which worker should run task. |
76 const uint _affinity; // Which worker should run task. |
83 int _numa_id; //Which numa node should run task. |
|
84 GCTask* _newer; // Tasks are on doubly-linked ... |
77 GCTask* _newer; // Tasks are on doubly-linked ... |
85 GCTask* _older; // ... lists. |
78 GCTask* _older; // ... lists. |
86 public: |
79 public: |
87 virtual char* name() { return (char *)"task"; } |
80 virtual char* name() { return (char *)"task"; } |
88 |
81 |
184 void enqueue(GCTaskQueue* list); |
171 void enqueue(GCTaskQueue* list); |
185 // Dequeue one task. |
172 // Dequeue one task. |
186 GCTask* dequeue(); |
173 GCTask* dequeue(); |
187 // Dequeue one task, preferring one with affinity. |
174 // Dequeue one task, preferring one with affinity. |
188 GCTask* dequeue(uint affinity); |
175 GCTask* dequeue(uint affinity); |
189 // Dequeue one task, preferring on with numa_aware. |
|
190 GCTask* numa_dequeue(int numa_id); |
|
191 protected: |
176 protected: |
192 // Constructor. Clients use factory, but there might be subclasses. |
177 // Constructor. Clients use factory, but there might be subclasses. |
193 GCTaskQueue(bool on_c_heap); |
178 GCTaskQueue(bool on_c_heap); |
194 // Destructor-like method. |
179 // Destructor-like method. |
195 // Because ResourceMark doesn't call destructors. |
180 // Because ResourceMark doesn't call destructors. |
273 return unsynchronized_queue()->dequeue(); |
258 return unsynchronized_queue()->dequeue(); |
274 } |
259 } |
275 GCTask* dequeue(uint affinity) { |
260 GCTask* dequeue(uint affinity) { |
276 guarantee(own_lock(), "don't own the lock"); |
261 guarantee(own_lock(), "don't own the lock"); |
277 return unsynchronized_queue()->dequeue(affinity); |
262 return unsynchronized_queue()->dequeue(affinity); |
278 } |
|
279 GCTask* numa_dequeue(int numa_id) { |
|
280 guarantee(own_lock(), "don't own the lock"); |
|
281 return unsynchronized_queue()->numa_dequeue(numa_id); |
|
282 } |
263 } |
283 uint length() const { |
264 uint length() const { |
284 guarantee(own_lock(), "don't own the lock"); |
265 guarantee(own_lock(), "don't own the lock"); |
285 return unsynchronized_queue()->length(); |
266 return unsynchronized_queue()->length(); |
286 } |
267 } |