comparison src/share/vm/runtime/virtualspace.cpp @ 22973:340ca8812af9

8067469: G1 ignores AlwaysPreTouch Summary: Factor out pretouch code of the various virtual space management classes and use them everywhere including in G1. Reviewed-by: stefank, ehelin, dholmes
author tschatzl
date Thu, 18 Dec 2014 09:37:02 +0100
parents 78bbf4d43a14
children c2ce24504334
comparison
equal deleted inserted replaced
22972:41a855ff6305 22973:340ca8812af9
628 _upper_high += upper_needs; 628 _upper_high += upper_needs;
629 } 629 }
630 } 630 }
631 631
632 if (pre_touch || AlwaysPreTouch) { 632 if (pre_touch || AlwaysPreTouch) {
633 int vm_ps = os::vm_page_size(); 633 os::pretouch_memory(previous_high, unaligned_new_high);
634 for (char* curr = previous_high;
635 curr < unaligned_new_high;
636 curr += vm_ps) {
637 // Note the use of a write here; originally we tried just a read, but
638 // since the value read was unused, the optimizer removed the read.
639 // If we ever have a concurrent touchahead thread, we'll want to use
640 // a read, to avoid the potential of overwriting data (if a mutator
641 // thread beats the touchahead thread to a page). There are various
642 // ways of making sure this read is not optimized away: for example,
643 // generating the code for a read procedure at runtime.
644 *curr = 0;
645 }
646 } 634 }
647 635
648 _high += bytes; 636 _high += bytes;
649 return true; 637 return true;
650 } 638 }