Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle 8-byte call in VPIC snippet for nestmates #3005

Merged
merged 1 commit into from
Sep 25, 2018

Conversation

jdmpapin
Copy link
Contributor

@jdmpapin jdmpapin commented Sep 24, 2018

When x86 PicBuilder is carrying out a direct call to a private method of
a nestmate, it sets the return address so that the call will return into
the code in the VPIC snippet, which in the case of a virtual dispatch
would be something like the following:

call qword ptr [$vftReg+$vftOffset]
jmp mainline

In particular, the callee should return to the jmp instruction, whose
address has been calculated as 7 + the address of the call instruction.
But the call is sometimes one byte longer. The variability is now dealt
with as follows:

  • When overwriting the call, PicBuilder now writes a value that works
    for both 7- and 8-byte offsets to the jmp instruction.

  • When doing direct dispatch for nestmates, PicBuilder now detects the
    offset to jmp, in order to compute the correct return address.

Fixes #2955

When x86 PicBuilder is carrying out a direct call to a private method of
a nestmate, it sets the return address so that the call will return into
the code in the VPIC snippet, which in the case of a virtual dispatch
would be something like the following:

    call qword ptr [$vftReg+$vftOffset]
    jmp mainline

In particular, the callee should return to the jmp instruction, whose
address has been calculated as 7 + the address of the call instruction.
But the call is sometimes one byte longer. The variability is now dealt
with as follows:

- When overwriting the call, PicBuilder now writes a value that works
  for both 7- and 8-byte offsets to the jmp instruction.

- When doing direct dispatch for nestmates, PicBuilder now detects the
  offset to jmp, in order to compute the correct return address.

Fixes eclipse-openj9#2955
Signed-off-by: Devin Papineau <devinmp@ca.ibm.com>
@andrewcraik
Copy link
Contributor

Jenkins test sanity jdk11 xlinux,win

@andrewcraik
Copy link
Contributor

Jenkins test sanity xlinux,win jdk11

@jdmpapin
Copy link
Contributor Author

@andrewcraik, is this good now?

Copy link
Contributor

@andrewcraik andrewcraik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants