2454 if (!Threads::includes(this) || is_exiting() || !is_external_suspend()) {
2455 return;
2456 }
2457
2458 MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag);
2459
2460 clear_external_suspend();
2461
2462 if (is_ext_suspended()) {
2463 clear_ext_suspended();
2464 SR_lock()->notify_all();
2465 }
2466 }
2467
2468 size_t JavaThread::_stack_red_zone_size = 0;
2469 size_t JavaThread::_stack_yellow_zone_size = 0;
2470 size_t JavaThread::_stack_reserved_zone_size = 0;
2471 size_t JavaThread::_stack_shadow_zone_size = 0;
2472
2473 void JavaThread::create_stack_guard_pages() {
2474 if (!os::uses_stack_guard_pages() || _stack_guard_state != stack_guard_unused) { return; }
2475 address low_addr = stack_end();
2476 size_t len = stack_guard_zone_size();
2477
2478 assert(is_aligned(low_addr, os::vm_page_size()), "Stack base should be the start of a page");
2479 assert(is_aligned(len, os::vm_page_size()), "Stack size should be a multiple of page size");
2480
2481 int must_commit = os::must_commit_stack_guard_pages();
2482 // warning("Guarding at " PTR_FORMAT " for len " SIZE_FORMAT "\n", low_addr, len);
2483
2484 if (must_commit && !os::create_stack_guard_pages((char *) low_addr, len)) {
2485 log_warning(os, thread)("Attempt to allocate stack guard pages failed.");
2486 return;
2487 }
2488
2489 if (os::guard_memory((char *) low_addr, len)) {
2490 _stack_guard_state = stack_guard_enabled;
2491 } else {
2492 log_warning(os, thread)("Attempt to protect stack guard pages failed ("
2493 PTR_FORMAT "-" PTR_FORMAT ").", p2i(low_addr), p2i(low_addr + len));
2494 if (os::uncommit_memory((char *) low_addr, len)) {
|
2454 if (!Threads::includes(this) || is_exiting() || !is_external_suspend()) {
2455 return;
2456 }
2457
2458 MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag);
2459
2460 clear_external_suspend();
2461
2462 if (is_ext_suspended()) {
2463 clear_ext_suspended();
2464 SR_lock()->notify_all();
2465 }
2466 }
2467
2468 size_t JavaThread::_stack_red_zone_size = 0;
2469 size_t JavaThread::_stack_yellow_zone_size = 0;
2470 size_t JavaThread::_stack_reserved_zone_size = 0;
2471 size_t JavaThread::_stack_shadow_zone_size = 0;
2472
2473 void JavaThread::create_stack_guard_pages() {
2474 if (!os::uses_stack_guard_pages() ||
2475 _stack_guard_state != stack_guard_unused ||
2476 (DisablePrimordialThreadGuardPages && os::is_primordial_thread())) {
2477 log_info(os, thread)("Stack guard page creation for thread "
2478 UINTX_FORMAT " disabled", os::current_thread_id());
2479 return;
2480 }
2481 address low_addr = stack_end();
2482 size_t len = stack_guard_zone_size();
2483
2484 assert(is_aligned(low_addr, os::vm_page_size()), "Stack base should be the start of a page");
2485 assert(is_aligned(len, os::vm_page_size()), "Stack size should be a multiple of page size");
2486
2487 int must_commit = os::must_commit_stack_guard_pages();
2488 // warning("Guarding at " PTR_FORMAT " for len " SIZE_FORMAT "\n", low_addr, len);
2489
2490 if (must_commit && !os::create_stack_guard_pages((char *) low_addr, len)) {
2491 log_warning(os, thread)("Attempt to allocate stack guard pages failed.");
2492 return;
2493 }
2494
2495 if (os::guard_memory((char *) low_addr, len)) {
2496 _stack_guard_state = stack_guard_enabled;
2497 } else {
2498 log_warning(os, thread)("Attempt to protect stack guard pages failed ("
2499 PTR_FORMAT "-" PTR_FORMAT ").", p2i(low_addr), p2i(low_addr + len));
2500 if (os::uncommit_memory((char *) low_addr, len)) {
|