Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | In the VDBE, allocate space to hold column names when the VDBE first starts. The ColumnCount opcode now just writes the null terminator into this space. (CVS 818) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
46d8f5e377bf790c18a7acdd1f3bc20b |
User & Date: | drh 2003-01-07 13:55:23.000 |
Context
2003-01-07
| ||
14:46 | Avoid calling truncate() and stat() on the checkpoint journal to improve the speed of a large number of UPDATEs within a transaction. (CVS 819) (check-in: 2f89e9e696 user: drh tags: trunk) | |
13:55 | In the VDBE, allocate space to hold column names when the VDBE first starts. The ColumnCount opcode now just writes the null terminator into this space. (CVS 818) (check-in: 46d8f5e377 user: drh tags: trunk) | |
13:43 | When constructing records and index keys, use static string space rather than mallocing (when possible) for a small speed improvement. (CVS 817) (check-in: 657c9fb513 user: drh tags: trunk) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
32 33 34 35 36 37 38 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** 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.194 2003/01/07 13:55:23 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> /* ** The makefile scans this source file and creates the following ** array of string constants which are the names of all VDBE opcodes. |
︙ | ︙ | |||
243 244 245 246 247 248 249 | int nOp; /* Number of instructions in the program */ int nOpAlloc; /* Number of slots allocated for aOp[] */ Op *aOp; /* Space to hold the virtual machine's program */ int nLabel; /* Number of labels used */ int nLabelAlloc; /* Number of slots allocated in aLabel[] */ int *aLabel; /* Space to hold the labels */ int tos; /* Index of top of stack */ | < | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | int nOp; /* Number of instructions in the program */ int nOpAlloc; /* Number of slots allocated for aOp[] */ Op *aOp; /* Space to hold the virtual machine's program */ int nLabel; /* Number of labels used */ int nLabelAlloc; /* Number of slots allocated in aLabel[] */ int *aLabel; /* Space to hold the labels */ int tos; /* Index of top of stack */ Stack *aStack; /* The operand stack, except string values */ char **zStack; /* Text or binary values of the stack */ char **azColName; /* Becomes the 4th parameter to callbacks */ int nCursor; /* Number of slots in aCsr[] */ Cursor *aCsr; /* One element of this array for each open cursor */ Keylist *pList; /* A list of ROWIDs */ Sorter *pSort; /* A linked list of objects to be sorted */ |
︙ | ︙ | |||
1030 1031 1032 1033 1034 1035 1036 | ** ** This routine will automatically close any cursors, lists, and/or ** sorters that were left open. */ static void Cleanup(Vdbe *p){ int i; PopStack(p, p->tos+1); | < < | 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 | ** ** This routine will automatically close any cursors, lists, and/or ** sorters that were left open. */ static void Cleanup(Vdbe *p){ int i; PopStack(p, p->tos+1); closeAllCursors(p); if( p->aMem ){ for(i=0; i<p->nMem; i++){ if( p->aMem[i].s.flags & STK_Dyn ){ sqliteFree(p->aMem[i].z); } } |
︙ | ︙ | |||
1101 1102 1103 1104 1105 1106 1107 | if( p->aOp[i].p3type==P3_DYNAMIC ){ sqliteFree(p->aOp[i].p3); } } sqliteFree(p->aOp); sqliteFree(p->aLabel); sqliteFree(p->aStack); | < | 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 | if( p->aOp[i].p3type==P3_DYNAMIC ){ sqliteFree(p->aOp[i].p3); } } sqliteFree(p->aOp); sqliteFree(p->aLabel); sqliteFree(p->aStack); sqliteFree(p); } /* ** Give a listing of the program in the virtual machine. ** ** The interface is the same as sqliteVdbeExec(). But instead of |
︙ | ︙ | |||
1406 1407 1408 1409 1410 1411 1412 | ** stack. And the stack never grows on successive executions of the ** same loop. So the total number of instructions is an upper bound ** on the maximum stack depth required. ** ** Allocation all the stack space we will ever need. */ sqliteVdbeAddOp(p, OP_Halt, 0, 0); | | | > > | 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 | ** stack. And the stack never grows on successive executions of the ** same loop. So the total number of instructions is an upper bound ** on the maximum stack depth required. ** ** Allocation all the stack space we will ever need. */ sqliteVdbeAddOp(p, OP_Halt, 0, 0); aStack = sqliteMalloc( p->nOp*(sizeof(aStack[0]) + 2*sizeof(char*)) ); p->aStack = aStack; zStack = p->zStack = (char**)&aStack[p->nOp]; p->azColName = (char**)&zStack[p->nOp]; p->tos = -1; #ifdef VDBE_PROFILE { int i; for(i=0; i<p->nOp; i++){ p->aOp[i].cnt = 0; p->aOp[i].cycles = 0; |
︙ | ︙ | |||
1717 1718 1719 1720 1721 1722 1723 | p->tos--; break; } /* Opcode: ColumnCount P1 * * ** ** Specify the number of column values that will appear in the | | < < < < < < < | 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 | p->tos--; break; } /* Opcode: ColumnCount P1 * * ** ** Specify the number of column values that will appear in the ** array passed as the 4th parameter to the callback. */ case OP_ColumnCount: { p->azColName[pOp->p1] = 0; p->nCallback = 0; break; } /* Opcode: ColumnName P1 * P3 ** ** P3 becomes the P1-th column name (first is 0). An array of pointers ** to all column names is passed as the 4th parameter to the callback. */ case OP_ColumnName: { p->azColName[pOp->p1] = pOp->p3; p->nCallback = 0; break; } |
︙ | ︙ |