Re: Genetic Programming and Machine Language



On Mon, 17 Nov 2008 20:29:48 -0500, Arne Vajhøj wrote:

Ken T. wrote:
There is another option that might work too. I could generate java
byte code, using a subset of the available commands. I was curious how
difficult it would be to execute a given string full of java byte code

Very easy.

Just create you own subclass of ClassLoader with a method:

protected Class findClass(String name) {
byte[] bc = yourMethodThatGetTheBytesOfClass(name); return
defineClass(name, bc, 0, bc.length);
}

and instantiate objects via that class loader.

and what the pitfalls of doing things this way might be. Would I
expect to see a dramatic increase in speed over that which would be
expected using my virtual machine (it is mostly a big switch
statement)?

Yes - you would.

I would guess as a factor 10-100 depending on the language and how
optimized your interpreter is.

Arne


Well I've gotten a variety of answers. Maybe I'll sit down and give it a
try. After thinking about it a bit, I just don't think it will help that
much. The compiler should be optimizing away most of my code anyway. It
should be some of the fastest executing Java code there is, since it
doesn't really do much.

Still I'm going to read up on how this all works.

Thanks to you, and to everyone else in the thread.


--
Ken T.

Never underestimate the power of stupid people in large groups.
.



Relevant Pages

  • Re: Genetic Programming and Machine Language
    ... I was curious how difficult it would be to execute a given string full of java byte code ... protected Class findClass{ ...
    (comp.lang.java.programmer)
  • Re: java executables using batch
    ... First thing I'd do is use Java launcher rather than BPXBATCH to execute your java programs. ... IGD103I SMS ALLOCATED TO DDNAME ... IGD104I HFS FILE WAS RETAINED, ...
    (bit.listserv.ibm-main)
  • Re: CFS: some bad numbers with Java/database threading
    ... Hmm, I know diddly about Java, and I don't want to preempt Antoine's next ... threads are started in a tight loop. ... where he said the *same* thread needs to execute ... multiple queries on the same data, and therefore your test code is susceptible ...
    (Linux-Kernel)
  • Re: Getting Fox News to work with Firefox
    ... Can you elaborate on the dangers of java? ... JavaScript, Java and Flash, even being very different technologies, ... You DON'T want to execute it! ...
    (Fedora)
  • Re: Antwort: How to access FIELDS in a RECORD using Java? (was:RE: How do __you__ read non-DB no
    ... For lots of examples including emulation of QSAM, BSAM, BDAM, and VSAM file ... VSAM java code is in vz390.java source module and all the other access ... module file (executable z9/z10 mainframe instructions) and memory data fields ... assemble, link, and execute simple WTO 'Hello World' demo with the command: ...
    (bit.listserv.ibm-main)