/ Check-in [00b17798]
Login

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

Overview
Comment:Modify the sqlite3VdbeUnpackRecord() interface to force the temporary space to be 8-byte aligned. This might be important for Sparc. Ticket #3318. (CVS 5573)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 00b177985ee08f13a7781d095936da3beaf0408c
User & Date: drh 2008-08-20 22:06:48
Context
2008-08-21
04:35
Remove leftover PGHDR_TO_DATA macro from pager.c. Ticket #3323. (CVS 5574) check-in: 5e9559c0 user: danielk1977 tags: trunk
2008-08-20
22:06
Modify the sqlite3VdbeUnpackRecord() interface to force the temporary space to be 8-byte aligned. This might be important for Sparc. Ticket #3318. (CVS 5573) check-in: 00b17798 user: drh tags: trunk
21:47
Comment and function naming tweaks to pcache. No functionality changes. (CVS 5572) check-in: 4b0e67d3 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12         -** $Id: btree.c,v 1.498 2008/08/20 14:49:24 danielk1977 Exp $
           12  +** $Id: btree.c,v 1.499 2008/08/20 22:06:48 drh Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** See the header comment on "btreeInt.h" for additional information.
    16     16   ** Including a description of file format and an overview of operation.
    17     17   */
    18     18   #include "btreeInt.h"
    19     19   
................................................................................
  3827   3827     const void *pKey,   /* Packed key if the btree is an index */
  3828   3828     i64 nKey,           /* Integer key for tables.  Size of pKey for indices */
  3829   3829     int bias,           /* Bias search to the high end */
  3830   3830     int *pRes           /* Write search results here */
  3831   3831   ){
  3832   3832     int rc;                    /* Status code */
  3833   3833     UnpackedRecord *pIdxKey;   /* Unpacked index key */
  3834         -  char aSpace[200];          /* Temp space for pIdxKey - to avoid a malloc */
         3834  +  UnpackedRecord aSpace[16]; /* Temp space for pIdxKey - to avoid a malloc */
  3835   3835   
  3836   3836     if( pKey ){
  3837   3837       pIdxKey = sqlite3VdbeRecordUnpack(pCur->pKeyInfo, nKey, pKey,
  3838         -                                   aSpace, sizeof(aSpace));
         3838  +                                      aSpace, sizeof(aSpace));
  3839   3839       if( pIdxKey==0 ) return SQLITE_NOMEM;
  3840   3840     }else{
  3841   3841       pIdxKey = 0;
  3842   3842     }
  3843   3843     rc = sqlite3BtreeMovetoUnpacked(pCur, pIdxKey, nKey, bias, pRes);
  3844   3844     if( pKey ){
  3845   3845       sqlite3VdbeDeleteUnpackedRecord(pIdxKey);

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.775 2008/08/13 19:11:48 drh Exp $
           46  +** $Id: vdbe.c,v 1.776 2008/08/20 22:06:48 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include <ctype.h>
    50     50   #include "vdbeInt.h"
    51     51   
    52     52   /*
    53     53   ** The following global variable is incremented every time a cursor
................................................................................
   551    551   #ifdef VDBE_PROFILE
   552    552     u64 start;                 /* CPU clock count at start of opcode */
   553    553     int origPc;                /* Program counter at start of opcode */
   554    554   #endif
   555    555   #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
   556    556     int nProgressOps = 0;      /* Opcodes executed since progress callback. */
   557    557   #endif
   558         -  char zTempSpace[200];      /* Space to hold a transient UnpackedRecord */
          558  +  UnpackedRecord aTempRec[16]; /* Space to hold a transient UnpackedRecord */
   559    559   
   560    560   
   561    561     assert( p->magic==VDBE_MAGIC_RUN );  /* sqlite3_step() verifies this */
   562    562     assert( db->magic==SQLITE_MAGIC_BUSY );
   563    563     sqlite3BtreeMutexArrayEnter(&p->aMutex);
   564    564     if( p->rc==SQLITE_NOMEM ){
   565    565       /* This happens if a malloc() inside a call to sqlite3_column_text() or
................................................................................
  3054   3054     if( (pC = p->apCsr[i])->pCursor!=0 ){
  3055   3055       int res;
  3056   3056       UnpackedRecord *pIdxKey;
  3057   3057   
  3058   3058       assert( pC->isTable==0 );
  3059   3059       assert( pIn3->flags & MEM_Blob );
  3060   3060       pIdxKey = sqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z,
  3061         -                                      zTempSpace, sizeof(zTempSpace));
         3061  +                                      aTempRec, sizeof(aTempRec));
  3062   3062       if( pIdxKey==0 ){
  3063   3063         goto no_mem;
  3064   3064       }
  3065   3065       if( pOp->opcode==OP_Found ){
  3066   3066         pIdxKey->flags |= UNPACKED_PREFIX_MATCH;
  3067   3067       }
  3068   3068       rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, pIdxKey, 0, 0, &res);
................................................................................
  3125   3125       i64 v;                     /* The record number that matches K */
  3126   3126       UnpackedRecord *pIdxKey;   /* Unpacked version of P4 */
  3127   3127   
  3128   3128       /* Make sure K is a string and make zKey point to K
  3129   3129       */
  3130   3130       assert( pK->flags & MEM_Blob );
  3131   3131       pIdxKey = sqlite3VdbeRecordUnpack(pCx->pKeyInfo, pK->n, pK->z,
  3132         -                                      zTempSpace, sizeof(zTempSpace));
         3132  +                                      aTempRec, sizeof(aTempRec));
  3133   3133       if( pIdxKey==0 ){
  3134   3134         goto no_mem;
  3135   3135       }
  3136   3136       pIdxKey->flags |= UNPACKED_IGNORE_ROWID;
  3137   3137   
  3138   3138       /* Search for an entry in P1 where all but the last rowid match K
  3139   3139       ** If there is no such entry, jump immediately to P2.

Changes to src/vdbe.h.

    11     11   *************************************************************************
    12     12   ** Header file for the Virtual DataBase Engine (VDBE)
    13     13   **
    14     14   ** This header defines the interface to the virtual database engine
    15     15   ** or VDBE.  The VDBE implements an abstract machine that runs a
    16     16   ** simple program to access and modify the underlying database.
    17     17   **
    18         -** $Id: vdbe.h,v 1.137 2008/08/13 19:11:48 drh Exp $
           18  +** $Id: vdbe.h,v 1.138 2008/08/20 22:06:48 drh Exp $
    19     19   */
    20     20   #ifndef _SQLITE_VDBE_H_
    21     21   #define _SQLITE_VDBE_H_
    22     22   #include <stdio.h>
    23     23   
    24     24   /*
    25     25   ** A single VDBE is an opaque structure named "Vdbe".  Only routines
................................................................................
   183    183   sqlite3 *sqlite3VdbeDb(Vdbe*);
   184    184   void sqlite3VdbeSetSql(Vdbe*, const char *z, int n);
   185    185   void sqlite3VdbeSwap(Vdbe*,Vdbe*);
   186    186   
   187    187   #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
   188    188   int sqlite3VdbeReleaseMemory(int);
   189    189   #endif
   190         -UnpackedRecord *sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,void*,int);
          190  +UnpackedRecord *sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,
          191  +                                        UnpackedRecord*,int);
   191    192   void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord*);
   192    193   int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*);
   193    194   
   194    195   
   195    196   #ifndef NDEBUG
   196    197     void sqlite3VdbeComment(Vdbe*, const char*, ...);
   197    198   # define VdbeComment(X)  sqlite3VdbeComment X

Changes to src/vdbeaux.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used for creating, destroying, and populating
    13     13   ** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.)  Prior
    14     14   ** to version 2.8.7, all this code was combined into the vdbe.c source file.
    15     15   ** But that file was getting too big so this subroutines were split out.
    16     16   **
    17         -** $Id: vdbeaux.c,v 1.408 2008/08/20 16:35:10 drh Exp $
           17  +** $Id: vdbeaux.c,v 1.409 2008/08/20 22:06:48 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <ctype.h>
    21     21   #include "vdbeInt.h"
    22     22   
    23     23   
    24     24   
................................................................................
  2194   2194   ** The returned structure should be closed by a call to
  2195   2195   ** sqlite3VdbeDeleteUnpackedRecord().
  2196   2196   */ 
  2197   2197   UnpackedRecord *sqlite3VdbeRecordUnpack(
  2198   2198     KeyInfo *pKeyInfo,     /* Information about the record format */
  2199   2199     int nKey,              /* Size of the binary record */
  2200   2200     const void *pKey,      /* The binary record */
  2201         -  void *pSpace,          /* Space available to hold resulting object */
         2201  +  UnpackedRecord *pSpace,/* Space available to hold resulting object */
  2202   2202     int szSpace            /* Size of pSpace[] in bytes */
  2203   2203   ){
  2204   2204     const unsigned char *aKey = (const unsigned char *)pKey;
  2205   2205     UnpackedRecord *p;
  2206   2206     int nByte;
  2207   2207     int idx, d;
  2208   2208     u16 u;                 /* Unsigned loop counter */