MySQL  8.0.20
Source Code Documentation
sp_instr_jump Class Reference

This is base class for all kinds of jump instructions. More...

#include <sp_instr.h>

Inheritance diagram for sp_instr_jump:
sp_instr sp_branch_instr sp_printable sp_instr_hpush_jump sp_instr_hreturn

Public Member Functions

 sp_instr_jump (uint ip, sp_pcontext *ctx)
 
 sp_instr_jump (uint ip, sp_pcontext *ctx, uint dest)
 
virtual void print (const THD *thd, String *str)
 
virtual bool execute (THD *, uint *nextp)
 Execute this instruction. More...
 
virtual uint opt_mark (sp_head *sp, List< sp_instr > *leads)
 Mark this instruction as reachable during optimization and return the index to the next instruction. More...
 
virtual uint opt_shortcut_jump (sp_head *sp, sp_instr *start)
 Short-cut jumps to jumps during optimization. More...
 
virtual void opt_move (uint dst, List< sp_branch_instr > *ibp)
 Inform the instruction that it has been moved during optimization. More...
 
virtual void set_destination (uint old_dest, uint new_dest)
 Update the destination; used by the SP-instruction-optimizer. More...
 
virtual void backpatch (uint dest)
 Update all instruction with the given label in the backpatch list to the specified instruction pointer. More...
 
virtual PSI_statement_infoget_psi_info ()
 
- Public Member Functions inherited from sp_instr
 sp_instr (uint ip, sp_pcontext *ctx)
 
virtual ~sp_instr ()
 
uint get_ip () const
 
virtual uint get_cont_dest () const
 Get the continuation destination (instruction pointer for the CONTINUE HANDLER) of this instruction. More...
 
sp_pcontextget_parsing_ctx () const
 
bool opt_is_marked () const
 
virtual SQL_I_List< Item_trigger_field > * get_instr_trig_field_list ()
 
- Public Member Functions inherited from sp_printable
virtual ~sp_printable ()
 
- Public Member Functions inherited from sp_branch_instr
virtual ~sp_branch_instr ()
 

Static Public Attributes

static PSI_statement_info psi_info = {0, "jump", 0, PSI_DOCUMENT_ME}
 

Protected Attributes

uint m_dest
 Where we will go. More...
 
sp_instrm_optdest
 
- Protected Attributes inherited from sp_instr
bool m_marked
 Show if this instruction is reachable within the SP (used by SP-optimizer). More...
 
uint m_ip
 Instruction pointer. More...
 
sp_pcontextm_parsing_ctx
 Instruction parsing context. More...
 

Additional Inherited Members

- Public Attributes inherited from sp_instr
Query_arena m_arena
 
- Protected Member Functions inherited from sp_instr
void clear_da (THD *thd) const
 Clear diagnostics area. More...
 

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.

Constructor & Destructor Documentation

◆ sp_instr_jump() [1/2]

sp_instr_jump::sp_instr_jump ( uint  ip,
sp_pcontext ctx 
)
inline

◆ sp_instr_jump() [2/2]

sp_instr_jump::sp_instr_jump ( uint  ip,
sp_pcontext ctx,
uint  dest 
)
inline

Member Function Documentation

◆ backpatch()

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.

◆ execute()

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.

◆ get_psi_info()

virtual PSI_statement_info* sp_instr_jump::get_psi_info ( )
inlinevirtual

Implements sp_instr.

Reimplemented in sp_instr_hreturn, and sp_instr_hpush_jump.

◆ opt_mark()

uint sp_instr_jump::opt_mark ( sp_head ,
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.

◆ opt_move()

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.

◆ opt_shortcut_jump()

uint sp_instr_jump::opt_shortcut_jump ( sp_head ,
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.

◆ print()

void sp_instr_jump::print ( const THD thd,
String str 
)
virtual

Implements sp_printable.

Reimplemented in sp_instr_hreturn, and sp_instr_hpush_jump.

◆ set_destination()

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.

Member Data Documentation

◆ m_dest

uint sp_instr_jump::m_dest
protected

Where we will go.

◆ m_optdest

sp_instr* sp_instr_jump::m_optdest
protected

◆ psi_info

PSI_statement_info sp_instr_jump::psi_info = {0, "jump", 0, PSI_DOCUMENT_ME}
static

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