equal
deleted
inserted
replaced
633 // |
633 // |
634 // 15 bytes seems to be a (very) safe value for max instruction size. |
634 // 15 bytes seems to be a (very) safe value for max instruction size. |
635 bool pc_is_near_addr = |
635 bool pc_is_near_addr = |
636 (pointer_delta((void*) addr, (void*) pc, sizeof(char)) < 15); |
636 (pointer_delta((void*) addr, (void*) pc, sizeof(char)) < 15); |
637 bool instr_spans_page_boundary = |
637 bool instr_spans_page_boundary = |
638 (align_size_down((intptr_t) pc ^ (intptr_t) addr, |
638 (align_down((intptr_t) pc ^ (intptr_t) addr, |
639 (intptr_t) page_size) > 0); |
639 (intptr_t) page_size) > 0); |
640 |
640 |
641 if (pc == addr || (pc_is_near_addr && instr_spans_page_boundary)) { |
641 if (pc == addr || (pc_is_near_addr && instr_spans_page_boundary)) { |
642 static volatile address last_addr = |
642 static volatile address last_addr = |
643 (address) os::non_memory_address_word(); |
643 (address) os::non_memory_address_word(); |
645 // In conservative mode, don't unguard unless the address is in the VM |
645 // In conservative mode, don't unguard unless the address is in the VM |
646 if (addr != last_addr && |
646 if (addr != last_addr && |
647 (UnguardOnExecutionViolation > 1 || os::address_is_in_vm(addr))) { |
647 (UnguardOnExecutionViolation > 1 || os::address_is_in_vm(addr))) { |
648 |
648 |
649 // Make memory rwx and retry |
649 // Make memory rwx and retry |
650 address page_start = align_ptr_down(addr, page_size); |
650 address page_start = align_down(addr, page_size); |
651 bool res = os::protect_memory((char*) page_start, page_size, |
651 bool res = os::protect_memory((char*) page_start, page_size, |
652 os::MEM_PROT_RWX); |
652 os::MEM_PROT_RWX); |
653 |
653 |
654 log_debug(os)("Execution protection violation " |
654 log_debug(os)("Execution protection violation " |
655 "at " INTPTR_FORMAT |
655 "at " INTPTR_FORMAT |