summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-14 15:39:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-14 15:39:39 +0000
commit6794aead0d7f34d41a8047ecdbfddb5b1707bf26 (patch)
treee48948b68a953fe0a31e18cbcc98ba1366c063d8 /eval.c
parente29813f764514fa0a6af15adb1d0a71800974a3f (diff)
* eval.c (rb_rescue2): reduce PUSH_TAG() as well as NODE_RESCUE.
[ruby-dev:26800] * range.c (range_check, range_init): reduce uselse exceptions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/eval.c b/eval.c
index de8c05ef9b..08773c6fdf 100644
--- a/eval.c
+++ b/eval.c
@@ -5241,17 +5241,23 @@ rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
int state;
volatile VALUE result;
volatile VALUE e_info = ruby_errinfo;
+ volatile int handle;
+ VALUE eclass;
va_list args;
PUSH_TAG(PROT_NONE);
- if ((state = EXEC_TAG()) == 0) {
- retry_entry:
+ switch (state = EXEC_TAG()) {
+ case TAG_RETRY:
+ if (!handle) break;
+ handle = Qfalse;
+ state = 0;
+ ruby_errinfo = Qnil;
+ case 0:
result = (*b_proc)(data1);
- }
- else if (state == TAG_RAISE) {
- int handle = Qfalse;
- VALUE eclass;
-
+ break;
+ case TAG_RAISE:
+ if (handle) break;
+ handle = Qfalse;
va_init_list(args, data2);
while (eclass = va_arg(args, VALUE)) {
if (rb_obj_is_kind_of(ruby_errinfo, eclass)) {
@@ -5262,25 +5268,14 @@ rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
va_end(args);
if (handle) {
+ state = 0;
if (r_proc) {
- PUSH_TAG(PROT_NONE);
- if ((state = EXEC_TAG()) == 0) {
- result = (*r_proc)(data2, ruby_errinfo);
- }
- POP_TAG();
- if (state == TAG_RETRY) {
- state = 0;
- ruby_errinfo = Qnil;
- goto retry_entry;
- }
+ result = (*r_proc)(data2, ruby_errinfo);
}
else {
result = Qnil;
- state = 0;
- }
- if (state == 0) {
- ruby_errinfo = e_info;
}
+ ruby_errinfo = e_info;
}
}
POP_TAG();