Change 'stack' to the more descriptive 'no-push' in vdbe.c. (CVS 2429)

FossilOrigin-Name: 7e54d3c7289c091d449844d21b923e553f1d1f5f
This commit is contained in:
danielk1977 2005-03-29 13:07:00 +00:00
parent bc04f8529d
commit 7a5147c5c9
6 changed files with 144 additions and 145 deletions

View File

@ -1,5 +1,5 @@
C Reduce\sthe\sspace\sallocated\sfor\sthe\sruntime\svirtual\smachine\sstack.\s(CVS\s2428)
D 2005-03-29T08:26:13
C Change\s'stack'\sto\sthe\smore\sdescriptive\s'no-push'\sin\svdbe.c.\s(CVS\s2429)
D 2005-03-29T13:07:00
F Makefile.in 5c00d0037104de2a50ac7647a5f12769795957a3
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -19,7 +19,7 @@ F ltmain.sh f6b283068efa69f06eb8aa1fe4bddfdbdeb35826
F main.mk 3acc5ae52addd43fd1858fe99fca54a49bca6a56
F mkdll.sh 5ec23622515d5bf8969404e80cfb5e220ddf0512
F mkopcodec.awk bd46ad001c98dfbab07b1713cb8e692fa0e5415d
F mkopcodeh.awk d3d6dfcef5a7b69398627aec581d1ec52561517d
F mkopcodeh.awk 7563ad235670e864ead95cf672be3fe081450ae0
F mkso.sh 125868def279650a07d3f0f5e8476fecf99613fd
F publish.sh ed0aba4ffdfadb36597d03ce8efdae96efc038cb
F spec.template b2f6c4e488cbc3b993a57deba22cbc36203c4da3
@ -75,11 +75,11 @@ F src/update.c 42823d00865c9fe4f01b3c62647858726345a28e
F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c
F src/util.c 02bc2750336b021b3f10e61538f665c4b0033b5d
F src/vacuum.c 5cf598003191bd91c17a64742bad8e46241698a8
F src/vdbe.c 68c8f34cbf7c05418c93e900d46f81b09500353a
F src/vdbe.c cb701319876cb1332a7372feaaa1310cd463c9f6
F src/vdbe.h 7f586cb6d6b57764e5aac1f87107d6a95ddce24c
F src/vdbeInt.h 39beecdfb017d3e042fe60974691abd573a5c5a2
F src/vdbeInt.h 97b62807bd001efd82006460ad8a8d72d1c8d36d
F src/vdbeapi.c 467caa6e6fb9247528b1c7ab9132ae1b4748e8ac
F src/vdbeaux.c b28883d9efc9d4c1ec26c0d2473d5d8febc8178e
F src/vdbeaux.c f07ea8a5c3f4b2bb7505f21753ea966d2f04d4d0
F src/vdbemem.c 4e853ce3151eaf7906150da85a1b3ce1fe5e8da8
F src/where.c c4b227458e8993decb515ed9a2fe2d4f5f8e3125
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
@ -278,7 +278,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b
P c41d55443c2dd532147962b87f542fb7d37075fd
R d1e86050613dbac2624d4c64006d314d
P 7d6818da33a87076d1faf35ffc15a3aada0533b3
R b2b5f4cce8b0df2fc23078e18d925b30
U danielk1977
Z d987ab454820e190643b62f4a4339773
Z 5e718761fcd6175855385aab184db7fd

View File

@ -1 +1 @@
7d6818da33a87076d1faf35ffc15a3aada0533b3
7e54d3c7289c091d449844d21b923e553f1d1f5f

View File

@ -44,8 +44,8 @@
used[op[name]] = 1
sameas[op[name]] = sym
}
if($i=="stack"){
stack[name] = 1
if($i=="no-push"){
nopush[name] = 1
}
}
}
@ -85,27 +85,26 @@ END {
# Generate the 10 16-bit bitmasks used by function opcodeUsesStack()
# in vdbeaux.c. See comments in that function for details.
#
stack[0] = 0 # 0..15
stack[1] = 0 # 16..31
stack[2] = 0 # 32..47
stack[3] = 0 # 48..63
stack[4] = 0 # 64..79
stack[5] = 0 # 80..95
stack[6] = 0 # 96..111
stack[7] = 0 # 112..127
stack[8] = 0 # 128..143
stack[9] = 0 # 144..159
nopush[0] = 0 # 0..15
nopush[1] = 0 # 16..31
nopush[2] = 0 # 32..47
nopush[3] = 0 # 48..63
nopush[4] = 0 # 64..79
nopush[5] = 0 # 80..95
nopush[6] = 0 # 96..111
nopush[7] = 0 # 112..127
nopush[8] = 0 # 128..143
nopush[9] = 0 # 144..159
for(name in op){
if( stack[name] ){
if( nopush[name] ){
n = op[name]
j = n%16
i = ((n - j)/16)
stack[i] = stack[i] + (2^j)
nopush[i] = nopush[i] + (2^j)
}
}
printf "\n"
for(i=0; i<10; i++){
printf "#define STACK_MASK_%d %d\n", i, stack[i]
printf "#define NOPUSH_MASK_%d %d\n", i, nopush[i]
}
}

View File

@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.462 2005/03/29 08:26:13 danielk1977 Exp $
** $Id: vdbe.c,v 1.463 2005/03/29 13:07:00 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@ -538,9 +538,9 @@ int sqlite3VdbeExec(
#ifndef NDEBUG
/* This is to check that the return value of static function
** opcodeUsesStack() (see vdbeaux.c) returns values that match the
** opcodeNoPush() (see vdbeaux.c) returns values that match the
** implementation of the virtual machine in this file. If
** opcodeUsesStack() returns non-zero, then the stack is guarenteed
** opcodeNoPush() returns non-zero, then the stack is guarenteed
** not to grow when the opcode is executed. If it returns zero, then
** the stack may grow by at most 1.
**
@ -548,7 +548,7 @@ int sqlite3VdbeExec(
** available if NDEBUG is defined at build time.
*/
pStackLimit = pTos;
if( !sqlite3VdbeOpcodeUsesStack(pOp->opcode) ){
if( !sqlite3VdbeOpcodeNoPush(pOp->opcode) ){
pStackLimit++;
}
#endif
@ -574,8 +574,8 @@ int sqlite3VdbeExec(
** that comment is used to determine the particular value of the opcode.
**
** If a comment on the same line as the "case OP_" construction contains
** the word "stack", then the opcode is guarenteed not to grow the
** vdbe stack when it is executed. See function opcodeUsesStack() in
** the word "no-push", then the opcode is guarenteed not to grow the
** vdbe stack when it is executed. See function opcode() in
** vdbeaux.c for details.
**
** Documentation about VDBE opcodes is generated by scanning this file
@ -597,7 +597,7 @@ int sqlite3VdbeExec(
** the one at index P2 from the beginning of
** the program.
*/
case OP_Goto: { /* no stack growth */
case OP_Goto: { /* no-push */
CHECK_FOR_INTERRUPT;
pc = pOp->p2 - 1;
break;
@ -613,7 +613,7 @@ case OP_Goto: { /* no stack growth */
** the return address stack will fill up and processing will abort
** with a fatal error.
*/
case OP_Gosub: { /* no stack growth */
case OP_Gosub: { /* no-push */
assert( p->returnDepth<sizeof(p->returnStack)/sizeof(p->returnStack[0]) );
p->returnStack[p->returnDepth++] = pc+1;
pc = pOp->p2 - 1;
@ -626,7 +626,7 @@ case OP_Gosub: { /* no stack growth */
** OP_Gosub. If an OP_Return has occurred for all OP_Gosubs, then
** processing aborts with a fatal error.
*/
case OP_Return: { /* no stack growth */
case OP_Return: { /* no-push */
assert( p->returnDepth>0 );
p->returnDepth--;
pc = p->returnStack[p->returnDepth] - 1;
@ -650,7 +650,7 @@ case OP_Return: { /* no stack growth */
** every program. So a jump past the last instruction of the program
** is the same as executing Halt.
*/
case OP_Halt: { /* no stack growth */
case OP_Halt: { /* no-push */
p->pTos = pTos;
p->rc = pOp->p1;
p->pc = pc;
@ -832,7 +832,7 @@ case OP_Variable: {
**
** P1 elements are popped off of the top of stack and discarded.
*/
case OP_Pop: { /* no stack growth */
case OP_Pop: { /* no-push */
assert( pOp->p1>=0 );
popStack(&pTos, pOp->p1);
assert( pTos>=&p->aStack[-1] );
@ -875,7 +875,7 @@ case OP_Dup: {
**
** See also the Dup instruction.
*/
case OP_Pull: { /* no stack growth */
case OP_Pull: { /* no-push */
Mem *pFrom = &pTos[-pOp->p1];
int i;
Mem ts;
@ -907,7 +907,7 @@ case OP_Pull: { /* no stack growth */
** stack (P1==0 is the top of the stack) with the value
** of the top of the stack. Then pop the top of the stack.
*/
case OP_Push: { /* no stack growth */
case OP_Push: { /* no-push */
Mem *pTo = &pTos[-pOp->p1];
assert( pTo>=p->aStack );
@ -922,7 +922,7 @@ case OP_Push: { /* no stack growth */
** invoke the callback function using the newly formed array as the
** 3rd parameter.
*/
case OP_Callback: { /* no stack growth */
case OP_Callback: { /* no-push */
int i;
assert( p->nResColumn==pOp->p1 );
@ -1058,11 +1058,11 @@ case OP_Concat: { /* same as TK_CONCAT */
** function before the division. Division by zero returns NULL.
** If either operand is NULL, the result is NULL.
*/
case OP_Add: /* same as TK_PLUS, no stack growth */
case OP_Subtract: /* same as TK_MINUS, no stack growth */
case OP_Multiply: /* same as TK_STAR, no stack growth */
case OP_Divide: /* same as TK_SLASH, no stack growth */
case OP_Remainder: { /* same as TK_REM, no stack growth */
case OP_Add: /* same as TK_PLUS, no-push */
case OP_Subtract: /* same as TK_MINUS, no-push */
case OP_Multiply: /* same as TK_STAR, no-push */
case OP_Divide: /* same as TK_SLASH, no-push */
case OP_Remainder: { /* same as TK_REM, no-push */
Mem *pNos = &pTos[-1];
assert( pNos>=p->aStack );
if( ((pTos->flags | pNos->flags) & MEM_Null)!=0 ){
@ -1142,7 +1142,7 @@ divide_by_zero:
** to retrieve the collation sequence set by this opcode is not available
** publicly, only to user functions defined in func.c.
*/
case OP_CollSeq: { /* no stack growth */
case OP_CollSeq: { /* no-push */
assert( pOp->p3type==P3_COLLSEQ );
break;
}
@ -1260,10 +1260,10 @@ case OP_Function: {
** right by N bits where N is the top element on the stack.
** If either operand is NULL, the result is NULL.
*/
case OP_BitAnd: /* same as TK_BITAND, no stack growth */
case OP_BitOr: /* same as TK_BITOR, no stack growth */
case OP_ShiftLeft: /* same as TK_LSHIFT, no stack growth */
case OP_ShiftRight: { /* same as TK_RSHIFT, no stack growth */
case OP_BitAnd: /* same as TK_BITAND, no-push */
case OP_BitOr: /* same as TK_BITOR, no-push */
case OP_ShiftLeft: /* same as TK_LSHIFT, no-push */
case OP_ShiftRight: { /* same as TK_RSHIFT, no-push */
Mem *pNos = &pTos[-1];
int a, b;
@ -1298,7 +1298,7 @@ case OP_ShiftRight: { /* same as TK_RSHIFT, no stack growth */
**
** To force the top of the stack to be an integer, just add 0.
*/
case OP_AddImm: { /* no stack growth */
case OP_AddImm: { /* no-push */
assert( pTos>=p->aStack );
Integerify(pTos);
pTos->i += pOp->p1;
@ -1315,7 +1315,7 @@ case OP_AddImm: { /* no stack growth */
** current value if P1==0, or to the least integer that is strictly
** greater than its current value if P1==1.
*/
case OP_ForceInt: { /* no stack growth */
case OP_ForceInt: { /* no-push */
int v;
assert( pTos>=p->aStack );
applyAffinity(pTos, SQLITE_AFF_INTEGER, db->enc);
@ -1350,7 +1350,7 @@ case OP_ForceInt: { /* no stack growth */
** P1 is 1, then the stack is popped. In all other cases, the depth
** of the stack is unchanged.
*/
case OP_MustBeInt: { /* no stack growth */
case OP_MustBeInt: { /* no-push */
assert( pTos>=p->aStack );
applyAffinity(pTos, SQLITE_AFF_INTEGER, db->enc);
if( (pTos->flags & MEM_Int)==0 ){
@ -1425,12 +1425,12 @@ case OP_MustBeInt: { /* no stack growth */
** the 2nd element down on the stack is greater than or equal to the
** top of the stack. See the Eq opcode for additional information.
*/
case OP_Eq: /* same as TK_EQ, no stack growth */
case OP_Ne: /* same as TK_NE, no stack growth */
case OP_Lt: /* same as TK_LT, no stack growth */
case OP_Le: /* same as TK_LE, no stack growth */
case OP_Gt: /* same as TK_GT, no stack growth */
case OP_Ge: { /* same as TK_GE, no stack growth */
case OP_Eq: /* same as TK_EQ, no-push */
case OP_Ne: /* same as TK_NE, no-push */
case OP_Lt: /* same as TK_LT, no-push */
case OP_Le: /* same as TK_LE, no-push */
case OP_Gt: /* same as TK_GT, no-push */
case OP_Ge: { /* same as TK_GE, no-push */
Mem *pNos;
int flags;
int res;
@ -1496,8 +1496,8 @@ case OP_Ge: { /* same as TK_GE, no stack growth */
** two values and push the resulting boolean value back onto the
** stack.
*/
case OP_And: /* same as TK_AND, no stack growth */
case OP_Or: { /* same as TK_OR, no stack growth */
case OP_And: /* same as TK_AND, no-push */
case OP_Or: { /* same as TK_OR, no-push */
Mem *pNos = &pTos[-1];
int v1, v2; /* 0==TRUE, 1==FALSE, 2==UNKNOWN or NULL */
@ -1544,7 +1544,7 @@ case OP_Or: { /* same as TK_OR, no stack growth */
** with its absolute value. If the top of the stack is NULL
** its value is unchanged.
*/
case OP_Negative: /* same as TK_UMINUS, no stack growth */
case OP_Negative: /* same as TK_UMINUS, no-push */
case OP_AbsValue: {
assert( pTos>=p->aStack );
if( pTos->flags & MEM_Real ){
@ -1577,7 +1577,7 @@ case OP_AbsValue: {
** with its complement. If the top of the stack is NULL its value
** is unchanged.
*/
case OP_Not: { /* same as TK_NOT, no stack growth */
case OP_Not: { /* same as TK_NOT, no-push */
assert( pTos>=p->aStack );
if( pTos->flags & MEM_Null ) break; /* Do nothing to NULLs */
Integerify(pTos);
@ -1593,7 +1593,7 @@ case OP_Not: { /* same as TK_NOT, no stack growth */
** with its ones-complement. If the top of the stack is NULL its
** value is unchanged.
*/
case OP_BitNot: { /* same as TK_BITNOT, no stack growth */
case OP_BitNot: { /* same as TK_BITNOT, no-push */
assert( pTos>=p->aStack );
if( pTos->flags & MEM_Null ) break; /* Do nothing to NULLs */
Integerify(pTos);
@ -1608,7 +1608,7 @@ case OP_BitNot: { /* same as TK_BITNOT, no stack growth */
** Do nothing. This instruction is often useful as a jump
** destination.
*/
case OP_Noop: { /* no stack growth */
case OP_Noop: { /* no-push */
break;
}
@ -1632,8 +1632,8 @@ case OP_Noop: { /* no stack growth */
** If the value popped of the stack is NULL, then take the jump if P1
** is true and fall through if P1 is false.
*/
case OP_If: /* no stack growth */
case OP_IfNot: { /* no stack growth */
case OP_If: /* no-push */
case OP_IfNot: { /* no-push */
int c;
assert( pTos>=p->aStack );
if( pTos->flags & MEM_Null ){
@ -1654,7 +1654,7 @@ case OP_IfNot: { /* no stack growth */
** to P2. Pop the stack P1 times if P1>0. If P1<0 leave the stack
** unchanged.
*/
case OP_IsNull: { /* same as TK_ISNULL, no stack growth */
case OP_IsNull: { /* same as TK_ISNULL, no-push */
int i, cnt;
Mem *pTerm;
cnt = pOp->p1;
@ -1677,7 +1677,7 @@ case OP_IsNull: { /* same as TK_ISNULL, no stack growth */
** stack if P1 times if P1 is greater than zero. If P1 is less than
** zero then leave the stack unchanged.
*/
case OP_NotNull: { /* same as TK_NOTNULL, no stack growth */
case OP_NotNull: { /* same as TK_NOTNULL, no-push */
int i, cnt;
cnt = pOp->p1;
if( cnt<0 ) cnt = -cnt;
@ -1698,7 +1698,7 @@ case OP_NotNull: { /* same as TK_NOTNULL, no stack growth */
** If OP_KeyAsData is to be applied to cursor P1, it must be executed
** before this op-code.
*/
case OP_SetNumColumns: { /* no stack growth */
case OP_SetNumColumns: { /* no-push */
Cursor *pC;
assert( (pOp->p1)<p->nCursor );
assert( p->apCsr[pOp->p1]!=0 );
@ -2156,7 +2156,7 @@ case OP_MakeRecord: {
** database file has an index of 0 and the file used for temporary tables
** has an index of 1.
*/
case OP_Statement: { /* no stack growth */
case OP_Statement: { /* no-push */
int i = pOp->p1;
Btree *pBt;
if( i>=0 && i<db->nDb && (pBt = db->aDb[i].pBt) && !(db->autoCommit) ){
@ -2176,7 +2176,7 @@ case OP_Statement: { /* no stack growth */
**
** This instruction causes the VM to halt.
*/
case OP_AutoCommit: { /* no stack growth */
case OP_AutoCommit: { /* no-push */
u8 i = pOp->p1;
u8 rollback = pOp->p2;
@ -2237,7 +2237,7 @@ case OP_AutoCommit: { /* no stack growth */
**
** If P2 is zero, then a read-lock is obtained on the database file.
*/
case OP_Transaction: { /* no stack growth */
case OP_Transaction: { /* no-push */
int i = pOp->p1;
Btree *pBt;
@ -2300,7 +2300,7 @@ case OP_ReadCookie: {
**
** A transaction must be started before executing this opcode.
*/
case OP_SetCookie: { /* no stack growth */
case OP_SetCookie: { /* no-push */
Db *pDb;
assert( pOp->p2<SQLITE_N_BTREE_META );
assert( pOp->p1>=0 && pOp->p1<db->nDb );
@ -2336,7 +2336,7 @@ case OP_SetCookie: { /* no stack growth */
** to be executed (to establish a read lock) before this opcode is
** invoked.
*/
case OP_VerifyCookie: { /* no stack growth */
case OP_VerifyCookie: { /* no-push */
int iMeta;
Btree *pBt;
assert( pOp->p1>=0 && pOp->p1<db->nDb );
@ -2396,8 +2396,8 @@ case OP_VerifyCookie: { /* no stack growth */
**
** See also OpenRead.
*/
case OP_OpenRead: /* no stack growth */
case OP_OpenWrite: { /* no stack growth */
case OP_OpenRead: /* no-push */
case OP_OpenWrite: { /* no-push */
int i = pOp->p1;
int p2 = pOp->p2;
int wrFlag;
@ -2485,7 +2485,7 @@ case OP_OpenWrite: { /* no stack growth */
** whereas "Temporary" in the context of CREATE TABLE means for the duration
** of the connection to the database. Same word; different meanings.
*/
case OP_OpenTemp: { /* no stack growth */
case OP_OpenTemp: { /* no-push */
int i = pOp->p1;
Cursor *pCx;
assert( i>=0 );
@ -2534,7 +2534,7 @@ case OP_OpenTemp: { /* no stack growth */
** A pseudo-table created by this opcode is useful for holding the
** NEW or OLD tables in a trigger.
*/
case OP_OpenPseudo: { /* no stack growth */
case OP_OpenPseudo: { /* no-push */
int i = pOp->p1;
Cursor *pCx;
assert( i>=0 );
@ -2552,7 +2552,7 @@ case OP_OpenPseudo: { /* no stack growth */
** Close a cursor previously opened as P1. If P1 is not
** currently open, this instruction is a no-op.
*/
case OP_Close: { /* no stack growth */
case OP_Close: { /* no-push */
int i = pOp->p1;
if( i>=0 && i<p->nCursor ){
sqlite3VdbeFreeCursor(p->apCsr[i]);
@ -2601,10 +2601,10 @@ case OP_Close: { /* no stack growth */
**
** See also: Found, NotFound, Distinct, MoveGt, MoveGe, MoveLt
*/
case OP_MoveLt: /* no stack growth */
case OP_MoveLe: /* no stack growth */
case OP_MoveGe: /* no stack growth */
case OP_MoveGt: { /* no stack growth */
case OP_MoveLt: /* no-push */
case OP_MoveLe: /* no-push */
case OP_MoveGe: /* no-push */
case OP_MoveGt: { /* no-push */
int i = pOp->p1;
Cursor *pC;
@ -2713,9 +2713,9 @@ case OP_MoveGt: { /* no stack growth */
**
** See also: Distinct, Found, MoveTo, NotExists, IsUnique
*/
case OP_Distinct: /* no stack growth */
case OP_NotFound: /* no stack growth */
case OP_Found: { /* no stack growth */
case OP_Distinct: /* no-push */
case OP_NotFound: /* no-push */
case OP_Found: { /* no-push */
int i = pOp->p1;
int alreadyExists = 0;
Cursor *pC;
@ -2764,7 +2764,7 @@ case OP_Found: { /* no stack growth */
**
** See also: Distinct, NotFound, NotExists, Found
*/
case OP_IsUnique: { /* no stack growth */
case OP_IsUnique: { /* no-push */
int i = pOp->p1;
Mem *pNos = &pTos[-1];
Cursor *pCx;
@ -2858,7 +2858,7 @@ case OP_IsUnique: { /* no stack growth */
**
** See also: Distinct, Found, MoveTo, NotFound, IsUnique
*/
case OP_NotExists: { /* no stack growth */
case OP_NotExists: { /* no-push */
int i = pOp->p1;
Cursor *pC;
BtCursor *pCrsr;
@ -3061,8 +3061,8 @@ case OP_NewRecno: {
**
** P1 may not be a pseudo-table opened using the OpenPseudo opcode.
*/
case OP_PutIntKey: /* no stack growth */
case OP_PutStrKey: { /* no stack growth */
case OP_PutIntKey: /* no-push */
case OP_PutStrKey: { /* no-push */
Mem *pNos = &pTos[-1];
int i = pOp->p1;
Cursor *pC;
@ -3156,7 +3156,7 @@ case OP_PutStrKey: { /* no stack growth */
**
** If P1 is a pseudo-table, then this instruction is a no-op.
*/
case OP_Delete: { /* no stack growth */
case OP_Delete: { /* no-push */
int i = pOp->p1;
Cursor *pC;
assert( i>=0 && i<p->nCursor );
@ -3180,7 +3180,7 @@ case OP_Delete: { /* no stack growth */
** change counter (returned by subsequent calls to sqlite3_changes())
** before it is reset. This is used by trigger programs.
*/
case OP_ResetCount: { /* no stack growth */
case OP_ResetCount: { /* no-push */
if( pOp->p1 ){
sqlite3VdbeSetChanges(db, p->nChange);
}
@ -3195,7 +3195,7 @@ case OP_ResetCount: { /* no stack growth */
** data off of the key rather than the data. This is used for
** processing compound selects.
*/
case OP_KeyAsData: { /* no stack growth */
case OP_KeyAsData: { /* no-push */
int i = pOp->p1;
Cursor *pC;
assert( i>=0 && i<p->nCursor );
@ -3371,7 +3371,7 @@ case OP_FullKey: {
** that occur while the cursor is on the null row will always push
** a NULL onto the stack.
*/
case OP_NullRow: { /* no stack growth */
case OP_NullRow: { /* no-push */
int i = pOp->p1;
Cursor *pC;
@ -3391,7 +3391,7 @@ case OP_NullRow: { /* no stack growth */
** If P2 is 0 or if the table or index is not empty, fall through
** to the following instruction.
*/
case OP_Last: { /* no stack growth */
case OP_Last: { /* no-push */
int i = pOp->p1;
Cursor *pC;
BtCursor *pCrsr;
@ -3422,7 +3422,7 @@ case OP_Last: { /* no stack growth */
** If P2 is 0 or if the table or index is not empty, fall through
** to the following instruction.
*/
case OP_Rewind: { /* no stack growth */
case OP_Rewind: { /* no-push */
int i = pOp->p1;
Cursor *pC;
BtCursor *pCrsr;
@ -3462,8 +3462,8 @@ case OP_Rewind: { /* no stack growth */
** to the following instruction. But if the cursor backup was successful,
** jump immediately to P2.
*/
case OP_Prev: /* no stack growth */
case OP_Next: { /* no stack growth */
case OP_Prev: /* no-push */
case OP_Next: { /* no-push */
Cursor *pC;
BtCursor *pCrsr;
@ -3504,7 +3504,7 @@ case OP_Next: { /* no stack growth */
** is rolled back. If P3 is not null, then it becomes part of the
** error message returned with the SQLITE_CONSTRAINT.
*/
case OP_IdxPut: { /* no stack growth */
case OP_IdxPut: { /* no-push */
int i = pOp->p1;
Cursor *pC;
BtCursor *pCrsr;
@ -3556,7 +3556,7 @@ case OP_IdxPut: { /* no stack growth */
** The top of the stack is an index key built using the MakeIdxKey opcode.
** This opcode removes that entry from the index.
*/
case OP_IdxDelete: { /* no stack growth */
case OP_IdxDelete: { /* no-push */
int i = pOp->p1;
Cursor *pC;
BtCursor *pCrsr;
@ -3658,9 +3658,9 @@ case OP_IdxRecno: {
** an epsilon prior to the comparison. This makes the opcode work
** like IdxLE.
*/
case OP_IdxLT: /* no stack growth */
case OP_IdxGT: /* no stack growth */
case OP_IdxGE: { /* no stack growth */
case OP_IdxLT: /* no-push */
case OP_IdxGT: /* no-push */
case OP_IdxGE: { /* no-push */
int i= pOp->p1;
BtCursor *pCrsr;
Cursor *pC;
@ -3704,7 +3704,7 @@ case OP_IdxGE: { /* no stack growth */
**
** The index entry is always popped from the stack.
*/
case OP_IdxIsNull: { /* no stack growth */
case OP_IdxIsNull: { /* no-push */
int i = pOp->p1;
int k, n;
const char *z;
@ -3778,7 +3778,7 @@ case OP_Destroy: {
**
** See also: Destroy
*/
case OP_Clear: { /* no stack growth */
case OP_Clear: { /* no-push */
rc = sqlite3BtreeClearTable(db->aDb[pOp->p2].pBt, pOp->p1);
break;
}
@ -3836,7 +3836,7 @@ case OP_CreateTable: {
** This opcode invokes the parser to create a new virtual machine,
** then runs the new virtual machine. It is thus a reentrant opcode.
*/
case OP_ParseSchema: { /* no stack growth */
case OP_ParseSchema: { /* no-push */
char *zSql;
int iDb = pOp->p1;
const char *zMaster;
@ -3868,7 +3868,7 @@ case OP_ParseSchema: { /* no stack growth */
** is dropped in order to keep the internal representation of the
** schema consistent with what is on disk.
*/
case OP_DropTable: { /* no stack growth */
case OP_DropTable: { /* no-push */
sqlite3UnlinkAndDeleteTable(db, pOp->p1, pOp->p3);
break;
}
@ -3880,7 +3880,7 @@ case OP_DropTable: { /* no stack growth */
** is dropped in order to keep the internal representation of the
** schema consistent with what is on disk.
*/
case OP_DropIndex: { /* no stack growth */
case OP_DropIndex: { /* no-push */
sqlite3UnlinkAndDeleteIndex(db, pOp->p1, pOp->p3);
break;
}
@ -3892,7 +3892,7 @@ case OP_DropIndex: { /* no stack growth */
** is dropped in order to keep the internal representation of the
** schema consistent with what is on disk.
*/
case OP_DropTrigger: { /* no stack growth */
case OP_DropTrigger: { /* no-push */
sqlite3UnlinkAndDeleteTrigger(db, pOp->p1, pOp->p3);
break;
}
@ -3957,7 +3957,7 @@ case OP_IntegrityCk: {
** Write the integer on the top of the stack
** into the temporary storage list.
*/
case OP_ListWrite: { /* no stack growth */
case OP_ListWrite: { /* no-push */
Keylist *pKeylist;
assert( pTos>=p->aStack );
pKeylist = p->pList;
@ -3981,7 +3981,7 @@ case OP_ListWrite: { /* no stack growth */
**
** Rewind the temporary buffer back to the beginning.
*/
case OP_ListRewind: { /* no stack growth */
case OP_ListRewind: { /* no-push */
/* What this opcode codes, really, is reverse the order of the
** linked list of Keylist structures so that they are read out
** in the same order that they were read in. */
@ -4028,7 +4028,7 @@ case OP_ListRead: {
**
** Reset the temporary storage buffer so that it holds nothing.
*/
case OP_ListReset: { /* no stack growth */
case OP_ListReset: { /* no-push */
if( p->pList ){
sqlite3VdbeKeylistFree(p->pList);
p->pList = 0;
@ -4043,7 +4043,7 @@ case OP_ListReset: { /* no stack growth */
** AggContextPop opcode.
**
*/
case OP_AggContextPush: { /* no stack growth */
case OP_AggContextPush: { /* no-push */
p->pAgg++;
assert( p->pAgg<&p->apAgg[p->nAgg] );
break;
@ -4054,7 +4054,7 @@ case OP_AggContextPush: { /* no stack growth */
** Restore the aggregator to the state it was in when AggContextPush
** was last called. Any data in the current aggregator is deleted.
*/
case OP_AggContextPop: { /* no stack growth */
case OP_AggContextPop: { /* no-push */
p->pAgg--;
assert( p->pAgg>=p->apAgg );
break;
@ -4068,7 +4068,7 @@ case OP_AggContextPop: { /* no stack growth */
** opcode. The context stores the last insert row id, the last statement change
** count, and the current statement change count.
*/
case OP_ContextPush: { /* no stack growth */
case OP_ContextPush: { /* no-push */
int i = p->contextStackTop++;
Context *pContext;
@ -4093,7 +4093,7 @@ case OP_ContextPush: { /* no stack growth */
** executed. The context stores the last insert row id, the last statement
** change count, and the current statement change count.
*/
case OP_ContextPop: { /* no stack growth */
case OP_ContextPop: { /* no-push */
Context *pContext = &p->contextStack[--p->contextStackTop];
assert( p->contextStackTop>=0 );
db->lastRowid = pContext->lastRowid;
@ -4110,7 +4110,7 @@ case OP_ContextPop: { /* no stack growth */
** and put them on the sorter. The key and data should have been
** made using the MakeRecord opcode.
*/
case OP_SortPut: { /* no stack growth */
case OP_SortPut: { /* no-push */
Mem *pNos = &pTos[-1];
Sorter *pSorter;
assert( pNos>=p->aStack );
@ -4134,7 +4134,7 @@ case OP_SortPut: { /* no stack growth */
** mergesort. The P3 argument is a pointer to a KeyInfo structure
** that describes the keys to be sorted.
*/
case OP_Sort: { /* no stack growth */
case OP_Sort: { /* no-push */
int i;
KeyInfo *pKeyInfo = (KeyInfo*)pOp->p3;
Sorter *pElem;
@ -4196,7 +4196,7 @@ case OP_SortNext: {
**
** Remove any elements that remain on the sorter.
*/
case OP_SortReset: { /* no stack growth */
case OP_SortReset: { /* no-push */
sqlite3VdbeSorterReset(p);
break;
}
@ -4211,7 +4211,7 @@ case OP_SortReset: { /* no stack growth */
** stack is popped once if P2 is 1. If P2 is zero, then
** the original data remains on the stack.
*/
case OP_MemStore: { /* no stack growth */
case OP_MemStore: { /* no-push */
assert( pTos>=p->aStack );
assert( pOp->p1>=0 && pOp->p1<p->nMem );
rc = sqlite3VdbeMemMove(&p->aMem[pOp->p1], pTos);
@ -4250,7 +4250,7 @@ case OP_MemLoad: {
** This instruction throws an error if the memory cell is not initially
** an integer.
*/
case OP_MemMax: { /* no stack growth */
case OP_MemMax: { /* no-push */
int i = pOp->p1;
Mem *pMem;
assert( pTos>=p->aStack );
@ -4274,7 +4274,7 @@ case OP_MemMax: { /* no stack growth */
** This instruction throws an error if the memory cell is not initially
** an integer.
*/
case OP_MemIncr: { /* no stack growth */
case OP_MemIncr: { /* no-push */
int i = pOp->p1;
Mem *pMem;
assert( i>=0 && i<p->nMem );
@ -4292,7 +4292,7 @@ case OP_MemIncr: { /* no stack growth */
** If the value of memory cell P1 is 1 or greater, jump to P2. This
** opcode assumes that memory cell P1 holds an integer value.
*/
case OP_IfMemPos: { /* no stack growth */
case OP_IfMemPos: { /* no-push */
int i = pOp->p1;
Mem *pMem;
assert( i>=0 && i<p->nMem );
@ -4314,7 +4314,7 @@ case OP_IfMemPos: { /* no stack growth */
** there is no GROUP BY expression). In this case it is illegal to invoke
** OP_AggFocus.
*/
case OP_AggReset: { /* no stack growth */
case OP_AggReset: { /* no-push */
assert( !pOp->p3 || pOp->p3type==P3_KEYINFO );
if( pOp->p1 ){
rc = sqlite3VdbeAggReset(0, p->pAgg, (KeyInfo *)pOp->p3);
@ -4338,7 +4338,7 @@ case OP_AggReset: { /* no stack growth */
** The aggregate will operate out of aggregate column P2.
** P3 is a pointer to the FuncDef structure for the function.
*/
case OP_AggInit: { /* no stack growth */
case OP_AggInit: { /* no-push */
int i = pOp->p2;
assert( i>=0 && i<p->pAgg->nMem );
p->pAgg->apFunc[i] = (FuncDef*)pOp->p3;
@ -4356,7 +4356,7 @@ case OP_AggInit: { /* no stack growth */
** Ideally, this index would be another parameter, but there are
** no free parameters left. The integer is popped from the stack.
*/
case OP_AggFunc: { /* no stack growth */
case OP_AggFunc: { /* no-push */
int n = pOp->p2;
int i;
Mem *pMem, *pRec;
@ -4414,7 +4414,7 @@ case OP_AggFunc: { /* no stack growth */
** zero or more AggNext operations. You must not execute an AggFocus
** in between an AggNext and an AggReset.
*/
case OP_AggFocus: { /* no stack growth */
case OP_AggFocus: { /* no-push */
char *zKey;
int nKey;
int res;
@ -4448,7 +4448,7 @@ case OP_AggFocus: { /* no stack growth */
** Move the top of the stack into the P2-th field of the current
** aggregate. String values are duplicated into new memory.
*/
case OP_AggSet: { /* no stack growth */
case OP_AggSet: { /* no-push */
AggElem *pFocus;
int i = pOp->p2;
pFocus = p->pAgg->pCurrent;
@ -4513,7 +4513,7 @@ case OP_AggGet: {
** zero or more AggNext operations. You must not execute an AggFocus
** in between an AggNext and an AggReset.
*/
case OP_AggNext: { /* no stack growth */
case OP_AggNext: { /* no-push */
int res;
assert( rc==SQLITE_OK );
CHECK_FOR_INTERRUPT;
@ -4574,7 +4574,7 @@ case OP_AggNext: { /* no stack growth */
** machines to be created and run. It may not be called from within
** a transaction.
*/
case OP_Vacuum: { /* no stack growth */
case OP_Vacuum: { /* no-push */
if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
rc = sqlite3RunVacuum(&p->zErrMsg, db);
if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
@ -4590,7 +4590,7 @@ case OP_Vacuum: { /* no stack growth */
** If P1 is 0, then all SQL statements become expired. If P1 is non-zero,
** then only the currently executing statement is affected.
*/
case OP_Expire: { /* no stack growth */
case OP_Expire: { /* no-push */
if( !pOp->p1 ){
sqlite3ExpirePreparedStatements(db);
}else{

View File

@ -406,7 +406,7 @@ int sqlite3VdbeMemFromBtree(BtCursor*,int,int,int,Mem*);
void sqlite3VdbeMemRelease(Mem *p);
#ifndef NDEBUG
void sqlite3VdbeMemSanity(Mem*, u8);
int sqlite3VdbeOpcodeUsesStack(u8);
int sqlite3VdbeOpcodeNoPush(u8);
#endif
int sqlite3VdbeMemTranslate(Mem*, u8);
void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf, int nBuf);

View File

@ -170,11 +170,11 @@ void sqlite3VdbeResolveLabel(Vdbe *p, int x){
** Return non-zero if opcode 'op' is guarenteed not to push more values
** onto the VDBE stack than it pops off.
*/
static int opcodeUsesStack(u8 op){
/* The 10 STACK_MASK_n constants are defined in the automatically
static int opcodeNoPush(u8 op){
/* The 10 NOPUSH_MASK_n constants are defined in the automatically
** generated header file opcodes.h. Each is a 16-bit bitmask, one
** bit corresponding to each opcode implemented by the virtual
** machine in vdbe.c. The bit is true if the word "stack" appears
** machine in vdbe.c. The bit is true if the word "no-push" appears
** in a comment on the same line as the "case OP_XXX:" in
** sqlite3VdbeExec() in vdbe.c.
**
@ -182,7 +182,7 @@ static int opcodeUsesStack(u8 op){
** to grow the stack when it is executed. Otherwise, it may grow the
** stack by at most one entry.
**
** STACK_MASK_0 corresponds to opcodes 0 to 15. STACK_MASK_1 contains
** NOPUSH_MASK_0 corresponds to opcodes 0 to 15. NOPUSH_MASK_1 contains
** one bit for opcodes 16 to 31, and so on.
**
** 16-bit bitmasks (rather than 32-bit) are specified in opcodes.h
@ -192,18 +192,18 @@ static int opcodeUsesStack(u8 op){
** IEEE floats.
*/
static u32 masks[5] = {
STACK_MASK_0 + (STACK_MASK_1<<16),
STACK_MASK_2 + (STACK_MASK_3<<16),
STACK_MASK_4 + (STACK_MASK_5<<16),
STACK_MASK_6 + (STACK_MASK_7<<16),
STACK_MASK_8 + (STACK_MASK_9<<16)
NOPUSH_MASK_0 + (NOPUSH_MASK_1<<16),
NOPUSH_MASK_2 + (NOPUSH_MASK_3<<16),
NOPUSH_MASK_4 + (NOPUSH_MASK_5<<16),
NOPUSH_MASK_6 + (NOPUSH_MASK_7<<16),
NOPUSH_MASK_8 + (NOPUSH_MASK_9<<16)
};
return (masks[op>>5] & (1<<(op&0x1F)));
}
#ifndef NDEBUG
int sqlite3VdbeOpcodeUsesStack(u8 op){
return opcodeUsesStack(op);
int sqlite3VdbeOpcodeNoPush(u8 op){
return opcodeNoPush(op);
}
#endif
@ -239,7 +239,7 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs, int *pMaxStack){
if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
}
if( opcodeUsesStack(opcode) ){
if( opcodeNoPush(opcode) ){
nMaxStack--;
}