186 // the table will eventually happen if the situation persists.
187 _resized_table = G1StringDedupTable::prepare_resize();
188 if (!is_resizing()) {
189 _rehashed_table = G1StringDedupTable::prepare_rehash();
190 }
191 }
192 }
193
194 G1StringDedupUnlinkOrOopsDoClosure::~G1StringDedupUnlinkOrOopsDoClosure() {
195 assert(!is_resizing() || !is_rehashing(), "Can not both resize and rehash");
196 if (is_resizing()) {
197 G1StringDedupTable::finish_resize(_resized_table);
198 } else if (is_rehashing()) {
199 G1StringDedupTable::finish_rehash(_rehashed_table);
200 }
201 }
202
203 // Atomically claims the next available queue for exclusive access by
204 // the current thread. Returns the queue number of the claimed queue.
205 size_t G1StringDedupUnlinkOrOopsDoClosure::claim_queue() {
206 return (size_t)Atomic::add_ptr(1, &_next_queue) - 1;
207 }
208
209 // Atomically claims the next available table partition for exclusive
210 // access by the current thread. Returns the table bucket number where
211 // the claimed partition starts.
212 size_t G1StringDedupUnlinkOrOopsDoClosure::claim_table_partition(size_t partition_size) {
213 return (size_t)Atomic::add_ptr(partition_size, &_next_bucket) - partition_size;
214 }
|
186 // the table will eventually happen if the situation persists.
187 _resized_table = G1StringDedupTable::prepare_resize();
188 if (!is_resizing()) {
189 _rehashed_table = G1StringDedupTable::prepare_rehash();
190 }
191 }
192 }
193
194 G1StringDedupUnlinkOrOopsDoClosure::~G1StringDedupUnlinkOrOopsDoClosure() {
195 assert(!is_resizing() || !is_rehashing(), "Can not both resize and rehash");
196 if (is_resizing()) {
197 G1StringDedupTable::finish_resize(_resized_table);
198 } else if (is_rehashing()) {
199 G1StringDedupTable::finish_rehash(_rehashed_table);
200 }
201 }
202
203 // Atomically claims the next available queue for exclusive access by
204 // the current thread. Returns the queue number of the claimed queue.
205 size_t G1StringDedupUnlinkOrOopsDoClosure::claim_queue() {
206 return Atomic::add((size_t)1, &_next_queue) - 1;
207 }
208
209 // Atomically claims the next available table partition for exclusive
210 // access by the current thread. Returns the table bucket number where
211 // the claimed partition starts.
212 size_t G1StringDedupUnlinkOrOopsDoClosure::claim_table_partition(size_t partition_size) {
213 return (size_t)Atomic::add(partition_size, &_next_bucket) - partition_size;
214 }
|