/ Check-in [4d078147]
Login

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

Overview
Comment:Do not run the tool/vdbe-compress.tcl script that generates the vdbeExecUnion object that reduces the size of the sqlite3VdbeExec() stack frame unless the SQLITE_SMALL_STACK compile-time option is specified as on of the OPTS in the makefile. The vdbeExecUnion object gets in the way of C-compiler optimizer and results in slightly slower code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4d0781473a465b4ab0a307914014f3d2ddd0ce33
User & Date: drh 2013-12-11 00:59:10
Context
2013-12-11
02:21
Fix harmless compiler warning. check-in: 2525296d user: mistachkin tags: trunk
00:59
Do not run the tool/vdbe-compress.tcl script that generates the vdbeExecUnion object that reduces the size of the sqlite3VdbeExec() stack frame unless the SQLITE_SMALL_STACK compile-time option is specified as on of the OPTS in the makefile. The vdbeExecUnion object gets in the way of C-compiler optimizer and results in slightly slower code. check-in: 4d078147 user: drh tags: trunk
2013-12-10
21:38
Avoid unnecessary calls to sqlite3VdbeSerialType() from within sqlite3VdbeSerialPut(). check-in: 079c04a5 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.in.

   530    530   # all that automatic generation.
   531    531   #
   532    532   .target_source:	$(SRC) $(TOP)/tool/vdbe-compress.tcl
   533    533   	rm -rf tsrc
   534    534   	mkdir tsrc
   535    535   	cp -f $(SRC) tsrc
   536    536   	rm tsrc/sqlite.h.in tsrc/parse.y
   537         -	$(TCLSH_CMD) $(TOP)/tool/vdbe-compress.tcl <tsrc/vdbe.c >vdbe.new
          537  +	$(TCLSH_CMD) $(TOP)/tool/vdbe-compress.tcl $(OPTS) <tsrc/vdbe.c >vdbe.new
   538    538   	mv vdbe.new tsrc/vdbe.c
   539    539   	touch .target_source
   540    540   
   541    541   sqlite3.c:	.target_source $(TOP)/tool/mksqlite3c.tcl
   542    542   	$(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl
   543    543   	cp tsrc/shell.c tsrc/sqlite3ext.h .
   544    544   

Changes to Makefile.msc.

   907    907   # all that automatic generation.
   908    908   #
   909    909   .target_source:	$(SRC) $(TOP)\tool\vdbe-compress.tcl
   910    910   	-rmdir /S/Q tsrc
   911    911   	-mkdir tsrc
   912    912   	for %i in ($(SRC)) do copy /Y %i tsrc
   913    913   	del /Q tsrc\sqlite.h.in tsrc\parse.y
   914         -	$(TCLSH_CMD) $(TOP)\tool\vdbe-compress.tcl < tsrc\vdbe.c > vdbe.new
          914  +	$(TCLSH_CMD) $(TOP)\tool\vdbe-compress.tcl $(OPTS) < tsrc\vdbe.c > vdbe.new
   915    915   	move vdbe.new tsrc\vdbe.c
   916    916   	echo > .target_source
   917    917   
   918    918   sqlite3.c:	.target_source $(TOP)\tool\mksqlite3c.tcl
   919    919   	$(TCLSH_CMD) $(TOP)\tool\mksqlite3c.tcl
   920    920   	copy tsrc\shell.c .
   921    921   	copy tsrc\sqlite3ext.h .

Changes to main.mk.

   398    398   # all that automatic generation.
   399    399   #
   400    400   target_source:	$(SRC) $(TOP)/tool/vdbe-compress.tcl
   401    401   	rm -rf tsrc
   402    402   	mkdir tsrc
   403    403   	cp -f $(SRC) tsrc
   404    404   	rm tsrc/sqlite.h.in tsrc/parse.y
   405         -	tclsh $(TOP)/tool/vdbe-compress.tcl <tsrc/vdbe.c >vdbe.new
          405  +	tclsh $(TOP)/tool/vdbe-compress.tcl $(OPTS) <tsrc/vdbe.c >vdbe.new
   406    406   	mv vdbe.new tsrc/vdbe.c
   407    407   	touch target_source
   408    408   
   409    409   sqlite3.c:	target_source $(TOP)/tool/mksqlite3c.tcl
   410    410   	tclsh $(TOP)/tool/mksqlite3c.tcl
   411    411   	cp tsrc/shell.c tsrc/sqlite3ext.h .
   412    412   	echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c

Changes to src/vdbe.c.

  2690   2690   #ifndef SQLITE_OMIT_BTREECOUNT
  2691   2691   case OP_Count: {         /* out2-prerelease */
  2692   2692     i64 nEntry;
  2693   2693     BtCursor *pCrsr;
  2694   2694   
  2695   2695     pCrsr = p->apCsr[pOp->p1]->pCursor;
  2696   2696     assert( pCrsr );
         2697  +  nEntry = 0;  /* Not needed.  Only used to silence a warning. */
  2697   2698     rc = sqlite3BtreeCount(pCrsr, &nEntry);
  2698   2699     pOut->u.i = nEntry;
  2699   2700     break;
  2700   2701   }
  2701   2702   #endif
  2702   2703   
  2703   2704   /* Opcode: Savepoint P1 * * P4 *
................................................................................
  4650   4651     assert( pCrsr!=0 );
  4651   4652     pOut->flags = MEM_Null;
  4652   4653     rc = sqlite3VdbeCursorMoveto(pC);
  4653   4654     if( NEVER(rc) ) goto abort_due_to_error;
  4654   4655     assert( pC->deferredMoveto==0 );
  4655   4656     assert( pC->isTable==0 );
  4656   4657     if( !pC->nullRow ){
         4658  +    rowid = 0;  /* Not needed.  Only used to silence a warning. */
  4657   4659       rc = sqlite3VdbeIdxRowid(db, pCrsr, &rowid);
  4658   4660       if( rc!=SQLITE_OK ){
  4659   4661         goto abort_due_to_error;
  4660   4662       }
  4661   4663       pOut->u.i = rowid;
  4662   4664       pOut->flags = MEM_Int;
  4663   4665     }
................................................................................
  4713   4715     }else{
  4714   4716       r.flags = UNPACKED_PREFIX_MATCH;
  4715   4717     }
  4716   4718     r.aMem = &aMem[pOp->p3];
  4717   4719   #ifdef SQLITE_DEBUG
  4718   4720     { int i; for(i=0; i<r.nField; i++) assert( memIsValid(&r.aMem[i]) ); }
  4719   4721   #endif
         4722  +  res = 0;  /* Not needed.  Only used to silence a warning. */
  4720   4723     rc = sqlite3VdbeIdxKeyCompare(pC, &r, &res);
  4721   4724     if( pOp->opcode==OP_IdxLT ){
  4722   4725       res = -res;
  4723   4726     }else{
  4724   4727       assert( pOp->opcode==OP_IdxGE );
  4725   4728       res++;
  4726   4729     }
................................................................................
  4773   4776     if( iCnt>1 ){
  4774   4777       rc = SQLITE_LOCKED;
  4775   4778       p->errorAction = OE_Abort;
  4776   4779     }else{
  4777   4780       iDb = pOp->p3;
  4778   4781       assert( iCnt==1 );
  4779   4782       assert( (p->btreeMask & (((yDbMask)1)<<iDb))!=0 );
         4783  +    iMoved = 0;  /* Not needed.  Only to silence a warning. */
  4780   4784       rc = sqlite3BtreeDropTable(db->aDb[iDb].pBt, pOp->p1, &iMoved);
  4781   4785       pOut->flags = MEM_Int;
  4782   4786       pOut->u.i = iMoved;
  4783   4787   #ifndef SQLITE_OMIT_AUTOVACUUM
  4784   4788       if( rc==SQLITE_OK && iMoved!=0 ){
  4785   4789         sqlite3RootPageMoved(db, iDb, iMoved, pOp->p1);
  4786   4790         /* All OP_Destroy operations occur on the same btree */

Changes to tool/vdbe-compress.tcl.

     9      9   # the same result.  The modifications made by this script merely help
    10     10   # the C compiler to generate code for sqlite3VdbeExec() that uses less
    11     11   # stack space.
    12     12   #
    13     13   # Script usage:
    14     14   #
    15     15   #          mv vdbe.c vdbe.c.template
    16         -#          tclsh vdbe-compress.tcl <vdbe.c.template >vdbe.c
           16  +#          tclsh vdbe-compress.tcl $CFLAGS <vdbe.c.template >vdbe.c
    17     17   #
    18     18   # Modifications made:
    19     19   #
    20     20   # All modifications are within the sqlite3VdbeExec() function.  The
    21     21   # modifications seek to reduce the amount of stack space allocated by
    22     22   # this routine by moving local variable declarations out of individual
    23     23   # opcode implementations and into a single large union.  The union contains
................................................................................
    37     37   #
    38     38   #############################################################################
    39     39   #
    40     40   set beforeUnion {}   ;# C code before union
    41     41   set unionDef {}      ;# C code of the union
    42     42   set afterUnion {}    ;# C code after the union
    43     43   set sCtr 0           ;# Context counter
           44  +
           45  +# If the SQLITE_SMALL_STACK compile-time option is missing, then
           46  +# this transformation becomes a no-op.
           47  +#
           48  +if {![regexp {SQLITE_SMALL_STACK} $argv]} {
           49  +  while {![eof stdin]} {
           50  +    puts [gets stdin]
           51  +  }
           52  +  exit
           53  +}
    44     54   
    45     55   # Read program text up to the spot where the union should be
    46     56   # inserted.
    47     57   #
    48     58   while {![eof stdin]} {
    49     59     set line [gets stdin]
    50     60     if {[regexp {INSERT STACK UNION HERE} $line]} break