Mercurial > hg > graal-jvmci-8
comparison src/share/vm/utilities/taskqueue.cpp @ 845:df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
Summary: Modifications to G1 so as to allow the use of compressed oops.
Reviewed-by: apetrusenko, coleenp, jmasa, kvn, never, phh, tonyp
author | ysr |
---|---|
date | Tue, 14 Jul 2009 15:40:39 -0700 |
parents | 0fbdb4381b99 |
children | 2a1472c30599 |
comparison
equal
deleted
inserted
replaced
839:bb18957ad21e | 845:df6caf649ff7 |
---|---|
62 bool ParallelTaskTerminator::peek_in_queue_set() { | 62 bool ParallelTaskTerminator::peek_in_queue_set() { |
63 return _queue_set->peek(); | 63 return _queue_set->peek(); |
64 } | 64 } |
65 | 65 |
66 void ParallelTaskTerminator::yield() { | 66 void ParallelTaskTerminator::yield() { |
67 assert(_offered_termination <= _n_threads, "Invariant"); | |
67 os::yield(); | 68 os::yield(); |
68 } | 69 } |
69 | 70 |
70 void ParallelTaskTerminator::sleep(uint millis) { | 71 void ParallelTaskTerminator::sleep(uint millis) { |
72 assert(_offered_termination <= _n_threads, "Invariant"); | |
71 os::sleep(Thread::current(), millis, false); | 73 os::sleep(Thread::current(), millis, false); |
72 } | 74 } |
73 | 75 |
74 bool | 76 bool |
75 ParallelTaskTerminator::offer_termination(TerminatorTerminator* terminator) { | 77 ParallelTaskTerminator::offer_termination(TerminatorTerminator* terminator) { |
78 assert(_offered_termination < _n_threads, "Invariant"); | |
76 Atomic::inc(&_offered_termination); | 79 Atomic::inc(&_offered_termination); |
77 | 80 |
78 uint yield_count = 0; | 81 uint yield_count = 0; |
79 // Number of hard spin loops done since last yield | 82 // Number of hard spin loops done since last yield |
80 uint hard_spin_count = 0; | 83 uint hard_spin_count = 0; |
94 uint hard_spin_start = hard_spin_limit; | 97 uint hard_spin_start = hard_spin_limit; |
95 | 98 |
96 // Loop waiting for all threads to offer termination or | 99 // Loop waiting for all threads to offer termination or |
97 // more work. | 100 // more work. |
98 while (true) { | 101 while (true) { |
102 assert(_offered_termination <= _n_threads, "Invariant"); | |
99 // Are all threads offering termination? | 103 // Are all threads offering termination? |
100 if (_offered_termination == _n_threads) { | 104 if (_offered_termination == _n_threads) { |
101 return true; | 105 return true; |
102 } else { | 106 } else { |
103 // Look for more work. | 107 // Look for more work. |
149 _total_peeks++; | 153 _total_peeks++; |
150 #endif | 154 #endif |
151 if (peek_in_queue_set() || | 155 if (peek_in_queue_set() || |
152 (terminator != NULL && terminator->should_exit_termination())) { | 156 (terminator != NULL && terminator->should_exit_termination())) { |
153 Atomic::dec(&_offered_termination); | 157 Atomic::dec(&_offered_termination); |
158 assert(_offered_termination < _n_threads, "Invariant"); | |
154 return false; | 159 return false; |
155 } | 160 } |
156 } | 161 } |
157 } | 162 } |
158 } | 163 } |