From usenet at andreas-s.net Fri Feb 4 14:08:09 2005 From: usenet at andreas-s.net (Andreas Schwarz) Date: Fri Feb 4 14:05:10 2005 Subject: [Yarv-devel] Status of YARV? Message-ID: <4203C819.3040003@andreas-s.net> Hi, does YARV support - C extensions - (native) threads - file IO - sockets? Andreas From ko1 at atdot.net Fri Feb 4 14:20:31 2005 From: ko1 at atdot.net (SASADA Koichi) Date: Fri Feb 4 14:19:25 2005 Subject: [Yarv-devel] Status of YARV? In-Reply-To: (Your message of "Fri, 04 Feb 2005 20:08:09 +0100") <4203C819.3040003@andreas-s.net> References: <4203C819.3040003@andreas-s.net> Message-ID: <20050205042031.21e8742a%ko1@atdot.net> Andreas Schwarz wrote : [ [Yarv-devel] Status of YARV? ] at Fri, 04 Feb 2005 20:08:09 +0100 Hi, > does YARV support > - C extensions Yes. > - (native) threads No. I want to support it sometime. > - file IO Yes. (same as C extensions) > - sockets? Yes. (same as C extensions) Regards, -- // SASADA Koichi at atdot dot net // From usenet at andreas-s.net Sat Feb 5 12:20:02 2005 From: usenet at andreas-s.net (Andreas Schwarz) Date: Sat Feb 5 12:28:49 2005 Subject: [Yarv-devel] Benchmark results on PPC Message-ID: Powerbook G4 1.33 GHz ruby 1.9.0 powerpc-darwin7.7.0(2005-02-05) YARVCore 0.1.0 rev: 126 (2005-01-25) [direct threaded code] [optimize basic operation] [optimize regexp match] [stack caching] [inline method cache] ----------------------------------------------------------- array: i=0 while i<10000000 i+=1 a = [1,2,3,4,5,6,7,8,9,10] end -- user system total real ruby 50.000000 0.030000 50.030000 ( 51.988689) yarv 12.620000 0.070000 12.690000 ( 13.058565) ----------------------------------------------------------- block: def m yield end i=0 while i<10000000 i+=1 m{ } end -- user system total real ruby 35.700000 0.020000 35.720000 ( 36.538383) yarv 4.210000 0.000000 4.210000 ( 4.318696) ----------------------------------------------------------- const: Const = 1 i = 0 while i < 10000000 i+= 1 j = Const end -- user system total real ruby 22.440000 0.020000 22.460000 ( 22.997802) yarv 1.510000 0.000000 1.510000 ( 1.549931) ----------------------------------------------------------- ensure: i=0 while i<1000000 i+=1 begin begin ensure end ensure end end -- user system total real ruby 1.930000 0.010000 1.940000 ( 2.012598) yarv 0.120000 0.000000 0.120000 ( 0.123234) ----------------------------------------------------------- factorial: def fact(n) if(n > 1) n * fact(n-1) else 1 end end fact(7300) -- user system total real ruby stack level too deep yarv 0.240000 0.030000 0.270000 ( 0.274964) ----------------------------------------------------------- fib: def fib n if n < 3 1 else fib(n-1) + fib(n-2) end end fib(32) -- user system total real ruby 11.960000 0.010000 11.970000 ( 12.257111) yarv 1.250000 0.000000 1.250000 ( 1.277800) ----------------------------------------------------------- lists: #from http://www.bagley.org/~doug/shootout/bench/lists/lists.ruby NUM = 10 SIZE = 10000 def test_lists() # create a list of integers (Li1) from 1 to SIZE li1 = (1..SIZE).to_a # copy the list to li2 (not by individual items) li2 = li1.dup # remove each individual item from left side of li2 and # append to right side of li3 (preserving order) li3 = Array.new while (not li2.empty?) li3.push(li2.shift) end # li2 must now be empty # remove each individual item from right side of li3 and # append to right side of li2 (reversing list) while (not li3.empty?) li2.push(li3.pop) end # li3 must now be empty # reverse li1 in place li1.reverse! # check that first item is now SIZE if li1[0] != SIZE then p "not SIZE" 0 else # compare li1 and li2 for equality if li1 != li2 then return(0) else # return the length of the list li1.length end end end i = 0 while i 1 1 + reccount(n-1) else 1 end end reccount 7000 -- user system total real ruby stack level too deep yarv 0.010000 0.000000 0.010000 ( 0.005373) ----------------------------------------------------------- regexp: i=0 while i<1000000 /hoge/ =~ 'xxxhogexxx' i+=1 end -- user system total real ruby 3.340000 0.000000 3.340000 ( 3.363574) yarv 1.280000 0.000000 1.280000 ( 1.295496) ----------------------------------------------------------- rescue: i=0 while i<10000000 i+=1 begin rescue end end -- user system total real ruby 23.150000 0.010000 23.160000 ( 23.330190) yarv 1.490000 0.010000 1.500000 ( 1.509364) ----------------------------------------------------------- rescue2: i=0 while i<100000 i+=1 begin raise rescue end end -- user system total real ruby 2.530000 0.190000 2.720000 ( 2.743173) yarv 1.810000 0.220000 2.030000 ( 2.049670) ----------------------------------------------------------- simpleiter: 1000000.times{|simpleiter| simpleiter } -- user system total real ruby 1.130000 0.000000 1.130000 ( 1.122475) yarv 0.470000 0.000000 0.470000 ( 0.473542) ----------------------------------------------------------- simplereturn: def m return 1 end i=0 while i<1000000 i+=1 m end -- user system total real ruby 2.720000 0.000000 2.720000 ( 2.728355) yarv 0.300000 0.000000 0.300000 ( 0.299973) ----------------------------------------------------------- so_ackermann: #!/usr/bin/ruby # -*- mode: ruby -*- # $Id: ackermann-ruby.code,v 1.4 2004/11/13 07:40:41 bfulgham Exp $ # http://www.bagley.org/~doug/shootout/ def ack(m, n) if m == 0 then n + 1 elsif n == 0 then ack(m - 1, 1) else ack(m - 1, ack(m, n - 1)) end end NUM = 7 ack(3, NUM) -- user system total real ruby stack level too deep yarv 0.340000 0.000000 0.340000 ( 0.338907) ----------------------------------------------------------- so_array: #!/usr/bin/ruby # -*- mode: ruby -*- # $Id: ary-ruby.code,v 1.4 2004/11/13 07:41:27 bfulgham Exp $ # http://www.bagley.org/~doug/shootout/ # with help from Paul Brannan and Mark Hubbart n = 9000 # Integer(ARGV.shift || 1) x = Array.new(n) y = Array.new(n, 0) n.times{|bi| x[bi] = bi + 1 } (0 .. 999).each do |e| (n-1).step(0,-1) do |bi| y[bi] += x.at(bi) end end # puts "#{y.first} #{y.last}" -- user system total real ruby 30.210000 0.040000 30.250000 ( 30.566711) yarv 11.950000 0.010000 11.960000 ( 12.050104) ----------------------------------------------------------- so_concatenate: #!/usr/bin/ruby # -*- mode: ruby -*- # $Id: strcat-ruby.code,v 1.4 2004/11/13 07:43:28 bfulgham Exp $ # http://www.bagley.org/~doug/shootout/ # based on code from Aristarkh A Zagorodnikov and Dat Nguyen STUFF = "hello\n" hello = '' 400000.times do |e| hello << STUFF end # puts hello.length -- user system total real ruby 0.860000 0.040000 0.900000 ( 0.908787) yarv 0.350000 0.000000 0.350000 ( 0.344135) ----------------------------------------------------------- so_count_words: #!/usr/bin/ruby # -*- mode: ruby -*- # $Id: wc-ruby.code,v 1.4 2004/11/13 07:43:32 bfulgham Exp $ # http://www.bagley.org/~doug/shootout/ # with help from Paul Brannan require 'stringio' input = StringIO.new data = File.read($DRIVER_PATH + '/wc.input') 5000.times{|i| input.write data } input.seek 0 nl = nw = nc = 0 while true data = (input.read(4096) or break) << (input.gets || "") nc += data.length nl += data.count("\n") ((data.strip! || data).tr!("\n", " ") || data).squeeze! nw += data.count(" ") + 1 end # puts "#{nl} #{nw} #{nc}" -- user system total real ruby 0.700000 0.160000 0.860000 ( 0.897124) yarv 0.750000 0.110000 0.860000 ( 0.869444) ----------------------------------------------------------- so_exception: #!/usr/bin/ruby # -*- mode: ruby -*- # $Id: except-ruby.code,v 1.4 2004/11/13 07:41:33 bfulgham Exp $ # http://www.bagley.org/~doug/shootout/ $HI = 0 $LO = 0 NUM = 250000 # Integer(ARGV[0] || 1) class Lo_Exception < Exception def initialize(num) @value = num end end class Hi_Exception < Exception def initialize(num) @value = num end end def some_function(num) begin hi_function(num) rescue print "We shouldn't get here, exception is: #{$!.type}\n" end end def hi_function(num) begin lo_function(num) rescue Hi_Exception $HI = $HI + 1 end end def lo_function(num) begin blowup(num) rescue Lo_Exception $LO = $LO + 1 end end def blowup(num) if num % 2 == 0 raise Lo_Exception.new(num) else raise Hi_Exception.new(num) end end i = 1 max = NUM+1 while i < max i+=1 some_function(i+1) end -- user system total real ruby 11.790000 0.620000 12.410000 ( 12.541421) yarv 7.810000 0.760000 8.570000 ( 8.711128) ----------------------------------------------------------- so_matrix: #!/usr/bin/ruby # -*- mode: ruby -*- # $Id: matrix-ruby.code,v 1.4 2004/11/13 07:42:14 bfulgham Exp $ # http://www.bagley.org/~doug/shootout/ n = 60 #Integer(ARGV.shift || 1) size = 30 def mkmatrix(rows, cols) count = 1 mx = Array.new(rows) (0 .. (rows - 1)).each do |bi| row = Array.new(cols, 0) (0 .. (cols - 1)).each do |j| row[j] = count count += 1 end mx[bi] = row end mx end def mmult(rows, cols, m1, m2) m3 = Array.new(rows) (0 .. (rows - 1)).each do |bi| row = Array.new(cols, 0) (0 .. (cols - 1)).each do |j| val = 0 (0 .. (cols - 1)).each do |k| val += m1.at(bi).at(k) * m2.at(k).at(j) end row[j] = val end m3[bi] = row end m3 end m1 = mkmatrix(size, size) m2 = mkmatrix(size, size) mm = Array.new n.times do mm = mmult(size, size, m1, m2) end # puts "#{mm[0][0]} #{mm[2][3]} #{mm[3][2]} #{mm[4][4]}" -- user system total real ruby 8.880000 0.010000 8.890000 ( 8.950790) yarv 3.120000 0.010000 3.130000 ( 3.160729) ----------------------------------------------------------- so_nested_loop: #!/usr/bin/ruby # -*- mode: ruby -*- # $Id: nestedloop-ruby.code,v 1.4 2004/11/13 07:42:22 bfulgham Exp $ # http://www.bagley.org/~doug/shootout/ # from Avi Bryant n = 16 # Integer(ARGV.shift || 1) x = 0 n.times do n.times do n.times do n.times do n.times do n.times do x += 1 end end end end end end # puts x -- user system total real ruby 26.630000 0.010000 26.640000 ( 26.883816) yarv 9.760000 0.000000 9.760000 ( 9.875278) ----------------------------------------------------------- so_object: #!/usr/bin/ruby # -*- mode: ruby -*- # $Id: objinst-ruby.code,v 1.4 2004/11/13 07:42:25 bfulgham Exp $ # http://www.bagley.org/~doug/shootout/ # with help from Aristarkh Zagorodnikov class Toggle def initialize(start_state) @bool = start_state end def value @bool end def activate @bool = !@bool self end end class NthToggle < Toggle def initialize(start_state, max_counter) super start_state @count_max = max_counter @counter = 0 end def activate @counter += 1 if @counter >= @count_max @bool = !@bool @counter = 0 end self end end n = 1500000 # (ARGV.shift || 1).to_i toggle = Toggle.new 1 5.times do toggle.activate.value ? 'true' : 'false' end n.times do toggle = Toggle.new 1 end ntoggle = NthToggle.new 1, 3 8.times do ntoggle.activate.value ? 'true' : 'false' end n.times do ntoggle = NthToggle.new 1, 3 end -- user system total real ruby 22.170000 0.040000 22.210000 ( 22.529004) yarv 17.690000 0.020000 17.710000 ( 17.964235) ----------------------------------------------------------- so_random: # from http://www.bagley.org/~doug/shootout/bench/random/random.ruby IM = 139968 IA = 3877 IC = 29573 $last = 42.0 def gen_random(max) (max * ($last = ($last * IA + IC) % IM)) / IM end N = 1000000 i=0 while i References: Message-ID: <4208DCA6.4090005@atdot.net> Hi, Andreas Schwarz wrote: > Powerbook G4 1.33 GHz Thanks you :) From ko1 at atdot.net Tue Feb 8 12:33:04 2005 From: ko1 at atdot.net (SASADA Koichi) Date: Tue Feb 8 12:31:02 2005 Subject: [Yarv-devel] YARV new feature Message-ID: <20050209023304.273304d%ko1@atdot.net> Hi, I added new feature to YARV. * goto/label statement I supported goto/label statement. Using this scheme, you can do more flexible programming on Ruby. like this: i=0 __label__(:start) __goto__(:label) p "skipped" __label__(:label) p "end" __goto__(:start) if (i+=1) < 3 Enjoy Happy Ruby Hacking! ... of course, only joke :-P But really implemented. You can use "goto/label" statement when you add option to build yarv: $ ruby extconf.rb --enable-support-goto Regards, -- // SASADA Koichi at atdot dot net // From surrender_it at yahoo.it Fri Feb 11 13:12:04 2005 From: surrender_it at yahoo.it (gabriele renzi) Date: Fri Feb 11 13:08:42 2005 Subject: [Yarv-devel] YARV new feature In-Reply-To: <20050209023304.273304d%ko1@atdot.net> Message-ID: <20050211181205.67916.qmail@web50102.mail.yahoo.com> --- SASADA Koichi ha scritto: > Hi, > I added new feature to YARV. > > > * goto/label statement Sorry for the dumb qu4estion: why do you support this? :) Another thing, I notice that since some revisions my mingw (gcc version 3.4.2 (mingw-special) ) raise a warning since thread_call0() calls call_cfunc(). I think that in vm.c, line 424 VALUE *argv; should be const VALUE *argv (notice I am compiling withouth warning flags or warning would be thousands :) ===== icq #69488917 ___________________________________ Nuovo Yahoo! Messenger: E' molto pi? divertente: Audibles, Avatar, Webcam, Giochi, Rubrica Scaricalo ora! http://it.messenger.yahoo.it From ko1 at atdot.net Fri Feb 11 16:42:11 2005 From: ko1 at atdot.net (SASADA Koichi) Date: Fri Feb 11 16:40:14 2005 Subject: [Yarv-devel] YARV new feature In-Reply-To: <20050211181205.67916.qmail@web50102.mail.yahoo.com> References: <20050211181205.67916.qmail@web50102.mail.yahoo.com> Message-ID: <420D26B3.3030508@atdot.net> Hi, gabriele renzi wrote: > --- SASADA Koichi ha scritto: > >>Hi, >>I added new feature to YARV. >> >> >>* goto/label statement > > > Sorry for the dumb qu4estion: why do you support this? > :) only joke (as I wrote in original post). > > Another thing, I notice that since some revisions my > mingw (gcc version 3.4.2 (mingw-special) ) raise a > warning since thread_call0() calls call_cfunc(). > > I think that in vm.c, line 424 > > VALUE *argv; > should be > const VALUE *argv Thank you. Regards, SASADA Koichi From ko1 at atdot.net Fri Feb 18 14:14:52 2005 From: ko1 at atdot.net (SASADA Koichi) Date: Fri Feb 18 14:13:45 2005 Subject: [Yarv-devel] [ANN] YARV: Yet Another RubyVM 0.1.1 Message-ID: <20050219041452.1cb796d%ko1@atdot.net> Hi, I'm happy to announce that I released YARV: Yet Another RubyVM 0.1.1. Project Home page: http://www.atdot.net/yarv/ YARV 0.1.1 : http://www.atdot.net/yarv/yarv-0.1.1.tar.gz 0.1.1 souces : http://www.atdot.net/viewcvs.cgi/yarv/tags/0.1.1/ Changes (between 0.1.0): * some bug fixes * refoctoring * New Features * support goto (*1) * adding Ruby option "-rite" to work ruby script on YARV instead of current ruby interpreter (*2) * defined? support * permit block parameter as local variables or so * Optimization * Instructions unification (aka super instruction) is supported tentatively. * JIT Compiler (Ruby script -> Native machine code), very experimental implementation * AOT Compiler support method dispatch If you want to know moreover, please subscribe yarv-devel (you can know about this ML in YARV Home page). This project is supported by IPA (Information-technology Promotion Agency, Japan) "Exploratory Software Project (youth)". -- // SASADA Koichi at atdot dot net // (*1) it's only joke (*2) using -r (require) option with ite.rb :) From surrender_it at yahoo.it Fri Feb 18 15:48:04 2005 From: surrender_it at yahoo.it (gabriele renzi) Date: Fri Feb 18 15:44:26 2005 Subject: [Yarv-devel] [ANN] YARV: Yet Another RubyVM 0.1.1 In-Reply-To: <20050219041452.1cb796d%ko1@atdot.net> Message-ID: <20050218204805.72253.qmail@web50104.mail.yahoo.com> --- SASADA Koichi ha scritto: > Hi, > > I'm happy to announce that I released YARV: Yet > Another RubyVM 0.1.1. great news > * Optimization > * Instructions unification (aka super instruction) > is supported > tentatively. > * JIT Compiler (Ruby script -> Native machine > code), very experimental > implementation > * AOT Compiler support method dispatch just wanted to understand: is there a way we can test JIT or AOT? And, btw, I think in jitcompile.c: #if __GNUC__ && __i386__ && OPT_JIT_COMPILE /* this part may be separeted to another file */ #include is a little weak since it would allow gcc on win32 to try loading mman.h so it would need a && !defined(WIN32) ===== icq #69488917 ___________________________________ Nuovo Yahoo! Messenger: E' molto pi? divertente: Audibles, Avatar, Webcam, Giochi, Rubrica Scaricalo ora! http://it.messenger.yahoo.it From ko1 at atdot.net Mon Feb 21 00:10:51 2005 From: ko1 at atdot.net (SASADA Koichi) Date: Mon Feb 21 00:09:43 2005 Subject: [Yarv-devel] [ANN] YARV: Yet Another RubyVM 0.1.1 In-Reply-To: (Your message of "Fri, 18 Feb 2005 21:48:04 +0100 (CET) ") <20050218204805.72253.qmail@web50104.mail.yahoo.com> References: <20050218204805.72253.qmail@web50104.mail.yahoo.com> Message-ID: <20050221141051.c01dd2%ko1@atdot.net> gabriele renzi wrote : [ Re: [Yarv-devel] [ANN] YARV: Yet Another RubyVM 0.1.1 ] at Fri, 18 Feb 2005 21:48:04 +0100 (CET) Hi, > just wanted to understand: is there a way we can test > JIT or AOT? JIT: 1. extconf.rb --enable-opt-jit-compile 2. make some method ex) def compiled 1+1 # yarv can't do jit compile complex scripts end 3. compile it jitcompile(self, :compiled) # this method jit compile self#compiled 4. call that method compiled() ---- script will #=> def compiled 1+1 # yarv can't do jit compile complex scripts end jitcompile(self, :compiled) # this method jit compile self#compiled compiled() 5. run this script AOT: 1. extconf.rb --enable-test-aot-compile 2. modify some file. note that default target is rb/aottest.rb 3. do compile with rb/aotcompile.rb you can do aot compile with "make aotc" compiled.inc will be created (ruby -> c compiled c source file). 4. call "compiled()" method 5. run this script > And, btw, I think in jitcompile.c: > #if __GNUC__ && __i386__ && OPT_JIT_COMPILE > /* this part may be separeted to another file */ > > #include > is a little weak since it would allow gcc on win32 to > try loading mman.h so it would need a > && !defined(WIN32) OK. Thank you. Regards, -- // SASADA Koichi at atdot dot net // From vincent.isambart at gmail.com Wed Feb 23 04:12:30 2005 From: vincent.isambart at gmail.com (Vincent Isambart) Date: Wed Feb 23 04:08:41 2005 Subject: [Yarv-devel] "a = {}; a[0] || = 1" crashes Message-ID: <7d9a1f5305022301121e20f43c@mail.gmail.com> Hello, I have a little problem with YARV. Note that my tests were done with the version from one week and a half ago so if the bug has been corrected you can trash this mail ;) YARV crashes with the following simple Ruby script: a = {}; a[0] || = 1 I checked it a little and it seems the error is during the compilation step. I do not know YARV or the Ruby interpreter very well so I may be mistaken. The problem seems to be in compile.c, and there search for NODE_OP_ASGN1. The error seems to be the "ADD_SEND (ret, nd_line(node), ID2SYM(node->nd_mid), I2F(1));" For the || and && operators, node->nd_mid's value is 0 and 1, it's not an ID... If you try a parse and disassemble the "a = {}; a[0] || = 1" script, you'll see that YARV will try to invoque null... I hope it's of any help. Keep up the good work :) Kind regards, Vincent Isambart From vincent.isambart at gmail.com Wed Feb 23 04:38:15 2005 From: vincent.isambart at gmail.com (Vincent Isambart) Date: Wed Feb 23 04:34:25 2005 Subject: [Yarv-devel] Mistake on the web page Message-ID: <7d9a1f5305022301383998ff11@mail.gmail.com> Hi, There is an error an the YARV web page: the 0.1.1 link points to yarv-0.1.0.tar.gz instead of yarv-0.1.1.tar.gz... Kind regards, Vincent Isambart From ko1 at atdot.net Wed Feb 23 10:48:28 2005 From: ko1 at atdot.net (SASADA Koichi) Date: Wed Feb 23 10:47:00 2005 Subject: [Yarv-devel] "a = {}; a[0] || = 1" crashes In-Reply-To: (Your message of "Wed, 23 Feb 2005 10:12:30 +0100") <7d9a1f5305022301121e20f43c@mail.gmail.com> References: <7d9a1f5305022301121e20f43c@mail.gmail.com> Message-ID: <20050224004828.2834742%ko1@atdot.net> Vincent Isambart wrote : [ [Yarv-devel] "a = {}; a[0] || = 1" crashes ] at Wed, 23 Feb 2005 10:12:30 +0100 Hi, > YARV crashes with the following simple Ruby script: > a = {}; a[0] || = 1 > > I checked it a little and it seems the error is during the compilation > step. I do not know YARV or the Ruby interpreter very well so I may be > mistaken. > The problem seems to be in compile.c, and there search for NODE_OP_ASGN1. > The error seems to be the "ADD_SEND (ret, nd_line(node), > ID2SYM(node->nd_mid), I2F(1));" > For the || and && operators, node->nd_mid's value is 0 and 1, it's not an ID... > If you try a parse and disassemble the "a = {}; a[0] || = 1" script, > you'll see that YARV will try to invoque null... Thank you. I missed it! I fixed it. Regards, -- // SASADA Koichi at atdot dot net // From ko1 at atdot.net Wed Feb 23 10:49:38 2005 From: ko1 at atdot.net (SASADA Koichi) Date: Wed Feb 23 10:48:09 2005 Subject: [Yarv-devel] Mistake on the web page In-Reply-To: (Your message of "Wed, 23 Feb 2005 10:38:15 +0100") <7d9a1f5305022301383998ff11@mail.gmail.com> References: <7d9a1f5305022301383998ff11@mail.gmail.com> Message-ID: <20050224004938.2845ac5%ko1@atdot.net> Vincent Isambart wrote : [ [Yarv-devel] Mistake on the web page ] at Wed, 23 Feb 2005 10:38:15 +0100 Hi, > There is an error an the YARV web page: the 0.1.1 link points to > yarv-0.1.0.tar.gz instead of yarv-0.1.1.tar.gz... Thanks also. I fixed it. (as you know, it's miss at copy and paste) Regrads, -- // SASADA Koichi at atdot dot net // From vincent.isambart at gmail.com Wed Feb 23 11:03:22 2005 From: vincent.isambart at gmail.com (Vincent Isambart) Date: Wed Feb 23 10:59:35 2005 Subject: [Yarv-devel] "a = {}; a[0] || = 1" crashes In-Reply-To: <20050224004828.2834742%ko1@atdot.net> References: <7d9a1f5305022301121e20f43c@mail.gmail.com> <20050224004828.2834742%ko1@atdot.net> Message-ID: <7d9a1f5305022308031768464a@mail.gmail.com> ?????? > > YARV crashes with the following simple Ruby script: > > a = {}; a[0] || = 1 > > > > I checked it a little and it seems the error is during the compilation > > step. I do not know YARV or the Ruby interpreter very well so I may be > > mistaken. > > The problem seems to be in compile.c, and there search for NODE_OP_ASGN1. > > The error seems to be the "ADD_SEND (ret, nd_line(node), > > ID2SYM(node->nd_mid), I2F(1));" > > For the || and && operators, node->nd_mid's value is 0 and 1, it's not an ID... > > If you try a parse and disassemble the "a = {}; a[0] || = 1" script, > > you'll see that YARV will try to invoque null... > > Thank you. > I missed it! I fixed it. Thanks for the fast correction. But I checked your correction and there is something odd. An extract of what you did: if(id == 0 || id == 1){ (...) } else if(id == 1){ /* and */ VALUE label = NEW_LABEL(nd_line(node)); } else{ ADD_SEQ (ret, COMPILE("NODE_OP_ASGN1 args->head: ", node->nd_args->nd_head)); ADD_SEND (ret, nd_line(node), ID2SYM(id), I2F(1)); ADD_SEND (ret, nd_line(node), ID2SYM(idASET), I2F(argc+1)); } I think the "else if(id == 1)" is useless... This branch will never be executed :P Kind regards, ???????? Vincent Isambart From ko1 at atdot.net Wed Feb 23 11:15:37 2005 From: ko1 at atdot.net (SASADA Koichi) Date: Wed Feb 23 11:14:08 2005 Subject: [Yarv-devel] "a = {}; a[0] || = 1" crashes In-Reply-To: <7d9a1f5305022308031768464a@mail.gmail.com> References: <7d9a1f5305022301121e20f43c@mail.gmail.com> <20050224004828.2834742%ko1@atdot.net> <7d9a1f5305022308031768464a@mail.gmail.com> Message-ID: <421CAC29.3010303@atdot.net> Hi, Vincent Isambart wrote: > ?????? ????? :) > > I think the "else if(id == 1)" is useless... This branch will never be > executed :P > Ya! I removed it. > ???????? Good night :) -- // SASADA Koichi at atdot dot net // From cwillia1 at rochester.rr.com Thu Feb 24 19:18:44 2005 From: cwillia1 at rochester.rr.com (Chris Williams) Date: Thu Feb 24 19:14:53 2005 Subject: [Yarv-devel] How to compile Ruby 1.9 snapshots in Windows(MinGW)? Message-ID: <000001c51acf$91e343f0$6400a8c0@ChrisLaptop> Hi, I'd love to play with YARV, but currently the only way to do that is to compile Ruby 1.9 and YARV yourself. I'm on Win XP and don't have MS VC++ anywhere. So I've been trying to compile with MinGW (as well as MYSYS and MYSYS DTK). I run: autoconf ./configure -enable-shared make And make fails with the following: ar rcu libmsvcrt-ruby18-static.a array.o bignum.o class.o compar.o dir.o dln.o enum.o error.o eval.o file.o gc.o hash.o inits.o io.o marshal.o math.o numeric.o object.o pack.o parse.o process.o prec.o random.o range.o re.o regex.o ruby.o signal.o sprintf.o st.o string.o struct.o time.o util.o variable.o version.o fileblocks.o crypt.o flock.o acosh.o win32.o dmyext.o gcc -g -O2 -I. -I. -c main.c gcc -g -O2 main.o dmyext.o libmsvcrt-ruby18-static.a -lwsock32 -o miniruby.exe c:\ruby19\build\ruby\miniruby.exe: No such file to load -- ubygems (LoadError) make: *** [rbconfig.rb] Error 1 Anyone out there who's compiled 1.9 with MinGW and can give me some pointers? Thanks, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/yarv-devel/attachments/20050224/4b8e17e6/attachment-0001.htm From ko1 at atdot.net Thu Feb 24 21:09:04 2005 From: ko1 at atdot.net (SASADA Koichi) Date: Thu Feb 24 21:06:47 2005 Subject: [Yarv-devel] How to compile Ruby 1.9 snapshots in Windows(MinGW)? In-Reply-To: <000001c51acf$91e343f0$6400a8c0@ChrisLaptop> References: <000001c51acf$91e343f0$6400a8c0@ChrisLaptop> Message-ID: <421E88C0.3080103@atdot.net> Hi, > gcc -g -O2 main.o dmyext.o libmsvcrt-ruby18-static.a -lwsock32 -o > miniruby.exe > > c:\ruby19\build\ruby\miniruby.exe: No such file to load -- ubygems > (LoadError) At first, you need ruby 1.9. (libmsvcrt-ruby18-static.a should not appear above) And you must remove RUBYOPT environment variable (Maybe your RUBYOPT includes "-rubygems") BTW, you can also use yarv with cygwin. Cheers, SASADA Koichi From cwillia1 at rochester.rr.com Thu Feb 24 22:45:32 2005 From: cwillia1 at rochester.rr.com (Chris Williams) Date: Thu Feb 24 22:41:49 2005 Subject: [Yarv-devel] How to compile Ruby 1.9 snapshots in Windows(MinGW)? In-Reply-To: <421E88C0.3080103@atdot.net> Message-ID: <000001c51aec$7aad50f0$6400a8c0@ChrisLaptop> Koichi-san, (Or should it be Sasad-san?) > > gcc -g -O2 main.o dmyext.o libmsvcrt-ruby18-static.a -lwsock32 > -o > > miniruby.exe > > > > c:\ruby19\build\ruby\miniruby.exe: No such file to load -- ubygems > > (LoadError) > > At first, you need ruby 1.9. (libmsvcrt-ruby18-static.a should not > appear above) > > And you must remove RUBYOPT environment variable (Maybe your RUBYOPT > includes "-rubygems") > > BTW, you can also use yarv with cygwin. > > Cheers, > SASADA Koichi You are correct, my RUBYOPT environment variable was set to "rubygems". After removing the variable from my system Ruby properly built. I'm running the YARV benchmarks now! Thanks, Chris From cwillia1 at rochester.rr.com Fri Feb 25 00:11:15 2005 From: cwillia1 at rochester.rr.com (Chris Williams) Date: Fri Feb 25 00:07:24 2005 Subject: [Yarv-devel] Unable to complete benchmarks Message-ID: <000001c51af8$6e970610$6400a8c0@ChrisLaptop> Koichi-san, all, After your help, I was able to compile and install Ruby 1.9 and also patch it and try out YARV. I'm having problems running the benchmarks either in my command prompt or through the MSYS shell with 'make benchmark'. What seems to be happening is that the sub-process used to run the benchmark will run and peg my CPU at 99% usage, then finish and disappear but the result isn't joined back to the main thread. The popen block appears to be stuck on 'puts io.gets' - and when I watch my processes in the Task Manager I see a subprocess is spawned, runs and disappears with no results. What is even stranger is that it seems to be random as to when it happens. Sometimes I can't complete the first benchmark in ruby, sometimes not in YARV, sometimes it happens on the second benchmark, etc. I'm using: ruby 1.9.0 (2005-02-23) [i386-mingw32] YARVCore 0.1.1 rev: 140 (2005-02-18) [direct threaded code] [optimize basic operation] [optimize regexp match] [stack caching] [inline method cache] WinXP SP2 Intel P4 2.8 GHz Has anyone else seen this? This seems like it would be a Ruby bug. Thanks, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/yarv-devel/attachments/20050225/2600c97c/attachment.htm From surrender_it at yahoo.it Fri Feb 25 11:20:02 2005 From: surrender_it at yahoo.it (gabriele renzi) Date: Fri Feb 25 11:16:10 2005 Subject: [Yarv-devel] Unable to complete benchmarks In-Reply-To: <000001c51af8$6e970610$6400a8c0@ChrisLaptop> Message-ID: <20050225162002.4370.qmail@web50108.mail.yahoo.com> --- Chris Williams ha scritto: > I'm using: > ruby 1.9.0 (2005-02-23) [i386-mingw32] > YARVCore 0.1.1 rev: 140 (2005-02-18) > [direct threaded code] [optimize basic operation] > [optimize regexp > match] [stack caching] [inline method cache] > WinXP SP2 > Intel P4 2.8 GHz > > Has anyone else seen this? This seems like it would > be a Ruby bug. I remember this some time ago,. but it was related to an alrady fixed bug in IO.read, IIRC. Using your same ruby/os on a athlonxp 2000+ I can run tests and benchmarks fine with both yarv revision 140 and 148 from the command prompt. ===== icq #69488917 ___________________________________ Nuovo Yahoo! Messenger: E' molto pi? divertente: Audibles, Avatar, Webcam, Giochi, Rubrica Scaricalo ora! http://it.messenger.yahoo.it From surrender_it at yahoo.it Sat Feb 26 03:03:29 2005 From: surrender_it at yahoo.it (gabriele renzi) Date: Sat Feb 26 02:59:33 2005 Subject: [Yarv-devel] some fun bugs Message-ID: <20050226080329.87296.qmail@web50103.mail.yahoo.com> since 0.0.1 was released I tried running a tiny script which stresses callcc a lot, by solving the "use just 4 colours in a map" problem. It always segfaulted. Yesterday I was trying to reduce the script to a minimum to find what was causing the segfault.. and I found 4 reasons :) 1: using callcc callcc do |k| k end gives: ./benchmark/bm_4col.rb:6: [BUG] Segmentation fault Actually, it seem that just callcc causes a segfault. 2: using infinite recursion def callcc # forget the name, just infinite recursion callcc end callcc gives: ./benchmark/bm_4col.rb:8: [BUG] stack overflow 3: calling a method with wrong number of args: def foo end foo(1) gives: ./benchmark/bm_4col.rb:6: [BUG] thread_backtrace: unkown instruction (-10741130) notice even that "unknown" is misspelled :) 4: return from block def foo 3.timed do return end end foo ./benchmark/bm_4col.rb:15: [BUG] thread_backtrace: unkown instruction (-8024) Sidenote: it seem that a paper on the implementation of Lua 5.0 has recently been released, maybe of interest: http://www.tecgraf.puc-rio.br/~lhf/ftp/doc/sblp2005.pdf ===== icq #69488917 ___________________________________ Nuovo Yahoo! Messenger: E' molto pi? divertente: Audibles, Avatar, Webcam, Giochi, Rubrica Scaricalo ora! http://it.messenger.yahoo.it From ko1 at atdot.net Sat Feb 26 03:54:38 2005 From: ko1 at atdot.net (SASADA Koichi) Date: Sat Feb 26 03:48:30 2005 Subject: [Yarv-devel] some fun bugs In-Reply-To: <20050226080329.87296.qmail@web50103.mail.yahoo.com> References: <20050226080329.87296.qmail@web50103.mail.yahoo.com> Message-ID: <4220394E.1050209@atdot.net> Hi, gabriele renzi wrote: > since 0.0.1 was released I tried running a tiny script > which stresses callcc a lot, by solving the "use just > 4 colours in a map" problem. It always segfaulted. 0.1.1 > > 1: using callcc > callcc do |k| > k > end > > gives: > ./benchmark/bm_4col.rb:6: [BUG] Segmentation fault > Actually, it seem that just > > callcc > causes a segfault. callcc is not supported by YARV. > 2: using infinite recursion > def callcc # forget the name, just infinite recursion > callcc > end > > callcc > > gives: > ./benchmark/bm_4col.rb:8: [BUG] stack overflow This means YARV can check stack overflow. (now, only calling rb_bug) > 3: calling a method with wrong number of args: > > def foo > > end > foo(1) > > gives: > ./benchmark/bm_4col.rb:6: [BUG] thread_backtrace: > unkown instruction (-10741130) > > notice even that "unknown" is misspelled :) > mmm... i'll fix it. This is caused by bugs of creating backtrace process. > 4: return from block > def foo > 3.timed do > return > end > end > > foo > ./benchmark/bm_4col.rb:15: [BUG] thread_backtrace: > unkown instruction (-8024) > i'll also fix it. > > Sidenote: it seem that a paper on the implementation > of Lua 5.0 has recently been released, maybe of > interest: > http://www.tecgraf.puc-rio.br/~lhf/ftp/doc/sblp2005.pdf I'll check it as soon as possible. Thank you. Thanks, SASADA Koichi From vincent.isambart at gmail.com Sat Feb 26 04:41:15 2005 From: vincent.isambart at gmail.com (Vincent Isambart) Date: Sat Feb 26 04:37:20 2005 Subject: [Yarv-devel] Little Crash Message-ID: <7d9a1f5305022601411cf66e11@mail.gmail.com> Hi, I got a little program crashing, and I do not know if it's a know bug: def foo(&block) $a = block end foo { puts "yo" } loop { $a.call } What's weird is that it is not crashing anymore if I remove the loop {} around the $a.call... When trying to reduce the size of the previous program I found something else that crashes: a = proc { puts "yo" } a.call but I suppose it's because proc is not yet supported... A little mistake in tmpl/insns.inc.tmpl: it should be DO NOT TOUCH instead of DO NOT TOUGH :) Keep up the good work :) Cheers, Vincent Isambart From ko1 at atdot.net Sun Feb 27 01:13:08 2005 From: ko1 at atdot.net (SASADA Koichi) Date: Sun Feb 27 01:11:45 2005 Subject: [Yarv-devel] Little Crash In-Reply-To: (Your message of "Sat, 26 Feb 2005 10:41:15 +0100") <7d9a1f5305022601411cf66e11@mail.gmail.com> References: <7d9a1f5305022601411cf66e11@mail.gmail.com> Message-ID: <20050227151308.66d5dd%ko1@atdot.net> Vincent Isambart wrote : [ [Yarv-devel] Little Crash ] at Sat, 26 Feb 2005 10:41:15 +0100 Hi, > I got a little program crashing, and I do not know if it's a know bug: > def foo(&block) > $a = block > end > > foo { puts "yo" } > > loop { > $a.call > } > > What's weird is that it is not crashing anymore if I remove the loop > {} around the $a.call... loop{} is not supported. you can use loop{} which is redefined in ruby script suche as: def loop while true yield end end > When trying to reduce the size of the previous program I found > something else that crashes: > a = proc { puts "yo" } > a.call > but I suppose it's because proc is not yet supported... yes, "proc" is not supported. also this case is solved with redefined method: def proc &b b end > > A little mistake in tmpl/insns.inc.tmpl: it should be DO NOT TOUCH > instead of DO NOT TOUGH :) orz Thanks, -- // SASADA Koichi at atdot dot net //