MCPcopy Create free account
hub / github.com/MariaDB/server / optimize

Method optimize

sql/sp_head.cc:3323–3363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3321*/
3322
3323void sp_head::optimize()
3324{
3325 List<sp_instr_opt_meta> bp;
3326 sp_instr *i;
3327 uint src, dst;
3328
3329 DBUG_EXECUTE_IF("sp_head_optimize_disable", return; );
3330
3331 opt_mark();
3332
3333 bp.empty();
3334 src= dst= 0;
3335 while ((i= get_instr(src)))
3336 {
3337 if (! i->marked)
3338 {
3339 delete i;
3340 src+= 1;
3341 }
3342 else
3343 {
3344 if (src != dst)
3345 {
3346 /* Move the instruction and update prev. jumps */
3347 sp_instr_opt_meta *ibp;
3348 List_iterator_fast<sp_instr_opt_meta> li(bp);
3349
3350 set_dynamic(&m_instr, (uchar*)&i, dst);
3351 while ((ibp= li++))
3352 {
3353 ibp->set_destination(src, dst);
3354 }
3355 }
3356 i->opt_move(dst, &bp);
3357 src+= 1;
3358 dst+= 1;
3359 }
3360 }
3361 m_instr.elements= dst;
3362 bp.empty();
3363}
3364
3365void sp_head::add_mark_lead(uint ip, List<sp_instr> *leads)
3366{

Callers 5

mysql_derived_optimizeFunction · 0.45
executeMethod · 0.45
db_load_routineMethod · 0.45
setup_jtbm_semi_joinsFunction · 0.45

Calls 4

set_dynamicFunction · 0.85
emptyMethod · 0.45
set_destinationMethod · 0.45
opt_moveMethod · 0.45

Tested by

no test coverage detected