[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Compiling to byte codes

Nobuyoshi Nakada

10/27/2007 12:50:00 PM

Hi,

At Sat, 27 Oct 2007 21:10:53 +0900,
JONNALAGADDA Srinivas wrote in [ruby-talk:276106]:
> I have just compiled and installed 1.9 from SVN trunk. I seem to miss the
> instructions for compiling my ruby script to byte codes. Is there some
> documentation available on using the YARV part of 1.9?

VM::InstructionSequence.new(source_string)

--
Nobu Nakada

2 Answers

Arlen Cuss

10/27/2007 1:43:00 PM

0


On Sat, 2007-10-27 at 22:21 +0900, JONNALAGADDA Srinivas wrote:
> On 10/27/07, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:
> >
> > VM::InstructionSequence.new(source_string)
> >
> > Thank you very much, it worked. I have also been able to 'VM::
> InstructionSequence.compile_file' and subsequently 'eval' the same. Is
> there a way I could dump this to a file, and re-load the same into another
> ruby session?
> Greetings,
> JS

How about..

File.open("something", "w") do |f|
f.write vm_compiled_stuff
end

# later

eval(File.read("vm_compiled"))


Nobuyoshi Nakada

10/27/2007 1:43:00 PM

0

Hi,

At Sat, 27 Oct 2007 22:21:47 +0900,
JONNALAGADDA Srinivas wrote in [ruby-talk:276113]:
> Thank you very much, it worked. I have also been able to 'VM::
> InstructionSequence.compile_file' and subsequently 'eval' the same. Is
> there a way I could dump this to a file, and re-load the same into another
> ruby session?

There are InstructionSequence#to_a and InstructionSequence.load
now, but they will be changed or removed in the near future.

--
Nobu Nakada