diff options
author | unknown <pem@mysql.com> | 2006-01-16 15:37:25 +0100 |
---|---|---|
committer | unknown <pem@mysql.com> | 2006-01-16 15:37:25 +0100 |
commit | 746705da8ea30bb6e20c97c8258d1c9e71bf9215 (patch) | |
tree | edb91858f12cf3e9bdd73845bf4b3a8695c550af /sql/sp_head.h | |
parent | bf38d0077096280bea615feb1a77200a93fe2624 (diff) | |
parent | 29915d6e1c71289fbae57aa7948e3453bf78485e (diff) | |
download | mariadb-git-746705da8ea30bb6e20c97c8258d1c9e71bf9215.tar.gz |
Merge mysql.com:/extern/mysql/bk/mysql-5.0
into mysql.com:/extern/mysql/work/bug14498/mysql-5.0
sql/sp_head.h:
Auto merged
sql/sp_pcontext.h:
Auto merged
mysql-test/r/sp.result:
Manual merge.
mysql-test/t/sp.test:
Manual merge.
sql/sp_head.cc:
Manual merge.
sql/sql_yacc.yy:
Manual merge.
Diffstat (limited to 'sql/sp_head.h')
-rw-r--r-- | sql/sp_head.h | 88 |
1 files changed, 47 insertions, 41 deletions
diff --git a/sql/sp_head.h b/sql/sp_head.h index 2eebd35f6dc..bd50afebde7 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -41,6 +41,7 @@ sp_get_flags_for_command(LEX *lex); struct sp_label; class sp_instr; +class sp_instr_jump_if_not; struct sp_cond_type; struct sp_pvar; @@ -266,6 +267,18 @@ public: int check_backpatch(THD *thd); + // Start a new cont. backpatch level. If 'i' is NULL, the level is just incr. + void + new_cont_backpatch(sp_instr_jump_if_not *i); + + // Add an instruction to the current level + void + add_cont_backpatch(sp_instr_jump_if_not *i); + + // Backpatch (and pop) the current level to the current position. + void + do_cont_backpatch(); + char *name(uint *lenp = 0) const { if (lenp) @@ -357,6 +370,18 @@ private: } bp_t; List<bp_t> m_backpatch; // Instructions needing backpatching /* + We need a special list for backpatching of conditional jump's continue + destination (in the case of a continue handler catching an error in + the test), since it would otherwise interfere with the normal backpatch + mechanism - jump_if_not instructions have two different destination + which are to be patched differently. + Since these occur in a more restricted way (always the same "level" in + the code), we don't need the label. + */ + List<sp_instr_jump_if_not> m_cont_backpatch; + uint m_cont_level; // The current cont. backpatch level + + /* Multi-set representing optimized list of tables to be locked by this routine. Does not include tables which are used by invoked routines. @@ -669,50 +694,17 @@ public: m_dest= dest; } -protected: - - sp_instr *m_optdest; // Used during optimization - -}; // class sp_instr_jump : public sp_instr - - -class sp_instr_jump_if : public sp_instr_jump -{ - sp_instr_jump_if(const sp_instr_jump_if &); /* Prevent use of these */ - void operator=(sp_instr_jump_if &); - -public: - - sp_instr_jump_if(uint ip, sp_pcontext *ctx, Item *i, LEX *lex) - : sp_instr_jump(ip, ctx), m_expr(i), m_lex_keeper(lex, TRUE) - {} - - sp_instr_jump_if(uint ip, sp_pcontext *ctx, Item *i, uint dest, LEX *lex) - : sp_instr_jump(ip, ctx, dest), m_expr(i), m_lex_keeper(lex, TRUE) - {} - - virtual ~sp_instr_jump_if() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual int exec_core(THD *thd, uint *nextp); - - virtual void print(String *str); - - virtual uint opt_mark(sp_head *sp); - - virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start) + virtual void set_destination(uint old_dest, uint new_dest) { - return m_ip; + if (m_dest == old_dest) + m_dest= new_dest; } -private: +protected: - Item *m_expr; // The condition - sp_lex_keeper m_lex_keeper; + sp_instr *m_optdest; // Used during optimization -}; // class sp_instr_jump_if : public sp_instr_jump +}; // class sp_instr_jump : public sp_instr class sp_instr_jump_if_not : public sp_instr_jump @@ -722,12 +714,16 @@ class sp_instr_jump_if_not : public sp_instr_jump public: + uint m_cont_dest; // Where continue handlers will go + sp_instr_jump_if_not(uint ip, sp_pcontext *ctx, Item *i, LEX *lex) - : sp_instr_jump(ip, ctx), m_expr(i), m_lex_keeper(lex, TRUE) + : sp_instr_jump(ip, ctx), m_cont_dest(0), m_expr(i), + m_lex_keeper(lex, TRUE), m_cont_optdest(0) {} sp_instr_jump_if_not(uint ip, sp_pcontext *ctx, Item *i, uint dest, LEX *lex) - : sp_instr_jump(ip, ctx, dest), m_expr(i), m_lex_keeper(lex, TRUE) + : sp_instr_jump(ip, ctx, dest), m_cont_dest(0), m_expr(i), + m_lex_keeper(lex, TRUE), m_cont_optdest(0) {} virtual ~sp_instr_jump_if_not() @@ -746,10 +742,20 @@ public: return m_ip; } + virtual void opt_move(uint dst, List<sp_instr> *ibp); + + virtual void set_destination(uint old_dest, uint new_dest) + { + sp_instr_jump::set_destination(old_dest, new_dest); + if (m_cont_dest == old_dest) + m_cont_dest= new_dest; + } + private: Item *m_expr; // The condition sp_lex_keeper m_lex_keeper; + sp_instr *m_cont_optdest; // Used during optimization }; // class sp_instr_jump_if_not : public sp_instr_jump |