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

Move compiler to a separate module #1700

Open
gbrail opened this issue Oct 16, 2024 · 2 comments
Open

Move compiler to a separate module #1700

gbrail opened this issue Oct 16, 2024 · 2 comments
Labels
embedding Rhino Issues related to enbedding Rhino enhancement Java Interop Issues related to the interaction between Java and JavaScript Potentially Breaking Change Issues that could break backwards compatibility

Comments

@gbrail
Copy link
Collaborator

gbrail commented Oct 16, 2024

It would not be difficult move the compiler -- all the stuff that generates bytecode and executes it -- to a separate Java module. We could use the ServiceLoader pattern to load it, so that there would be no configuration require other than putting it in the classpath.

We could also take this opportunity to clean up the "optimization mode" concept -- perhaps take it out and make it effectively a boolean that defaults to true if the compiler is present.

Advantages:

  • Smaller code size in case that is very important to some people
  • Easier for compatibility with really old systems, since the compiler now depends on JDK 9+ features
  • No possibility of causing Android problems when the compiler uses packages that don't exist on Android
  • Smaller packaging for Android users

Disadvantages:

  • People who just include the "rhino" module and not the compiler will have worse performance, they will not know why, and they will blame Rhino.
@anonyein
Copy link

anonyein commented Oct 16, 2024

https://github.com/raphw/byte-buddy/tree/master/byte-buddy-android
There also exists generating bytecode for Android. Exclude Android maybe too early!

@rPraml
Copy link
Contributor

rPraml commented Oct 16, 2024

@anonyein android is currently not excluded, but it runs only in interpreted mode.

If we move the compiler to a separate module, e.g. rhino-compiler-jdk, we can create (later) a module, e.g. rhino-compiler-android, that can generate android compatible bytecode

Disadvantages:

* People who just include the "rhino" module and not the compiler will have worse performance, they will not know why, and they will blame Rhino.

Hmm, that's a fair point. No one read the docs. 😉 Maybe we enforce, that at least/exactly one compiler module must be present. So we can make a rhino-compiler-dummy, that has to be on classpath (until we have a native android compiler)

@p-bakker p-bakker added Java Interop Issues related to the interaction between Java and JavaScript embedding Rhino Issues related to enbedding Rhino test262 Issues related to passage of test262 TestSuite Potentially Breaking Change Issues that could break backwards compatibility enhancement and removed test262 Issues related to passage of test262 TestSuite labels Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
embedding Rhino Issues related to enbedding Rhino enhancement Java Interop Issues related to the interaction between Java and JavaScript Potentially Breaking Change Issues that could break backwards compatibility
Projects
None yet
Development

No branches or pull requests

4 participants