Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Genetic Programming and Machine Language

Reply
Thread Tools

Re: Genetic Programming and Machine Language

 
 
softwarepearls_com
Guest
Posts: n/a
 
      11-17-2008
On Nov 17, 4:43*pm, "Ken T." <(E-Mail Removed)> wrote:
> Over the weekend I started development of a platform to allow me to play
> around with genetic programming a bit. *I decided on a machine language
> representation of the developed code for various reasons, so I developed
> my own little virtual machine that works very much like an old 6502
> microprocessor. *
>
> This was all quite easy and works great, but it does negate some of the
> performance gains associated with working directly with machine language
> programs. *Ideally I would like to generate programs written in the
> machine language of the native platform and run them there. *I know this
> would be a great hassle, so I'm not even going to bother with that right
> now. *
>
> 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
> 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)?
>
> Thanks,
>
> --
> Ken T.
>
> * For every complex problem, there is a solution that is simple, neat,
> * and wrong.
> * * * * -- H. L. Mencken


I predict a dramatic speed increase over your current approach if you
generated JVM instruction sequences.

The hard part here would be to generate sequences that don't crash the
JVM. You'd have to include plenty of logic to ensure your sequences
never violate any of the fairly long list of preconditions for legal
code. But assuming you could get over the initial period of
frustrating JVM crashes (remember: you don't get any pretty Java stack
traces when the JVM blows), you'd be looking at a pretty powerful
genetic programming engine.
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      11-17-2008
"Ken T." wrote:
> > There is another option that might work too. *I could generate java [sic] 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
> > 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)?


I suggest using a file to hold your source, and name the file with the
extension ".java". Write your state machine in accordance with Java
syntax. Then, as Joshua Cranmer predicted, I bet
> it seems likely that the JIT optimizer will be able to
> make the core interpreter quite fast,


softwarepearls_com <(E-Mail Removed)> wrote:
> I predict a dramatic speed increase over your current approach if you
> generated JVM instruction sequences.


I predict the easiest way is to do it via an actual Java program.

> The hard part here would be to generate sequences that don't crash the
> JVM. You'd have to include plenty of logic to ensure your sequences


Correctly written Java won't crash the JVM; incorrectly written Java
won't start the JVM.

> never violate any of the fairly long list of preconditions for legal
> code. But assuming you could get over the initial period of
> frustrating JVM crashes (remember: you don't get any pretty Java stack
> traces when the JVM blows), you'd be looking at a pretty powerful
> genetic programming engine.


Write the genetic algorithm in Java. Translate the algorithm, not the
6502.

--
Lew
 
Reply With Quote
 
 
 
 
softwarepearls_com
Guest
Posts: n/a
 
      11-18-2008
On Nov 17, 8:33*pm, Eric Sosman <(E-Mail Removed)> wrote:
> softwarepearls_com wrote:
> > On Nov 17, 4:43 pm, "Ken T." <(E-Mail Removed)> wrote:
> >> Over the weekend I started development of a platform to allow me to play
> >> around with genetic programming a bit. *I decided on a machine language
> >> representation of the developed code for various reasons, so I developed
> >> my own little virtual machine that works very much like an old 6502
> >> microprocessor. *

>
> >> This was all quite easy and works great, but it does negate some of the
> >> performance gains associated with working directly with machine language
> >> programs. *Ideally I would like to generate programs written in the
> >> machine language of the native platform and run them there. *I know this
> >> would be a great hassle, so I'm not even going to bother with that right
> >> now. *

>
> >> 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
> >> 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)?

>
> > I predict a dramatic speed increase over your current approach if you
> > generated JVM instruction sequences.

>
> > The hard part here would be to generate sequences that don't crash the
> > JVM. You'd have to include plenty of logic to ensure your sequences
> > never violate any of the fairly long list of preconditions for legal
> > code. But assuming you could get over the initial period of
> > frustrating JVM crashes (remember: you don't get any pretty Java stack
> > traces when the JVM blows), you'd be looking at a pretty powerful
> > genetic programming engine.

>
> * * *If he can crash the JVM by loading bad byte code, the JVM has
> a bug. *Instead of an "initial period of frustrating JVM crashes"
> I think he's more likely to see an "initial period where byte code
> validation fails and ClassLoaders throw exceptions."
>
> --
> (E-Mail Removed)


In my eperience with Sun's latest Windows JVM, it is easy to submit a
bytecode sequence that crashes the JVM.. and when you don't get an
outright JVM crash, the validation exceptions are sadistically sparse
on information helping the developer track down the cause. It's all
just the cost of working at the bleeding edge
 
Reply With Quote
 
Eric Sosman
Guest
Posts: n/a
 
      11-18-2008
softwarepearls_com wrote:
> On Nov 17, 8:33 pm, Eric Sosman <(E-Mail Removed)> wrote:
>> [...]
>> If he can crash the JVM by loading bad byte code, the JVM has
>> a bug. Instead of an "initial period of frustrating JVM crashes"
>> I think he's more likely to see an "initial period where byte code
>> validation fails and ClassLoaders throw exceptions."

>
> In my eperience with Sun's latest Windows JVM, it is easy to submit a
> bytecode sequence that crashes the JVM..


You'd do everyone a favor by reporting the bug to Sun.
I'm sure they would take it *very* seriously, because if bad
byte code can cause the JVM to go off the rails there's at
least a chance that a security exploit is possible. Byte
code validation is supposed to detect and reject malformed
input without causing the JVM to do unpredictable or unwanted
things; if it's failing in this there is something Very Badly
Wrong. Please, please, please tell Sun, right away.

If you can provide a reproducible test case, that will be
even better.

> and when you don't get an
> outright JVM crash, the validation exceptions are sadistically sparse
> on information helping the developer track down the cause. It's all
> just the cost of working at the bleeding edge


True, exceptions thrown for validation failures are not
exactly overburdened with information. Still, a nice clean
exception is a far cry from a JVM crash. Also, I found they
gave me enough clues to enable me to fix my own byte code
generation when it went awry, so the edge may be not quite
so gore-spattered as you suggest.

--
Eric Sosman
http://www.velocityreviews.com/forums/(E-Mail Removed)lid
 
Reply With Quote
 
softwarepearls_com
Guest
Posts: n/a
 
      11-18-2008
On Nov 18, 2:26*pm, Eric Sosman <(E-Mail Removed)> wrote:
> softwarepearls_com wrote:
> > On Nov 17, 8:33 pm, Eric Sosman <(E-Mail Removed)> wrote:
> >> [...]
> >> * * *If he can crash the JVM by loading bad byte code, the JVM has
> >> a bug. *Instead of an "initial period of frustrating JVM crashes"
> >> I think he's more likely to see an "initial period where byte code
> >> validation fails and ClassLoaders throw exceptions."

>
> > In my eperience with Sun's latest Windows JVM, it is easy to submit a
> > bytecode sequence that crashes the JVM..

>
> * * *You'd do everyone a favor by reporting the bug to Sun.
> I'm sure they would take it *very* seriously, because if bad
> byte code can cause the JVM to go off the rails there's at
> least a chance that a security exploit is possible. *Byte
> code validation is supposed to detect and reject malformed
> input without causing the JVM to do unpredictable or unwanted
> things; if it's failing in this there is something Very Badly
> Wrong. *Please, please, please tell Sun, right away.


You know, I was a regular Bug Parade user/contributor many years ago,
but as time went by, and I saw how Sun has a very odd approach to
respecting the bug-fixing priorities set by parade users (at the
explicit invitation of Sun), I concluded that I had been naive in
thinking Sun would respect the contributors. The number of really high
profile bugs which people were begging/shouting Sun to fix, that
remained open and unfixed year after year after year, really disgusted
me in the end.

I think the slightly less naive view is that Sun fix the bugs they
want to fix, according to their commercial (and shifting) priorities,
and not ours (incl Bug Parade's).
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      11-19-2008
softwarepearls_com wrote:
>>> In my eperience with Sun's latest Windows JVM, it is easy to submit a
>>> bytecode sequence that crashes the JVM..


Eric Sosman wrote:
>> You'd do everyone a favor by reporting the bug to Sun.
>> I'm sure they would take it *very* seriously, because if bad
>> byte code can cause the JVM to go off the rails there's at
>> least a chance that a security exploit is possible. Byte
>> code validation is supposed to detect and reject malformed
>> input without causing the JVM to do unpredictable or unwanted
>> things; if it's failing in this there is something Very Badly
>> Wrong. Please, please, please tell Sun, right away.


softwarepearls_com wrote:
> You know, I was a regular Bug Parade user/contributor many years ago,
> but as time went by, and I saw how Sun has a very odd approach to
> respecting the bug-fixing priorities set by parade users (at the
> explicit invitation of Sun), I concluded that I had been naive in
> thinking Sun would respect the contributors. The number of really high
> profile bugs which people were begging/shouting Sun to fix, that
> remained open and unfixed year after year after year, really disgusted
> me in the end.


If you could provide the newsgroup an example, that would add credibility.

I, for one, am not convinced.

--
Lew
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      11-19-2008

Lew wrote:
>> If you could provide the newsgroup an example, that would add
>> credibility.
>>
>> I, for one, am not convinced.


Ken T. wrote:
> Not to support his original claim, I don't know the facts, but an example
> would be the lack of support for applets under 64 bit architectures. I
> understand it will be fixed in the next release, but it took them forever
> and was highly rated on the bug parade.


Oh, dear, I should never use a modifier when dangling. So sorry.

I mean an example of "a bytecode sequence that crashes the JVM."

--
Lew
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      11-19-2008
Lew wrote:
>> I, for one, am not convinced.


Eric Sosman wrote:
> After spending half of yesterday on the problem I succeeded
> in constructing a malformed class file that crashed the JVM, and
> have reported the bug. I wish softwarepearls_com, who had seen
> the crash, had not chosen to drive on by without stopping.


I am convinced.

--
Lew
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Genetic programming: pygene, pygp, AST, or (gasp) Lisp? John Ladasky Python 5 08-03-2008 10:55 AM
ANN: pygene0.12 - Genetic Programming&Algorithms Library aum Python 1 12-11-2005 07:35 PM
Tutorial/Help on programming Genetic Algroithms in Java/C++ Ruben Hoste C++ 10 09-23-2004 10:12 PM
Tutorial/Help on programming Genetic Algroithms in Java/C++ Ruben Hoste Java 10 09-23-2004 10:12 PM
Where to find newsgroups on Genetic Programming ? ThanhVu Nguyen C++ 3 09-14-2004 06:47 PM



Advertisments