Dynamically Generated Compiled Code
Hi folks,
Is there a way to dynamically generate compiled code? I am after what can be done with reflection but without the performance cost. It seems logical that a good way to accomplish the goal is to compile code at run-time.
Thoughts? Successes? Ideas?
Re: Dynamically Generated Compiled Code
Sounds like an interpreter... Performance cost will be present.
Re: Dynamically Generated Compiled Code
Using reflection is an interpreter and does come with a performance cost. What I am looking for is potentially a way to construct Java code on the fly and pass it to something that will translate it into byte-code for later use... or anything that comes close to that.
Re: Dynamically Generated Compiled Code
Isn't that the same thing that already happens, though?
Re: Dynamically Generated Compiled Code
You're right that does happen. The part that I failed to mention is that I would want to retain that compiled code and potentially execute it many times without having to reinterpret it. Hope that clarifies things a touch.
Re: Dynamically Generated Compiled Code
Found what I was looking for:
http://java.sys-con.com/read/36843.htm
Thanks.
Re: Dynamically Generated Compiled Code
You can resolve the thread by clicking on the Thread Tools menu and selecting "Mark Thread Resolved".