Reduce the size of VdbeCursor again, this time without a performance hit.

FossilOrigin-Name: 933939932c44bccb0958f203a5bd24e683c1cf38
diff --git a/manifest b/manifest
index b28f74b..667c92d 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Unpack\ssome\sfields,\sadding\ssome\sspace\sback\sto\sthe\sVdbeCursor\sobject,\nin\sorder\sto\shelp\sthe\scode\sto\srun\sa\slittle\sfaster.
-D 2013-11-21T00:10:35.929
+C Reduce\sthe\ssize\sof\sVdbeCursor\sagain,\sthis\stime\swithout\sa\sperformance\shit.
+D 2013-11-21T01:04:02.826
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 8a07bebafbfda0eb67728f4bd15a36201662d1a1
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -280,11 +280,11 @@
 F src/utf.c 6fc6c88d50448c469c5c196acf21617a24f90269
 F src/util.c 2fa6c821d28bbdbeec1b2a7b091a281c9ef8f918
 F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179
-F src/vdbe.c fb6007ac59ebebf398ce1709f9cef367bfd15dce
+F src/vdbe.c c375ba0385f747e58d98686f5f4f0439c6297b35
 F src/vdbe.h c06f0813f853566457ce9cfb1a4a4bc39a5da644
-F src/vdbeInt.h 7cb3c641d42154ea0c66055ca77557005ff4535d
+F src/vdbeInt.h 0ac03c790b8ea4568b747550ba9bbf92a8e8feb2
 F src/vdbeapi.c 93a22a9ba2abe292d5c2cf304d7eb2e894dde0ed
-F src/vdbeaux.c c592609996435944837b8906fbbcfcfac0714c90
+F src/vdbeaux.c bbf06ccbb159611d55e32783c6e9fdec75b120d0
 F src/vdbeblob.c 8cd05a5630e6d5563ad017bf82edaf812b28acde
 F src/vdbemem.c cc529bbf4f13e4e181bdb446bf6e6962ab030b4b
 F src/vdbesort.c 9d83601f9d6243fe70dd0169a2820c5ddfd48147
@@ -1140,7 +1140,7 @@
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 5f9d50688508affd0bc8e4d52e21dacfacdbb5ce
-R 11a6306351cf31959d33e284a4627112
+P f8d5efcd7b92492b833b6cd1cb6bec006c6a0809
+R 842b8e02c5c12ba51889f25ba6cef74b
 U drh
-Z 5afd15b6c955a3c65a923acb8d5d260f
+Z a21060677c94bf6a3d8120f6bac96f14
diff --git a/manifest.uuid b/manifest.uuid
index b0ba0a8..8232c53 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-f8d5efcd7b92492b833b6cd1cb6bec006c6a0809
\ No newline at end of file
+933939932c44bccb0958f203a5bd24e683c1cf38
\ No newline at end of file
diff --git a/src/vdbe.c b/src/vdbe.c
index d50a23f..e234ea4 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -212,9 +212,8 @@
   int nByte;
   VdbeCursor *pCx = 0;
   nByte = 
-      ROUND8(sizeof(VdbeCursor)) + 
-      (isBtreeCursor?sqlite3BtreeCursorSize():0) + 
-      (2*nField+2)*sizeof(u32);
+      ROUND8(sizeof(VdbeCursor)) + 2*sizeof(u32)*nField + 
+      (isBtreeCursor?sqlite3BtreeCursorSize():0);
 
   assert( iCur<p->nCursor );
   if( p->apCsr[iCur] ){
@@ -226,12 +225,9 @@
     memset(pCx, 0, sizeof(VdbeCursor));
     pCx->iDb = iDb;
     pCx->nField = nField;
-    if( nField ){
-      pCx->aType = (u32 *)&pMem->z[ROUND8(sizeof(VdbeCursor))];
-    }
     if( isBtreeCursor ){
       pCx->pCursor = (BtCursor*)
-          &pMem->z[ROUND8(sizeof(VdbeCursor))+(2*nField+2)*sizeof(u32)];
+          &pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField];
       sqlite3BtreeCursorZero(pCx->pCursor);
     }
   }
@@ -5807,7 +5803,6 @@
     pCur = allocateCursor(p, pOp->p1, 0, -1, 0);
     if( pCur ){
       pCur->pVtabCursor = pVtabCursor;
-      pCur->pModule = pVtabCursor->pVtab->pModule;
     }else{
       db->mallocFailed = 1;
       pModule->xClose(pVtabCursor);
diff --git a/src/vdbeInt.h b/src/vdbeInt.h
index b1b7f2e..adcb13d 100644
--- a/src/vdbeInt.h
+++ b/src/vdbeInt.h
@@ -53,6 +53,9 @@
 ** loop over all entries of the Btree.  You can also insert new BTree
 ** entries or retrieve the key or data from the entry that the cursor
 ** is currently pointing to.
+**
+** Cursors can also point to virtual tables, sorters, or "pseudo-tables".
+** A pseudo-table is a single-row table implemented by registers.
 ** 
 ** Every cursor that the virtual machine has open is represented by an
 ** instance of the following structure.
@@ -74,7 +77,6 @@
   Bool isOrdered:1;     /* True if the underlying table is BTREE_UNORDERED */
   Bool multiPseudo:1;   /* Multi-register pseudo-cursor */
   sqlite3_vtab_cursor *pVtabCursor;  /* The cursor for a virtual table */
-  const sqlite3_module *pModule;     /* Module for cursor pVtabCursor */
   i64 seqCount;         /* Sequence counter */
   i64 movetoTarget;     /* Argument to the deferred sqlite3BtreeMoveto() */
   i64 lastRowid;        /* Rowid being deleted by OP_Delete */
@@ -93,8 +95,11 @@
   u32 payloadSize;      /* Total number of bytes in the record */
   u32 szRow;            /* Byte available in aRow */
   u32 iHdrOffset;       /* Offset to next unparsed byte of the header */
-  u32 *aType;           /* Type values for all entries in the record */
   const u8 *aRow;       /* Data for the current row, if all on one page */
+  u32 aType[1];         /* Type values for all entries in the record */
+  /* 2*nField extra array elements allocated for aType[], beyond the one
+  ** static element declared in the structure.  nField total array slots for
+  ** aType[] and nField+1 array slots for aOffset[] */
 };
 typedef struct VdbeCursor VdbeCursor;
 
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index 2e3cdfb..0c74f51 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -1674,7 +1674,7 @@
 #ifndef SQLITE_OMIT_VIRTUALTABLE
   if( pCx->pVtabCursor ){
     sqlite3_vtab_cursor *pVtabCursor = pCx->pVtabCursor;
-    const sqlite3_module *pModule = pCx->pModule;
+    const sqlite3_module *pModule = pVtabCursor->pVtab->pModule;
     p->inVtabMethod = 1;
     pModule->xClose(pVtabCursor);
     p->inVtabMethod = 0;