[#1147] Copying RVALUE — why the lucky stiff <ruby-core@...>

Hello, everyone. Hope you are all doing well.

18 messages 2003/06/17
[#1155] Re: Copying RVALUE — matz@... (Yukihiro Matsumoto) 2003/06/20

Hi,

[#1157] Re: Copying RVALUE — why the lucky stiff <ruby-core@...> 2003/06/20

Yukihiro Matsumoto (matz@ruby-lang.org) wrote:

[#1173] class.c code cleanup (rb_class_*_instance_methods) — Matthew Dempsky <jivera@...>

Hi, I'm new to this mailing list so I don't know the procedure for

15 messages 2003/06/22
[#1174] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — nobu.nokada@... 2003/06/22

Hi,

[#1175] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — Matthew Dempsky <jivera@...> 2003/06/22

On Sun, 2003-06-22 at 05:36, nobu.nokada@softhome.net wrote:

[#1176] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — nobu.nokada@... 2003/06/22

Hi,

[#1193] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — Matthew Dempsky <jivera@...> 2003/06/25

On Sun, 2003-06-22 at 07:41, nobu.nokada@softhome.net wrote:

[#1177] Re: In 1.8.0 nil.to_s is not the same as "" — ts <decoux@...>

14 messages 2003/06/22

Re: [1.8] Exception::new

From: nobu.nokada@...
Date: 2003-06-05 10:23:35 UTC
List: ruby-core #1123
Hi,

At Thu, 5 Jun 2003 17:48:34 +0900,
ts wrote:
>  Normal ?
> 
> svg% ruby -ve 'def Exception::new(*args) raise; end; raise'
> ruby 1.8.0 (2003-06-05) [i686-linux]
> Segmentation fault
> svg% 

Contains fix for (ruby-bugs-ja:PR#487) and [ruby-core:01119].


Index: eval.c
===================================================================
RCS file: //sharui/cvs/ruby/src/ruby/eval.c,v
retrieving revision 1.454
diff -u -2 -p -r1.454 eval.c
--- eval.c	5 Jun 2003 06:40:42 -0000	1.454
+++ eval.c	5 Jun 2003 10:13:58 -0000
@@ -1049,5 +1049,5 @@ error_print()
 	errat = Qnil;
     }
-    POP_TAG();
+    if (EXEC_TAG()) goto error;
     if (NIL_P(errat)){
 	ruby_set_current_source();
@@ -1070,5 +1070,4 @@ error_print()
 
     eclass = CLASS_OF(ruby_errinfo);
-    PUSH_TAG(PROT_NONE);
     if (EXEC_TAG() == 0) {
 	VALUE e = rb_obj_as_string(ruby_errinfo);
@@ -1080,5 +1079,5 @@ error_print()
 	elen = 0;
     }
-    POP_TAG();
+    if (EXEC_TAG()) goto error;
     if (eclass == rb_eRuntimeError && elen == 0) {
 	warn_print(": unhandled exception\n");
@@ -1134,4 +1133,6 @@ error_print()
 	}
     }
+  error:
+    POP_TAG();
 }
 
@@ -3842,4 +3843,7 @@ static int thread_set_raised();
 static void thread_reset_raised();
 
+static VALUE exception_error;
+static VALUE sysstack_error;
+
 static void
 rb_longjmp(tag, mesg)
@@ -3848,5 +3852,7 @@ rb_longjmp(tag, mesg)
 {
     VALUE at;
+    int raised = thread_set_raised();
 
+    if (raised) mesg = exception_error;
     if (NIL_P(mesg)) mesg = ruby_errinfo;
     if (NIL_P(mesg)) {
@@ -3867,5 +3873,5 @@ rb_longjmp(tag, mesg)
 
     if (RTEST(ruby_debug) && !NIL_P(ruby_errinfo)
-	&& !thread_set_raised()
+	&& !raised
 	&& !rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
 	VALUE e = ruby_errinfo;
@@ -3881,6 +3887,8 @@ rb_longjmp(tag, mesg)
 	}
 	POP_TAG();
-	thread_reset_raised();
-	if (status) JUMP_TAG(status);
+	if (status) {
+	    thread_reset_raised();
+	    JUMP_TAG(status);
+	}
     }
 
@@ -3895,4 +3903,5 @@ rb_longjmp(tag, mesg)
 	error_print();
     }
+    if (!raised) thread_reset_raised();
     JUMP_TAG(tag);
 }
@@ -4574,5 +4583,5 @@ stack_check()
 	PUSH_TAG(PROT_NONE);
 	if ((state = EXEC_TAG()) == 0) {
-	    rb_raise(rb_eSysStackError, "stack level too deep");
+	    rb_exc_raise(sysstack_error);
 	}
 	POP_TAG();
@@ -7628,5 +7637,10 @@ Init_Proc()
     rb_define_method(rb_eLocalJumpError, "reason", localjump_reason, 0);
 
+    exception_error = rb_exc_new2(rb_eFatal, "recursed exception");
+    rb_global_variable(&exception_error);
+
     rb_eSysStackError = rb_define_class("SystemStackError", rb_eStandardError);
+    sysstack_error = rb_exc_new2(rb_eSysStackError, "stack level too deep");
+    rb_global_variable(&sysstack_error);
 
     rb_cBlock = rb_define_class("Block", rb_cObject);


-- 
Nobu Nakada

In This Thread