Documentation Source Text

Check-in [0d929c02e3]
Login

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

Overview
Comment:Enhance the "opcodes.html" document to include hyperlinks from to the opcodes.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0d929c02e331e1f8215d8b8896a9690504be1659
User & Date: drh 2014-05-24 17:01:49
Context
2014-05-24
17:31
Merge accidental fork check-in: 0f2064446a user: drh tags: trunk
17:16
Further improvements to the opcodes.html documentation generator. check-in: 4f034b4e83 user: drh tags: trunk
17:01
Enhance the "opcodes.html" document to include hyperlinks from to the opcodes. check-in: 0d929c02e3 user: drh tags: trunk
16:20
Update the change log for 3.8.5. Fix a typo in the isolation.html document. check-in: ee616cbbb3 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pages/opcode.in.

43
44
45
46
47
48
49





















50
51
52
53
54
55
56
..
67
68
69
70
71
72
73
74

75
76
77
78

79
80
81
82
83
84
85
...
218
219
220
221
222
223
224
225
226
227
228
229
230
    regsub -all {<} $line {\&lt;} line
    append Opcode($current_op:text) \n$pstart$line
    set pstart {}
    set pend "</p>\n"
  }
}
unset file





















</tcl>

<h3>Introduction</h3>

<p>In order to execute an SQL statement, the SQLite library first parses
the SQL, analyzes the statement, then generates a short program to execute
the statement.  The program is generated for a "virtual machine" implemented
................................................................................
Unfortunately, the virtual machine tutorial was written for
SQLite version 1.0.  There are substantial changes in the virtual
machine for version 2.0 and again for version 3.0.0 and again
for version 3.5.5 and the document has not been updated.  But the
basic concepts behind the virtual machine still apply.
</p>

<p>The source code to the virtual machine is in the <b>vdbe.c</b> source

file.  All of the opcode definitions further down in this document are
contained in comments in the source file.  In fact, the opcode table
in this document
was generated by scanning the <b>vdbe.c</b> source file 

and extracting the necessary information from comments.  So the 
source code comments are really the canonical source of information
about the virtual machine.  When in doubt, refer to the source code.</p>

<p>Each instruction in the virtual machine consists of an opcode and
up to five operands named P1, P2  P3, P4, and P5.  P1, P2, and P3 
are 32-bit signed integers.  These operands often refer to registers.
................................................................................

<p><table cellspacing="1" border="1" cellpadding="10">
<tr><th>Opcode&nbsp;Name</th><th>Description</th></tr>

<tcl>
  foreach op [lsort -dictionary $OpcodeList] {
    hd_puts {<tr><td valign="top" align="center">}
    hd_puts "<a name=\"$op\"></a><p>$op</p>"
    regsub -all {\[(P[0-9+]+)\]} $Opcode($op:text) {\&#91;\1\&#93} txt
    hd_resolve "<td>[string trim $txt]</td></tr>"
  }
</tcl>
</table></p>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
>



|
>







 







|

|



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
..
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
...
241
242
243
244
245
246
247
248
249
250
251
252
253
    regsub -all {<} $line {\&lt;} line
    append Opcode($current_op:text) \n$pstart$line
    set pstart {}
    set pend "</p>\n"
  }
}
unset file

# Scan $txt and replace every opcode name with a link to its documentation
#
proc LinkOpcodeNames {txt} {
  global Opcode
  set out {}
  while {[regexp {^(.*?)((OP_)?[A-Z][a-z][A-Za-z]+)(.*)$} $txt \
             all pre op opx tail]} {
    append out $pre
    regsub {^OP_} $op {} key
    if {[info exists Opcode($key:text)]} {
      append out "<a href=\"#$key\">$op</a>"
    } else {
      append out $op
    }
    set txt $tail
  }
  append out $txt
  return $out
}

</tcl>

<h3>Introduction</h3>

<p>In order to execute an SQL statement, the SQLite library first parses
the SQL, analyzes the statement, then generates a short program to execute
the statement.  The program is generated for a "virtual machine" implemented
................................................................................
Unfortunately, the virtual machine tutorial was written for
SQLite version 1.0.  There are substantial changes in the virtual
machine for version 2.0 and again for version 3.0.0 and again
for version 3.5.5 and the document has not been updated.  But the
basic concepts behind the virtual machine still apply.
</p>

<p>The source code to the virtual machine is in the 
[http://www.sqlite.org/src/finfo?name=src/vdbe.c | vdbe.c] source
file.  All of the opcode definitions further down in this document are
contained in comments in the source file.  In fact, the opcode table
in this document
was generated by scanning the 
[http://www.sqlite.org/src/finfo?name=src/vdbe.c | vdbe.c] source file 
and extracting the necessary information from comments.  So the 
source code comments are really the canonical source of information
about the virtual machine.  When in doubt, refer to the source code.</p>

<p>Each instruction in the virtual machine consists of an opcode and
up to five operands named P1, P2  P3, P4, and P5.  P1, P2, and P3 
are 32-bit signed integers.  These operands often refer to registers.
................................................................................

<p><table cellspacing="1" border="1" cellpadding="10">
<tr><th>Opcode&nbsp;Name</th><th>Description</th></tr>

<tcl>
  foreach op [lsort -dictionary $OpcodeList] {
    hd_puts {<tr><td valign="top" align="center">}
    hd_puts "\n<a name=\"$op\"></a><p>$op</p>\n"
    regsub -all {\[(P[0-9+]+)\]} $Opcode($op:text) {\&#91;\1\&#93} txt
    hd_resolve "<td>[string trim [LinkOpcodeNames $txt]]</td></tr>\n"
  }
</tcl>
</table></p>