MXS-3404 Extend sqlite3 op-size from u8 to u16

To make it possible to have more tokens than 255.

Parsers operators (i.e. tokens) is one thing and opcodes
for the virtual machine of sqlite3 is another. Unfortunately
they are not completely separate, but some of the opcodes
in <build-directory>/opcodes.h are the same as the tokens in
<build-directory>/parse.h. And while the parser tokens are now
16-bit, the VM opcodes are 8-bit. However, this is probably not
a problem even if some of the parser tokens that are duplicated
in the opcodes are > 256 as we only use sqlite3 for parsing and
not for executing anything (on the sqlite3 VM).
This commit is contained in:
Johan Wikman
2021-02-15 10:30:49 +02:00
parent 5f42ee88c9
commit 797d7812cc
8 changed files with 21 additions and 21 deletions

View File

@ -52,12 +52,12 @@ foreach x $extras {
# Some additional #defines related to token codes.
#
puts "\n/* The token codes above must all fit in 8 bits */"
puts [format "#define %-20s %-6s" TKFLG_MASK 0xff]
puts "\n/* The token codes above must all fit in 12 bits */"
puts [format "#define %-20s %-6s" TKFLG_MASK 0xfff]
puts "\n/* Flags that can be added to a token code when it is not"
puts "** being stored in a u8: */"
foreach {fg val comment} {
TKFLG_DONTFOLD 0x100 {/* Omit constant folding optimizations */}
TKFLG_DONTFOLD 0x1000 {/* Omit constant folding optimizations */}
} {
puts [format "#define %-20s %-6s %s" $fg $val $comment]
}

View File

@ -804,7 +804,7 @@ int main(int argc, char **argv){
}
printf("%s };\n", j==0 ? "" : "\n");
printf(" static const unsigned char aCode[%d] = {\n", nKeyword);
printf(" static const unsigned short aCode[%d] = {\n", nKeyword);
for(i=j=0; i<nKeyword; i++){
char *zToken = aKeywordTable[i].zTokenType;
if( j==0 ) printf(" ");