/ Check-in [7ccebf68]
Login

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

Overview
Comment:Enhanced comments on the opcode.h building script. (CVS 3033)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7ccebf68eb1f707c2349004ae33575b484cc31a2
User & Date: drh 2006-01-26 14:29:59
Context
2006-01-27
06:32
Fix a couple of (harmless) intel compiler warnings. (CVS 3034) check-in: 2e23231f user: danielk1977 tags: trunk
2006-01-26
14:29
Enhanced comments on the opcode.h building script. (CVS 3033) check-in: 7ccebf68 user: drh tags: trunk
13:25
Fix an error in the collation sequence examples in datatype3.html. Ticket #1641. (CVS 3032) check-in: 1658ea53 user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to mkopcodeh.awk.

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
...
114
115
116
117
118
119
120



121
122
123
124
#
#       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_ value 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 translation from one to the other is avoided.  This makes the
# code generator run (infinitesimally) faster and more importantly it makes
# the total library smaller.
#
# This script also scans for lines of the form:
#
#       case OP_aaaa:       /* no-push */
#
# When the no-push comment is found on an opcode, it means that that
# opcode does not leave a result on the stack.  But identifying which
# opcodes leave results on the stack it is possible to determine a
# much smaller upper bound on the size of the stack.  This allows
# a smaller stack to be allocated, which is important to embedded
# systems with limited memory space.  This script generates a series
# of "NOPUSH_MASK" defines that contain bitmaps of opcodes that leave
# results on the stack.  The NOPUSH_MASK defines are used in vdbeaux.c
# to help determine the maximum stack size.
................................................................................
      n = op[name]
      j = n%16
      i = ((n - j)/16)
      nopush[i] = nopush[i] + (2^j)
    }
  }
  printf "\n"



  for(i=0; i<10; i++){
    printf "#define NOPUSH_MASK_%d %d\n", i, nopush[i]
  }
}







|




|

|






|







 







>
>
>

|


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
...
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#
#       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 run (infinitesimally) faster and more importantly it makes
# the library footprint smaller.
#
# This script also scans for lines of the form:
#
#       case OP_aaaa:       /* no-push */
#
# When the no-push comment is found on an opcode, it means that that
# opcode does not leave a result on the stack.  By identifying which
# opcodes leave results on the stack it is possible to determine a
# much smaller upper bound on the size of the stack.  This allows
# a smaller stack to be allocated, which is important to embedded
# systems with limited memory space.  This script generates a series
# of "NOPUSH_MASK" defines that contain bitmaps of opcodes that leave
# results on the stack.  The NOPUSH_MASK defines are used in vdbeaux.c
# to help determine the maximum stack size.
................................................................................
      n = op[name]
      j = n%16
      i = ((n - j)/16)
      nopush[i] = nopush[i] + (2^j)
    }
  }
  printf "\n"
  print "/* Opcodes that are guaranteed to never push a value onto the stack"
  print "** contain a 1 their corresponding position of the following mask"
  print "** set.  See the opcodeNoPush() function in vdbeaux.c  */"
  for(i=0; i<10; i++){
    printf "#define NOPUSH_MASK_%d 0x%04x\n", i, nopush[i]
  }
}