comparison src/share/vm/memory/space.cpp @ 20317:ee019285a52c

8031323: Optionally align objects copied to survivor spaces Reviewed-by: brutisso, tschatzl
author jmasa
date Mon, 04 Aug 2014 10:48:10 -0700
parents 1526a938e670
children 7848fc12602b
comparison
equal deleted inserted replaced
20316:3c048df3ef8b 20317:ee019285a52c
26 #include "classfile/systemDictionary.hpp" 26 #include "classfile/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp" 27 #include "classfile/vmSymbols.hpp"
28 #include "gc_implementation/shared/liveRange.hpp" 28 #include "gc_implementation/shared/liveRange.hpp"
29 #include "gc_implementation/shared/markSweep.hpp" 29 #include "gc_implementation/shared/markSweep.hpp"
30 #include "gc_implementation/shared/spaceDecorator.hpp" 30 #include "gc_implementation/shared/spaceDecorator.hpp"
31 #include "gc_interface/collectedHeap.inline.hpp"
31 #include "memory/blockOffsetTable.inline.hpp" 32 #include "memory/blockOffsetTable.inline.hpp"
32 #include "memory/defNewGeneration.hpp" 33 #include "memory/defNewGeneration.hpp"
33 #include "memory/genCollectedHeap.hpp" 34 #include "memory/genCollectedHeap.hpp"
34 #include "memory/space.hpp" 35 #include "memory/space.hpp"
35 #include "memory/space.inline.hpp" 36 #include "memory/space.inline.hpp"
715 } 716 }
716 } else { 717 } else {
717 return NULL; 718 return NULL;
718 } 719 }
719 } while (true); 720 } while (true);
721 }
722
723 HeapWord* ContiguousSpace::allocate_aligned(size_t size) {
724 assert(Heap_lock->owned_by_self() || (SafepointSynchronize::is_at_safepoint() && Thread::current()->is_VM_thread()), "not locked");
725 HeapWord* end_value = end();
726
727 HeapWord* obj = CollectedHeap::align_allocation_or_fail(top(), end_value, SurvivorAlignmentInBytes);
728 if (obj == NULL) {
729 return NULL;
730 }
731
732 if (pointer_delta(end_value, obj) >= size) {
733 HeapWord* new_top = obj + size;
734 set_top(new_top);
735 assert(is_ptr_aligned(obj, SurvivorAlignmentInBytes) && is_aligned(new_top),
736 "checking alignment");
737 return obj;
738 } else {
739 set_top(obj);
740 return NULL;
741 }
720 } 742 }
721 743
722 // Requires locking. 744 // Requires locking.
723 HeapWord* ContiguousSpace::allocate(size_t size) { 745 HeapWord* ContiguousSpace::allocate(size_t size) {
724 return allocate_impl(size, end()); 746 return allocate_impl(size, end());