equal
deleted
inserted
replaced
716 // |
716 // |
717 // 15 bytes seems to be a (very) safe value for max instruction size. |
717 // 15 bytes seems to be a (very) safe value for max instruction size. |
718 bool pc_is_near_addr = |
718 bool pc_is_near_addr = |
719 (pointer_delta((void*) addr, (void*) pc, sizeof(char)) < 15); |
719 (pointer_delta((void*) addr, (void*) pc, sizeof(char)) < 15); |
720 bool instr_spans_page_boundary = |
720 bool instr_spans_page_boundary = |
721 (align_size_down((intptr_t) pc ^ (intptr_t) addr, |
721 (align_down((intptr_t) pc ^ (intptr_t) addr, |
722 (intptr_t) page_size) > 0); |
722 (intptr_t) page_size) > 0); |
723 |
723 |
724 if (pc == addr || (pc_is_near_addr && instr_spans_page_boundary)) { |
724 if (pc == addr || (pc_is_near_addr && instr_spans_page_boundary)) { |
725 static volatile address last_addr = |
725 static volatile address last_addr = |
726 (address) os::non_memory_address_word(); |
726 (address) os::non_memory_address_word(); |
728 // In conservative mode, don't unguard unless the address is in the VM |
728 // In conservative mode, don't unguard unless the address is in the VM |
729 if (addr != last_addr && |
729 if (addr != last_addr && |
730 (UnguardOnExecutionViolation > 1 || os::address_is_in_vm(addr))) { |
730 (UnguardOnExecutionViolation > 1 || os::address_is_in_vm(addr))) { |
731 |
731 |
732 // Set memory to RWX and retry |
732 // Set memory to RWX and retry |
733 address page_start = align_ptr_down(addr, page_size); |
733 address page_start = align_down(addr, page_size); |
734 bool res = os::protect_memory((char*) page_start, page_size, |
734 bool res = os::protect_memory((char*) page_start, page_size, |
735 os::MEM_PROT_RWX); |
735 os::MEM_PROT_RWX); |
736 |
736 |
737 log_debug(os)("Execution protection violation " |
737 log_debug(os)("Execution protection violation " |
738 "at " INTPTR_FORMAT |
738 "at " INTPTR_FORMAT |