yarv-diff:83
From: ko1 atdot.net
Date: 15 Aug 2005 20:38:50 -0000
Subject: [yarv-diff:83] r239 - in trunk: . yarvtest
Author: ko1
Date: 2005-08-16 05:38:49 +0900 (Tue, 16 Aug 2005)
New Revision: 239
Added:
trunk/test1.rb
Modified:
trunk/ChangeLog
trunk/common.mk
trunk/compile.c
trunk/compile.h
trunk/test.rb
trunk/yarvtest/test_exception.rb
Log:
* test1.rb : added. gdb and run1 rule run this script
* compile.c : fix error handled variable access
* yarvtest/test_exception.rb : add tests for above
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2005-08-15 19:27:09 UTC (rev 238)
+++ trunk/ChangeLog 2005-08-15 20:38:49 UTC (rev 239)
@@ -4,6 +4,15 @@
# from Mon, 03 May 2004 01:24:19 +0900
#
+2005-08-16(Tue) 05:34:48 +0900 Koichi Sasada <ko1 atdot.net>
+
+ * test1.rb : added. gdb and run1 rule run this script
+
+ * compile.c : fix error handled variable access
+
+ * yarvtest/test_exception.rb : add tests for above
+
+
2005-08-16(Tue) 04:26:08 +0900 Koichi Sasada <ko1 atdot.net>
* base ruby : ruby 1.9.0 (2005-08-15)
Modified: trunk/common.mk
===================================================================
--- trunk/common.mk 2005-08-15 19:27:09 UTC (rev 238)
+++ trunk/common.mk 2005-08-15 20:38:49 UTC (rev 239)
@@ -395,8 +395,11 @@
$(BASERUBY) -I$(srcdir) $(srcdir)/yarvtest/test_$(ITEM).rb $(OPT) yarv=$(MINIRUBY) ruby=$(BASERUBY)
run: all
- $(BASERUBY) $(srcdir)/test.rb $(RUNOPT) $(MINIRUBY) $(BASERUBY)
+ $(BASERUBY) -I$(srcdir)/lib $(srcdir)/test.rb $(MINIRUBY) $(BASERUBY) $(RUNOPT)
+run1: all
+ $(MINIRUBY) $(srcdir)/test1.rb
+
benchmark: all
$(BASERUBY) -I$(srcdir) $(srcdir)/benchmark/run_rite.rb $(OPT) $(ITEMS) --yarv-program=$(MINIRUBY) --ruby-program=$(BASERUBY)
@@ -410,4 +413,4 @@
echo run > run.gdb
gdb: all run.gdb
- gdb -x run.gdb --quiet --args $(MINIRUBY) -I$(srcdir) $(srcdir)/test.rb
+ gdb -x run.gdb --quiet --args $(MINIRUBY) -I$(srcdir) $(srcdir)/test1.rb
Modified: trunk/compile.c
===================================================================
--- trunk/compile.c 2005-08-15 19:27:09 UTC (rev 238)
+++ trunk/compile.c 2005-08-15 20:38:49 UTC (rev 239)
@@ -678,9 +678,10 @@
iseq_translate_direct_threaded_code(iseqobj);
GC_CHECK();
- if(CPDEBUG > 5){
+ if(CPDEBUG > 1){
VALUE str = iseq_disasm(self);
printf("%s\n", StringValueCStr(str));
+ fflush(stdout);
}
debugs("[compile step: finish]\n");
@@ -2568,14 +2569,13 @@
if(!poped){
ADD_INSN(ret, nd_line(node), dup);
}
- if(nd_type(node) == NODE_DASGN){
- idx = get_dyna_var_idx(self, node->nd_vid, &lv, &ls);
+ idx = get_dyna_var_idx(self, node->nd_vid, &lv, &ls);
+ if(nd_type(node) == NODE_DASGN_CURR &&
+ lv > 0 &&
+ iseqobj->type != ISEQ_TYPE_RESCUE){
+ rb_bug("NODE_DASGN_CURR, but lv != 0 (%d)", lv);
}
- else{
- idx = get_dyna_var_idx_at(self, node->nd_vid);
- ls = iseqobj->local_size;
- lv = 0;
- }
+
if(idx < 0){
debugi("unknown id", node->nd_vid);
COMPILE_ERROR(("NODE_DASGN error"));
Modified: trunk/compile.h
===================================================================
--- trunk/compile.h 2005-08-15 19:27:09 UTC (rev 238)
+++ trunk/compile.h 2005-08-15 20:38:49 UTC (rev 239)
@@ -28,7 +28,7 @@
#if 0
#undef CPDEBUG
-#define CPDEBUG 1
+#define CPDEBUG 2
#endif
#if CPDEBUG > 0
Modified: trunk/test.rb
===================================================================
--- trunk/test.rb 2005-08-15 19:27:09 UTC (rev 238)
+++ trunk/test.rb 2005-08-15 20:38:49 UTC (rev 239)
@@ -1,9 +1,31 @@
$prog = <<'__EOP__'
-##################################################################
-# write your test program
-require 'r'
+1.times{|e|
+ begin
+ rescue => err
+ end
+}
+__END__
+
+stack.each{|e|
+ begin
+ rescue SystemCallError => err
+ end
+}
+
+__END__
+list.each{|path|
+ # optimize for the most common case
+ stack.each{|path|
+ begin
+ p path
+ rescue SystemCallError => err
+
+ end
+ }
+}
+
##################################################################
__EOP__
Added: trunk/test1.rb
===================================================================
--- trunk/test1.rb 2005-08-15 19:27:09 UTC (rev 238)
+++ trunk/test1.rb 2005-08-15 20:38:49 UTC (rev 239)
@@ -0,0 +1,8 @@
+1.times{|e|
+ begin
+ raise
+ rescue => err
+ end
+ p err
+ p err.backtrace
+}
Modified: trunk/yarvtest/test_exception.rb
===================================================================
--- trunk/yarvtest/test_exception.rb 2005-08-15 19:27:09 UTC (rev 238)
+++ trunk/yarvtest/test_exception.rb 2005-08-15 20:38:49 UTC (rev 239)
@@ -173,6 +173,29 @@
end
}
end
+
+ def test_error_variable
+ ae %q{
+ a = nil
+ 1.times{|e|
+ begin
+ rescue => err
+ end
+ a = err.class
+ }
+ }
+ ae %q{
+ a = nil
+ 1.times{|e|
+ begin
+ raise
+ rescue => err
+ end
+ a = err.class
+ }
+ a
+ }
+ end
def test_raise_in_other_scope
ae %q{
--
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml