45 #include "gc/g1/g1HeapTransition.hpp"
46 #include "gc/g1/g1HeapVerifier.hpp"
47 #include "gc/g1/g1HotCardCache.hpp"
48 #include "gc/g1/g1MemoryPool.hpp"
49 #include "gc/g1/g1OopClosures.inline.hpp"
50 #include "gc/g1/g1ParScanThreadState.inline.hpp"
51 #include "gc/g1/g1Policy.hpp"
52 #include "gc/g1/g1RegionToSpaceMapper.hpp"
53 #include "gc/g1/g1RemSet.hpp"
54 #include "gc/g1/g1RootClosures.hpp"
55 #include "gc/g1/g1RootProcessor.hpp"
56 #include "gc/g1/g1StringDedup.hpp"
57 #include "gc/g1/g1ThreadLocalData.hpp"
58 #include "gc/g1/g1YCTypes.hpp"
59 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
60 #include "gc/g1/heapRegion.inline.hpp"
61 #include "gc/g1/heapRegionRemSet.hpp"
62 #include "gc/g1/heapRegionSet.inline.hpp"
63 #include "gc/g1/vm_operations_g1.hpp"
64 #include "gc/shared/adaptiveSizePolicy.hpp"
65 #include "gc/shared/gcHeapSummary.hpp"
66 #include "gc/shared/gcId.hpp"
67 #include "gc/shared/gcLocker.hpp"
68 #include "gc/shared/gcTimer.hpp"
69 #include "gc/shared/gcTrace.hpp"
70 #include "gc/shared/gcTraceTime.inline.hpp"
71 #include "gc/shared/generationSpec.hpp"
72 #include "gc/shared/isGCActiveMark.hpp"
73 #include "gc/shared/preservedMarks.inline.hpp"
74 #include "gc/shared/suspendibleThreadSet.hpp"
75 #include "gc/shared/referenceProcessor.inline.hpp"
76 #include "gc/shared/taskqueue.inline.hpp"
77 #include "gc/shared/weakProcessor.hpp"
78 #include "logging/log.hpp"
79 #include "memory/allocation.hpp"
80 #include "memory/iterator.hpp"
81 #include "memory/resourceArea.hpp"
82 #include "oops/access.inline.hpp"
83 #include "oops/compressedOops.inline.hpp"
84 #include "oops/oop.inline.hpp"
375
376 // A successful humongous object allocation changes the used space
377 // information of the old generation so we need to recalculate the
378 // sizes and update the jstat counters here.
379 g1mm()->update_sizes();
380 }
381
382 _verifier->verify_region_sets_optional();
383
384 return result;
385 }
386
387 HeapWord* G1CollectedHeap::allocate_new_tlab(size_t word_size) {
388 assert_heap_not_locked_and_not_at_safepoint();
389 assert(!is_humongous(word_size), "we do not allow humongous TLABs");
390
391 return attempt_allocation(word_size);
392 }
393
394 HeapWord*
395 G1CollectedHeap::mem_allocate(size_t word_size,
396 bool* gc_overhead_limit_was_exceeded) {
397 assert_heap_not_locked_and_not_at_safepoint();
398
399 if (is_humongous(word_size)) {
400 return attempt_allocation_humongous(word_size);
401 }
402 return attempt_allocation(word_size);
403 }
404
405 HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size) {
406 ResourceMark rm; // For retrieving the thread names in log messages.
407
408 // Make sure you read the note in attempt_allocation_humongous().
409
410 assert_heap_not_locked_and_not_at_safepoint();
411 assert(!is_humongous(word_size), "attempt_allocation_slow() should not "
412 "be called for humongous allocation requests");
413
414 // We should only get here after the first-level allocation attempt
415 // (attempt_allocation()) failed to allocate.
416
417 // We will loop until a) we manage to successfully perform the
418 // allocation or b) we successfully schedule a collection which
|
45 #include "gc/g1/g1HeapTransition.hpp"
46 #include "gc/g1/g1HeapVerifier.hpp"
47 #include "gc/g1/g1HotCardCache.hpp"
48 #include "gc/g1/g1MemoryPool.hpp"
49 #include "gc/g1/g1OopClosures.inline.hpp"
50 #include "gc/g1/g1ParScanThreadState.inline.hpp"
51 #include "gc/g1/g1Policy.hpp"
52 #include "gc/g1/g1RegionToSpaceMapper.hpp"
53 #include "gc/g1/g1RemSet.hpp"
54 #include "gc/g1/g1RootClosures.hpp"
55 #include "gc/g1/g1RootProcessor.hpp"
56 #include "gc/g1/g1StringDedup.hpp"
57 #include "gc/g1/g1ThreadLocalData.hpp"
58 #include "gc/g1/g1YCTypes.hpp"
59 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
60 #include "gc/g1/heapRegion.inline.hpp"
61 #include "gc/g1/heapRegionRemSet.hpp"
62 #include "gc/g1/heapRegionSet.inline.hpp"
63 #include "gc/g1/vm_operations_g1.hpp"
64 #include "gc/shared/adaptiveSizePolicy.hpp"
65 #include "gc/shared/collectedHeap.inline.hpp"
66 #include "gc/shared/gcHeapSummary.hpp"
67 #include "gc/shared/gcId.hpp"
68 #include "gc/shared/gcLocker.hpp"
69 #include "gc/shared/gcTimer.hpp"
70 #include "gc/shared/gcTrace.hpp"
71 #include "gc/shared/gcTraceTime.inline.hpp"
72 #include "gc/shared/generationSpec.hpp"
73 #include "gc/shared/isGCActiveMark.hpp"
74 #include "gc/shared/preservedMarks.inline.hpp"
75 #include "gc/shared/suspendibleThreadSet.hpp"
76 #include "gc/shared/referenceProcessor.inline.hpp"
77 #include "gc/shared/taskqueue.inline.hpp"
78 #include "gc/shared/weakProcessor.hpp"
79 #include "logging/log.hpp"
80 #include "memory/allocation.hpp"
81 #include "memory/iterator.hpp"
82 #include "memory/resourceArea.hpp"
83 #include "oops/access.inline.hpp"
84 #include "oops/compressedOops.inline.hpp"
85 #include "oops/oop.inline.hpp"
376
377 // A successful humongous object allocation changes the used space
378 // information of the old generation so we need to recalculate the
379 // sizes and update the jstat counters here.
380 g1mm()->update_sizes();
381 }
382
383 _verifier->verify_region_sets_optional();
384
385 return result;
386 }
387
388 HeapWord* G1CollectedHeap::allocate_new_tlab(size_t word_size) {
389 assert_heap_not_locked_and_not_at_safepoint();
390 assert(!is_humongous(word_size), "we do not allow humongous TLABs");
391
392 return attempt_allocation(word_size);
393 }
394
395 HeapWord*
396 G1CollectedHeap::mem_allocate(size_t word_size, Klass* klass, Thread* thread,
397 bool* gc_overhead_limit_was_exceeded) {
398 assert_heap_not_locked_and_not_at_safepoint();
399
400 HeapWord* obj = allocate_from_tlab(klass, thread, word_size);
401 if (obj != NULL) {
402 return obj;
403 }
404 if (is_humongous(word_size)) {
405 return attempt_allocation_humongous(word_size);
406 }
407 return attempt_allocation(word_size);
408 }
409
410 HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size) {
411 ResourceMark rm; // For retrieving the thread names in log messages.
412
413 // Make sure you read the note in attempt_allocation_humongous().
414
415 assert_heap_not_locked_and_not_at_safepoint();
416 assert(!is_humongous(word_size), "attempt_allocation_slow() should not "
417 "be called for humongous allocation requests");
418
419 // We should only get here after the first-level allocation attempt
420 // (attempt_allocation()) failed to allocate.
421
422 // We will loop until a) we manage to successfully perform the
423 // allocation or b) we successfully schedule a collection which
|