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
commite1174370057495b8f4dc9856ee58e1b176493da1 (patch)
tree7a0a03dff9582ae375b05d6000e51d3072186b8d /eval.c
parent8e5e94d2f318c9b6169259abd3cd6fc729e46823 (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/trunk@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 99847df415..8eba49c3d2 100644
--- a/eval.c
+++ b/eval.c
@@ -5361,17 +5361,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)) {
@@ -5382,25 +5388,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();