Ruva: Pure-ruby toy (J)VM

Austin Z. wrote:

-austin
As long as it compiles extensions on Windows, sure. :slight_smile:

On Tue, 2006-10-10 at 05:15 +0900, Austin Z. wrote:

So … anyone up for JRuby on Ruva?

Me! Me!

Aww heck, it doesn’t seem to work … (yet ;))

On Tue, 2006-10-10 at 05:51 +0900, Nick S. wrote:

On 10/9/06, Christian N. [email protected] wrote:

Can it run JRuby? :wink:

What aboute the reverse – load Ruva inside of JRuby – or better (worse?)
still, JRuby inside of Ruva inside of JRuby – now there’s an incestuous
cycle. The image of two snakes eating each others’ tail comes to mind.

Hmm, y’know, there is a JPython I believe… :smiley:

Ross B. wrote:

For anyone who’s interested in this kind of stuff, I just uploaded my
pure-ruby toy JVM to Rubyforge. It’s obviously very slow, but can be

I tried to play with it a bit but I don’t have Classpath installed. Is
there a way to read in classes for inspection without Classpath?

On Tue, 2006-10-10 at 07:21 +0900, Charles Oliver N. wrote:

Seriously though, this might have real applications in JRuby. Existing
libraries for examining bytecodes are far from friendly, and having a
nice API to examine classes and code could be useful. We’re planning on
writing the next iteration of the Ruby-bytecode compiler in Ruby, and
having a library like this to examine the results will make that easier.

Yeah, that kind of thing was the reason I started on Ruva last year.
Doing a lot of stuff with generated classes, and the JVM’s preverifier
errors are, shall we say “unhelpful”, to say the least …

Anyway, I’ll be glad (plus a bit surprised) if anything in there’s of
use…

On Tue, 2006-10-10 at 23:09 +0900, Charles Oliver N. wrote:

Ross B. wrote:

For anyone who’s interested in this kind of stuff, I just uploaded my
pure-ruby toy JVM to Rubyforge. It’s obviously very slow, but can be

I tried to play with it a bit but I don’t have Classpath installed. Is
there a way to read in classes for inspection without Classpath?

Sure is. This gets a dump of a class just as it’s read in (before it’s
resolved):

pp
Ruva::VM::Class::Reader.file(“test/java_classes/TestFunctional10.class”)

The unresolved class returned by Reader.file is visitable too - there’s
a bit of a basic TraceClassVisitor in ruva/utils/class_visitor.rb but it
gives too much output most of the time…

If you’re after the code, it’s easier to get the class resolved or
you’ll have to find the code attributes yourself, so try something like:

loader = Ruva::VM::ClassLoader.new(nil, ‘test/java_classes’)

=> #<Ruva::VM::ClassLoader:0xb7dac098 … >

clz = loader.load_class(‘TestFunctional10’)

=> TestFunctional10

clz.methods.each { |m| puts m; Ruva::Utils::CodeDumper.print(m.code) }

public void (int)

seq | bytes | mnemonic | operands

----------------------------------------------------------

0 | 0x0000…0x0000 | ALOAD_0 | []

1 | 0x0001…0x0003 | INVOKESPECIAL | [0, 1]

[ … etc … ]

Also, have a look at the bottom of class_loader.rb and a few others,
there are small test programs there sometimes…

Hope that helps,

“Simen E.” [email protected] writes:

This is not the Python Mailing List.

Somehow the image of two rubies eating each other seems a bit bizarre,
even for this thread.

I heard Ruby is a popular girls name in some areas… ehem. :^)