My Project
Public Member Functions | Protected Attributes
sp_instr Class Reference

#include <sp_instr.h>

Inheritance diagram for sp_instr:
Sql_alloc sp_printable sp_instr_cclose sp_instr_cfetch sp_instr_copen sp_instr_cpop sp_instr_error sp_instr_hpop sp_instr_jump sp_lex_instr

List of all members.

Public Member Functions

 sp_instr (uint ip, sp_pcontext *ctx)
virtual bool execute (THD *thd, uint *nextp)=0
uint get_ip () const
virtual uint get_cont_dest () const
sp_pcontextget_parsing_ctx () const
virtual uint opt_mark (sp_head *sp, List< sp_instr > *leads)
virtual uint opt_shortcut_jump (sp_head *sp, sp_instr *start)
virtual void opt_move (uint dst, List< sp_branch_instr > *ibp)
bool opt_is_marked () const
virtual SQL_I_List
< Item_trigger_field > * 
get_instr_trig_field_list ()

Protected Attributes

bool m_marked
uint m_ip
 Instruction pointer.
 Instruction parsing context.

Detailed Description

Base class for every SP-instruction. sp_instr defines interface and provides base implementation.

Member Function Documentation

virtual bool sp_instr::execute ( THD *  thd,
uint *  nextp 
) [pure virtual]

Execute this instruction

thdThread context
[out]nextpindex of the next instruction to execute. (For most instructions this will be the instruction following this one). Note that this parameter is undefined in case of errors, use get_cont_dest() to find the continuation instruction for CONTINUE error handlers.
Error status.

Implemented in sp_instr_error, sp_instr_cfetch, sp_instr_cclose, sp_instr_copen, sp_instr_cpop, sp_instr_cpush, sp_instr_hreturn, sp_instr_hpop, sp_instr_hpush_jump, sp_instr_jump, sp_instr_stmt, and sp_lex_instr.

virtual uint sp_instr::get_cont_dest ( ) const [inline, virtual]

Get the continuation destination (instruction pointer for the CONTINUE HANDLER) of this instruction.

the continuation destination

Reimplemented in sp_lex_branch_instr.

virtual uint sp_instr::opt_mark ( sp_head sp,
List< sp_instr > *  leads 
) [inline, virtual]

Mark this instruction as reachable during optimization and return the index to the next instruction. Jump instruction will add their destination to the leads list.

Reimplemented in sp_instr_error, sp_instr_hreturn, sp_instr_hpush_jump, sp_instr_set_case_expr, sp_lex_branch_instr, sp_instr_jump, and sp_instr_freturn.

virtual void sp_instr::opt_move ( uint  dst,
List< sp_branch_instr > *  ibp 
) [inline, virtual]

Inform the instruction that it has been moved during optimization. Most instructions will simply update its index, but jump instructions must also take care of their destination pointers. Forward jumps get pushed to the backpatch list 'ibp'.

Reimplemented in sp_instr_set_case_expr, sp_lex_branch_instr, and sp_instr_jump.

virtual uint sp_instr::opt_shortcut_jump ( sp_head sp,
sp_instr start 
) [inline, virtual]

Short-cut jumps to jumps during optimization. This is used by the jump instructions' opt_mark() methods. 'start' is the starting point, used to prevent the mark sweep from looping for ever. Return the end destination.

Reimplemented in sp_instr_hreturn, sp_instr_hpush_jump, and sp_instr_jump.

Member Data Documentation

bool sp_instr::m_marked [protected]

Show if this instruction is reachable within the SP (used by SP-optimizer).

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines