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

feat(core) EspressoVM compatibility #1003

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

lewurm
Copy link

@lewurm lewurm commented Aug 19, 2024

reserved0 is used by EspressoVM, thus it cannot serve as a "reference NULL" as on HotSpot: https://github.com/oracle/graal/blob/3149f62458029ffe92b8dcefe0b3e59612684cfa/espresso/src/com.oracle.truffle.espresso.mokapot/include/mokapot.h#L67-L73

The relevant config is MOKA_LATTE. reserved3 is NULL though.


EspressoVM aka. Java on Truffle: https://www.graalvm.org/latest/reference-manual/java-on-truffle/

I tested the fix with Espresso, but I'm not 100% sure about the implications for other implementations. So please understand this PR more like a bug report 🙂 In general, I saw that in #875 (comment) it is mentioned that you want to get rid of (ab)using reserved3, so I think that's the better fix going forward.

@lewurm lewurm changed the title feat(core) GraalVM Native Image compatibility feat(core) EspressoVM compatibility Aug 19, 2024
`reserved0` is used by EspressoVM, thus it cannot serve as a "reference NULL" as on HotSpot:
https://github.com/oracle/graal/blob/3149f62458029ffe92b8dcefe0b3e59612684cfa/espresso/src/com.oracle.truffle.espresso.mokapot/include/mokapot.h#L67-L73

The relevant config is `MOKA_LATTE`. `reserved3` is `NULL` though.
@xxDark
Copy link

xxDark commented Aug 24, 2024

I have ran into this issue myself, what if all reversed slots are in use? Won't it be better to copy JNIEnv with one more pointer in the function table? nsetupEnvData copies the JNI function table already. It's not like this could get any worse: some JVMTI agent might replace the function table with its own, completely overriding even reserved slots. With one more function pointer, however, there is at least less of a chance of someone putting something in reservedN and overwriting LWJGL thread-local data.

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

Successfully merging this pull request may close these issues.

3 participants