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 } |