开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (1256)
标签 (152)
master
cli_extension
branch-3.42
reuse-schema
bedrock
wal2
begin-concurrent
fts5-expr-limit
oo1-no-cache-Stmt.columnCount
subsec-modifier
comma-format
cli-hex-escape
json5
generate_series-revamp
rtree-batch-insert
branch-3.41
sessions-rowid-tables
rtree-bulk-insert-perf
shell-for-test
cli-no-dump
release
version-3.42.0
version-3.41.2
version-3.41.1
version-3.41.0
version-3.40.1
major-release
version-3.40.0
version-3.39.4
version-3.39.3
version-3.39.2
version-3.39.1
version-3.39.0
version-3.38.5
version-3.38.4
relese
version-3.38.3
version-3.38.2
version-3.38.1
version-3.38.0
master
分支 (1256)
标签 (152)
master
cli_extension
branch-3.42
reuse-schema
bedrock
wal2
begin-concurrent
fts5-expr-limit
oo1-no-cache-Stmt.columnCount
subsec-modifier
comma-format
cli-hex-escape
json5
generate_series-revamp
rtree-batch-insert
branch-3.41
sessions-rowid-tables
rtree-bulk-insert-perf
shell-for-test
cli-no-dump
release
version-3.42.0
version-3.41.2
version-3.41.1
version-3.41.0
version-3.40.1
major-release
version-3.40.0
version-3.39.4
version-3.39.3
version-3.39.2
version-3.39.1
version-3.39.0
version-3.38.5
version-3.38.4
relese
version-3.38.3
version-3.38.2
version-3.38.1
version-3.38.0
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (1256)
标签 (152)
master
cli_extension
branch-3.42
reuse-schema
bedrock
wal2
begin-concurrent
fts5-expr-limit
oo1-no-cache-Stmt.columnCount
subsec-modifier
comma-format
cli-hex-escape
json5
generate_series-revamp
rtree-batch-insert
branch-3.41
sessions-rowid-tables
rtree-bulk-insert-perf
shell-for-test
cli-no-dump
release
version-3.42.0
version-3.41.2
version-3.41.1
version-3.41.0
version-3.40.1
major-release
version-3.40.0
version-3.39.4
version-3.39.3
version-3.39.2
version-3.39.1
version-3.39.0
version-3.38.5
version-3.38.4
relese
version-3.38.3
version-3.38.2
version-3.38.1
version-3.38.0
sqlite
/
tool
/
mkopcodeh.tcl
sqlite
/
tool
/
mkopcodeh.tcl
mkopcodeh.tcl 8.87 KB
一键复制 编辑 原始数据 按行查看 历史
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
#!/usr/bin/tclsh
#
# Generate the file opcodes.h.
#
# This TCL script scans a concatenation of the parse.h output file from the
# parser and the vdbe.c source file in order to generate the opcodes numbers
# for all opcodes.
#
# The lines of the vdbe.c that we are interested in are of the form:
#
# case OP_aaaa: /* same as TK_bbbbb */
#
# The TK_ comment is optional. If it is present, then the value assigned to
# the OP_ is the same as the TK_ value. If missing, the OP_ value is assigned
# a small integer that is different from every other OP_ value.
#
# We go to the trouble of making some OP_ values the same as TK_ values
# as an optimization. During parsing, things like expression operators
# are coded with TK_ values such as TK_ADD, TK_DIVIDE, and so forth. Later
# 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 smaller and faster.
#
# This script also scans for lines of the form:
#
# case OP_aaaa: /* jump, in1, in2, in3, out2, out3 */
#
# When such comments are found on an opcode, it means that certain
# properties apply to that opcode. Set corresponding flags using the
# OPFLG_INITIALIZER macro.
#
set in stdin
set currentOp {}
set prevName {}
set nOp 0
set nGroup 0
while {![eof $in]} {
set line [gets $in]
# Remember the TK_ values from the parse.h file.
# NB: The "TK_" prefix stands for "ToKen", not the graphical Tk toolkit
# commonly associated with TCL.
#
if {[regexp {^#define TK_} $line]} {
set tk([lindex $line 1]) [lindex $line 2]
continue
}
# Find "/* Opcode: " lines in the vdbe.c file. Each one introduces
# a new opcode. Remember which parameters are used.
#
if {[regexp {^.. Opcode: } $line]} {
set currentOp OP_[lindex $line 2]
set m 0
foreach term $line {
switch $term {
P1 {incr m 1}
P2 {incr m 2}
P3 {incr m 4}
P4 {incr m 8}
P5 {incr m 16}
}
}
set paramused($currentOp) $m
}
# Find "** Synopsis: " lines that follow Opcode:
#
if {[regexp {^.. Synopsis: (.*)} $line all x] && $currentOp!=""} {
set synopsis($currentOp) [string trim $x]
}
# Scan for "case OP_aaaa:" lines in the vdbe.c file
#
if {[regexp {^case OP_} $line]} {
set line [split $line]
set name [string trim [lindex $line 1] :]
if {$name=="OP_Abortable"} continue; # put OP_Abortable last
set op($name) -1
set group($name) 0
set jump($name) 0
set in1($name) 0
set in2($name) 0
set in3($name) 0
set out2($name) 0
set out3($name) 0
set ncycle($name) 0
for {set i 3} {$i<[llength $line]-1} {incr i} {
switch [string trim [lindex $line $i] ,] {
same {
incr i
if {[lindex $line $i]=="as"} {
incr i
set sym [string trim [lindex $line $i] ,]
set val $tk($sym)
set op($name) $val
set used($val) 1
set sameas($val) $sym
set def($val) $name
}
}
group {set group($name) 1}
jump {set jump($name) 1}
in1 {set in1($name) 1}
in2 {set in2($name) 1}
in3 {set in3($name) 1}
out2 {set out2($name) 1}
out3 {set out3($name) 1}
ncycle {set ncycle($name) 1}
}
}
if {$group($name)} {
set newGroup 0
if {[info exists groups($nGroup)]} {
if {$prevName=="" || !$group($prevName)} {
set newGroup 1
}
}
lappend groups($nGroup) $name
if {$newGroup} {incr nGroup}
} else {
if {$prevName!="" && $group($prevName)} {
incr nGroup
}
}
set order($nOp) $name
set prevName $name
incr nOp
}
}
# Assign numbers to all opcodes and output the result.
#
puts "/* Automatically generated. Do not edit */"
puts "/* See the tool/mkopcodeh.tcl script for details */"
foreach name {OP_Noop OP_Explain OP_Abortable} {
set jump($name) 0
set in1($name) 0
set in2($name) 0
set in3($name) 0
set out2($name) 0
set out3($name) 0
set ncycle($name) 0
set op($name) -1
set order($nOp) $name
incr nOp
}
# The following are the opcodes that receive special processing in the
# resolveP2Values() routine. Update this list whenever new cases are
# added to the pOp->opcode switch within resolveP2Values().
#
set rp2v_ops {
OP_Transaction
OP_AutoCommit
OP_Savepoint
OP_Checkpoint
OP_Vacuum
OP_JournalMode
OP_VUpdate
OP_VFilter
OP_Init
}
# Assign the smallest values to opcodes that are processed by resolveP2Values()
# to make code generation for the switch() statement smaller and faster.
#
set cnt -1
for {set i 0} {$i<$nOp} {incr i} {
set name $order($i)
if {[lsearch $rp2v_ops $name]>=0} {
incr cnt
while {[info exists used($cnt)]} {incr cnt}
set op($name) $cnt
set used($cnt) 1
set def($cnt) $name
}
}
set mxCase1 $cnt
# 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, while
# preserving any groupings of opcodes (i.e. those that must be
# together).
#
for {set g 0} {$g<$nGroup} {incr g} {
set gLen [llength $groups($g)]
set ok 0; set start -1
set seek $cnt
while {!$ok} {
incr seek
while {[info exists used($seek)]} {incr seek}
set ok 1; set start $seek
for {set j 0} {$j<$gLen} {incr j} {
incr seek
if {[info exists used($seek)]} {
set ok 0; break
}
}
}
if {$ok} {
set next $start
for {set j 0} {$j<$gLen} {incr j} {
set name [lindex $groups($g) $j]
if {$op($name)>=0} continue
set op($name) $next
set used($next) 1
set def($next) $name
incr next
}
} else {
error "cannot find opcodes for group: $groups($g)"
}
}
for {set i 0} {$i<$nOp} {incr i} {
set name $order($i)
if {$op($name)<0} {
incr cnt
while {[info exists used($cnt)]} {incr cnt}
set op($name) $cnt
set used($cnt) 1
set def($cnt) $name
}
}
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 {}
if {[info exists jump($name)] && $jump($name)} {
lappend com "jump"
}
if {[info exists sameas($i)]} {
lappend com "same as $sameas($i)"
}
if {[info exists synopsis($name)]} {
lappend com "synopsis: $synopsis($name)"
}
if {[llength $com]} {
puts -nonewline [format " /* %-42s */" [join $com {, }]]
}
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 x 0
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}
if {$ncycle($name)} {incr x 64}
}
set bv($i) $x
}
puts ""
puts "/* Properties such as \"out2\" or \"jump\" that are specified in"
puts "** comments following the \"case\" for each opcode in the vdbe.c"
puts "** are encoded into bitvectors as follows:"
puts "*/"
puts "#define OPFLG_JUMP 0x01 /* jump: P2 holds jmp target */"
puts "#define OPFLG_IN1 0x02 /* in1: P1 is an input */"
puts "#define OPFLG_IN2 0x04 /* in2: P2 is an input */"
puts "#define OPFLG_IN3 0x08 /* in3: P3 is an input */"
puts "#define OPFLG_OUT2 0x10 /* out2: P2 is an output */"
puts "#define OPFLG_OUT3 0x20 /* out3: P3 is an output */"
puts "#define OPFLG_NCYCLE 0x40 /* ncycle:Cycles count against P1 */"
puts "#define OPFLG_INITIALIZER 173円\\"
for {set i 0} {$i<=$max} {incr i} {
if {$i%8==0} {
puts -nonewline [format "/* %3d */" $i]
}
puts -nonewline [format " 0x%02x," $bv($i)]
if {$i%8==7} {
puts "\\"
}
}
puts "175円"
puts ""
puts "/* The resolve3P2Values() 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 SQLITE_MX_JUMP_OPCODE $mxJump /* Maximum JUMP opcode */"
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

https://github.com/sqlite/sqlite
暂无标签
未知许可证
查看未知开源许可协议
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/gitlgx/sqlite.git
git@gitee.com:gitlgx/sqlite.git
gitlgx
sqlite
sqlite
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /