diff options
author | unknown <pem@mysql.com> | 2006-01-25 15:11:49 +0100 |
---|---|---|
committer | unknown <pem@mysql.com> | 2006-01-25 15:11:49 +0100 |
commit | 7ee65fcf8560ab981c5afcd9a3e747577f22e8f0 (patch) | |
tree | d0809b2aee3fe4e188c050796ec4c74587189bd8 /sql/sql_yacc.yy | |
parent | 8f395ebbfa87f21cb7acf655876790df99389499 (diff) | |
download | mariadb-git-7ee65fcf8560ab981c5afcd9a3e747577f22e8f0.tar.gz |
Fixed BUG#15737: Stored procedure optimizer bug with LEAVE
Second version.
The problem was that the optimizer didn't work correctly with forwards jumps
to "no-op" hpop and cpop instructions.
Don't generate "no-op" instructions (hpop 0 and cpop 0), it isn't actually
necessary.
mysql-test/r/sp-code.result:
Updated results for new test case (BUG#15737)
mysql-test/t/sp-code.test:
New test case (BUG#15737)
sql/sp_head.cc:
Removed backpatch methods from sp_instr_hpop/cpop, since they're not needed any more.
Added more documentation to sp_head::optimize()
sql/sp_head.h:
Removed backpatch and opt_mark methods from sp_instr_hpop/cpop, since they're not needed
any more.
Added comments to optimizer methods in sp_instr.
sql/sql_yacc.yy:
Don't generate "no-op" hpop and cpop instructions for LEAVE, it's not necessary.
Just generate them when needed.
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0ef389950fc..f41a8b7e979 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2064,17 +2064,16 @@ sp_proc_stmt: } else { - uint ip= sp->instructions(); sp_instr_jump *i; - sp_instr_hpop *ih; - sp_instr_cpop *ic; + uint ip= sp->instructions(); + uint n; - ih= new sp_instr_hpop(ip++, ctx, 0); - sp->push_backpatch(ih, lab); - sp->add_instr(ih); - ic= new sp_instr_cpop(ip++, ctx, 0); - sp->push_backpatch(ic, lab); - sp->add_instr(ic); + n= ctx->diff_handlers(lab->ctx); + if (n) + sp->add_instr(new sp_instr_hpop(ip++, ctx, n)); + n= ctx->diff_cursors(lab->ctx); + if (n) + sp->add_instr(new sp_instr_cpop(ip++, ctx, n)); i= new sp_instr_jump(ip, ctx); sp->push_backpatch(i, lab); /* Jumping forward */ sp->add_instr(i); |