< prev index next >

src/hotspot/share/gc/shared/memAllocator.cpp

Print this page

  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  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "classfile/javaClasses.hpp"
 27 #include "gc/shared/allocTracer.hpp"
 28 #include "gc/shared/collectedHeap.hpp"
 29 #include "gc/shared/memAllocator.hpp"
 30 #include "gc/shared/threadLocalAllocBuffer.inline.hpp"
 31 #include "gc/shared/tlab_globals.hpp"
 32 #include "memory/universe.hpp"
 33 #include "oops/arrayOop.hpp"
 34 #include "oops/oop.inline.hpp"
 35 #include "prims/jvmtiExport.hpp"
 36 #include "runtime/sharedRuntime.hpp"
 37 #include "runtime/handles.inline.hpp"
 38 #include "runtime/thread.inline.hpp"
 39 #include "services/lowMemoryDetector.hpp"
 40 #include "utilities/align.hpp"
 41 #include "utilities/copy.hpp"
 42 
 43 class MemAllocator::Allocation: StackObj {
 44   friend class MemAllocator;
 45 
 46   const MemAllocator& _allocator;

409   // Set array length before setting the _klass field because a
410   // non-NULL klass field indicates that the object is parsable by
411   // concurrent GC.
412   assert(_length >= 0, "length should be non-negative");
413   if (_do_zero) {
414     mem_clear(mem);
415   }
416   arrayOopDesc::set_length(mem, _length);
417   return finish(mem);
418 }
419 
420 oop ClassAllocator::initialize(HeapWord* mem) const {
421   // Set oop_size field before setting the _klass field because a
422   // non-NULL _klass field indicates that the object is parsable by
423   // concurrent GC.
424   assert(_word_size > 0, "oop_size must be positive.");
425   mem_clear(mem);
426   java_lang_Class::set_oop_size(mem, (int)_word_size);
427   return finish(mem);
428 }











  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  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "classfile/javaClasses.inline.hpp"
 27 #include "gc/shared/allocTracer.hpp"
 28 #include "gc/shared/collectedHeap.hpp"
 29 #include "gc/shared/memAllocator.hpp"
 30 #include "gc/shared/threadLocalAllocBuffer.inline.hpp"
 31 #include "gc/shared/tlab_globals.hpp"
 32 #include "memory/universe.hpp"
 33 #include "oops/arrayOop.hpp"
 34 #include "oops/oop.inline.hpp"
 35 #include "prims/jvmtiExport.hpp"
 36 #include "runtime/sharedRuntime.hpp"
 37 #include "runtime/handles.inline.hpp"
 38 #include "runtime/thread.inline.hpp"
 39 #include "services/lowMemoryDetector.hpp"
 40 #include "utilities/align.hpp"
 41 #include "utilities/copy.hpp"
 42 
 43 class MemAllocator::Allocation: StackObj {
 44   friend class MemAllocator;
 45 
 46   const MemAllocator& _allocator;

409   // Set array length before setting the _klass field because a
410   // non-NULL klass field indicates that the object is parsable by
411   // concurrent GC.
412   assert(_length >= 0, "length should be non-negative");
413   if (_do_zero) {
414     mem_clear(mem);
415   }
416   arrayOopDesc::set_length(mem, _length);
417   return finish(mem);
418 }
419 
420 oop ClassAllocator::initialize(HeapWord* mem) const {
421   // Set oop_size field before setting the _klass field because a
422   // non-NULL _klass field indicates that the object is parsable by
423   // concurrent GC.
424   assert(_word_size > 0, "oop_size must be positive.");
425   mem_clear(mem);
426   java_lang_Class::set_oop_size(mem, (int)_word_size);
427   return finish(mem);
428 }
429 
430 oop StackChunkAllocator::initialize(HeapWord* mem) const {
431   // const size_t hs = oopDesc::header_size();
432   // Copy::fill_to_aligned_words(mem + hs, vmClasses::StackChunk_klass()->size_helper() - hs);
433 
434   assert(_stack_size > 0, "");
435   assert(_word_size > (size_t)_stack_size, "");
436   jdk_internal_vm_StackChunk::set_size(mem, _stack_size);
437   return finish(mem);
438 }
< prev index next >