yarv-diff:406
From: ko1 atdot.net
Date: 6 Nov 2006 17:30:06 +0900
Subject: [yarv-diff:406] r574 - in trunk: . rb template yarvtest
Author: ko1
Date: 2006-11-06 17:30:05 +0900 (Mon, 06 Nov 2006)
New Revision: 574
Modified:
trunk/ChangeLog
trunk/array.c
trunk/eval_proc.c
trunk/eval_thread.c
trunk/insns.def
trunk/rb/insns2vm.rb
trunk/template/vm.inc.tmpl
trunk/vm_macro.def
trunk/yarvtest/test_block.rb
Log:
* eval_proc.c : remove "static" from external global variables
* eval_thread.c : ditto
* array.c : fix indent
* insns.def : add a suitable cast
* vm_macro.def : allow scalar value on splat arguments
* yarvtest/test_block.rb : fix to synchronize Ruby HEAD
* rb/insns2vm.rb : remove String#each for 1.9
* template/vm.inc.tmpl : ditto (remove String#each_with_index)
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-11-06 04:24:44 UTC (rev 573)
+++ trunk/ChangeLog 2006-11-06 08:30:05 UTC (rev 574)
@@ -4,6 +4,25 @@
# from Mon, 03 May 2004 01:24:19 +0900
#
+2006-11-06(Mon) 16:36:47 +0900 Koichi Sasada <ko1 atdot.net>
+
+ * eval_proc.c : remove "static" from external global variables
+
+ * eval_thread.c : ditto
+
+ * array.c : fix indent
+
+ * insns.def : add a suitable cast
+
+ * vm_macro.def : allow scalar value on splat arguments
+
+ * yarvtest/test_block.rb : fix to synchronize Ruby HEAD
+
+ * rb/insns2vm.rb : remove String#each for 1.9
+
+ * template/vm.inc.tmpl : ditto (remove String#each_with_index)
+
+
2006-11-06(Mon) 13:22:34 +0900 Koichi Sasada <ko1 atdot.net>
* iseq.c : fixed GC debugging outputs
Modified: trunk/array.c
===================================================================
--- trunk/array.c 2006-11-06 04:24:44 UTC (rev 573)
+++ trunk/array.c 2006-11-06 08:30:05 UTC (rev 574)
@@ -237,7 +237,7 @@
ary = rb_ary_new2(n);
if (n > 0 && elts) {
MEMCPY(RARRAY_PTR(ary), elts, VALUE, n);
- ARY_SET_LEN(ary, n);
+ ARY_SET_LEN(ary, n);
}
return ary;
@@ -252,8 +252,8 @@
}
else {
xfree(RARRAY(ary)->as.heap.ptr);
+ }
}
- }
}
static VALUE
Modified: trunk/eval_proc.c
===================================================================
--- trunk/eval_proc.c 2006-11-06 04:24:44 UTC (rev 573)
+++ trunk/eval_proc.c 2006-11-06 08:30:05 UTC (rev 574)
@@ -11,8 +11,8 @@
NODE *body;
};
-static VALUE rb_cUnboundMethod;
-static VALUE rb_cMethod;
+VALUE rb_cUnboundMethod;
+VALUE rb_cMethod;
static VALUE bmcall(VALUE, VALUE);
static int method_arity(VALUE);
Modified: trunk/eval_thread.c
===================================================================
--- trunk/eval_thread.c 2006-11-06 04:24:44 UTC (rev 573)
+++ trunk/eval_thread.c 2006-11-06 08:30:05 UTC (rev 574)
@@ -520,7 +520,7 @@
* 3: 15 16
*/
-static VALUE rb_cCont;
+VALUE rb_cCont;
/*
* call-seq:
Modified: trunk/insns.def
===================================================================
--- trunk/insns.def 2006-11-06 04:24:44 UTC (rev 573)
+++ trunk/insns.def 2006-11-06 08:30:05 UTC (rev 574)
@@ -1632,7 +1632,7 @@
/* fixnum + fixnum */
val = (recv + (obj & (~1)));
if ((~(recv ^ obj) & (recv ^ val)) &
- (0x01 << ((sizeof(VALUE) * CHAR_BIT) - 1))) {
+ ((VALUE)0x01 << ((sizeof(VALUE) * CHAR_BIT) - 1))) {
val = rb_big_plus(rb_int2big(FIX2INT(recv)),
rb_int2big(FIX2INT(obj)));
}
Modified: trunk/rb/insns2vm.rb
===================================================================
--- trunk/rb/insns2vm.rb 2006-11-06 04:24:44 UTC (rev 573)
+++ trunk/rb/insns2vm.rb 2006-11-06 08:30:05 UTC (rev 574)
@@ -150,7 +150,7 @@
c = 'others'
j = ''
e = ''
- comm.each{|line|
+ comm.each_line{|line|
case line
when /@c (.+)/
c = $1
@@ -789,8 +789,8 @@
vm_body << "\n"
vm_body << make_insn_def(insn)
}
-
- ERB.new(File.read(File.join($srcdir, '/template/vm.inc.tmpl'))).result(binding)
+ src = File.read(File.join($srcdir, '/template/vm.inc.tmpl'))
+ ERB.new(src).result(binding)
end
@@ -1116,7 +1116,7 @@
def vm_macro_inc
ret = ''
flag = false
- File.read($srcdir + '/vm_macro.def').each{|line|
+ File.read($srcdir + '/vm_macro.def').each_line{|line|
line.rstrip!
if /^MACRO\s/ =~ line
line.sub!(/^MACRO/, '#define')
Modified: trunk/template/vm.inc.tmpl
===================================================================
--- trunk/template/vm.inc.tmpl 2006-11-06 04:24:44 UTC (rev 573)
+++ trunk/template/vm.inc.tmpl 2006-11-06 08:30:05 UTC (rev 574)
@@ -14,12 +14,14 @@
<%=
ret = ''
offset = 15
-vm_body.each_with_index{|line, line_no|
+line_no = 0
+vm_body.each_line{|line|
if line =~ /^\#line __CURRENT_LINE__/
ret << line.sub(/__CURRENT_LINE__/, "#{line_no+offset}")
else
ret <<line
end
+ line_no += 1
}
ret
%>
Modified: trunk/vm_macro.def
===================================================================
--- trunk/vm_macro.def 2006-11-06 04:24:44 UTC (rev 573)
+++ trunk/vm_macro.def 2006-11-06 08:30:05 UTC (rev 574)
@@ -36,9 +36,13 @@
VALUE ary = TOPN(0);
VALUE *ptr, *dst;
int i;
- if (TYPE(ary) != T_ARRAY) {
- ary = rb_Array(ary);
+ VALUE tmp = rb_check_convert_type(ary, T_ARRAY, "Array", "to_splat");
+
+ if (NIL_P(tmp)) {
+ tmp = rb_ary_new3(1, ary);
}
+ ary = tmp;
+
ptr = RARRAY_PTR(ary);
dst = GET_SP() - 1;
for (i = 0; i < RARRAY_LEN(ary); i++) {
Modified: trunk/yarvtest/test_block.rb
===================================================================
--- trunk/yarvtest/test_block.rb 2006-11-06 04:24:44 UTC (rev 573)
+++ trunk/yarvtest/test_block.rb 2006-11-06 08:30:05 UTC (rev 574)
@@ -39,9 +39,9 @@
end
a = nil
- iter{|a|
+ [iter{|a|
a
- } + a
+ }, a]
}
ae %q{
def iter
@@ -87,19 +87,22 @@
end
def test_param3
- ae %q{
- h = {}
- [1].each{|h[:foo]|}
- h
- }
- ae %q{
- obj = Object.new
- def obj.x=(y)
+ if false
+ # TODO: Ruby 1.9 doesn't support expr block parameter
+ ae %q{
+ h = {}
+ [1].each{|h[:foo]|}
+ h
+ }
+ ae %q{
+ obj = Object.new
+ def obj.x=(y)
$ans = y
end
[1].each{|obj.x|}
- $ans
- }
+ $ans
+ }
+ end
end
def test_blocklocal
--
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml