527 char* unaligned_lower_new_high = 528 MIN2(unaligned_new_high, lower_high_boundary()); 529 char* unaligned_middle_new_high = 530 MIN2(unaligned_new_high, middle_high_boundary()); 531 char* unaligned_upper_new_high = 532 MIN2(unaligned_new_high, upper_high_boundary()); 533 534 // Align the new highs based on the regions alignment. lower and upper 535 // alignment will always be default page size. middle alignment will be 536 // LargePageSizeInBytes if the actual size of the virtual space is in 537 // fact larger than LargePageSizeInBytes. 538 char* aligned_lower_new_high = 539 (char*) round_to((intptr_t) unaligned_lower_new_high, lower_alignment()); 540 char* aligned_middle_new_high = 541 (char*) round_to((intptr_t) unaligned_middle_new_high, middle_alignment()); 542 char* aligned_upper_new_high = 543 (char*) round_to((intptr_t) unaligned_upper_new_high, upper_alignment()); 544 545 // Determine which regions need to grow in this expand_by call. 546 // If you are growing in the lower region, high() must be in that 547 // region so calcuate the size based on high(). For the middle and 548 // upper regions, determine the starting point of growth based on the 549 // location of high(). By getting the MAX of the region's low address 550 // (or the prevoius region's high address) and high(), we can tell if it 551 // is an intra or inter region growth. 552 size_t lower_needs = 0; 553 if (aligned_lower_new_high > lower_high()) { 554 lower_needs = 555 pointer_delta(aligned_lower_new_high, lower_high(), sizeof(char)); 556 } 557 size_t middle_needs = 0; 558 if (aligned_middle_new_high > middle_high()) { 559 middle_needs = 560 pointer_delta(aligned_middle_new_high, middle_high(), sizeof(char)); 561 } 562 size_t upper_needs = 0; 563 if (aligned_upper_new_high > upper_high()) { 564 upper_needs = 565 pointer_delta(aligned_upper_new_high, upper_high(), sizeof(char)); 566 } 567 568 // Check contiguity. 569 assert(low_boundary() <= lower_high() && 570 lower_high() <= lower_high_boundary(), | 527 char* unaligned_lower_new_high = 528 MIN2(unaligned_new_high, lower_high_boundary()); 529 char* unaligned_middle_new_high = 530 MIN2(unaligned_new_high, middle_high_boundary()); 531 char* unaligned_upper_new_high = 532 MIN2(unaligned_new_high, upper_high_boundary()); 533 534 // Align the new highs based on the regions alignment. lower and upper 535 // alignment will always be default page size. middle alignment will be 536 // LargePageSizeInBytes if the actual size of the virtual space is in 537 // fact larger than LargePageSizeInBytes. 538 char* aligned_lower_new_high = 539 (char*) round_to((intptr_t) unaligned_lower_new_high, lower_alignment()); 540 char* aligned_middle_new_high = 541 (char*) round_to((intptr_t) unaligned_middle_new_high, middle_alignment()); 542 char* aligned_upper_new_high = 543 (char*) round_to((intptr_t) unaligned_upper_new_high, upper_alignment()); 544 545 // Determine which regions need to grow in this expand_by call. 546 // If you are growing in the lower region, high() must be in that 547 // region so calculate the size based on high(). For the middle and 548 // upper regions, determine the starting point of growth based on the 549 // location of high(). By getting the MAX of the region's low address 550 // (or the previous region's high address) and high(), we can tell if it 551 // is an intra or inter region growth. 552 size_t lower_needs = 0; 553 if (aligned_lower_new_high > lower_high()) { 554 lower_needs = 555 pointer_delta(aligned_lower_new_high, lower_high(), sizeof(char)); 556 } 557 size_t middle_needs = 0; 558 if (aligned_middle_new_high > middle_high()) { 559 middle_needs = 560 pointer_delta(aligned_middle_new_high, middle_high(), sizeof(char)); 561 } 562 size_t upper_needs = 0; 563 if (aligned_upper_new_high > upper_high()) { 564 upper_needs = 565 pointer_delta(aligned_upper_new_high, upper_high(), sizeof(char)); 566 } 567 568 // Check contiguity. 569 assert(low_boundary() <= lower_high() && 570 lower_high() <= lower_high_boundary(), |