< prev index next >

src/share/vm/gc_implementation/g1/g1Allocator.hpp

Print this page
rev 7799 : [mq]: 8073466-remove-ratining-functionality-in-pargcallocbuffer
   1 /*
   2  * Copyright (c) 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  *


 142     }
 143     return result;
 144   }
 145 };
 146 
 147 class G1ParGCAllocBuffer: public ParGCAllocBuffer {
 148 private:
 149   bool _retired;
 150 
 151 public:
 152   G1ParGCAllocBuffer(size_t gclab_word_size);
 153   virtual ~G1ParGCAllocBuffer() {
 154     guarantee(_retired, "Allocation buffer has not been retired");
 155   }
 156 
 157   virtual void set_buf(HeapWord* buf) {
 158     ParGCAllocBuffer::set_buf(buf);
 159     _retired = false;
 160   }
 161 
 162   virtual void retire(bool end_of_gc, bool retain) {
 163     if (_retired) {
 164       return;
 165     }
 166     ParGCAllocBuffer::retire(end_of_gc, retain);
 167     _retired = true;
 168   }
 169 };
 170 
 171 class G1ParGCAllocator : public CHeapObj<mtGC> {
 172   friend class G1ParScanThreadState;
 173 protected:
 174   G1CollectedHeap* _g1h;
 175 
 176   // The survivor alignment in effect in bytes.
 177   // == 0 : don't align survivors
 178   // != 0 : align survivors to that alignment
 179   // These values were chosen to favor the non-alignment case since some
 180   // architectures have a special compare against zero instructions.
 181   const uint _survivor_alignment_bytes;
 182 
 183   size_t _alloc_buffer_waste;
 184   size_t _undo_waste;
 185 
 186   void add_to_alloc_buffer_waste(size_t waste) { _alloc_buffer_waste += waste; }


   1 /*
   2  * Copyright (c) 2014, 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  *


 142     }
 143     return result;
 144   }
 145 };
 146 
 147 class G1ParGCAllocBuffer: public ParGCAllocBuffer {
 148 private:
 149   bool _retired;
 150 
 151 public:
 152   G1ParGCAllocBuffer(size_t gclab_word_size);
 153   virtual ~G1ParGCAllocBuffer() {
 154     guarantee(_retired, "Allocation buffer has not been retired");
 155   }
 156 
 157   virtual void set_buf(HeapWord* buf) {
 158     ParGCAllocBuffer::set_buf(buf);
 159     _retired = false;
 160   }
 161 
 162   virtual void retire() {
 163     if (_retired) {
 164       return;
 165     }
 166     ParGCAllocBuffer::retire();
 167     _retired = true;
 168   }
 169 };
 170 
 171 class G1ParGCAllocator : public CHeapObj<mtGC> {
 172   friend class G1ParScanThreadState;
 173 protected:
 174   G1CollectedHeap* _g1h;
 175 
 176   // The survivor alignment in effect in bytes.
 177   // == 0 : don't align survivors
 178   // != 0 : align survivors to that alignment
 179   // These values were chosen to favor the non-alignment case since some
 180   // architectures have a special compare against zero instructions.
 181   const uint _survivor_alignment_bytes;
 182 
 183   size_t _alloc_buffer_waste;
 184   size_t _undo_waste;
 185 
 186   void add_to_alloc_buffer_waste(size_t waste) { _alloc_buffer_waste += waste; }


< prev index next >