MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sp_instr Class Reference

#include <sp_instr.h>

Inheritance diagram for sp_instr:
Collaboration diagram for sp_instr:

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
- Public Member Functions inherited from sp_printable
virtual void print (String *str)=0

Protected Attributes

bool m_marked
uint m_ip
 Instruction pointer.
sp_pcontextm_parsing_ctx
 Instruction parsing context.

Additional Inherited Members

- Static Public Member Functions inherited from Sql_alloc
static void * operator new (size_t size) throw ()
static void * operator new[] (size_t size) throw ()
static void * operator new[] (size_t size, MEM_ROOT *mem_root) throw ()
static void * operator new (size_t size, MEM_ROOT *mem_root) throw ()
static void operator delete (void *ptr, size_t size)
static void operator delete (void *ptr, MEM_ROOT *mem_root)
static void operator delete[] (void *ptr, MEM_ROOT *mem_root)
static void operator delete[] (void *ptr, size_t size)

Detailed Description

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

Definition at line 61 of file sp_instr.h.

Member Function Documentation

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

Execute this instruction

Parameters
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.
Returns
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
inlinevirtual

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

Returns
the continuation destination

Reimplemented in sp_lex_branch_instr.

Definition at line 98 of file sp_instr.h.

Here is the caller graph for this function:

virtual uint sp_instr::opt_mark ( sp_head sp,
List< sp_instr > *  leads 
)
inlinevirtual

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.

Definition at line 113 of file sp_instr.h.

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

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.

Definition at line 134 of file sp_instr.h.

Here is the caller graph for this function:

virtual uint sp_instr::opt_shortcut_jump ( sp_head sp,
sp_instr start 
)
inlinevirtual

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.

Definition at line 125 of file sp_instr.h.

Here is the caller graph for this function:

Member Data Documentation

bool sp_instr::m_marked
protected

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

Definition at line 143 of file sp_instr.h.


The documentation for this class was generated from the following file: