yarv-diff:309
From: ko1 atdot.net
Date: 23 Feb 2006 06:15:50 -0000
Subject: [yarv-diff:309] r474 - in trunk: . yarvtest
Author: ko1
Date: 2006-02-23 15:15:50 +0900 (Thu, 23 Feb 2006)
New Revision: 474
Modified:
trunk/
trunk/ChangeLog
trunk/eval.c
trunk/eval_intern.h
trunk/eval_load.c
trunk/vm.c
trunk/yarvcore.c
trunk/yarvtest/test_proc.rb
Log:
r730@lermite: ko1 | 2006-02-23 15:15:13 +0900
* eval.c : support rb_frame_self()
* eval_intern.h (th_get_ruby_level_cfp) : return 0 if no cfp
* eval_load.c : comment out scope set
* yarvcore.c : fix to initialize/free process of iseq
* vm.c (th_invoke_proc) : fix to set special cref always
* yarvtest/test_proc.rb : add a test for above
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 81cd9672-7512-7e48-ae48-6936450e977d:/local/yarv/trunk:726
+ 81cd9672-7512-7e48-ae48-6936450e977d:/local/yarv/trunk:730
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-02-22 20:45:10 UTC (rev 473)
+++ trunk/ChangeLog 2006-02-23 06:15:50 UTC (rev 474)
@@ -4,6 +4,21 @@
# from Mon, 03 May 2004 01:24:19 +0900
#
+2006-02-23(Thu) 15:10:09 +0900 Koichi Sasada <ko1 atdot.net>
+
+ * eval.c : support rb_frame_self()
+
+ * eval_intern.h (th_get_ruby_level_cfp) : return 0 if no cfp
+
+ * eval_load.c : comment out scope set
+
+ * yarvcore.c : fix to initialize/free process of iseq
+
+ * vm.c (th_invoke_proc) : fix to set special cref always
+
+ * yarvtest/test_proc.rb : add a test for above
+
+
2006-02-22(Wed) 23:33:47 +0900 Koichi Sasada <ko1 atdot.net>
* common.mk : add rule "runruby"
Modified: trunk/eval.c
===================================================================
--- trunk/eval.c 2006-02-22 20:45:10 UTC (rev 473)
+++ trunk/eval.c 2006-02-23 06:15:50 UTC (rev 474)
@@ -1634,6 +1634,7 @@
if (TYPE(defined_class) == T_ICLASS) {
defined_class = RBASIC(defined_class)->klass;
}
+
if (!rb_obj_is_kind_of
(rb_frame_self(), rb_class_real(defined_class)))
return method_missing(recv, mid, argc, argv, NOEX_PROTECTED);
@@ -1853,8 +1854,7 @@
static VALUE
rb_frame_self(void)
{
- UNSUPPORTED(rb_frame_self);
- return Qnil;
+ return GET_THREAD()->cfp->self;
}
const char *
Modified: trunk/eval_intern.h
===================================================================
--- trunk/eval_intern.h 2006-02-22 20:45:10 UTC (rev 473)
+++ trunk/eval_intern.h 2006-02-23 06:15:50 UTC (rev 474)
@@ -10,9 +10,9 @@
#define UNSUPPORTED(func) \
{ \
int *a = 0; \
- fprintf(stderr, "%s", "-- unsuppoted: " #func "\n"); \
+ fprintf(stderr, "%s", "-- unsupported: " #func "\n"); fflush(stderr); \
*a = 0; \
- rb_bug("unsuppoted: " #func); \
+ rb_bug("unsupported: " #func); \
}
#include "ruby.h"
@@ -308,7 +308,7 @@
cfp = YARV_PREVIOUS_CONTROL_FRAME(cfp);
}
if (!iseq) {
- rb_bug("th_get_ruby_level_cfp: unreachable");
+ return 0;
}
return cfp;
}
Modified: trunk/eval_load.c
===================================================================
--- trunk/eval_load.c 2006-02-22 20:45:10 UTC (rev 473)
+++ trunk/eval_load.c 2006-02-23 06:15:50 UTC (rev 474)
@@ -376,7 +376,7 @@
ruby_current_node = 0;
ruby_sourcefile = rb_source_filename(RSTRING(path)->ptr);
ruby_sourceline = 0;
- SCOPE_SET(NOEX_PUBLIC);
+ //SCOPE_SET(NOEX_PUBLIC);
handle = (long)dln_load(RSTRING(path)->ptr);
rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
break;
Modified: trunk/vm.c
===================================================================
--- trunk/vm.c 2006-02-22 20:45:10 UTC (rev 473)
+++ trunk/vm.c 2006-02-23 06:15:50 UTC (rev 474)
@@ -664,10 +664,8 @@
TH_PUSH_TAG(th);
if ((state = EXEC_TAG()) == 0) {
- if (proc->special_cref_stack) {
- stored_special_cref_stack =
- lfp_set_special_cref(proc->block.lfp, proc->special_cref_stack);
- }
+ stored_special_cref_stack =
+ lfp_set_special_cref(proc->block.lfp, proc->special_cref_stack);
th->safe_level = proc->safe_level;
if (BUILTIN_TYPE(proc->block.iseq) == T_NODE) {
@@ -711,9 +709,7 @@
TH_POP_TAG();
th->safe_level = stored_safe;
- if (stored_special_cref_stack) {
- lfp_set_special_cref(proc->block.lfp, stored_special_cref_stack);
- }
+ lfp_set_special_cref(proc->block.lfp, stored_special_cref_stack);
if (state) {
JUMP_TAG(state);
@@ -890,9 +886,9 @@
static NODE *
lfp_get_special_cref(VALUE *lfp)
{
- NODE *node;
- if (((VALUE)(node = (NODE *) lfp[-1])) != Qnil && node->nd_file) {
- return (NODE *) node->nd_file;
+ struct RValues *values;
+ if (((VALUE)(values = (void *)lfp[-1])) != Qnil && values->basic.klass) {
+ return (NODE *)values->basic.klass;
}
else {
return 0;
@@ -958,6 +954,7 @@
th_cref_push(yarv_thread_t *th, VALUE klass, int noex)
{
NODE *cref = NEW_BLOCK(klass);
+ cref->nd_file = 0;
yarv_control_frame_t *cfp = th_get_ruby_level_cfp(th, th->cfp);
cref->nd_next = get_cref(cfp->iseq, cfp->lfp);
cref->nd_visi = noex;
Modified: trunk/yarvcore.c
===================================================================
--- trunk/yarvcore.c 2006-02-22 20:45:10 UTC (rev 473)
+++ trunk/yarvcore.c 2006-02-23 06:15:50 UTC (rev 474)
@@ -360,6 +360,7 @@
yarv_iseq_t *iseq;
obj = Data_Make_Struct(klass, yarv_iseq_t, iseq_mark, iseq_free, iseq);
+ MEMZERO(iseq, yarv_iseq_t, 1);
return obj;
}
@@ -387,10 +388,12 @@
if (type == ISEQ_TYPE_TOP) {
/* toplevel is private */
iseq->cref_stack = NEW_BLOCK(rb_cObject);
+ iseq->cref_stack->nd_file = 0;
iseq->cref_stack->nd_visi = NOEX_PRIVATE;
}
else if (type == ISEQ_TYPE_METHOD || type == ISEQ_TYPE_CLASS) {
iseq->cref_stack = NEW_BLOCK(0); /* place holder */
+ iseq->cref_stack->nd_file = 0;
}
else if (parent) {
yarv_iseq_t *piseq;
@@ -437,8 +440,10 @@
static VALUE
cleanup_iseq_build(yarv_iseq_t *iseq)
{
- compile_data_free(iseq->compile_data);
+ struct iseq_compile_data *data = iseq->compile_data;
iseq->compile_data = 0;
+ compile_data_free(data);
+
if (ruby_nerrs > 0) {
VALUE str = rb_str_buf_new2("compile error");
ruby_nerrs = 0;
Modified: trunk/yarvtest/test_proc.rb
===================================================================
--- trunk/yarvtest/test_proc.rb 2006-02-22 20:45:10 UTC (rev 473)
+++ trunk/yarvtest/test_proc.rb 2006-02-23 06:15:50 UTC (rev 474)
@@ -127,6 +127,18 @@
end
$pr.call
}
+ ae %q{
+ Const = :top
+ class C
+ Const = :C
+ end
+ pr = proc{
+ Const
+ }
+ C.class_eval %q{
+ pr.call
+ }
+ }
end
def test_3nest
--
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml