ruby-changes:3143
From: ko1@a...
Date: 25 Dec 2007 06:19:34 +0900
Subject: [ruby-changes:3143] ko1 - Ruby:r14635 (trunk): * vm.c: add dummy toplevel frame.
ko1 2007-12-25 06:18:47 +0900 (Tue, 25 Dec 2007)
New Revision: 14635
Modified files:
trunk/ChangeLog
trunk/vm.c
Log:
* vm.c: add dummy toplevel frame.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14635&r2=14634
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm.c?r1=14635&r2=14634
Index: ChangeLog
===================================================================
--- ChangeLog (revision 14634)
+++ ChangeLog (revision 14635)
@@ -1,3 +1,7 @@
+Tue Dec 25 06:15:01 2007 Koichi Sasada <ko1@a...>
+
+ * vm.c: add dummy toplevel frame.
+
Tue Dec 25 05:44:56 2007 Eric Hodel <drbrain@s...>
* lib/net/http.rb: Fix uninitialized variable warning.
Index: vm.c
===================================================================
--- vm.c (revision 14634)
+++ vm.c (revision 14635)
@@ -1412,10 +1412,10 @@
{
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *reg_cfp = th->cfp;
- volatile VALUE iseq = rb_iseq_new(0, filename, filename, 0, ISEQ_TYPE_TOP);
+ volatile VALUE iseqval = rb_iseq_new(0, filename, filename, 0, ISEQ_TYPE_TOP);
VALUE val;
- vm_push_frame(th, DATA_PTR(iseq), FRAME_MAGIC_TOP,
+ vm_push_frame(th, DATA_PTR(iseqval), FRAME_MAGIC_TOP,
recv, (VALUE)blockptr, 0, reg_cfp->sp, 0, 1);
val = (*func)(arg);
@@ -1666,23 +1666,7 @@
th->cfp = (void *)(th->stack + th->stack_size);
vm_push_frame(th, 0, FRAME_MAGIC_TOP, Qnil, 0, 0,
- th->stack, 0, 0);
- vm_push_frame(th, 0, FRAME_MAGIC_TOP, Qnil, 0, 0,
- th->cfp->sp, 0, 0);
-
-#if 0
- th->cfp->pc = 0;
- th->cfp->sp = th->stack;
- th->cfp->bp = 0;
- th->cfp->lfp = th->stack;
- *th->cfp->lfp = 0;
- th->cfp->dfp = th->stack;
- th->cfp->self = Qnil;
- th->cfp->flag = 0;
- th->cfp->iseq = 0;
- th->cfp->proc = 0;
- th->cfp->block_iseq = 0;
-#endif
+ th->stack, 0, 1);
th->status = THREAD_RUNNABLE;
th->errinfo = Qnil;
@@ -1823,7 +1807,10 @@
{
rb_vm_t *vm = ruby_current_vm;
rb_thread_t *th = GET_THREAD();
+ VALUE filename = rb_str_new2("<dummy toplevel>");
+ volatile VALUE iseqval = rb_iseq_new(0, filename, filename, 0, ISEQ_TYPE_TOP);
volatile VALUE th_self;
+ rb_iseq_t *iseq;
/* create vm object */
vm->self = Data_Wrap_Struct(rb_cVM, rb_vm_mark, vm_free, vm);
@@ -1831,7 +1818,6 @@
/* create main thread */
th_self = th->self = Data_Wrap_Struct(rb_cThread, rb_thread_mark,
thread_free, th);
-
vm->main_thread = th;
vm->running_thread = th;
th->vm = vm;
@@ -1841,6 +1827,13 @@
vm->living_threads = st_init_numtable();
st_insert(vm->living_threads, th_self, (st_data_t) th->thread_id);
+
+ rb_register_mark_object(iseqval);
+ GetISeqPtr(iseqval, iseq);
+ th->cfp->iseq = iseq;
+ th->cfp->pc = iseq->iseq_encoded;
+ (th->cfp+1)->iseq = iseq;
+ (th->cfp+1)->pc = iseq->iseq_encoded;
}
vm_init_redefined_flag();
}
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml