diff options
author | konstantin@mysql.com <> | 2006-02-02 12:03:35 +0300 |
---|---|---|
committer | konstantin@mysql.com <> | 2006-02-02 12:03:35 +0300 |
commit | 065f8066d5de10cf998b02d0e02216f61d87e9db (patch) | |
tree | 72eba57e7d347ae15c6a57558fd619c2afc05b31 /sql/sp_head.h | |
parent | bcb4178c730f82a023766ef8a6f44004aa68ea21 (diff) | |
parent | 88285b92f23486a3c9f8e6bfeb6b68d66d132f86 (diff) | |
download | mariadb-git-065f8066d5de10cf998b02d0e02216f61d87e9db.tar.gz |
Merge mysql.com:/home/kostja/mysql/mysql-5.0-for_merge
into mysql.com:/home/kostja/mysql/mysql-5.1-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 e4ef7526683..37ab486c6f3 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; @@ -265,6 +266,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) @@ -356,6 +369,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. @@ -668,50 +693,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 @@ -721,12 +713,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() @@ -745,10 +741,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 |