index

src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp

Print this page
rev 7780 : imported patch 8072621
   1 /*
   2  * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 114   // Clear the cached CSet starting regions and time stamps.
 115   // Their validity is dependent on the GC timestamp.
 116   clear_cset_start_regions();
 117 }
 118 
 119 inline void G1CollectedHeap::increment_gc_time_stamp() {
 120   ++_gc_time_stamp;
 121   OrderAccess::fence();
 122 }
 123 
 124 inline void G1CollectedHeap::old_set_remove(HeapRegion* hr) {
 125   _old_set.remove(hr);
 126 }
 127 
 128 inline bool G1CollectedHeap::obj_in_cs(oop obj) {
 129   HeapRegion* r = _hrm.addr_to_region((HeapWord*) obj);
 130   return r != NULL && r->in_collection_set();
 131 }
 132 
 133 inline HeapWord* G1CollectedHeap::attempt_allocation(size_t word_size,
 134                                                      unsigned int* gc_count_before_ret,
 135                                                      int* gclocker_retry_count_ret) {
 136   assert_heap_not_locked_and_not_at_safepoint();
 137   assert(!is_humongous(word_size), "attempt_allocation() should not "
 138          "be called for humongous allocation requests");
 139 
 140   AllocationContext_t context = AllocationContext::current();
 141   HeapWord* result = _allocator->mutator_alloc_region(context)->attempt_allocation(word_size,
 142                                                                                    false /* bot_updates */);
 143   if (result == NULL) {
 144     result = attempt_allocation_slow(word_size,
 145                                      context,
 146                                      gc_count_before_ret,
 147                                      gclocker_retry_count_ret);
 148   }
 149   assert_heap_not_locked();
 150   if (result != NULL) {
 151     dirty_young_block(result, word_size);
 152   }
 153   return result;
 154 }
 155 


   1 /*
   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.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 114   // Clear the cached CSet starting regions and time stamps.
 115   // Their validity is dependent on the GC timestamp.
 116   clear_cset_start_regions();
 117 }
 118 
 119 inline void G1CollectedHeap::increment_gc_time_stamp() {
 120   ++_gc_time_stamp;
 121   OrderAccess::fence();
 122 }
 123 
 124 inline void G1CollectedHeap::old_set_remove(HeapRegion* hr) {
 125   _old_set.remove(hr);
 126 }
 127 
 128 inline bool G1CollectedHeap::obj_in_cs(oop obj) {
 129   HeapRegion* r = _hrm.addr_to_region((HeapWord*) obj);
 130   return r != NULL && r->in_collection_set();
 131 }
 132 
 133 inline HeapWord* G1CollectedHeap::attempt_allocation(size_t word_size,
 134                                                      uint* gc_count_before_ret,
 135                                                      uint* gclocker_retry_count_ret) {
 136   assert_heap_not_locked_and_not_at_safepoint();
 137   assert(!is_humongous(word_size), "attempt_allocation() should not "
 138          "be called for humongous allocation requests");
 139 
 140   AllocationContext_t context = AllocationContext::current();
 141   HeapWord* result = _allocator->mutator_alloc_region(context)->attempt_allocation(word_size,
 142                                                                                    false /* bot_updates */);
 143   if (result == NULL) {
 144     result = attempt_allocation_slow(word_size,
 145                                      context,
 146                                      gc_count_before_ret,
 147                                      gclocker_retry_count_ret);
 148   }
 149   assert_heap_not_locked();
 150   if (result != NULL) {
 151     dirty_young_block(result, word_size);
 152   }
 153   return result;
 154 }
 155 


index