Skip to content

Commit

Permalink
Merge pull request #3005 from jdmpapin/nestmates78
Browse files Browse the repository at this point in the history
Handle 8-byte call in VPIC snippet for nestmates
  • Loading branch information
andrewcraik committed Sep 25, 2018
2 parents 463bcf2 + c70f394 commit e860fe5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions runtime/compiler/x/runtime/X86PicBuilder.pasm
Original file line number Diff line number Diff line change
Expand Up @@ -1986,14 +1986,22 @@ resolvedToDirectMethodVPic:
; via a call though the VFT *unless* RA-5 has 0e8h (direct call relative).
; Make sure the VM sees an 0e8h so that it uses the VFT offset register.
; Start with a debug trap because the call itself is dead.
mov dword ptr [rdx+eq_VPicData_size], 0e8cccch ; int 3, int 3, call
;
; By writing 0e8h twice in a row, it doesn't matter here whether the vtable
; call instruction would have been 7 or 8 bytes.
mov dword ptr [rdx+eq_VPicData_size], 0e8e8cccch ; int 3, int 3, call, call

xor rax, J9TR_J9_VTABLE_INDEX_DIRECT_METHOD_FLAG ; rax is the J9Method to be directly invoked
mov qword ptr [rdx+eq_VPicData_directMethod], rax

callDirectMethodVPic:
lea rdi, [rdx+eq_VPicData_size+7] ; Adjusted return address
; 7 (offset to jump after call through VFT)
; The size of the vtable call instruction is 7 bytes + possibly a SIB byte,
; which is needed when ModR/M for the call is 94h.
cmp byte ptr [rdx+eq_VPicData_callMemModRM], 94h
sete dil ; 1 for SIB byte, or else 0
movzx edi, dil
lea rdi, [rdx+eq_VPicData_size+7+rdi] ; Adjusted return address
; 7 (size of vtable call without SIB byte)
add rdx, eq_VPicData_j2iThunk
jmp dispatchDirectMethod

Expand Down

0 comments on commit e860fe5

Please sign in to comment.