Skip to content

Commit

Permalink
Remove the tail recursion optimization.
Browse files Browse the repository at this point in the history
  • Loading branch information
arnoldrobbins committed Mar 26, 2018
1 parent 9b03de3 commit e32b1e2
Show file tree
Hide file tree
Showing 11 changed files with 347 additions and 378 deletions.
15 changes: 15 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
2018-03-26 Arnold D. Robbins <[email protected]>

Remove the tail recursion optimization. It's fundamentally
broken, in the case where a local var becomes a parameter.
Thanks to Denis Shirokov <[email protected]> for the report.
See test/tailrecurse.awk.

* awk.h [num_tail_calls, tail_call]: Remove definitions.
* awkgram.y (grammar, mk_function): Remove code related to
the tail recursion optimization.
* eval.c (dump_fcall_stack): Adjust dumping code since no longer
looping through tail call recursion.
(setup_frame): Remove code related to the tail recursion optimization.
(init_interpret): Ditto.

2018-03-22 Arnold D. Robbins <[email protected]>

* configure.ac: Check for %a support in system printf.
Expand Down
4 changes: 0 additions & 4 deletions awk.h
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@ typedef struct exp_node {
#define func_node sub.nodep.x.extra
#define prev_frame_size sub.nodep.reflags
#define reti sub.nodep.l.li
#define num_tail_calls sub.nodep.cnt

/* Node_var: */
#define var_value lnode
Expand Down Expand Up @@ -862,9 +861,6 @@ typedef struct exp_instruction {
/* Op_func_call, Op_func */
#define func_body x.xn

/* Op_func_call */
#define tail_call d.dl

/* Op_subscript */
#define sub_count d.dl

Expand Down
Loading

0 comments on commit e32b1e2

Please sign in to comment.