diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2018-03-26 10:45:01 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2018-03-26 10:45:01 +0300 |
commit | e32b1e252bba65f8311e7cb038b085fe42cf42ed (patch) | |
tree | fddea0eb5f0a49d87d1e343248aaabbb74574a11 /awkgram.y | |
parent | 9b03de3b6c449d014674dd2bfd5947c55d1f0711 (diff) | |
download | egawk-e32b1e252bba65f8311e7cb038b085fe42cf42ed.tar.gz egawk-e32b1e252bba65f8311e7cb038b085fe42cf42ed.tar.bz2 egawk-e32b1e252bba65f8311e7cb038b085fe42cf42ed.zip |
Remove the tail recursion optimization.
Diffstat (limited to 'awkgram.y')
-rw-r--r-- | awkgram.y | 27 |
1 files changed, 2 insertions, 25 deletions
@@ -993,20 +993,9 @@ non_compound_stmt $$ = list_create($1); (void) list_prepend($$, instruction(Op_push_i)); $$->nexti->memory = dupnode(Nnull_string); - } else { - if (do_optimize - && $3->lasti->opcode == Op_func_call - && strcmp($3->lasti->func_name, in_function) == 0 - ) { - /* Do tail recursion optimization. Tail - * call without a return value is recognized - * in mk_function(). - */ - ($3->lasti + 1)->tail_call = true; - } - + } else $$ = list_append($3, $1); - } + $$ = add_pending_comment($$); } | simple_stmt statement_term @@ -4736,18 +4725,6 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def) thisfunc = fi->func_body; assert(thisfunc != NULL); - if (do_optimize && def->lasti->opcode == Op_pop) { - /* tail call which does not return any value. */ - - INSTRUCTION *t; - - for (t = def->nexti; t->nexti != def->lasti; t = t->nexti) - ; - if (t->opcode == Op_func_call - && strcmp(t->func_name, thisfunc->vname) == 0) - (t + 1)->tail_call = true; - } - /* add any pre-function comment to start of action for profile.c */ if (function_comment != NULL) { |