20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "aot/aotLoader.hpp"
27 #include "classfile/classLoaderDataGraph.hpp"
28 #include "classfile/symbolTable.hpp"
29 #include "classfile/stringTable.hpp"
30 #include "classfile/systemDictionary.hpp"
31 #include "classfile/vmSymbols.hpp"
32 #include "code/codeCache.hpp"
33 #include "code/icBuffer.hpp"
34 #include "gc/serial/defNewGeneration.hpp"
35 #include "gc/shared/adaptiveSizePolicy.hpp"
36 #include "gc/shared/cardTableBarrierSet.hpp"
37 #include "gc/shared/cardTableRS.hpp"
38 #include "gc/shared/collectedHeap.inline.hpp"
39 #include "gc/shared/collectorCounters.hpp"
40 #include "gc/shared/gcId.hpp"
41 #include "gc/shared/gcLocker.hpp"
42 #include "gc/shared/gcPolicyCounters.hpp"
43 #include "gc/shared/gcTrace.hpp"
44 #include "gc/shared/gcTraceTime.inline.hpp"
45 #include "gc/shared/genCollectedHeap.hpp"
46 #include "gc/shared/genOopClosures.inline.hpp"
47 #include "gc/shared/generationSpec.hpp"
48 #include "gc/shared/oopStorageParState.inline.hpp"
49 #include "gc/shared/space.hpp"
50 #include "gc/shared/strongRootsScope.hpp"
51 #include "gc/shared/vmGCOperations.hpp"
52 #include "gc/shared/weakProcessor.hpp"
53 #include "gc/shared/workgroup.hpp"
54 #include "memory/filemap.hpp"
55 #include "memory/metaspaceCounters.hpp"
56 #include "memory/resourceArea.hpp"
57 #include "oops/oop.inline.hpp"
58 #include "runtime/biasedLocking.hpp"
59 #include "runtime/flags/flagSetting.hpp"
360 if (op.prologue_succeeded()) {
361 result = op.result();
362 if (op.gc_locked()) {
363 assert(result == NULL, "must be NULL if gc_locked() is true");
364 continue; // Retry and/or stall as necessary.
365 }
366
367 // Allocation has failed and a collection
368 // has been done. If the gc time limit was exceeded the
369 // this time, return NULL so that an out-of-memory
370 // will be thrown. Clear gc_overhead_limit_exceeded
371 // so that the overhead exceeded does not persist.
372
373 const bool limit_exceeded = size_policy()->gc_overhead_limit_exceeded();
374 const bool softrefs_clear = soft_ref_policy()->all_soft_refs_clear();
375
376 if (limit_exceeded && softrefs_clear) {
377 *gc_overhead_limit_was_exceeded = true;
378 size_policy()->set_gc_overhead_limit_exceeded(false);
379 if (op.result() != NULL) {
380 CollectedHeap::fill_with_object(op.result(), size);
381 }
382 return NULL;
383 }
384 assert(result == NULL || is_in_reserved(result),
385 "result not in heap");
386 return result;
387 }
388
389 // Give a warning if we seem to be looping forever.
390 if ((QueuedAllocationWarningCount > 0) &&
391 (try_count % QueuedAllocationWarningCount == 0)) {
392 log_warning(gc, ergo)("GenCollectedHeap::mem_allocate_work retries %d times,"
393 " size=" SIZE_FORMAT " %s", try_count, size, is_tlab ? "(TLAB)" : "");
394 }
395 }
396 }
397
398 #ifndef PRODUCT
399 // Override of memory state checking method in CollectedHeap:
400 // Some collectors (CMS for example) can't have badHeapWordVal written
|
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "aot/aotLoader.hpp"
27 #include "classfile/classLoaderDataGraph.hpp"
28 #include "classfile/symbolTable.hpp"
29 #include "classfile/stringTable.hpp"
30 #include "classfile/systemDictionary.hpp"
31 #include "classfile/vmSymbols.hpp"
32 #include "code/codeCache.hpp"
33 #include "code/icBuffer.hpp"
34 #include "gc/serial/defNewGeneration.hpp"
35 #include "gc/shared/adaptiveSizePolicy.hpp"
36 #include "gc/shared/cardTableBarrierSet.hpp"
37 #include "gc/shared/cardTableRS.hpp"
38 #include "gc/shared/collectedHeap.inline.hpp"
39 #include "gc/shared/collectorCounters.hpp"
40 #include "gc/shared/fill.hpp"
41 #include "gc/shared/gcId.hpp"
42 #include "gc/shared/gcLocker.hpp"
43 #include "gc/shared/gcPolicyCounters.hpp"
44 #include "gc/shared/gcTrace.hpp"
45 #include "gc/shared/gcTraceTime.inline.hpp"
46 #include "gc/shared/genCollectedHeap.hpp"
47 #include "gc/shared/genOopClosures.inline.hpp"
48 #include "gc/shared/generationSpec.hpp"
49 #include "gc/shared/oopStorageParState.inline.hpp"
50 #include "gc/shared/space.hpp"
51 #include "gc/shared/strongRootsScope.hpp"
52 #include "gc/shared/vmGCOperations.hpp"
53 #include "gc/shared/weakProcessor.hpp"
54 #include "gc/shared/workgroup.hpp"
55 #include "memory/filemap.hpp"
56 #include "memory/metaspaceCounters.hpp"
57 #include "memory/resourceArea.hpp"
58 #include "oops/oop.inline.hpp"
59 #include "runtime/biasedLocking.hpp"
60 #include "runtime/flags/flagSetting.hpp"
361 if (op.prologue_succeeded()) {
362 result = op.result();
363 if (op.gc_locked()) {
364 assert(result == NULL, "must be NULL if gc_locked() is true");
365 continue; // Retry and/or stall as necessary.
366 }
367
368 // Allocation has failed and a collection
369 // has been done. If the gc time limit was exceeded the
370 // this time, return NULL so that an out-of-memory
371 // will be thrown. Clear gc_overhead_limit_exceeded
372 // so that the overhead exceeded does not persist.
373
374 const bool limit_exceeded = size_policy()->gc_overhead_limit_exceeded();
375 const bool softrefs_clear = soft_ref_policy()->all_soft_refs_clear();
376
377 if (limit_exceeded && softrefs_clear) {
378 *gc_overhead_limit_was_exceeded = true;
379 size_policy()->set_gc_overhead_limit_exceeded(false);
380 if (op.result() != NULL) {
381 Fill::range(op.result(), size);
382 }
383 return NULL;
384 }
385 assert(result == NULL || is_in_reserved(result),
386 "result not in heap");
387 return result;
388 }
389
390 // Give a warning if we seem to be looping forever.
391 if ((QueuedAllocationWarningCount > 0) &&
392 (try_count % QueuedAllocationWarningCount == 0)) {
393 log_warning(gc, ergo)("GenCollectedHeap::mem_allocate_work retries %d times,"
394 " size=" SIZE_FORMAT " %s", try_count, size, is_tlab ? "(TLAB)" : "");
395 }
396 }
397 }
398
399 #ifndef PRODUCT
400 // Override of memory state checking method in CollectedHeap:
401 // Some collectors (CMS for example) can't have badHeapWordVal written
|