1410 static size_t stack_red_zone_size() { |
1410 static size_t stack_red_zone_size() { |
1411 assert(_stack_red_zone_size > 0, "Don't call this before the field is initialized."); |
1411 assert(_stack_red_zone_size > 0, "Don't call this before the field is initialized."); |
1412 return _stack_red_zone_size; |
1412 return _stack_red_zone_size; |
1413 } |
1413 } |
1414 static void set_stack_red_zone_size(size_t s) { |
1414 static void set_stack_red_zone_size(size_t s) { |
1415 assert(is_size_aligned(s, os::vm_page_size()), |
1415 assert(is_aligned(s, os::vm_page_size()), |
1416 "We can not protect if the red zone size is not page aligned."); |
1416 "We can not protect if the red zone size is not page aligned."); |
1417 assert(_stack_red_zone_size == 0, "This should be called only once."); |
1417 assert(_stack_red_zone_size == 0, "This should be called only once."); |
1418 _stack_red_zone_size = s; |
1418 _stack_red_zone_size = s; |
1419 } |
1419 } |
1420 address stack_red_zone_base() { |
1420 address stack_red_zone_base() { |
1427 static size_t stack_yellow_zone_size() { |
1427 static size_t stack_yellow_zone_size() { |
1428 assert(_stack_yellow_zone_size > 0, "Don't call this before the field is initialized."); |
1428 assert(_stack_yellow_zone_size > 0, "Don't call this before the field is initialized."); |
1429 return _stack_yellow_zone_size; |
1429 return _stack_yellow_zone_size; |
1430 } |
1430 } |
1431 static void set_stack_yellow_zone_size(size_t s) { |
1431 static void set_stack_yellow_zone_size(size_t s) { |
1432 assert(is_size_aligned(s, os::vm_page_size()), |
1432 assert(is_aligned(s, os::vm_page_size()), |
1433 "We can not protect if the yellow zone size is not page aligned."); |
1433 "We can not protect if the yellow zone size is not page aligned."); |
1434 assert(_stack_yellow_zone_size == 0, "This should be called only once."); |
1434 assert(_stack_yellow_zone_size == 0, "This should be called only once."); |
1435 _stack_yellow_zone_size = s; |
1435 _stack_yellow_zone_size = s; |
1436 } |
1436 } |
1437 |
1437 |
1438 static size_t stack_reserved_zone_size() { |
1438 static size_t stack_reserved_zone_size() { |
1439 // _stack_reserved_zone_size may be 0. This indicates the feature is off. |
1439 // _stack_reserved_zone_size may be 0. This indicates the feature is off. |
1440 return _stack_reserved_zone_size; |
1440 return _stack_reserved_zone_size; |
1441 } |
1441 } |
1442 static void set_stack_reserved_zone_size(size_t s) { |
1442 static void set_stack_reserved_zone_size(size_t s) { |
1443 assert(is_size_aligned(s, os::vm_page_size()), |
1443 assert(is_aligned(s, os::vm_page_size()), |
1444 "We can not protect if the reserved zone size is not page aligned."); |
1444 "We can not protect if the reserved zone size is not page aligned."); |
1445 assert(_stack_reserved_zone_size == 0, "This should be called only once."); |
1445 assert(_stack_reserved_zone_size == 0, "This should be called only once."); |
1446 _stack_reserved_zone_size = s; |
1446 _stack_reserved_zone_size = s; |
1447 } |
1447 } |
1448 address stack_reserved_zone_base() { |
1448 address stack_reserved_zone_base() { |
1478 // loop touches all pages in the shadow zone. |
1478 // loop touches all pages in the shadow zone. |
1479 // This can be guaranteed differently, as well. E.g., if |
1479 // This can be guaranteed differently, as well. E.g., if |
1480 // the page size is a multiple of 4K, banging in 4K steps |
1480 // the page size is a multiple of 4K, banging in 4K steps |
1481 // suffices to touch all pages. (Some pages are banged |
1481 // suffices to touch all pages. (Some pages are banged |
1482 // several times, though.) |
1482 // several times, though.) |
1483 assert(is_size_aligned(s, os::vm_page_size()), |
1483 assert(is_aligned(s, os::vm_page_size()), |
1484 "Stack bang assumes multiple of page size."); |
1484 "Stack bang assumes multiple of page size."); |
1485 assert(_stack_shadow_zone_size == 0, "This should be called only once."); |
1485 assert(_stack_shadow_zone_size == 0, "This should be called only once."); |
1486 _stack_shadow_zone_size = s; |
1486 _stack_shadow_zone_size = s; |
1487 } |
1487 } |
1488 |
1488 |