yarv-diff:199
From: ko1 atdot.net
Date: 29 Jan 2006 02:44:35 -0000
Subject: [yarv-diff:199] r357 - in trunk: . yarvtest
Author: ko1
Date: 2006-01-29 11:44:35 +0900 (Sun, 29 Jan 2006)
New Revision: 357
Modified:
trunk/ChangeLog
trunk/eval_proc.c
trunk/insns.def
trunk/test.rb
trunk/thread_win32.h
trunk/vm.c
trunk/yarvtest/test_class.rb
trunk/yarvtest/test_proc.rb
Log:
* eval_proc.c (proc_alloc) : fix [yarv-dev:777]
* yarvtest/test_proc.rb : add a test for above
* insns.def : fix [yarv-dev:782] and add YARV_CHECK_INTS()
* yarvtest/test_class.rb : add a test for above
* thread_win32.h : fix [yarv-dev-en:23]
* vm.c (th_call0) : add YARV_CHECK_INTS()
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-01-09 03:00:03 UTC (rev 356)
+++ trunk/ChangeLog 2006-01-29 02:44:35 UTC (rev 357)
@@ -4,6 +4,21 @@
# from Mon, 03 May 2004 01:24:19 +0900
#
+2006-01-29(Sun) 11:40:26 +0900 Koichi Sasada <ko1 atdot.net>
+
+ * eval_proc.c (proc_alloc) : fix [yarv-dev:777]
+
+ * yarvtest/test_proc.rb : add a test for above
+
+ * insns.def : fix [yarv-dev:782] and add YARV_CHECK_INTS()
+
+ * yarvtest/test_class.rb : add a test for above
+
+ * thread_win32.h : fix [yarv-dev-en:23]
+
+ * vm.c (th_call0) : add YARV_CHECK_INTS()
+
+
2006-01-09(Mon) 11:56:34 +0900 Minero Aoki <aamine loveruby.net>
* yarvcore.h: add prototype (remove warning).
Modified: trunk/eval_proc.c
===================================================================
--- trunk/eval_proc.c 2006-01-09 03:00:03 UTC (rev 356)
+++ trunk/eval_proc.c 2006-01-29 02:44:35 UTC (rev 357)
@@ -158,7 +158,7 @@
rb_raise(rb_eArgError, "tried to create Proc object without a block");
}
}
- cfp = th_get_ruby_level_cfp(th, YARV_PREVIOUS_CONTROL_FRAME(cfp));
+ cfp = YARV_PREVIOUS_CONTROL_FRAME(cfp);
procval = th_make_proc(th, cfp, block);
if(is_lambda){
Modified: trunk/insns.def
===================================================================
--- trunk/insns.def 2006-01-09 03:00:03 UTC (rev 356)
+++ trunk/insns.def 2006-01-29 02:44:35 UTC (rev 357)
@@ -1094,6 +1094,10 @@
/* find klass */
if(rb_const_defined_at(cbase, id)){
klass = rb_const_get_at(cbase, id);
+ if (TYPE(klass) != T_CLASS) {
+ rb_raise(rb_eTypeError, "%s is not a class",
+ rb_id2name(id));
+ }
if(super != rb_cObject){
/* type check */
VALUE tmp;
@@ -1333,6 +1337,7 @@
#endif
#endif
macro_eval_invoke_method(recv, klass, id, num, mn, blockptr);
+ YARV_CHECK_INTS();
}
/**
Modified: trunk/test.rb
===================================================================
--- trunk/test.rb 2006-01-09 03:00:03 UTC (rev 356)
+++ trunk/test.rb 2006-01-29 02:44:35 UTC (rev 357)
@@ -1,7 +1,77 @@
+require 'test/unit'
+__END__
+__END__
+require 'test/unit'
+
+__END__
+
+def m
+end
+def block
+ Object.method(:m).to_proc
+end
+
+b = block()
+b.call
+
+__END__
+
+module M
+ A = :M_A
+end
+
+class C
+ class A
+ include M
+ p A #=> C::A
+ end
+end
+
+p C::A::A
+
+__END__
+
+module M
+ A = :M_A
+end
+
+class A
+ include M
+ p A #=> :M_A @ ruby 1.8, 1.9
+end
+
+p A::A #=> M_A
+
+__END__
+
+p
+
+__END__
+
+require 'timeout'
+
+timeout(3){
+ sleep 5
+}
+
+p 'hello'
+
+__END__
trap(:SIGINT){
p 1
+ raise "wakeup"
}
+def m
+end
+begin
+ sleep
+ #m
+rescue => e
+ p e
+end
+__END__
+
segv
__END__
Modified: trunk/thread_win32.h
===================================================================
--- trunk/thread_win32.h 2006-01-09 03:00:03 UTC (rev 356)
+++ trunk/thread_win32.h 2006-01-29 02:44:35 UTC (rev 357)
@@ -207,7 +207,7 @@
thread_debug("timer_thread: %p\n", GetCurrentThreadId());
while(system_working){
Sleep(WIN32_WAIT_TIMEOUT);
- GET_VM()->interrupt_flag = 1;
+ GET_VM()->running_thread->interrupt_flag = 1;
}
return 0;
}
Modified: trunk/vm.c
===================================================================
--- trunk/vm.c 2006-01-09 03:00:03 UTC (rev 356)
+++ trunk/vm.c 2006-01-29 02:44:35 UTC (rev 357)
@@ -231,7 +231,7 @@
if(envptr == endptr){
cfp->lfp = nenvptr;
}
-
+
/* as Binding */
env->block.self = cfp->self;
env->block.lfp = cfp->lfp;
@@ -364,10 +364,8 @@
if(PROCDEBUG){
check_env_value(envval);
}
-
procval = rb_obj_alloc(cYarvProc);
GetProcVal(procval, proc);
-
proc->blockprocval = blockprocval;
proc->block.self = block->self;
proc->block.lfp = block->lfp;
@@ -418,7 +416,9 @@
FRAME_MAGIC_CFUNC, recv, (VALUE)blockptr,
0, reg_cfp->sp, 0,
0, 0, 0);
+
val = call_cfunc(body->nd_cfnc, recv, body->nd_argc, argc, argv);
+
th->cfp = reg_cfp; /* pop control stack frame */
break;
}
@@ -455,6 +455,7 @@
default:
rb_bug("unsupported: thread_call0");
}
+ YARV_CHECK_INTS();
return val;
}
@@ -527,7 +528,6 @@
FRAME_MAGIC_IFUNC, block->self, (VALUE)block->dfp,
0, th->cfp->sp, block->lfp,
0, 0, 0);
-
val = (*ifunc->nd_cfnc)(arg, ifunc->nd_tval, Qnil);
th->cfp++;
@@ -615,7 +615,8 @@
volatile yarv_stored_klass_t sk;
volatile VALUE stored_special_cref_stack;
- stored_special_cref_stack = th_restore_stored_klass(th, proc->block.lfp, &proc->stored_klass);
+ stored_special_cref_stack =
+ th_restore_stored_klass(th, proc->block.lfp, &proc->stored_klass);
TH_PUSH_TAG(th);
if((state = EXEC_TAG()) == 0){
@@ -627,7 +628,7 @@
}
}
else{
-
+ // TODO
}
th_restore_restored_klass(th, proc->block.lfp, stored_special_cref_stack);
Modified: trunk/yarvtest/test_class.rb
===================================================================
--- trunk/yarvtest/test_class.rb 2006-01-09 03:00:03 UTC (rev 356)
+++ trunk/yarvtest/test_class.rb 2006-01-29 02:44:35 UTC (rev 357)
@@ -507,6 +507,19 @@
remove_const(:C)
end
end
+
+ def test_reopen_not_class
+ ae %q{
+ begin
+ B = 1
+ class B
+ p B
+ end
+ rescue TypeError => e
+ e.message
+ end
+ }
+ end
end
Modified: trunk/yarvtest/test_proc.rb
===================================================================
--- trunk/yarvtest/test_proc.rb 2006-01-09 03:00:03 UTC (rev 356)
+++ trunk/yarvtest/test_proc.rb 2006-01-29 02:44:35 UTC (rev 357)
@@ -228,6 +228,21 @@
m
}
end
-
+
+ def test_method_to_proc
+ ae %q{
+ class C
+ def foo
+ :ok
+ end
+ end
+
+ def block
+ C.method(:new).to_proc
+ end
+ b = block()
+ b.call.foo
+ }
+ end
end
--
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml