From 8645250f3d8a823e0e9a1d264bd1b7936ba1f2c6 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 9 Jan 2003 06:16:43 +0000 Subject: * parse.y (stmt): NODE_NOT elimitation for if/unless/while/until node. * parse.y (primary): ditto. * eval.c (rb_eval): reduce recursive rb_eval() call by using sort of continuation passing style. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 86671173d..e954ac0d6 100644 --- a/eval.c +++ b/eval.c @@ -2209,6 +2209,7 @@ rb_eval(self, n) VALUE self; NODE *n; { + NODE * volatile contnode = 0; NODE * volatile node = n; int state; volatile VALUE result = Qnil; @@ -2224,10 +2225,10 @@ rb_eval(self, n) ruby_current_node = node; switch (nd_type(node)) { case NODE_BLOCK: - while (node->nd_next) { - rb_eval(self, node->nd_head); - node = node->nd_next; + if (contnode) { + rb_bug("nested NODE_BLOCK"); } + contnode = node->nd_next; node = node->nd_head; goto again; @@ -3391,7 +3392,6 @@ rb_eval(self, n) break; case NODE_NEWLINE: - ruby_sourceline = node->nd_nth; if (trace_func) { call_trace_func("line", node, self, ruby_frame->last_func, @@ -3405,6 +3405,11 @@ rb_eval(self, n) } finish: CHECK_INTS; + if (contnode) { + node = contnode; + contnode = 0; + goto again; + } return result; } @@ -4304,7 +4309,7 @@ rb_with_disable_interrupt(proc, data) return result; } -static void +static inline void stack_check() { static int overflowing = 0; -- cgit