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

IR creates new compiler passes using reflection #2225

Closed
chrisseaton opened this issue Nov 22, 2014 · 4 comments
Closed

IR creates new compiler passes using reflection #2225

chrisseaton opened this issue Nov 22, 2014 · 4 comments
Labels
Milestone

Comments

@chrisseaton
Copy link
Contributor

The IR creates new compiler passes using reflection. This causes problems for people doing things such as AOT compilation. Can we avoid it? Could we switch this reflection to factory methods?

The reason I'm asking rather than just going ahead and doing it is that I thought that maybe there is something more complex going on here. Are you trying to support runtime loading of compiler passes or something like that?

https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/ir/passes/CompilerPass.java#L136-L154

@subbuss

@headius
Copy link
Member

headius commented Nov 23, 2014

@subbuss and @enebo will have to comment, but I assumed it was so we could configure the passes that run at runtime and potentially include new passes without modifying any code.

I'm guessing you're asking about this because it causes problems for the substrate build? There will certainly be other places we load code reflectively.

@chrisseaton
Copy link
Contributor Author

Yeah - Substrate or any other hypothetical AOT tool people might want to run in the future.

I'm going through and substituting all the places that use reflection or class loaders. I can work around most of them - such as those in Joda and JCodings. Some stuff I'm just disabling for now, like requiring class files or converting Ruby objects to Java objects.

IR compiler phases could be simply switched to factory methods so that I don't have to do anything with them. We could then add a factory method that does use reflection if that's needed. This would allow the IR interpreter to be used in Substrate, and if someone ever wrote a Graal backend for IR, or a byte code interpreter in Truffle, that would work as well.

I'm happy to do the work.

@enebo
Copy link
Member

enebo commented Nov 23, 2014

Yeah this was done to make passes pluggable without being in source. I think jruby-visualizer might? have one. We can make a factory for the builtin ones and lookup based on name from that factory so we can remove reflection for builtin passes. We should probably be doing that anyways.

@chrisseaton
Copy link
Contributor Author

Closing as @donv has a better workaround which will achieve the same goal for me.

@chrisseaton chrisseaton added this to the Won't Fix milestone May 20, 2015
@chrisseaton chrisseaton added the ir label May 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants