[Biojava-l] byte-code generation
Gerald Loeffler
Gerald.Loeffler@vienna.at
Wed, 20 Sep 2000 10:24:59 +0200
Hi!
On the subject of generating/manipulting byte-code: there is
o the JavaClass API (http://www.inf.fu-berlin.de/~dahm/JavaClass/) and
o the gnu bytecode package (part of Kawa: http://www.gnu.org/software/kawa/ ,
http://sources.redhat.com/kawa/api/gnu/bytecode/package-summary.html)
which give you (very superficially formulated) an reflection-level API for handling Java byte-code.
cheers,
gerald
Simon Brocklehurst wrote:
>
> Matthew Pocock wrote:
>
> > Dear all,
> >
> > Does anybody here know how to generate java byte-code? I am hoping to
> > write an implementation of DPFactory that generates java classes at
> > run-time that implement the algorithms using code, rather than
> > interpreting them. The optimizers will have a much better chance at
> > making the algorithms go faster. This may end up being heavy-duty
> > byte-code generation stuff, but should mean that it goes about as fast
> > as is possible.
> >
> > Any pointers or interested people?
>
> Matthew,
>
> I'm not sure if I understand what you want to do - mainly because I don't
> know:
>
> o what you mean by "implement the algorithms using code"
> o what you mean by "the optimizers"
> o what your DPFactory class does
>
> But if what you mean is that you want to generate java classes on the fly
> from within your software, here's a couple of suggestions....
>
> To generate byte-code, you can obviously use.... wait for it... javac!
> You can fairly trivially do this on-the-fly from within your DPFactory
> either by using runtime.exec() or by accessing sun.tools.javac, and then
> load your new classes dynamically. Pluses and minuses of both approaches,
> but both will work.
>
> If you actually want to getting into writing your own optimized byte-code
> this is rather more difficult and more work. You might want to at least
> consider running javac-generated byte code through a byte code optimizer
> (again, you could do this on the fly with runtime.exec() and seeing if
> this gets you where you want to go.
>
> Failing that, buy some more CPU ;-)
>
> Simon
> --
> Simon M. Brocklehurst, Ph.D.
> Head of Bioinformatics & Advanced IS
> Cambridge Antibody Technology
> The Science Park, Melbourn, Cambridgeshire, UK
> http://www.CambridgeAntibody.com/
> mailto:simon.brocklehurst@CambridgeAntibody.com
>
> _______________________________________________
> Biojava-l mailing list - Biojava-l@biojava.org
> http://biojava.org/mailman/listinfo/biojava-l
--
Gerald.Loeffler@vienna.at _________________ Software Architect
http://www.imp.univie.ac.at ____ http://www.daemonstration.com
OOA&D, Java, J2EE, JSP, Servlets, JavaBeans, ODBMS, RDBMS, XML
"I am a lover of knowledge, and the men who dwell in the city are
my teachers, and not the trees or the country." - Socrates