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

#include <sp_instr.h>

Inheritance diagram for sp_instr_jump:
Collaboration diagram for sp_instr_jump:

Public Member Functions

 sp_instr_jump (uint ip, sp_pcontext *ctx)
 sp_instr_jump (uint ip, sp_pcontext *ctx, uint dest)
virtual void print (String *str)
virtual bool execute (THD *thd, uint *nextp)
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)
virtual void set_destination (uint old_dest, uint new_dest)
virtual void backpatch (uint dest)
- Public Member Functions inherited from sp_instr
 sp_instr (uint ip, sp_pcontext *ctx)
uint get_ip () const
virtual uint get_cont_dest () const
sp_pcontextget_parsing_ctx () const
bool opt_is_marked () const

Protected Attributes

uint m_dest
 Where we will go.
sp_instrm_optdest
- Protected Attributes inherited from sp_instr
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

This is base class for all kinds of jump instructions.

Note
this is the only class, we directly construct instances of, that has subclasses. We also redefine sp_instr_jump behavior in those subclasses.
Todo:
later we will consider introducing a new class, which will be the base for sp_instr_jump, sp_instr_set_case_expr and sp_instr_jump_case_when. Something like sp_regular_branch_instr (similar to sp_lex_branch_instr).

Definition at line 658 of file sp_instr.h.

Member Function Documentation

virtual void sp_instr_jump::backpatch ( uint  dest)
inlinevirtual

Update all instruction with the given label in the backpatch list to the specified instruction pointer.

Parameters
destdestination instruction pointer.

Implements sp_branch_instr.

Reimplemented in sp_instr_hpush_jump.

Definition at line 706 of file sp_instr.h.

virtual bool sp_instr_jump::execute ( THD *  thd,
uint *  nextp 
)
inlinevirtual

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.

Implements sp_instr.

Reimplemented in sp_instr_hreturn, and sp_instr_hpush_jump.

Definition at line 684 of file sp_instr.h.

uint sp_instr_jump::opt_mark ( sp_head sp,
List< sp_instr > *  leads 
)
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 from sp_instr.

Reimplemented in sp_instr_hreturn, and sp_instr_hpush_jump.

Definition at line 1022 of file sp_instr.cc.

Here is the call graph for this function:

void sp_instr_jump::opt_move ( uint  dst,
List< sp_branch_instr > *  ibp 
)
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 from sp_instr.

Definition at line 1052 of file sp_instr.cc.

uint sp_instr_jump::opt_shortcut_jump ( sp_head sp,
sp_instr start 
)
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 from sp_instr.

Reimplemented in sp_instr_hreturn, and sp_instr_hpush_jump.

Definition at line 1032 of file sp_instr.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void sp_instr_jump::set_destination ( uint  old_dest,
uint  new_dest 
)
inlinevirtual

Update the destination; used by the SP-instruction-optimizer.

Parameters
old_destcurrent (old) destination (instruction pointer).
new_destnew destination (instruction pointer).

Implements sp_branch_instr.

Definition at line 700 of file sp_instr.h.


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