[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tail-call elimination
From: |
Stefan Monnier |
Subject: |
Re: tail-call elimination |
Date: |
Mon, 07 Jan 2013 13:28:15 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> Based on feedback by Stefan, I have updated the patch. This is a
> slightly less "pure" version of TCO than the original patch, but it
> should be faster. (And really, the difference between this and the
> "pure" version is pretty much academic.)
It's looking pretty good. I have a few remaining questions/comments/nitpicks:
> + stack.next = byte_stack_list;
> + byte_stack_list = &stack;
> +
> CHECK_STRING (bytestr);
> CHECK_VECTOR (vector);
> CHECK_NATNUM (maxdepth);
IIUC These checks are "runtime redundant" with the checks you added
right after the "tail_call:" label. Try to restructure the code to
remove this redundancy.
> + /* If the next op is return, maybe we can eliminate the tail
> call */
Please add a "." at the end of that sentence and make sure it is
followed by 2 spaces.
> + if (SYMBOLP (fun) && !EQ (fun, Qunbound)
> + && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
You can drop the !EQ (fun, Qunbound) test.
> + fun = indirect_function (fun);
> + if (COMPILEDP(fun))
Please add a space between COMPILEDP and the following open parenthesis.
> + int prev_maxdepth = XFASTINT(maxdepth);
Add the same space here too.
> + args_template = syms_left;
Not sure why you named the var "syms_left".
> + else
> + {
> + top = bottom;
> + }
You don't need that braces (tho they don't hurt), but you do need to add
a comment explaining that that elements that were on top are now
referenced by `args' and will be moved back to `top' and that this move
needs to be careful not to overwrite data before it reads it since the
two areas may (and often will) overlap.
One more thing: have you performed some performance tests?
I'd recommend you compare something like
cd lisp; rm **/*.elc; time make compile
-- Stefan
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: tail-call elimination,
Stefan Monnier <=