1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Modify mkopcodeh.tcl so that it can handle "same as" opcodes with values

larger than the total number of opcodes.

FossilOrigin-Name: 1eb56fe0305f0841b14865b7560add3da529b211328f5fa171b9628418a6ed49
This commit is contained in:
dan
2017-07-14 17:50:11 +00:00
parent c9fb27bfa8
commit 0e6b83088f
3 changed files with 25 additions and 17 deletions

View File

@ -192,11 +192,13 @@ for {set i 0} {$i<$nOp} {incr i} {
set def($cnt) $name
}
}
set max $cnt
for {set i 0} {$i<$nOp} {incr i} {
set max [lindex [lsort -decr -integer [array names used]] 0]
for {set i 0} {$i<=$max} {incr i} {
if {![info exists used($i)]} {
set def($i) "OP_NotUsed_$i"
}
if {$i>$max} {set max $i}
set name $def($i)
puts -nonewline [format {#define %-16s %3d} $name $i]
set com {}
@ -217,18 +219,24 @@ for {set i 0} {$i<$nOp} {incr i} {
puts ""
}
if {$max>255} {
error "More than 255 opcodes - VdbeOp.opcode is of type u8!"
}
# Generate the bitvectors:
#
set bv(0) 0
for {set i 0} {$i<=$max} {incr i} {
set name $def($i)
set x 0
if {$jump($name)} {incr x 1}
if {$in1($name)} {incr x 2}
if {$in2($name)} {incr x 4}
if {$in3($name)} {incr x 8}
if {$out2($name)} {incr x 16}
if {$out3($name)} {incr x 32}
set name $def($i)
if {[string match OP_NotUsed* $name]==0} {
if {$jump($name)} {incr x 1}
if {$in1($name)} {incr x 2}
if {$in2($name)} {incr x 4}
if {$in3($name)} {incr x 8}
if {$out2($name)} {incr x 16}
if {$out3($name)} {incr x 32}
}
set bv($i) $x
}
puts ""