hotspot/src/share/vm/memory/collectorPolicy.cpp
changeset 29078 3b7dd035c20b
parent 27898 813ad96387b3
child 29207 c5b52635f690
equal deleted inserted replaced
28940:c314cf1db3fa 29078:3b7dd035c20b
     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.
   595   *gc_overhead_limit_was_exceeded = false;
   595   *gc_overhead_limit_was_exceeded = false;
   596 
   596 
   597   HeapWord* result = NULL;
   597   HeapWord* result = NULL;
   598 
   598 
   599   // Loop until the allocation is satisfied, or unsatisfied after GC.
   599   // Loop until the allocation is satisfied, or unsatisfied after GC.
   600   for (int try_count = 1, gclocker_stalled_count = 0; /* return or throw */; try_count += 1) {
   600   for (uint try_count = 1, gclocker_stalled_count = 0; /* return or throw */; try_count += 1) {
   601     HandleMark hm; // Discard any handles allocated in each iteration.
   601     HandleMark hm; // Discard any handles allocated in each iteration.
   602 
   602 
   603     // First allocation attempt is lock-free.
   603     // First allocation attempt is lock-free.
   604     Generation *young = gch->get_gen(0);
   604     Generation *young = gch->get_gen(0);
   605     assert(young->supports_inline_contig_alloc(),
   605     assert(young->supports_inline_contig_alloc(),
   609       if (result != NULL) {
   609       if (result != NULL) {
   610         assert(gch->is_in_reserved(result), "result not in heap");
   610         assert(gch->is_in_reserved(result), "result not in heap");
   611         return result;
   611         return result;
   612       }
   612       }
   613     }
   613     }
   614     unsigned int gc_count_before;  // Read inside the Heap_lock locked region.
   614     uint gc_count_before;  // Read inside the Heap_lock locked region.
   615     {
   615     {
   616       MutexLocker ml(Heap_lock);
   616       MutexLocker ml(Heap_lock);
   617       if (PrintGC && Verbose) {
   617       if (PrintGC && Verbose) {
   618         gclog_or_tty->print_cr("TwoGenerationCollectorPolicy::mem_allocate_work:"
   618         gclog_or_tty->print_cr("TwoGenerationCollectorPolicy::mem_allocate_work:"
   619                       " attempting locked slow path allocation");
   619                       " attempting locked slow path allocation");