summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-01-09 06:16:43 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-01-09 06:16:43 +0000
commitdadb16d894109891f21fb514e6ae11f0f598e14f (patch)
treedfef5085206eb64aeeadb052b39ef0da1c7dcf09 /eval.c
parente29b4b4862f4e3a6a727c407a711939f74124941 (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@3314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/eval.c b/eval.c
index 86671173d3..e954ac0d67 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;