MySQL 8.0.39
Source Code Documentation
sp_instr Class Referenceabstract

Base class for every SP-instruction. More...

#include <sp_instr.h>

Inheritance diagram for sp_instr:
[legend]

Public Member Functions

 sp_instr (uint ip, sp_pcontext *ctx)
 
 ~sp_instr () override
 
virtual bool execute (THD *thd, uint *nextp)=0
 Execute this instruction. More...
 
virtual PSI_statement_infoget_psi_info ()=0
 
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
 
virtual uint opt_mark (sp_head *, 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_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...
 
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 void print (const THD *thd, String *str)=0
 
virtual ~sp_printable ()=default
 

Public Attributes

Query_arena m_arena
 

Protected Member Functions

void clear_da (THD *thd) const
 Clear diagnostics area. More...
 

Protected Attributes

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...
 

Private Member Functions

 sp_instr (const sp_instr &)
 
void operator= (sp_instr &)
 

Detailed Description

Base class for every SP-instruction.

sp_instr defines interface and provides base implementation.

Constructor & Destructor Documentation

◆ sp_instr() [1/2]

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

◆ ~sp_instr()

sp_instr::~sp_instr ( )
inlineoverride

◆ sp_instr() [2/2]

sp_instr::sp_instr ( const sp_instr )
private

Member Function Documentation

◆ clear_da()

void sp_instr::clear_da ( THD thd) const
inlineprotected

Clear diagnostics area.

Parameters
thdThread context

◆ execute()

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_jump, sp_instr_error, sp_lex_instr, sp_instr_stmt, sp_instr_hpush_jump, sp_instr_hpop, sp_instr_hreturn, sp_instr_cpush, sp_instr_cpop, sp_instr_copen, sp_instr_cclose, and sp_instr_cfetch.

◆ get_cont_dest()

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.

◆ get_instr_trig_field_list()

virtual SQL_I_List< Item_trigger_field > * sp_instr::get_instr_trig_field_list ( )
inlinevirtual

Reimplemented in sp_lex_instr.

◆ get_ip()

uint sp_instr::get_ip ( ) const
inline

◆ get_parsing_ctx()

sp_pcontext * sp_instr::get_parsing_ctx ( ) const
inline

◆ get_psi_info()

◆ operator=()

void sp_instr::operator= ( sp_instr )
private

◆ opt_is_marked()

bool sp_instr::opt_is_marked ( ) const
inline

◆ opt_mark()

virtual uint sp_instr::opt_mark ( sp_head ,
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_freturn, sp_instr_error, sp_instr_jump, sp_lex_branch_instr, sp_instr_set_case_expr, sp_instr_hpush_jump, and sp_instr_hreturn.

◆ opt_move()

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_jump, sp_lex_branch_instr, and sp_instr_set_case_expr.

◆ opt_shortcut_jump()

virtual uint sp_instr::opt_shortcut_jump ( sp_head ,
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_hpush_jump, sp_instr_hreturn, and sp_instr_jump.

Member Data Documentation

◆ m_arena

Query_arena sp_instr::m_arena

◆ m_ip

uint sp_instr::m_ip
protected

Instruction pointer.

◆ m_marked

bool sp_instr::m_marked
protected

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

◆ m_parsing_ctx

sp_pcontext* sp_instr::m_parsing_ctx
protected

Instruction parsing context.


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