/ Check-in [1eb56fe0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Modify mkopcodeh.tcl so that it can handle "same as" opcodes with values larger than the total number of opcodes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:1eb56fe0305f0841b14865b7560add3da529b211328f5fa171b9628418a6ed49
User & Date: dan 2017-07-14 17:50:11
Context
2017-07-14
19:12
Tweak Makefile.in so that testfixture can be built with the --disable-amalgamation configure switch. check-in: 394c6f4f user: dan tags: trunk
17:50
Modify mkopcodeh.tcl so that it can handle "same as" opcodes with values larger than the total number of opcodes. check-in: 1eb56fe0 user: dan tags: trunk
15:57
In the LSM1 virtual table, dequote the filename before opening the file. check-in: 6ed4ef03 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tool/mkopcodeh.tcl.

   188    188       incr cnt
   189    189       while {[info exists used($cnt)]} {incr cnt}
   190    190       set op($name) $cnt
   191    191       set used($cnt) 1
   192    192       set def($cnt) $name
   193    193     }
   194    194   }
   195         -set max $cnt
   196         -for {set i 0} {$i<$nOp} {incr i} {
          195  +
          196  +set max [lindex [lsort -decr -integer [array names used]] 0]
          197  +for {set i 0} {$i<=$max} {incr i} {
   197    198     if {![info exists used($i)]} {
   198    199       set def($i) "OP_NotUsed_$i"
   199    200     }
          201  +  if {$i>$max} {set max $i}
   200    202     set name $def($i)
   201    203     puts -nonewline [format {#define %-16s %3d} $name $i]
   202    204     set com {}
   203    205     if {[info exists sameas($i)]} {
   204    206       set com "same as $sameas($i)"
   205    207     }
   206    208     if {[info exists synopsis($name)]} {
................................................................................
   212    214       }
   213    215     }
   214    216     if {$com!=""} {
   215    217       puts -nonewline [format " /* %-42s */" $com]
   216    218     }
   217    219     puts ""
   218    220   }
          221  +
          222  +if {$max>255} {
          223  +  error "More than 255 opcodes - VdbeOp.opcode is of type u8!"
          224  +}
   219    225   
   220    226   # Generate the bitvectors:
   221    227   #
   222    228   set bv(0) 0
   223    229   for {set i 0} {$i<=$max} {incr i} {
   224         -  set name $def($i)
   225    230     set x 0
   226         -  if {$jump($name)}  {incr x 1}
   227         -  if {$in1($name)}   {incr x 2}
   228         -  if {$in2($name)}   {incr x 4}
   229         -  if {$in3($name)}   {incr x 8}
   230         -  if {$out2($name)}  {incr x 16}
   231         -  if {$out3($name)}  {incr x 32}
          231  +  set name $def($i)
          232  +  if {[string match OP_NotUsed* $name]==0} {
          233  +    if {$jump($name)}  {incr x 1}
          234  +    if {$in1($name)}   {incr x 2}
          235  +    if {$in2($name)}   {incr x 4}
          236  +    if {$in3($name)}   {incr x 8}
          237  +    if {$out2($name)}  {incr x 16}
          238  +    if {$out3($name)}  {incr x 32}
          239  +  }
   232    240     set bv($i) $x
   233    241   }
   234    242   puts ""
   235    243   puts "/* Properties such as \"out2\" or \"jump\" that are specified in"
   236    244   puts "** comments following the \"case\" for each opcode in the vdbe.c"
   237    245   puts "** are encoded into bitvectors as follows:"
   238    246   puts "*/"