mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Remove the VdbeOp.opflags field and its associated initialization overhead.
Update mkopcodeh.tcl to reorder opcode numbers to help the resolveP2Values() routine run faster. FossilOrigin-Name: 099478fa7521ba52262ef2bf24dd8f0114ce92e1
This commit is contained in:
@ -20,8 +20,7 @@
|
||||
# during code generation, we need to generate corresponding opcodes like
|
||||
# OP_Add and OP_Divide. By making TK_ADD==OP_Add and TK_DIVIDE==OP_Divide,
|
||||
# code to translate from one to the other is avoided. This makes the
|
||||
# code generator run (infinitesimally) faster and more importantly it makes
|
||||
# the library footprint smaller.
|
||||
# code generator smaller and faster.
|
||||
#
|
||||
# This script also scans for lines of the form:
|
||||
#
|
||||
@ -159,7 +158,29 @@ for {set i 0} {$i<$nOp} {incr i} {
|
||||
}
|
||||
}
|
||||
|
||||
# Generate the numeric values for remaining opcodes
|
||||
# Assign the next group of values to JUMP opcodes
|
||||
#
|
||||
for {set i 0} {$i<$nOp} {incr i} {
|
||||
set name $order($i)
|
||||
if {$op($name)>=0} continue
|
||||
if {!$jump($name)} continue
|
||||
incr cnt
|
||||
while {[info exists used($cnt)]} {incr cnt}
|
||||
set op($name) $cnt
|
||||
set used($cnt) 1
|
||||
set def($cnt) $name
|
||||
}
|
||||
|
||||
# Find the numeric value for the largest JUMP opcode
|
||||
#
|
||||
set mxJump -1
|
||||
for {set i 0} {$i<$nOp} {incr i} {
|
||||
set name $order($i)
|
||||
if {$jump($name) && $op($name)>$mxJump} {set mxJump $op($name)}
|
||||
}
|
||||
|
||||
|
||||
# Generate the numeric values for all remaining opcodes
|
||||
#
|
||||
for {set i 0} {$i<$nOp} {incr i} {
|
||||
set name $order($i)
|
||||
@ -232,3 +253,11 @@ for {set i 0} {$i<=$max} {incr i} {
|
||||
}
|
||||
}
|
||||
puts "\175"
|
||||
puts ""
|
||||
puts "/* The sqlite3P2Values() routine is able to run faster if it knows"
|
||||
puts "** the value of the largest JUMP opcode. The smaller the maximum"
|
||||
puts "** JUMP opcode the better, so the mkopcodeh.tcl script that"
|
||||
puts "** generated this include file strives to group all JUMP opcodes"
|
||||
puts "** together near the beginning of the list."
|
||||
puts "*/"
|
||||
puts "#define OP_MX_JUMP $mxJump /* Maximum JUMP opcode */"
|
||||
|
Reference in New Issue
Block a user