1 /* |
1 /* |
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
259 |
259 |
260 HeapWord* result = young_gen()->allocate(size); |
260 HeapWord* result = young_gen()->allocate(size); |
261 |
261 |
262 uint loop_count = 0; |
262 uint loop_count = 0; |
263 uint gc_count = 0; |
263 uint gc_count = 0; |
264 int gclocker_stalled_count = 0; |
264 uint gclocker_stalled_count = 0; |
265 |
265 |
266 while (result == NULL) { |
266 while (result == NULL) { |
267 // We don't want to have multiple collections for a single filled generation. |
267 // We don't want to have multiple collections for a single filled generation. |
268 // To prevent this, each thread tracks the total_collections() value, and if |
268 // To prevent this, each thread tracks the total_collections() value, and if |
269 // the count has changed, does not do a new collection. |
269 // the count has changed, does not do a new collection. |
519 // This method is used by System.gc() and JVMTI. |
519 // This method is used by System.gc() and JVMTI. |
520 void ParallelScavengeHeap::collect(GCCause::Cause cause) { |
520 void ParallelScavengeHeap::collect(GCCause::Cause cause) { |
521 assert(!Heap_lock->owned_by_self(), |
521 assert(!Heap_lock->owned_by_self(), |
522 "this thread should not own the Heap_lock"); |
522 "this thread should not own the Heap_lock"); |
523 |
523 |
524 unsigned int gc_count = 0; |
524 uint gc_count = 0; |
525 unsigned int full_gc_count = 0; |
525 uint full_gc_count = 0; |
526 { |
526 { |
527 MutexLocker ml(Heap_lock); |
527 MutexLocker ml(Heap_lock); |
528 // This value is guarded by the Heap_lock |
528 // This value is guarded by the Heap_lock |
529 gc_count = Universe::heap()->total_collections(); |
529 gc_count = Universe::heap()->total_collections(); |
530 full_gc_count = Universe::heap()->total_full_collections(); |
530 full_gc_count = Universe::heap()->total_full_collections(); |