[前][次][番号順一覧][スレッド一覧][生データ]

yarv-diff:226

From: ko1 atdot.net
Date: 12 Feb 2006 06:28:54 -0000
Subject: [yarv-diff:226] r383 - in trunk: . test/ruby yarvtest

Author: ko1
Date: 2006-02-12 15:28:53 +0900 (Sun, 12 Feb 2006)
New Revision: 383

Removed:
   trunk/env.h
Modified:
   trunk/
   trunk/ChangeLog
   trunk/common.mk
   trunk/compile.c
   trunk/error.c
   trunk/eval.c
   trunk/eval_intern.h
   trunk/gc.c
   trunk/insns.def
   trunk/parse.y
   trunk/ruby.h
   trunk/test.rb
   trunk/test/ruby/test_gc.rb
   trunk/vm.c
   trunk/yarvcore.c
   trunk/yarvcore.h
   trunk/yarvtest/test_exception.rb
Log:
 r560@leremita:  ko1 | 2006-02-12 15:28:05 +0900
 	* env.h : removed
 
 	* common.mk : remove env.h dependency
 
 	* compile.c, eval_intern.h : remove include env.h
 
 	* vm.c : ditto
 
 	* ruby.h, gc.c, error.c : remove T_SCOPE, T_VARMAP
 
 	* parse.y, eval.c : use rb_parse_in_eval() instead of ruby_in_eval
 
 	* yarvcore.c, yarvcore.h : add a prase_in_eval member to yarv_thread_t
 
 	* insns.def : add push value to throw instruction
 	for stack consistency
 
 	* yarvtest/test_exception.rb : add a test for above
 
 	* test/ruby/test_gc.rb : fix typo
 



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 81cd9672-7512-7e48-ae48-6936450e977d:/local/yarv/trunk:558
   + 81cd9672-7512-7e48-ae48-6936450e977d:/local/yarv/trunk:560

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/ChangeLog	2006-02-12 06:28:53 UTC (rev 383)
@@ -4,6 +4,30 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
+2006-02-12(Sun) 15:14:44 +0900  Koichi Sasada  <ko1 atdot.net>
+
+	* env.h : removed
+
+	* common.mk : remove env.h dependency
+
+	* compile.c, eval_intern.h : remove include env.h
+
+	* vm.c : ditto
+
+	* ruby.h, gc.c, error.c : remove T_SCOPE, T_VARMAP
+
+	* parse.y, eval.c : use rb_parse_in_eval() instead of ruby_in_eval
+
+	* yarvcore.c, yarvcore.h : add a prase_in_eval member to yarv_thread_t
+
+	* insns.def : add push value to throw instruction
+	for stack consistency
+
+	* yarvtest/test_exception.rb : add a test for above
+
+	* test/ruby/test_gc.rb : fix typo
+
+
 2006-02-12(Sun) 05:05:02 +0900  Koichi Sasada  <ko1 atdot.net>
 
 	* eval.c, eval_intern.h, eval_load.c, eval_proc.c, node.h,

Modified: trunk/common.mk
===================================================================
--- trunk/common.mk	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/common.mk	2006-02-12 06:28:53 UTC (rev 383)
@@ -252,7 +252,7 @@
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
 error.$(OBJEXT): {$(VPATH)}error.c {$(VPATH)}ruby.h config.h \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
-  {$(VPATH)}env.h {$(VPATH)}st.h vm_opts.h
+  {$(VPATH)}st.h vm_opts.h
 euc_jp.$(OBJEXT): {$(VPATH)}euc_jp.c {$(VPATH)}regenc.h \
   {$(VPATH)}oniguruma.h
 
@@ -260,28 +260,28 @@
   {$(VPATH)}eval_method.h {$(VPATH)}eval_safe.h {$(VPATH)}eval_jump.h \
   {$(VPATH)}ruby.h config.h  {$(VPATH)}yarvcore.h \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
-  {$(VPATH)}node.h {$(VPATH)}env.h {$(VPATH)}util.h \
+  {$(VPATH)}node.h {$(VPATH)}util.h \
   {$(VPATH)}rubysig.h {$(VPATH)}st.h {$(VPATH)}dln.h {$(VPATH)}yarv.h
 eval_load.$(OBJEXT): {$(VPATH)}eval_load.c {$(VPATH)}eval_intern.h \
   {$(VPATH)}ruby.h config.h \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
-  {$(VPATH)}node.h {$(VPATH)}env.h {$(VPATH)}util.h  {$(VPATH)}yarvcore.h \
+  {$(VPATH)}node.h {$(VPATH)}util.h  {$(VPATH)}yarvcore.h \
   {$(VPATH)}rubysig.h {$(VPATH)}st.h {$(VPATH)}dln.h {$(VPATH)}yarv.h
 eval_thread.$(OBJEXT): {$(VPATH)}eval_thread.c {$(VPATH)}eval_intern.h \
   {$(VPATH)}ruby.h config.h  {$(VPATH)}yarvcore.h \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
-  {$(VPATH)}node.h {$(VPATH)}env.h {$(VPATH)}util.h \
+  {$(VPATH)}node.h {$(VPATH)}util.h \
   {$(VPATH)}rubysig.h {$(VPATH)}st.h {$(VPATH)}dln.h {$(VPATH)}yarv.h
 eval_proc.$(OBJEXT): {$(VPATH)}eval_proc.c  {$(VPATH)}eval_intern.h \
   {$(VPATH)}ruby.h config.h  {$(VPATH)}yarvcore.h \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
-  {$(VPATH)}node.h {$(VPATH)}env.h {$(VPATH)}util.h \
+  {$(VPATH)}node.h {$(VPATH)}util.h \
   {$(VPATH)}rubysig.h {$(VPATH)}st.h {$(VPATH)}dln.h {$(VPATH)}yarv.h
 
 thread.$(OBJEXT): {$(VPATH)}thread.c  {$(VPATH)}eval_intern.h \
   {$(VPATH)}thread_win32.h {$(VPATH)}thread_pthread.h {$(VPATH)}ruby.h config.h \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
-  {$(VPATH)}node.h {$(VPATH)}env.h {$(VPATH)}util.h \
+  {$(VPATH)}node.h {$(VPATH)}util.h \
   {$(VPATH)}rubysig.h {$(VPATH)}st.h {$(VPATH)}dln.h {$(VPATH)}yarv.h
 
 file.$(OBJEXT): {$(VPATH)}file.c {$(VPATH)}ruby.h config.h \
@@ -291,7 +291,7 @@
 gc.$(OBJEXT): {$(VPATH)}gc.c {$(VPATH)}ruby.h config.h \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
   {$(VPATH)}rubysig.h {$(VPATH)}st.h {$(VPATH)}node.h \
-  {$(VPATH)}env.h {$(VPATH)}re.h {$(VPATH)}regex.h {$(VPATH)}yarvcore.h
+  {$(VPATH)}re.h {$(VPATH)}regex.h {$(VPATH)}yarvcore.h
 hash.$(OBJEXT): {$(VPATH)}hash.c {$(VPATH)}ruby.h config.h \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
   {$(VPATH)}st.h {$(VPATH)}util.h {$(VPATH)}rubysig.h
@@ -308,7 +308,7 @@
 math.$(OBJEXT): {$(VPATH)}math.c {$(VPATH)}ruby.h config.h \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
 numeric.$(OBJEXT): {$(VPATH)}numeric.c {$(VPATH)}ruby.h config.h \
-  {$(VPATH)}env.h {$(VPATH)}defines.h {$(VPATH)}intern.h \
+  {$(VPATH)}defines.h {$(VPATH)}intern.h \
   {$(VPATH)}missing.h
 object.$(OBJEXT): {$(VPATH)}object.c {$(VPATH)}ruby.h config.h \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
@@ -317,7 +317,7 @@
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
 parse.$(OBJEXT): {$(VPATH)}parse.c {$(VPATH)}ruby.h config.h \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
-  {$(VPATH)}env.h {$(VPATH)}node.h {$(VPATH)}st.h \
+  {$(VPATH)}node.h {$(VPATH)}st.h \
   {$(VPATH)}regex.h {$(VPATH)}util.h {$(VPATH)}lex.c
 prec.$(OBJEXT): {$(VPATH)}prec.c {$(VPATH)}ruby.h config.h \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
@@ -366,7 +366,7 @@
   {$(VPATH)}util.h
 variable.$(OBJEXT): {$(VPATH)}variable.c {$(VPATH)}ruby.h config.h \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
-  {$(VPATH)}env.h {$(VPATH)}node.h {$(VPATH)}st.h {$(VPATH)}util.h
+  {$(VPATH)}node.h {$(VPATH)}st.h {$(VPATH)}util.h
 version.$(OBJEXT): {$(VPATH)}version.c {$(VPATH)}ruby.h config.h rev.inc \
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
   {$(VPATH)}version.h {$(VPATH)}yarv_version.h rev.inc

Modified: trunk/compile.c
===================================================================
--- trunk/compile.c	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/compile.c	2006-02-12 06:28:53 UTC (rev 383)
@@ -8,7 +8,6 @@
 
 #include "ruby.h"
 #include "node.h"
-#include "env.h"
 
 #include "yarvcore.h"
 #include "compile.h"

Deleted: trunk/env.h
===================================================================
--- trunk/env.h	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/env.h	2006-02-12 06:28:53 UTC (rev 383)
@@ -1,59 +0,0 @@
-/**********************************************************************
-
-  env.h -
-
-  $Author: ocean $
-  $Date: 2005/09/14 06:32:30 $
-  created at: Mon Jul 11 11:53:03 JST 1994
-
-  Copyright (C) 1993-2003 Yukihiro Matsumoto
-
-**********************************************************************/
-
-#ifndef ENV_H
-#define ENV_H
-
-RUBY_EXTERN struct FRAME {
-    VALUE self;
-    int argc;
-    ID callee;
-    ID this_func;
-    VALUE this_class;
-    struct FRAME *prev;
-    struct FRAME *tmp;
-    struct RNode *node;
-    int iter;
-    int flags;
-    unsigned long uniq;
-} *ruby_frame;
-
-void rb_gc_mark_frame(struct FRAME *);
-
-#define FRAME_DMETH  1
-#define FRAME_FUNC   2
-
-RUBY_EXTERN struct SCOPE {
-    struct RBasic super;
-    ID *local_tbl;
-    VALUE *local_vars;
-    int flags;
-} *ruby_scope;
-
-#define SCOPE_ALLOCA  0
-#define SCOPE_MALLOC  1
-#define SCOPE_NOSTACK 2
-#define SCOPE_DONT_RECYCLE 4
-
-RUBY_EXTERN int ruby_in_eval;
-
-RUBY_EXTERN VALUE ruby_class;
-
-struct RVarmap {
-    struct RBasic super;
-    ID id;
-    VALUE val;
-    struct RVarmap *next;
-};
-RUBY_EXTERN struct RVarmap *ruby_dyna_vars;
-
-#endif /* ENV_H */

Modified: trunk/error.c
===================================================================
--- trunk/error.c	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/error.c	2006-02-12 06:28:53 UTC (rev 383)
@@ -23,8 +23,6 @@
 #endif
 
 extern const char ruby_version[], ruby_release_date[], ruby_platform[];
-extern int ruby_in_eval;
-
 int ruby_nerrs;
 
 const char *rb_sourcefile();
@@ -195,8 +193,6 @@
     {T_SYMBOL,	"Symbol"},	/* :symbol */
     {T_DATA,	"Data"},	/* internal use: wrapped C pointers */
     {T_MATCH,	"MatchData"},	/* data of $~ */
-    {T_VARMAP,	"Varmap"},	/* internal use: dynamic variables */
-    {T_SCOPE,	"Scope"},	/* internal use: variable scope */
     {T_NODE,	"Node"},	/* internal use: syntax tree node */
     {T_UNDEF,	"undef"},	/* internal use: #undef; should not happen */
     {-1,	0}
@@ -1044,7 +1040,6 @@
     vsnprintf(buf, BUFSIZ, fmt, args);
     va_end(args);
 
-    ruby_in_eval = 0;
     rb_exc_fatal(rb_exc_new2(rb_eFatal, buf));
 }
 
@@ -1478,20 +1473,21 @@
 static void
 err_append(const char *s)
 {
-    if (ruby_in_eval) {
-	if (NIL_P(GET_THREAD()->errinfo)) {
-	    GET_THREAD()->errinfo = rb_exc_new2(rb_eSyntaxError, s);
-	}
-	else {
-	    VALUE str = rb_obj_as_string(GET_THREAD()->errinfo);
-
-	    rb_str_cat2(str, "\n");
-	    rb_str_cat2(str, s);
-	    GET_THREAD()->errinfo = rb_exc_new3(rb_eSyntaxError, str);
-	}
+  yarv_thread_t *th = GET_THREAD();
+  if (th->parse_in_eval) {
+    if (NIL_P(th->errinfo)) {
+      th->errinfo = rb_exc_new2(rb_eSyntaxError, s);
     }
     else {
-	rb_write_error(s);
-	rb_write_error("\n");
+      VALUE str = rb_obj_as_string(GET_THREAD()->errinfo);
+
+      rb_str_cat2(str, "\n");
+      rb_str_cat2(str, s);
+      th->errinfo = rb_exc_new3(rb_eSyntaxError, str);
     }
+  }
+  else {
+    rb_write_error(s);
+    rb_write_error("\n");
+  }
 }

Modified: trunk/eval.c
===================================================================
--- trunk/eval.c	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/eval.c	2006-02-12 06:28:53 UTC (rev 383)
@@ -159,8 +159,6 @@
   ruby_running = 1;
 }
 
-int ruby_in_eval;
-
 void
 ruby_options(int argc, char **argv)
 {
@@ -1955,8 +1953,11 @@
       th->base_block->iseq = cfp->iseq; /* TODO */
     }
 
+    
     /* make eval iseq */
+    th->parse_in_eval++;
     iseqval = th_compile(th, src, rb_str_new2(file), INT2FIX(line));
+    th->parse_in_eval--;
     th_set_eval_stack(th, iseqval);
     th->base_block = 0;
     if(0){ // for debug
@@ -2933,3 +2934,8 @@
   }
 }
 
+int
+rb_parse_in_eval(void)
+{
+  return GET_THREAD()->parse_in_eval != 0;
+}

Modified: trunk/eval_intern.h
===================================================================
--- trunk/eval_intern.h	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/eval_intern.h	2006-02-12 06:28:53 UTC (rev 383)
@@ -17,7 +17,6 @@
 
 #include "ruby.h"
 #include "node.h"
-#include "env.h"
 #include "util.h"
 #include "rubysig.h"
 #include "yarv.h"

Modified: trunk/gc.c
===================================================================
--- trunk/gc.c	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/gc.c	2006-02-12 06:28:53 UTC (rev 383)
@@ -16,7 +16,6 @@
 #include "rubysig.h"
 #include "st.h"
 #include "node.h"
-#include "env.h"
 #include "re.h"
 #include "yarvcore.h"
 #include <stdio.h>
@@ -330,8 +329,6 @@
 	struct RFile   file;
 	struct RNode   node;
 	struct RMatch  match;
-	struct RVarmap varmap;
-	struct SCOPE   scope;
     } as;
 #ifdef GC_DEBUG
     char *file;
@@ -957,22 +954,6 @@
 	}
 	break;
 
-      case T_VARMAP:
-	gc_mark(obj->as.varmap.val, lev);
-	ptr = (VALUE)obj->as.varmap.next;
-	goto again;
-
-      case T_SCOPE:
-	if (obj->as.scope.local_vars && (obj->as.scope.flags & SCOPE_MALLOC)) {
-	    int n = obj->as.scope.local_tbl[0]+1;
-	    VALUE *vars = &obj->as.scope.local_vars[-1];
-
-	    while (n--) {
-		gc_mark(*vars++, lev);
-	    }
-	}
-	break;
-
       case T_STRUCT:
 	{
 	    long len = RSTRUCT_LEN(obj);
@@ -1205,7 +1186,6 @@
 	break;
 
       case T_FLOAT:
-      case T_VARMAP:
       case T_BLOCK:
       case T_VALUE:
 	break;
@@ -1228,17 +1208,6 @@
 	}
 	return;			/* no need to free iv_tbl */
 
-      case T_SCOPE:
-	if (RANY(obj)->as.scope.local_vars &&
-            RANY(obj)->as.scope.flags != SCOPE_ALLOCA) {
-	    VALUE *vars = RANY(obj)->as.scope.local_vars-1;
-	    if (vars[0] == 0)
-		RUBY_CRITICAL(free(RANY(obj)->as.scope.local_tbl));
-	    if (RANY(obj)->as.scope.flags & SCOPE_MALLOC)
-		RUBY_CRITICAL(free(vars));
-	}
-	break;
-
       case T_STRUCT:
 	if (RBASIC(obj)->flags & RSTRUCT_EMBED_LEN_MASK == 0 &&
 	    RANY(obj)->as.rstruct.as.heap.ptr) {
@@ -1252,12 +1221,6 @@
     }
 }
 
-void
-rb_gc_mark_frame(struct FRAME *frame)
-{
-    gc_mark((VALUE)frame->node, 0);
-}
-
 #ifdef __GNUC__
 #if defined(__human68k__) || defined(DJGPP)
 #if defined(__human68k__)
@@ -1593,8 +1556,6 @@
 	    if (p->as.basic.flags) {
 		switch (TYPE(p)) {
 		  case T_ICLASS:
-		  case T_VARMAP:
-		  case T_SCOPE:
 		  case T_NODE:
 		    continue;
 		  case T_CLASS:
@@ -1625,8 +1586,6 @@
 	    if (p->as.basic.flags) {
 		switch (TYPE(p)) {
 		  case T_ICLASS:
-		  case T_VARMAP:
-		  case T_SCOPE:
 		  case T_NODE:
 		    continue;
 		  case T_CLASS:

Modified: trunk/insns.def
===================================================================
--- trunk/insns.def	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/insns.def	2006-02-12 06:28:53 UTC (rev 383)
@@ -1546,11 +1546,12 @@
 throw
 (num_t throw_state)
 (VALUE throwobj)
-()
+(VALUE val)
 {
   num_t state = throw_state & 0xff;
   num_t flag  = throw_state & 0x8000;
   num_t level = throw_state >> 16;
+  val = Qnil; /* dummy */
 
   if(state != 0){
     VALUE *pt;

Modified: trunk/parse.y
===================================================================
--- trunk/parse.y	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/parse.y	2006-02-12 06:28:53 UTC (rev 383)
@@ -4702,7 +4702,7 @@
     lex_gets_ptr = 0;
     lex_input = s;
     lex_pbeg = lex_p = lex_pend = 0;
-    compile_for_eval = ruby_in_eval;
+    compile_for_eval = rb_parse_in_eval();
 
     return yycompile(parser, f, line);
 }

Modified: trunk/ruby.h
===================================================================
--- trunk/ruby.h	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/ruby.h	2006-02-12 06:28:53 UTC (rev 383)
@@ -223,8 +223,6 @@
 #define T_VALUE  0x1a
 #define T_BLOCK  0x1b
 #define T_UNDEF  0x1c
-#define T_VARMAP 0x1d
-#define T_SCOPE  0x1e
 #define T_NODE   0x1f
 
 #define T_MASK   0x1f

Modified: trunk/test/ruby/test_gc.rb
===================================================================
--- trunk/test/ruby/test_gc.rb	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/test/ruby/test_gc.rb	2006-02-12 06:28:53 UTC (rev 383)
@@ -30,6 +30,6 @@
     GC.start
     assert true   # reach here or dumps core
 
-    GC.debug_flag = prev_df
+    GC.stress = prev_stress
   end
 end

Modified: trunk/test.rb
===================================================================
--- trunk/test.rb	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/test.rb	2006-02-12 06:28:53 UTC (rev 383)
@@ -1,4 +1,82 @@
-      class C
+
+/a/ =~ 'a'
+$p1 = proc{
+  p $~
+}
+
+def m
+  /a/ =~ 'a'
+  $p2 = proc{
+    p $~
+  }
+end
+
+m
+
+Thread.new{
+  $p1.call
+  $p2.call
+}.join
+
+
+__END__
+
+class A
+  def m
+    def a
+      puts "OK"
+    end
+  end
+end
+
+a = A.new
+a.m
+a.a
+__END__
+eval('if')
+
+__END__
+class Object
+  unless method_defined?(:funcall)
+    alias funcall __send__   # TODO: tmp
+  end
+end
+class C
+  @@cvar = :cvar
+  def forall_TYPE(mid)
+    objects = [Object.new, [], nil, true, false, 77, :sym]
+    objects.each do |obj|
+      obj.class.class_variable_set :@@cvar, 13
+      funcall mid, obj
+    end
+  end
+
+  def instance_eval_block_basic_i o
+    p [o, o.instance_eval { @@cvar }]
+    1.times{
+      p [o, o.instance_eval { @@cvar }]
+    }
+    p [o, o.class.module_eval { @@cvar }]
+    1.times{
+      p [o, o.class.module_eval { @@cvar }]
+    }
+  end
+end
+
+C.new.forall_TYPE(:instance_eval_block_basic_i)
+
+__END__
+class C
+  @@cvar = nil
+  class D
+    p @@cvar
+  end
+end
+
+
+
+__END__
+class C
         $b = binding
       end
       eval %q{

Modified: trunk/vm.c
===================================================================
--- trunk/vm.c	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/vm.c	2006-02-12 06:28:53 UTC (rev 383)
@@ -1,6 +1,5 @@
 #include "ruby.h"
 #include "node.h"
-#include "env.h"
 #include "st.h"
 
 #include "yarvcore.h"

Modified: trunk/yarvcore.c
===================================================================
--- trunk/yarvcore.c	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/yarvcore.c	2006-02-12 06:28:53 UTC (rev 383)
@@ -183,7 +183,6 @@
 }
 
 RUBY_EXTERN int rb_thread_critical;
-RUBY_EXTERN int ruby_in_eval;
 RUBY_EXTERN int ruby_nerrs;
 RUBY_EXTERN NODE* ruby_eval_tree;
 
@@ -193,13 +192,14 @@
   NODE *node;
   volatile VALUE iseq;
   volatile int critical;
+  yarv_thread_t *th = GET_THREAD();
 
   critical = rb_thread_critical;
   rb_thread_critical = Qtrue;
   {
-    ruby_in_eval++;
+    th->parse_in_eval++;
     rb_load_file(file);
-    ruby_in_eval--;
+    th->parse_in_eval--;
     node = ruby_eval_tree;
   }
   rb_thread_critical = critical;

Modified: trunk/yarvcore.h
===================================================================
--- trunk/yarvcore.h	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/yarvcore.h	2006-02-12 06:28:53 UTC (rev 383)
@@ -350,15 +350,15 @@
 typedef struct yarv_thread_struct{
   VALUE self;
   yarv_vm_t *vm;
-  
+
   /* execution information */
   VALUE *stack;                   /* must free, must mark*/
   unsigned long stack_size;
   yarv_control_frame_t *cfp;
+  int safe_level;
 
   /* passing state */
   int state;
-  int safe_level;
 
   /* for rb_iterate */
   yarv_block_t *passed_block;
@@ -374,12 +374,12 @@
 
   VALUE *local_lfp;
   VALUE local_svar;
-  
+
   /* thread control */
   yarv_thread_id_t thread_id;
   enum yarv_thread_status status;
   int priority;
-  
+
   native_thread_data_t native_thread_data;
 
   VALUE thgroup;
@@ -391,6 +391,8 @@
   int interrupt_flag;
   struct yarv_tag *tag;
 
+  int parse_in_eval;
+
   st_table *local_storage; /* thread local storage */
 
   struct{
@@ -400,7 +402,7 @@
   } signal_queue;
 
   void *signal_thread_list;
-  
+
   VALUE first_proc;
   VALUE first_args;
 

Modified: trunk/yarvtest/test_exception.rb
===================================================================
--- trunk/yarvtest/test_exception.rb	2006-02-11 20:08:54 UTC (rev 382)
+++ trunk/yarvtest/test_exception.rb	2006-02-12 06:28:53 UTC (rev 383)
@@ -382,5 +382,17 @@
       $ans
     }
   end
+
+  def test_stack_consistency
+    ae %q{ # 
+      proc{
+        begin
+          raise
+          break
+        rescue
+          :ok
+        end
+      }.call
+    }
 end
 


-- 
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]