How can I correctly invoke external methods in the JVM interpreter?
zhengxianwei
baikaishiuc at gmail.com
Fri May 3 13:38:21 UTC 2024
I have added the -Xint configuration to the JVM, and I would like to invoke
external functions when executing bytecode instanceof. I have added the
following method
```
JRT_ENTRY(void, InterpreterRuntime::dump_instanceof0(JavaThread* current))
//log_info(os)("invoke instanceof %s:%d", __FILE__, __LINE__);
JRT_END
```
Then modify templateTable_x86.cpp
```
void TemplateTable::instanceof() {
transition(atos, itos);
Label done, is_null, ok_is_subtype, quicked, resolved;
call_VM(noreg, CAST_FROM_FN_PTR(address,
InterpreterRuntime::dump_instanceof0));
__ testptr(rax, rax);
__ jcc(Assembler::zero, is_null);
```
But compiling OpenJDK will result in errors
```
* For target support_images_jmods__create_java.desktop.jmod_exec:
Error occurred during initialization of VM
java.lang.InternalError: platform encoding not initialized
at jdk.internal.util.SystemProps$Raw.platformProperties(java.base/Native
Method)
at jdk.internal.util.SystemProps$Raw.<init>(java.base/SystemProps.java:263)
at
jdk.internal.util.SystemProps.initProperties(java.base/SystemProps.java:67)
at java.lang.System.initPhase1(java.base/System.java:2167)
```
Could you please tell me what's incorrect about the method I implemented
above ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-dev/attachments/20240503/999795fa/attachment.htm>
More information about the hotspot-dev
mailing list