Fwd: How can I correctly invoke external methods in the JVM interpreter?
zhengxianwei
baikaishiuc at gmail.com
Sun May 5 08:14:11 UTC 2024
---------- Forwarded message ---------
From: zhengxianwei <baikaishiuc at gmail.com>
Date: Sun, May 5, 2024 at 9:34 AM
Subject: Re: How can I correctly invoke external methods in the JVM
interpreter?
To: Andrew Haley <aph-open at littlepinkcloud.com>
Thank you for your reply.
Yesterday, I analyzed the code and found that when CALL_VM is called, it
needs to save and restore the register group, while I assumed that CALL_VM
itself included the operation to restore the context. Now it's working fine
> Calls from the interpreter to
> native code use the C calling convention
This is something I really need
> Also, you must step through the generated code in a debugger
Yes, you're right. I need to track the generated assembly code. A few days
ago, when I was analyzing the issue, I found debugging the JVM with both
JDB and GDB to be cumbersome, so I was reluctant to spend time debugging
the code. Now it seems I need to re-understand the entire process
On Sat, May 4, 2024 at 6:09 PM Andrew Haley <aph-open at littlepinkcloud.com>
wrote:
> On 5/3/24 14:38, zhengxianwei wrote:
> > Could you please tell me what's incorrect about the method I implemented
> above ?
>
> Think about register contents. Calls from the interpreter to
> native code use the C calling convention, which preserves the
> contents of some registers but clobbers others. You need to know
> that calling convention, and ensure that anything in use gets
> saved when you call native code.
>
> Also, you must step through the generated code in a debugger.
> Then you would see what had gone wrong.
>
> --
> Andrew Haley (he/him)
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> https://keybase.io/andrewhaley
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-dev/attachments/20240505/609db2e5/attachment.htm>
More information about the hotspot-dev
mailing list