From 6b017cc6d49512fd8b132c5f88df094f39be5320 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 14 Jun 2010 18:01:46 +0000 Subject: [PATCH] Move the xShmMap method to in between xShmLock and xShmBarrier, since it seems to fit in there logically. FossilOrigin-Name: 58dfd83d8b7905391e2a06bb918ffa209c6de6b5 --- manifest | 32 ++++++++++++++++---------------- manifest.uuid | 2 +- src/os_unix.c | 6 +++--- src/os_win.c | 8 +++----- src/sqlite.h.in | 2 +- src/test6.c | 4 ++-- src/test_devsym.c | 22 +++++++++++----------- src/test_onefile.c | 4 ++-- src/test_osinst.c | 38 +++++++++++++++++++------------------- src/test_vfs.c | 30 ++++++++++++++---------------- 10 files changed, 72 insertions(+), 76 deletions(-) diff --git a/manifest b/manifest index 95e8cf0a0c..871839e12d 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Merge\sthe\sexperimental\sshared-memory\smmap-by-chunk\schanges\sinto\sthe\strunk. -D 2010-06-14T17:09:53 +C Move\sthe\sxShmMap\smethod\sto\sin\sbetween\sxShmLock\sand\sxShmBarrier,\ssince\sit\sseems\nto\sfit\sin\sthere\slogically. +D 2010-06-14T18:01:47 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -157,8 +157,8 @@ F src/os.c 9c4a2f82a50306a33907678ec0187b6ad1486bfe F src/os.h d7775504a51e6e0d40315aa427b3e229ff9ff9ca F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19 -F src/os_unix.c 710418915cc3b59e596ee7ae916deca5dc740ca7 -F src/os_win.c 3d761e33687cb24645fe66e5efd11244390e8e9c +F src/os_unix.c 22bb2a8c1f3bbf65d91505a5f047014258d63c60 +F src/os_win.c dfde7d33c446e89dd9a277c036f2c4cc564b3138 F src/pager.c 2964185d4356d0dc159b8340e52d2538d32394e5 F src/pager.h ca1f23c0cf137ac26f8908df2427c8b308361efd F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e @@ -173,7 +173,7 @@ F src/resolve.c ac5f1a713cd1ae77f08b83cc69581e11bf5ae6f9 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/select.c c03d8a0565febcde8c6a12c5d77d065fddae889b F src/shell.c fd4ccdb37c3b68de0623eb938a649e0990710714 -F src/sqlite.h.in 6e8e9454f6ada979405543b19e0c18ca16fd020e +F src/sqlite.h.in 2c084e205661f04b8e5a0367c87d9877e8aea268 F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89 F src/sqliteInt.h 242987ebd2366ea36650a09cdab04a9163c62109 F src/sqliteLimit.h 196e2f83c3b444c4548fc1874f52f84fdbda40f3 @@ -185,7 +185,7 @@ F src/test2.c e3f564ab1e9fd0b47b0c9e23e7054e38bf0836cf F src/test3.c 4c21700c73a890a47fc685c1097bfb661346ac94 F src/test4.c ad03bb987ddedce928f4258c1e7fa4109a73497d F src/test5.c cc55900118fa4add8ec9cf69fc4225a4662f76b1 -F src/test6.c 43d6ce22d77b22f8c580be40990be6fa204d7f4d +F src/test6.c 44e0a99e8bb43c924ff6cdfb1f6e6de10450b7fe F src/test7.c 3f2d63e4ccf97f8c2cf1a7fa0a3c8e2e2a354e6e F src/test8.c f959db9a22d882013b64c92753fa793b2ce3bdea F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60 @@ -195,7 +195,7 @@ F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2 F src/test_config.c 6210f501d358bde619ae761f06f123529c6ba24f F src/test_demovfs.c da81a5f7785bb352bda7911c332a983ec4f17f27 -F src/test_devsym.c b2c821471efb0f3680de0c60fbe1ac673517ddd6 +F src/test_devsym.c 41e6b76f74f292cbb581020dc70b72e7c2813d68 F src/test_func.c 13b582345fb1185a93e46c53310fae8547dcce20 F src/test_hexio.c 1237f000ec7a491009b1233f5c626ea71bce1ea2 F src/test_init.c 5d624ffd0409d424cf9adbfe1f056b200270077c @@ -205,14 +205,14 @@ F src/test_journal.c 044c1a53ec4dd6f0dde66727b154cd099f5f34d1 F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e F src/test_malloc.c 2842c922b8e8d992aba722214952204ca025b411 F src/test_mutex.c ce06b59aca168cd8c520b77159a24352a7469bd3 -F src/test_onefile.c 4ce8c753c0240f010f0f2af89604875967d20945 -F src/test_osinst.c 0d3d47cf3a8a0b4db9a5d0255b9d74c671ca19b4 +F src/test_onefile.c fb979cecd57217fd49023ed5468d8c93429c4fbe +F src/test_osinst.c f1e4194860aa7e2f2ed7375c6b1f23a4290dd98c F src/test_pcache.c 7bf828972ac0d2403f5cfa4cd14da41f8ebe73d8 F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0 F src/test_server.c bbba05c144b5fc4b52ff650a4328027b3fa5fcc6 F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa F src/test_thread.c aa9919c885a1fe53eafc73492f0898ee6c0a0726 -F src/test_vfs.c 8e125e01b4f88c6a2e131d5a65d15f5c96d665f1 +F src/test_vfs.c db0f5c7c814bde2c6d5df39c900a45929f2f6635 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/tokenize.c 25ceb0f0a746ea1d0f9553787f3f0a56853cfaeb F src/trigger.c 8927588cb9e6d47f933b53bfe74200fbb504100d @@ -823,14 +823,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 95cc3f6fdec5494560c3cd4439d06870d1c62506 13e7a8242206bca4b5bf356ef074e66474d39609 -R 25e35232d2e784a0633c25f463199a04 +P f295e7ed5f04f6b8bffdaff8b565be3836ce4e80 +R 35a4e87593b0bc9655f2a4469c646d85 U drh -Z 04fdb9faf7b89a9cf801831e630d8cdf +Z 756186848e2cf008caf07f5485ff8d21 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFMFmJkoxKgR168RlERAk/eAJ9VllwzElSwe9gXOW0UoIt+bcEvsgCfSESl -TnMmecbXjWkPCx7cvVOMr4o= -=hImA +iD8DBQFMFm6OoxKgR168RlERAsLQAJwKJ+ZFUqfvyXHQFBi5TZjmWwLZ0wCgjUxf +Nnihq1LdFY/IzbBJJRSCfi8= +=JYW4 -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 1711da0160..8d71ef4dd4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f295e7ed5f04f6b8bffdaff8b565be3836ce4e80 \ No newline at end of file +58dfd83d8b7905391e2a06bb918ffa209c6de6b5 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index fcccead725..9dbd3d3aad 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3653,9 +3653,9 @@ shmpage_out: #else # define unixShmOpen 0 # define unixShmLock 0 +# define unixShmMap 0 # define unixShmBarrier 0 # define unixShmClose 0 -# define unixShmMap 0 #endif /* #ifndef SQLITE_OMIT_WAL */ /* @@ -3715,9 +3715,9 @@ static const sqlite3_io_methods METHOD = { \ unixDeviceCharacteristics, /* xDeviceCapabilities */ \ unixShmOpen, /* xShmOpen */ \ unixShmLock, /* xShmLock */ \ + unixShmMap, /* xShmMap */ \ unixShmBarrier, /* xShmBarrier */ \ - unixShmClose, /* xShmClose */ \ - unixShmMap /* xShmMap */ \ + unixShmClose /* xShmClose */ \ }; \ static const sqlite3_io_methods *FINDER##Impl(const char *z, unixFile *p){ \ UNUSED_PARAMETER(z); UNUSED_PARAMETER(p); \ diff --git a/src/os_win.c b/src/os_win.c index 3a6b47771a..ec62e394c9 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1664,9 +1664,7 @@ static void winShmBarrier( #else # define winShmOpen 0 -# define winShmSize 0 -# define winShmGet 0 -# define winShmRelease 0 +# define winShmMap 0 # define winShmLock 0 # define winShmBarrier 0 # define winShmClose 0 @@ -1695,9 +1693,9 @@ static const sqlite3_io_methods winIoMethod = { winDeviceCharacteristics, winShmOpen, /* xShmOpen */ winShmLock, /* xShmLock */ + winShmMap, /* xShmMap */ winShmBarrier, /* xShmBarrier */ - winShmClose, /* xShmClose */ - winShmMap /* xShmMap */ + winShmClose /* xShmClose */ }; /*************************************************************************** diff --git a/src/sqlite.h.in b/src/sqlite.h.in index f6ec12b988..512132626a 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -661,9 +661,9 @@ struct sqlite3_io_methods { /* Methods above are valid for version 1 */ int (*xShmOpen)(sqlite3_file*); int (*xShmLock)(sqlite3_file*, int offset, int n, int flags); + int (*xShmMap)(sqlite3_file*, int iPage, int pgsz, int, void volatile**); void (*xShmBarrier)(sqlite3_file*); int (*xShmClose)(sqlite3_file*, int deleteFlag); - int (*xShmMap)(sqlite3_file*, int iPage, int pgsz, int, void volatile**); /* Methods above are valid for version 2 */ /* Additional methods may be added in future releases */ }; diff --git a/src/test6.c b/src/test6.c index d6e6db2c18..5b5ee38b93 100644 --- a/src/test6.c +++ b/src/test6.c @@ -561,9 +561,9 @@ static const sqlite3_io_methods CrashFileVtab = { cfDeviceCharacteristics, /* xDeviceCharacteristics */ cfShmOpen, /* xShmOpen */ cfShmLock, /* xShmLock */ + cfShmMap, /* xShmMap */ cfShmBarrier, /* xShmBarrier */ - cfShmClose, /* xShmClose */ - cfShmMap /* xShmMap */ + cfShmClose /* xShmClose */ }; /* diff --git a/src/test_devsym.c b/src/test_devsym.c index 98d6e2a30e..7f4326c47d 100644 --- a/src/test_devsym.c +++ b/src/test_devsym.c @@ -52,9 +52,9 @@ static int devsymSectorSize(sqlite3_file*); static int devsymDeviceCharacteristics(sqlite3_file*); static int devsymShmOpen(sqlite3_file*); static int devsymShmLock(sqlite3_file*,int,int,int); +static int devsymShmMap(sqlite3_file*,int,int,int, void volatile **); static void devsymShmBarrier(sqlite3_file*); static int devsymShmClose(sqlite3_file*,int); -static int devsymShmMap(sqlite3_file*,int,int,int, void volatile **); /* ** Method declarations for devsym_vfs. @@ -119,9 +119,9 @@ static sqlite3_io_methods devsym_io_methods = { devsymDeviceCharacteristics, /* xDeviceCharacteristics */ devsymShmOpen, /* xShmOpen */ devsymShmLock, /* xShmLock */ + devsymShmMap, /* xShmMap */ devsymShmBarrier, /* xShmBarrier */ - devsymShmClose, /* xShmClose */ - devsymShmMap /* xShmMap */ + devsymShmClose /* xShmClose */ }; struct DevsymGlobal { @@ -246,14 +246,6 @@ static int devsymShmLock(sqlite3_file *pFile, int ofst, int n, int flags){ devsym_file *p = (devsym_file *)pFile; return sqlite3OsShmLock(p->pReal, ofst, n, flags); } -static void devsymShmBarrier(sqlite3_file *pFile){ - devsym_file *p = (devsym_file *)pFile; - sqlite3OsShmBarrier(p->pReal); -} -static int devsymShmClose(sqlite3_file *pFile, int delFlag){ - devsym_file *p = (devsym_file *)pFile; - return sqlite3OsShmClose(p->pReal, delFlag); -} static int devsymShmMap( sqlite3_file *pFile, int iRegion, @@ -264,6 +256,14 @@ static int devsymShmMap( devsym_file *p = (devsym_file *)pFile; return sqlite3OsShmMap(p->pReal, iRegion, szRegion, isWrite, pp); } +static void devsymShmBarrier(sqlite3_file *pFile){ + devsym_file *p = (devsym_file *)pFile; + sqlite3OsShmBarrier(p->pReal); +} +static int devsymShmClose(sqlite3_file *pFile, int delFlag){ + devsym_file *p = (devsym_file *)pFile; + return sqlite3OsShmClose(p->pReal, delFlag); +} diff --git a/src/test_onefile.c b/src/test_onefile.c index ea6c972603..39b410b4a3 100644 --- a/src/test_onefile.c +++ b/src/test_onefile.c @@ -221,8 +221,8 @@ static sqlite3_io_methods fs_io_methods = { fsSectorSize, /* xSectorSize */ fsDeviceCharacteristics, /* xDeviceCharacteristics */ 0, /* xShmOpen */ - 0, /* xShmSize */ 0, /* xShmLock */ + 0, /* xShmMap */ 0, /* xShmBarrier */ 0 /* xShmClose */ }; @@ -243,8 +243,8 @@ static sqlite3_io_methods tmp_io_methods = { tmpSectorSize, /* xSectorSize */ tmpDeviceCharacteristics, /* xDeviceCharacteristics */ 0, /* xShmOpen */ - 0, /* xShmSize */ 0, /* xShmLock */ + 0, /* xShmMap */ 0, /* xShmBarrier */ 0 /* xShmClose */ }; diff --git a/src/test_osinst.c b/src/test_osinst.c index f97822a1ab..206a2e9cab 100644 --- a/src/test_osinst.c +++ b/src/test_osinst.c @@ -151,9 +151,9 @@ static int vfslogDeviceCharacteristics(sqlite3_file*); static int vfslogShmOpen(sqlite3_file *pFile); static int vfslogShmLock(sqlite3_file *pFile, int ofst, int n, int flags); +static int vfslogShmMap(sqlite3_file *pFile,int,int,int,volatile void **); static void vfslogShmBarrier(sqlite3_file*); static int vfslogShmClose(sqlite3_file *pFile, int deleteFlag); -static int vfslogShmMap(sqlite3_file *pFile,int,int,int,volatile void **); /* ** Method declarations for vfslog_vfs. @@ -213,9 +213,9 @@ static sqlite3_io_methods vfslog_io_methods = { vfslogDeviceCharacteristics, /* xDeviceCharacteristics */ vfslogShmOpen, /* xShmOpen */ vfslogShmLock, /* xShmLock */ + vfslogShmMap, /* xShmMap */ vfslogShmBarrier, /* xShmBarrier */ - vfslogShmClose, /* xShmClose */ - vfslogShmMap /* xShmMap */ + vfslogShmClose /* xShmClose */ }; #if defined(SQLITE_OS_UNIX) && !defined(NO_GETTOD) @@ -445,6 +445,22 @@ static int vfslogShmLock(sqlite3_file *pFile, int ofst, int n, int flags){ vfslog_call(p->pVfslog, OS_SHMLOCK, p->iFileId, t, rc, 0, 0); return rc; } +static int vfslogShmMap( + sqlite3_file *pFile, + int iRegion, + int szRegion, + int isWrite, + volatile void **pp +){ + int rc; + sqlite3_uint64 t; + VfslogFile *p = (VfslogFile *)pFile; + t = vfslog_time(); + rc = p->pReal->pMethods->xShmMap(p->pReal, iRegion, szRegion, isWrite, pp); + t = vfslog_time() - t; + vfslog_call(p->pVfslog, OS_SHMMAP, p->iFileId, t, rc, 0, 0); + return rc; +} static void vfslogShmBarrier(sqlite3_file *pFile){ sqlite3_uint64 t; VfslogFile *p = (VfslogFile *)pFile; @@ -463,22 +479,6 @@ static int vfslogShmClose(sqlite3_file *pFile, int deleteFlag){ vfslog_call(p->pVfslog, OS_SHMCLOSE, p->iFileId, t, rc, 0, 0); return rc; } -static int vfslogShmMap( - sqlite3_file *pFile, - int iRegion, - int szRegion, - int isWrite, - volatile void **pp -){ - int rc; - sqlite3_uint64 t; - VfslogFile *p = (VfslogFile *)pFile; - t = vfslog_time(); - rc = p->pReal->pMethods->xShmMap(p->pReal, iRegion, szRegion, isWrite, pp); - t = vfslog_time() - t; - vfslog_call(p->pVfslog, OS_SHMMAP, p->iFileId, t, rc, 0, 0); - return rc; -} /* diff --git a/src/test_vfs.c b/src/test_vfs.c index 89cc842caf..ef673c271f 100644 --- a/src/test_vfs.c +++ b/src/test_vfs.c @@ -70,9 +70,9 @@ struct Testvfs { */ #define TESTVFS_SHMOPEN_MASK 0x00000001 #define TESTVFS_SHMLOCK_MASK 0x00000010 -#define TESTVFS_SHMBARRIER_MASK 0x00000020 -#define TESTVFS_SHMCLOSE_MASK 0x00000040 -#define TESTVFS_SHMPAGE_MASK 0x00000080 +#define TESTVFS_SHMMAP_MASK 0x00000020 +#define TESTVFS_SHMBARRIER_MASK 0x00000040 +#define TESTVFS_SHMCLOSE_MASK 0x00000080 #define TESTVFS_OPEN_MASK 0x00000100 #define TESTVFS_SYNC_MASK 0x00000200 @@ -135,9 +135,9 @@ static int tvfsCurrentTime(sqlite3_vfs*, double*); static int tvfsShmOpen(sqlite3_file*); static int tvfsShmLock(sqlite3_file*, int , int, int); +static int tvfsShmMap(sqlite3_file*,int,int,int, void volatile **); static void tvfsShmBarrier(sqlite3_file*); static int tvfsShmClose(sqlite3_file*, int); -static int tvfsShmPage(sqlite3_file*,int,int,int, void volatile **); static sqlite3_io_methods tvfs_io_methods = { 2, /* iVersion */ @@ -155,9 +155,9 @@ static sqlite3_io_methods tvfs_io_methods = { tvfsDeviceCharacteristics, /* xDeviceCharacteristics */ tvfsShmOpen, /* xShmOpen */ tvfsShmLock, /* xShmLock */ + tvfsShmMap, /* xShmMap */ tvfsShmBarrier, /* xShmBarrier */ - tvfsShmClose, /* xShmClose */ - tvfsShmPage /* xShmPage */ + tvfsShmClose /* xShmClose */ }; static int tvfsResultCode(Testvfs *p, int *pRc){ @@ -613,7 +613,7 @@ static void tvfsAllocPage(TestvfsBuffer *p, int iPage, int pgsz){ } } -static int tvfsShmPage( +static int tvfsShmMap( sqlite3_file *pFile, /* Handle open on database file */ int iPage, /* Page to retrieve */ int pgsz, /* Size of pages */ @@ -624,19 +624,19 @@ static int tvfsShmPage( TestvfsFile *pFd = (TestvfsFile *)pFile; Testvfs *p = (Testvfs *)(pFd->pVfs->pAppData); - if( p->pScript && p->mask&TESTVFS_SHMPAGE_MASK ){ + if( p->pScript && p->mask&TESTVFS_SHMMAP_MASK ){ Tcl_Obj *pArg = Tcl_NewObj(); Tcl_IncrRefCount(pArg); Tcl_ListObjAppendElement(p->interp, pArg, Tcl_NewIntObj(iPage)); Tcl_ListObjAppendElement(p->interp, pArg, Tcl_NewIntObj(pgsz)); Tcl_ListObjAppendElement(p->interp, pArg, Tcl_NewIntObj(isWrite)); - tvfsExecTcl(p, "xShmPage", + tvfsExecTcl(p, "xShmMap", Tcl_NewStringObj(pFd->pShm->zFile, -1), pFd->pShmId, pArg ); tvfsResultCode(p, &rc); Tcl_DecrRefCount(pArg); } - if( rc==SQLITE_OK && p->mask&TESTVFS_SHMPAGE_MASK && tvfsInjectIoerr(p) ){ + if( rc==SQLITE_OK && p->mask&TESTVFS_SHMMAP_MASK && tvfsInjectIoerr(p) ){ rc = SQLITE_IOERR; } @@ -841,7 +841,7 @@ static int testvfs_obj_cmd( { "xShmLock", TESTVFS_SHMLOCK_MASK }, { "xShmBarrier", TESTVFS_SHMBARRIER_MASK }, { "xShmClose", TESTVFS_SHMCLOSE_MASK }, - { "xShmPage", TESTVFS_SHMPAGE_MASK }, + { "xShmMap", TESTVFS_SHMMAP_MASK }, { "xSync", TESTVFS_SYNC_MASK }, { "xOpen", TESTVFS_OPEN_MASK }, }; @@ -962,12 +962,10 @@ static void testvfs_obj_del(ClientData cd){ ** ** The VFS passes all file I/O calls through to the underlying VFS. ** -** Whenever one of the xShmSize, xShmGet or xShmRelease methods of the VFS -** are invoked, the SCRIPT is executed as follows: +** Whenever the xShmMap method of the VFS +** is invoked, the SCRIPT is executed as follows: ** -** SCRIPT xShmSize FILENAME ID -** SCRIPT xShmGet FILENAME ID -** SCRIPT xShmRelease FILENAME ID +** SCRIPT xShmMap FILENAME ID ** ** The value returned by the invocation of SCRIPT above is interpreted as ** an SQLite error code and returned to SQLite. Either a symbolic