yarv-diff:248
From: ko1 atdot.net
Date: 13 Feb 2006 21:32:56 -0000
Subject: [yarv-diff:248] r411 - in trunk: . test/ruby
Author: ko1
Date: 2006-02-14 06:32:53 +0900 (Tue, 14 Feb 2006)
New Revision: 411
Modified:
trunk/
trunk/ChangeLog
trunk/compile.c
trunk/insns.def
trunk/parse.y
trunk/signal.c
trunk/test.rb
trunk/test/ruby/beginmainend.rb
trunk/test/ruby/test_beginendblock.rb
Log:
r613@lermite: ko1 | 2006-02-14 06:32:21 +0900
* compile.c, parse.y : support BEGIN{} (remove local scope)
* test/ruby/beginmainend.rb : fix to apply YARV's specification
* test/ruby/test_beginendblock.rb : enable BEGIN{} test
* signal.c : exit at double segv
* insns.def (preexe) : remove instruction "preexe"
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 81cd9672-7512-7e48-ae48-6936450e977d:/local/yarv/trunk:609
+ 81cd9672-7512-7e48-ae48-6936450e977d:/local/yarv/trunk:613
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-02-13 20:54:30 UTC (rev 410)
+++ trunk/ChangeLog 2006-02-13 21:32:53 UTC (rev 411)
@@ -4,6 +4,19 @@
# from Mon, 03 May 2004 01:24:19 +0900
#
+2006-02-14(Tue) 06:26:21 +0900 Koichi Sasada <ko1 atdot.net>
+
+ * compile.c, parse.y : support BEGIN{} (remove local scope)
+
+ * test/ruby/beginmainend.rb : fix to apply YARV's specification
+
+ * test/ruby/test_beginendblock.rb : enable BEGIN{} test
+
+ * signal.c : exit at double segv
+
+ * insns.def (preexe) : remove instruction "preexe"
+
+
2006-02-14(Tue) 05:53:56 +0900 Minero Aoki <aamine loveruby.net>
* eval.c (ruby_cleanup): th->errinfo contains a NODE while
Modified: trunk/compile.c
===================================================================
--- trunk/compile.c 2006-02-13 20:54:30 UTC (rev 410)
+++ trunk/compile.c 2006-02-13 21:32:53 UTC (rev 411)
@@ -4396,13 +4396,8 @@
break;
}
case NODE_PRELUDE:{
- VALUE iseqval = NEW_ISEQVAL(node->nd_head,
- rb_str_new2("BEGIN{}"),
- ISEQ_TYPE_TOP);
-
- ADD_INSN1(ret, nd_line(node), preexe, iseqval);
- ADD_INSN(ret, nd_line(node), pop);
- COMPILE_(ret, "prelude body", node->nd_body, poped);
+ COMPILE_POPED(ret, "prelude", node->nd_head);
+ COMPILE_(ret, "body", node->nd_body, poped);
break;
}
default:
Modified: trunk/insns.def
===================================================================
--- trunk/insns.def 2006-02-13 20:54:30 UTC (rev 410)
+++ trunk/insns.def 2006-02-13 21:32:53 UTC (rev 411)
@@ -553,7 +553,6 @@
}
}
-
/**
@c put
@e splat array
@@ -746,7 +745,6 @@
/* none */
}
-
/**
@c stack
@e
@@ -761,7 +759,6 @@
/* none */
}
-
/**
@c stack
@e get nth stack value from stack top
@@ -776,7 +773,6 @@
val = TOPN(n);
}
-
/**
@c stack
@e empt current stack
@@ -893,7 +889,6 @@
INC_VM_STATE_VERSION();
}
-
/**
@c setting
@e make alias (if v_p is Qtrue, make valias)
@@ -916,7 +911,6 @@
}
}
-
/**
@c setting
@e undef
@@ -933,7 +927,6 @@
INC_VM_STATE_VERSION();
}
-
/**
@c setting
@e defined?
@@ -1032,25 +1025,6 @@
/**
@c setting
- @e BEGIN{}
- @j BEGIN{}
- */
-DEFINE_INSN
-preexe
-(BLOCKISEQ blockiseq)
-()
-(VALUE dummy)
-{
- /* invoke block */
- th_set_env(th, blockiseq, FRAME_MAGIC_TOP, GET_SELF(),
- 0, blockiseq->iseq_encoded, GET_SP(), 0,
- blockiseq->local_size, 0, 0);
- RESTORE_REGS();
- NEXT_INSN();
-}
-
-/**
- @c setting
@e END{}
@j END{}
*/
Modified: trunk/parse.y
===================================================================
--- trunk/parse.y 2006-02-13 20:54:30 UTC (rev 410)
+++ trunk/parse.y 2006-02-13 21:32:53 UTC (rev 411)
@@ -921,7 +921,7 @@
if (in_def || in_single) {
yyerror("BEGIN in method");
}
- local_push(0);
+ // local_push(0);
/*%
if (in_def || in_single) {
yyerror("BEGIN in method");
@@ -932,8 +932,9 @@
{
/*%%%*/
ruby_eval_tree_begin = block_append(ruby_eval_tree_begin,
- NEW_PREEXE($4));
- local_pop();
+ $4);
+ // NEW_PREEXE($4));
+ // local_pop();
$$ = 0;
/*%
$$ = dispatch1(BEGIN, $4);
Modified: trunk/signal.c
===================================================================
--- trunk/signal.c 2006-02-13 20:54:30 UTC (rev 410)
+++ trunk/signal.c 2006-02-13 21:32:53 UTC (rev 411)
@@ -460,6 +460,7 @@
#endif
if (segv_received) {
fprintf(stderr, "SEGV recieved in SEGV handler\n");
+ exit(1);
}
else {
segv_received = 1;
Modified: trunk/test/ruby/beginmainend.rb
===================================================================
--- trunk/test/ruby/beginmainend.rb 2006-02-13 20:54:30 UTC (rev 410)
+++ trunk/test/ruby/beginmainend.rb 2006-02-13 21:32:53 UTC (rev 411)
@@ -16,7 +16,7 @@
}
# for scope check
-raise if defined?(local_begin1)
+#raise if defined?(local_begin1)
raise unless defined?($global_begin1)
raise unless defined?(::ConstBegin1)
local_for_end2 = "e2"
Modified: trunk/test/ruby/test_beginendblock.rb
===================================================================
--- trunk/test/ruby/test_beginendblock.rb 2006-02-13 20:54:30 UTC (rev 410)
+++ trunk/test/ruby/test_beginendblock.rb 2006-02-13 21:32:53 UTC (rev 411)
@@ -10,7 +10,7 @@
end
def test_beginendblock
-assert false, "TODO: BEGIN{} support is incomplete"
+#assert false, "TODO: BEGIN{} support is incomplete"
ruby = EnvUtil.rubybin
target = File.join(DIR, 'beginmainend.rb')
io = IO.popen("#{q(ruby)} #{q(target)}")
Modified: trunk/test.rb
===================================================================
--- trunk/test.rb 2006-02-13 20:54:30 UTC (rev 410)
+++ trunk/test.rb 2006-02-13 21:32:53 UTC (rev 411)
@@ -1,3 +1,29 @@
+BEGIN{a = 1}
+p defined?(a) #=>
+
+
+BEGIN{
+ A = 1
+ p A
+}
+p A
+__END__
+a = 4 if p a
+
+BEGIN{
+ a = 1
+ p a
+ BEGIN{
+ a = 2
+ p a
+ }
+ a = 3
+ p a
+}
+
+
+__END__
+
def m a, b
p [a, b]
a + b
--
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml