|
Re: Compile Ruby Code?: msg#00060lang.jruby.user
I certainly agree with the "easier to sell Java". That's one of the founding principals of my work personally on JRuby...trying to subvert the system and make Ruby possible within the Java world. There is a short-term "compilation" option I have been considering that perhaps you might have an opinion on. In the absence of a real compiler, there is some value in being able to turn Ruby scripts into Java class files, even if there's little actual compilation being done. What we could do is simply serialize or embed the Ruby script into a class file along with wrapper code to handle JRuby specifics. What you would essentially have is a class that could be classloaded as normal, and that loading process would prime JRuby with appropriate Ruby definitions. Ultimately what happens behind the scenes is just that the class itself calls out to JRuby or JRuby is made aware of the class, and from there the normal Ruby script parsing happens. Ultimately, since Ruby is far more dynamic a language (not just dynamically typed, but really "dynamic"), we'll have to do something like this anyway...there's just no way on current JVMs that Ruby code can be run directly. What this gets you is a way to make Ruby feel a bit more like Java code, and a minimal obfuscation of Ruby script code within a class file. Would something like this provide any value? On 2/22/06, Kris Leech <krisleech@xxxxxxxxxxxxxxx> wrote: > Thanks for your comments Charles. I interested in JRuby for two reasons, > both of almost equal weight, firstly to allow ruby code to be deployed > to servers without ruby installed. This is often the case in the public > sector and secondly as a layer of protection for Intellectual Property. > I think the combination of bytecode and obfuscation would be enough to > make reverse engineering the code more costly than writing it from > scratch :) > > I am aware of one company writing an obfuscator, but they only answered > one email I sent so I dont know if it is due any time soon. However I > guess it would not be very difficult to write one. It would just be a > fancy find and replace on the source code. > > Am I right in thinking JRuby can be used in two ways, firstly it can be > used to run ruby code using java (java interpreter) and secondly it > allows ruby code to be embedded in Java applications? > > If ruby code can be put inside a Java applications not only can we run > our code on Java but we can actually distribute a java application (with > the ruby hidden inside). At the moment in certain sectors its easier to > sell java. > > Many Thanks, K. > > > > Charles O Nutter wrote: > > >Unless (or until) a reverse-compiler were created (which probably > >would not be a high priority at first) there wouldn't be an easy way > >to reverse it. However, Java bytecode isn't terribly complicated, and > >the source for the compiler would be open, so eventually someone would > >be able to reverse the process. > > > >If you are looking to protect Ruby code this way, an additional > >obfuscation step might be your best bet, so that even if the code were > >decompiled it would be unreadable. An obfuscator that takes existing > >Java classes and mutilates them might also be an option. This would > >obviously make debugging more difficult, and we do not have plans to > >write an obfuscator at this time. > > > >- Charlie > > > >On 2/20/06, Kris Leech <krisleech@xxxxxxxxxxxxxxx> wrote: > > > > > >>Thanks Tom for the swift reply, can ByteCode be easily transformed back > >>in to ruby code? > >> > >> > >>Thomas E Enebo wrote: > >> > >> > >> > >>>On Mon, 20 Feb 2006, Kris Leech defenestrated me: > >>> > >>> > >>> > >>> > >>> > >>>>Great work with JRuby and the opening up of platform coverage. I was > >>>>looking at JRuby as a means of protecting Intellectual Property ie. > >>>>distributing compiled or byte code instead of source code. But it > >>>>appears that JRuby is an interpretor only, at the moment anyway. > >>>> > >>>>Are there any plans to create a ruby bytecode pre-compiler? > >>>> > >>>> > >>>> > >>>> > >>> Yes, but not in the immediate future. Charles Nutter has been in > >>>the progress of converting the evaluation part of JRuby to be iterative > >>>instead of recursive. An iterative evaluation model should be fairly > >>>straight-forward to translate into instructions. So once that is done > >>>we will look at compilation. > >>> > >>>-Tom > >>> > >>> > >>> > >>> > >>> > >> > >> > >>------------------------------------------------------- > >>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > >>for problems? Stop! Download the new AJAX search engine that makes > >>searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > >>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > >>_______________________________________________ > >>Jruby-user mailing list > >>Jruby-user@xxxxxxxxxxxxxxxxxxxxx > >>https://lists.sourceforge.net/lists/listinfo/jruby-user > >> > >> > >> > > > > > >-- > >Charles Oliver Nutter @ headius.blogspot.com > >JRuby Developer @ jruby.sourceforge.net > >Application Architect @ www.ventera.com > > > > > >------------------------------------------------------- > >This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > >for problems? Stop! Download the new AJAX search engine that makes > >searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > >http://sel.as-us.falkag.net/sel?cmd=k&kid3432&bid#0486&dat1642 > >_______________________________________________ > >Jruby-user mailing list > >Jruby-user@xxxxxxxxxxxxxxxxxxxxx > >https://lists.sourceforge.net/lists/listinfo/jruby-user > > > > > > > > > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > _______________________________________________ > Jruby-user mailing list > Jruby-user@xxxxxxxxxxxxxxxxxxxxx > https://lists.sourceforge.net/lists/listinfo/jruby-user > -- Charles Oliver Nutter @ headius.blogspot.com JRuby Developer @ jruby.sourceforge.net Application Architect @ www.ventera.com ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | embedding Ruby on Rails: 00060, Phil Bogle |
|---|---|
| Next by Date: | RE: Compile Ruby Code?: 00060, Yemi D. Bedu |
| Previous by Thread: | Re: Compile Ruby Code?i: 00060, Kris Leech |
| Next by Thread: | Re: Compile Ruby Code?: 00060, Kris Leech |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | Mail Home | sitemap | FAQ | advertise |