Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/nativeInst_x86.hpp @ 18638:0dac22d266d8
always try decode both types of AMD64 safepoint patterns (i.e., near and far) when testing a PC for being a safepoint
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 05 Dec 2014 19:24:09 +0100 |
parents | 5335d65fec56 |
children | be896a1983c0 |
comparison
equal
deleted
inserted
replaced
18637:d5d1fbe270e9 | 18638:0dac22d266d8 |
---|---|
560 ubyte_at(0) == 0xEB; /* short jump */ } | 560 ubyte_at(0) == 0xEB; /* short jump */ } |
561 inline bool NativeInstruction::is_cond_jump() { return (int_at(0) & 0xF0FF) == 0x800F /* long jump */ || | 561 inline bool NativeInstruction::is_cond_jump() { return (int_at(0) & 0xF0FF) == 0x800F /* long jump */ || |
562 (ubyte_at(0) & 0xF0) == 0x70; /* short jump */ } | 562 (ubyte_at(0) & 0xF0) == 0x70; /* short jump */ } |
563 inline bool NativeInstruction::is_safepoint_poll() { | 563 inline bool NativeInstruction::is_safepoint_poll() { |
564 #ifdef AMD64 | 564 #ifdef AMD64 |
565 if (Assembler::is_polling_page_far()) { | 565 // Try decoding a near safepoint first: |
566 // two cases, depending on the choice of the base register in the address. | 566 if (ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl && |
567 if (((ubyte_at(0) & NativeTstRegMem::instruction_rex_prefix_mask) == NativeTstRegMem::instruction_rex_prefix && | 567 ubyte_at(1) == 0x05) { // 00 rax 101 |
568 ubyte_at(1) == NativeTstRegMem::instruction_code_memXregl && | 568 address fault = addr_at(6) + int_at(2); |
569 (ubyte_at(2) & NativeTstRegMem::modrm_mask) == NativeTstRegMem::modrm_reg) || | 569 NOT_GRAAL(assert(!Assembler::is_polling_page_far(), "unexpected poll encoding");) |
570 ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl && | 570 return os::is_poll_address(fault); |
571 (ubyte_at(1) & NativeTstRegMem::modrm_mask) == NativeTstRegMem::modrm_reg) { | 571 } |
572 return true; | 572 // Now try decoding a far safepoint: |
573 } else { | 573 // two cases, depending on the choice of the base register in the address. |
574 return false; | 574 if (((ubyte_at(0) & NativeTstRegMem::instruction_rex_prefix_mask) == NativeTstRegMem::instruction_rex_prefix && |
575 } | 575 ubyte_at(1) == NativeTstRegMem::instruction_code_memXregl && |
576 } else { | 576 (ubyte_at(2) & NativeTstRegMem::modrm_mask) == NativeTstRegMem::modrm_reg) || |
577 if (ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl && | 577 ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl && |
578 ubyte_at(1) == 0x05) { // 00 rax 101 | 578 (ubyte_at(1) & NativeTstRegMem::modrm_mask) == NativeTstRegMem::modrm_reg) { |
579 address fault = addr_at(6) + int_at(2); | 579 NOT_GRAAL(assert(Assembler::is_polling_page_far(), "unexpected poll encoding");) |
580 return os::is_poll_address(fault); | 580 return true; |
581 } else { | 581 } |
582 return false; | 582 return false; |
583 } | |
584 } | |
585 #else | 583 #else |
586 return ( ubyte_at(0) == NativeMovRegMem::instruction_code_mem2reg || | 584 return ( ubyte_at(0) == NativeMovRegMem::instruction_code_mem2reg || |
587 ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl ) && | 585 ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl ) && |
588 (ubyte_at(1)&0xC7) == 0x05 && /* Mod R/M == disp32 */ | 586 (ubyte_at(1)&0xC7) == 0x05 && /* Mod R/M == disp32 */ |
589 (os::is_poll_address((address)int_at(2))); | 587 (os::is_poll_address((address)int_at(2))); |