176 if (UsePerfData) { 177 _eden_counters->update_capacity(); 178 _from_counters->update_capacity(); 179 _to_counters->update_capacity(); 180 } 181 } 182 183 void PSYoungGen::set_space_boundaries(size_t eden_size, size_t survivor_size) { 184 assert(eden_size < virtual_space()->committed_size(), "just checking"); 185 assert(eden_size > 0 && survivor_size > 0, "just checking"); 186 187 // Initial layout is Eden, to, from. After swapping survivor spaces, 188 // that leaves us with Eden, from, to, which is step one in our two 189 // step resize-with-live-data procedure. 190 char *eden_start = virtual_space()->low(); 191 char *to_start = eden_start + eden_size; 192 char *from_start = to_start + survivor_size; 193 char *from_end = from_start + survivor_size; 194 195 assert(from_end == virtual_space()->high(), "just checking"); 196 assert(is_object_aligned((intptr_t)eden_start), "checking alignment"); 197 assert(is_object_aligned((intptr_t)to_start), "checking alignment"); 198 assert(is_object_aligned((intptr_t)from_start), "checking alignment"); 199 200 MemRegion eden_mr((HeapWord*)eden_start, (HeapWord*)to_start); 201 MemRegion to_mr ((HeapWord*)to_start, (HeapWord*)from_start); 202 MemRegion from_mr((HeapWord*)from_start, (HeapWord*)from_end); 203 204 eden_space()->initialize(eden_mr, true, ZapUnusedHeapArea); 205 to_space()->initialize(to_mr , true, ZapUnusedHeapArea); 206 from_space()->initialize(from_mr, true, ZapUnusedHeapArea); 207 } 208 209 #ifndef PRODUCT 210 void PSYoungGen::space_invariants() { 211 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); 212 const size_t alignment = heap->space_alignment(); 213 214 // Currently, our eden size cannot shrink to zero 215 guarantee(eden_space()->capacity_in_bytes() >= alignment, "eden too small"); 216 guarantee(from_space()->capacity_in_bytes() >= alignment, "from too small"); 217 guarantee(to_space()->capacity_in_bytes() >= alignment, "to too small"); 218 594 595 log_trace(gc, ergo)(" [eden_start .. eden_end): [" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, 596 p2i(eden_start), 597 p2i(eden_end), 598 pointer_delta(eden_end, eden_start, sizeof(char))); 599 log_trace(gc, ergo)(" [ to_start .. to_end): [" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, 600 p2i(to_start), 601 p2i(to_end), 602 pointer_delta( to_end, to_start, sizeof(char))); 603 log_trace(gc, ergo)(" [from_start .. from_end): [" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, 604 p2i(from_start), 605 p2i(from_end), 606 pointer_delta(from_end, from_start, sizeof(char))); 607 } 608 609 610 guarantee((HeapWord*)from_start <= from_space()->bottom(), 611 "from start moved to the right"); 612 guarantee((HeapWord*)from_end >= from_space()->top(), 613 "from end moved into live data"); 614 assert(is_object_aligned((intptr_t)eden_start), "checking alignment"); 615 assert(is_object_aligned((intptr_t)from_start), "checking alignment"); 616 assert(is_object_aligned((intptr_t)to_start), "checking alignment"); 617 618 MemRegion edenMR((HeapWord*)eden_start, (HeapWord*)eden_end); 619 MemRegion toMR ((HeapWord*)to_start, (HeapWord*)to_end); 620 MemRegion fromMR((HeapWord*)from_start, (HeapWord*)from_end); 621 622 // Let's make sure the call to initialize doesn't reset "top"! 623 HeapWord* old_from_top = from_space()->top(); 624 625 // For logging block below 626 size_t old_from = from_space()->capacity_in_bytes(); 627 size_t old_to = to_space()->capacity_in_bytes(); 628 629 if (ZapUnusedHeapArea) { 630 // NUMA is a special case because a numa space is not mangled 631 // in order to not prematurely bind its address to memory to 632 // the wrong memory (i.e., don't want the GC thread to first 633 // touch the memory). The survivor spaces are not numa 634 // spaces and are mangled. 635 if (UseNUMA) { 636 if (eden_from_to_order) { | 176 if (UsePerfData) { 177 _eden_counters->update_capacity(); 178 _from_counters->update_capacity(); 179 _to_counters->update_capacity(); 180 } 181 } 182 183 void PSYoungGen::set_space_boundaries(size_t eden_size, size_t survivor_size) { 184 assert(eden_size < virtual_space()->committed_size(), "just checking"); 185 assert(eden_size > 0 && survivor_size > 0, "just checking"); 186 187 // Initial layout is Eden, to, from. After swapping survivor spaces, 188 // that leaves us with Eden, from, to, which is step one in our two 189 // step resize-with-live-data procedure. 190 char *eden_start = virtual_space()->low(); 191 char *to_start = eden_start + eden_size; 192 char *from_start = to_start + survivor_size; 193 char *from_end = from_start + survivor_size; 194 195 assert(from_end == virtual_space()->high(), "just checking"); 196 assert(is_ptr_object_aligned(eden_start), "checking alignment"); 197 assert(is_ptr_object_aligned(to_start), "checking alignment"); 198 assert(is_ptr_object_aligned(from_start), "checking alignment"); 199 200 MemRegion eden_mr((HeapWord*)eden_start, (HeapWord*)to_start); 201 MemRegion to_mr ((HeapWord*)to_start, (HeapWord*)from_start); 202 MemRegion from_mr((HeapWord*)from_start, (HeapWord*)from_end); 203 204 eden_space()->initialize(eden_mr, true, ZapUnusedHeapArea); 205 to_space()->initialize(to_mr , true, ZapUnusedHeapArea); 206 from_space()->initialize(from_mr, true, ZapUnusedHeapArea); 207 } 208 209 #ifndef PRODUCT 210 void PSYoungGen::space_invariants() { 211 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); 212 const size_t alignment = heap->space_alignment(); 213 214 // Currently, our eden size cannot shrink to zero 215 guarantee(eden_space()->capacity_in_bytes() >= alignment, "eden too small"); 216 guarantee(from_space()->capacity_in_bytes() >= alignment, "from too small"); 217 guarantee(to_space()->capacity_in_bytes() >= alignment, "to too small"); 218 594 595 log_trace(gc, ergo)(" [eden_start .. eden_end): [" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, 596 p2i(eden_start), 597 p2i(eden_end), 598 pointer_delta(eden_end, eden_start, sizeof(char))); 599 log_trace(gc, ergo)(" [ to_start .. to_end): [" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, 600 p2i(to_start), 601 p2i(to_end), 602 pointer_delta( to_end, to_start, sizeof(char))); 603 log_trace(gc, ergo)(" [from_start .. from_end): [" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, 604 p2i(from_start), 605 p2i(from_end), 606 pointer_delta(from_end, from_start, sizeof(char))); 607 } 608 609 610 guarantee((HeapWord*)from_start <= from_space()->bottom(), 611 "from start moved to the right"); 612 guarantee((HeapWord*)from_end >= from_space()->top(), 613 "from end moved into live data"); 614 assert(is_ptr_object_aligned(eden_start), "checking alignment"); 615 assert(is_ptr_object_aligned(from_start), "checking alignment"); 616 assert(is_ptr_object_aligned(to_start), "checking alignment"); 617 618 MemRegion edenMR((HeapWord*)eden_start, (HeapWord*)eden_end); 619 MemRegion toMR ((HeapWord*)to_start, (HeapWord*)to_end); 620 MemRegion fromMR((HeapWord*)from_start, (HeapWord*)from_end); 621 622 // Let's make sure the call to initialize doesn't reset "top"! 623 HeapWord* old_from_top = from_space()->top(); 624 625 // For logging block below 626 size_t old_from = from_space()->capacity_in_bytes(); 627 size_t old_to = to_space()->capacity_in_bytes(); 628 629 if (ZapUnusedHeapArea) { 630 // NUMA is a special case because a numa space is not mangled 631 // in order to not prematurely bind its address to memory to 632 // the wrong memory (i.e., don't want the GC thread to first 633 // touch the memory). The survivor spaces are not numa 634 // spaces and are mangled. 635 if (UseNUMA) { 636 if (eden_from_to_order) { |