From bf9b994f52f076fa955c2d9aabe1c6970f30d205 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 19 Nov 2022 13:09:03 +0000 Subject: [PATCH 01/21] Streamline the decodeFlags() routine in btree.c for a small performance increase. FossilOrigin-Name: 4cb285210b4a2b14c80962bf2ecb35be310d3444c329c15d86b3073096455704 --- manifest | 14 ++++----- manifest.uuid | 2 +- src/btree.c | 85 +++++++++++++++++++++++++++------------------------ 3 files changed, 53 insertions(+), 48 deletions(-) diff --git a/manifest b/manifest index 3df90b2d8a..4507d9d171 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sbuild\sof\ssqlite3.mjs\s(ES6\smodule),\sadd\sa\stest\sapp\sfor\sit,\sand\sinclude\sit\sin\sthe\sdist\sbuild. -D 2022-11-19T05:26:45.763 +C Streamline\sthe\sdecodeFlags()\sroutine\sin\sbtree.c\sfor\sa\ssmall\sperformance\nincrease. +D 2022-11-19T13:09:03.004 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -578,7 +578,7 @@ F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7 F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca -F src/btree.c e8fae9a95ea9561aebc41e467a9ee9ba9150ca373031e65773d62ff02d8250d2 +F src/btree.c 405994e58bdf8f58adb5b238cda4b428de2bfe67e8dac5577082f2fd70faeade F src/btree.h 4fcbb0b041013071dd5e9f53c538d49916c092e6ad8842185985e5270a0792de F src/btreeInt.h 8ce1332edd89dfd2461d561ac10a0ab5601c8e06200cb5230596c3caaf54482e F src/build.c d3e43e950e4e377c1d451a4862556792acdef1faba14a03f899d30d09731c48b @@ -2057,8 +2057,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 10c723d96d61d2e552ec1102563d58f1eb11bc3d30e03606fd8e0279c5a9043a -R 222130501cabad70ae0d5e4c47519919 -U stephan -Z bbe51f75fec2c52a531f67e9a6ac36f6 +P 2e783670e10b59e67c14b0db7f4803b41790cc7730de221d54fa2d4483cfba33 +R b0bb099cec1bed805505fb24b4006305 +U drh +Z 40c7b0608af0db932c6182b2b48b07d6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 78bd7a46af..e953848055 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2e783670e10b59e67c14b0db7f4803b41790cc7730de221d54fa2d4483cfba33 \ No newline at end of file +4cb285210b4a2b14c80962bf2ecb35be310d3444c329c15d86b3073096455704 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 1c6c14d4b6..569b596c57 100644 --- a/src/btree.c +++ b/src/btree.c @@ -1900,62 +1900,67 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){ ** Only the following combinations are supported. Anything different ** indicates a corrupt database files: ** -** PTF_ZERODATA -** PTF_ZERODATA | PTF_LEAF -** PTF_LEAFDATA | PTF_INTKEY -** PTF_LEAFDATA | PTF_INTKEY | PTF_LEAF +** PTF_ZERODATA (0x02, 2) +** PTF_LEAFDATA | PTF_INTKEY (0x05, 5) +** PTF_ZERODATA | PTF_LEAF (0x0a, 10) +** PTF_LEAFDATA | PTF_INTKEY | PTF_LEAF (0x0d, 13) */ static int decodeFlags(MemPage *pPage, int flagByte){ BtShared *pBt; /* A copy of pPage->pBt */ assert( pPage->hdrOffset==(pPage->pgno==1 ? 100 : 0) ); assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - pPage->leaf = (u8)(flagByte>>3); assert( PTF_LEAF == 1<<3 ); - flagByte &= ~PTF_LEAF; - pPage->childPtrSize = 4-4*pPage->leaf; pBt = pPage->pBt; - if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){ - /* EVIDENCE-OF: R-07291-35328 A value of 5 (0x05) means the page is an - ** interior table b-tree page. */ - assert( (PTF_LEAFDATA|PTF_INTKEY)==5 ); - /* EVIDENCE-OF: R-26900-09176 A value of 13 (0x0d) means the page is a - ** leaf table b-tree page. */ - assert( (PTF_LEAFDATA|PTF_INTKEY|PTF_LEAF)==13 ); - pPage->intKey = 1; - if( pPage->leaf ){ + pPage->max1bytePayload = pBt->max1bytePayload; + if( flagByte>=(PTF_ZERODATA | PTF_LEAF) ){ + pPage->childPtrSize = 0; + pPage->leaf = 1; + if( flagByte==(PTF_LEAFDATA | PTF_INTKEY | PTF_LEAF) ){ pPage->intKeyLeaf = 1; pPage->xCellSize = cellSizePtrTableLeaf; pPage->xParseCell = btreeParseCellPtr; + pPage->intKey = 1; + pPage->maxLocal = pBt->maxLeaf; + pPage->minLocal = pBt->minLeaf; + }else if( flagByte==(PTF_ZERODATA | PTF_LEAF) ){ + pPage->intKey = 0; + pPage->intKeyLeaf = 0; + pPage->xCellSize = cellSizePtr; + pPage->xParseCell = btreeParseCellPtrIndex; + pPage->maxLocal = pBt->maxLocal; + pPage->minLocal = pBt->minLocal; }else{ + pPage->intKey = 0; + pPage->intKeyLeaf = 0; + pPage->xCellSize = cellSizePtr; + pPage->xParseCell = btreeParseCellPtrIndex; + return SQLITE_CORRUPT_PAGE(pPage); + } + }else{ + pPage->childPtrSize = 4; + pPage->leaf = 0; + if( flagByte==(PTF_ZERODATA) ){ + pPage->intKey = 0; + pPage->intKeyLeaf = 0; + pPage->xCellSize = cellSizePtr; + pPage->xParseCell = btreeParseCellPtrIndex; + pPage->maxLocal = pBt->maxLocal; + pPage->minLocal = pBt->minLocal; + }else if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){ pPage->intKeyLeaf = 0; pPage->xCellSize = cellSizePtrNoPayload; pPage->xParseCell = btreeParseCellPtrNoPayload; + pPage->intKey = 1; + pPage->maxLocal = pBt->maxLeaf; + pPage->minLocal = pBt->minLeaf; + }else{ + pPage->intKey = 0; + pPage->intKeyLeaf = 0; + pPage->xCellSize = cellSizePtr; + pPage->xParseCell = btreeParseCellPtrIndex; + return SQLITE_CORRUPT_PAGE(pPage); } - pPage->maxLocal = pBt->maxLeaf; - pPage->minLocal = pBt->minLeaf; - }else if( flagByte==PTF_ZERODATA ){ - /* EVIDENCE-OF: R-43316-37308 A value of 2 (0x02) means the page is an - ** interior index b-tree page. */ - assert( (PTF_ZERODATA)==2 ); - /* EVIDENCE-OF: R-59615-42828 A value of 10 (0x0a) means the page is a - ** leaf index b-tree page. */ - assert( (PTF_ZERODATA|PTF_LEAF)==10 ); - pPage->intKey = 0; - pPage->intKeyLeaf = 0; - pPage->xCellSize = cellSizePtr; - pPage->xParseCell = btreeParseCellPtrIndex; - pPage->maxLocal = pBt->maxLocal; - pPage->minLocal = pBt->minLocal; - }else{ - /* EVIDENCE-OF: R-47608-56469 Any other value for the b-tree page type is - ** an error. */ - pPage->intKey = 0; - pPage->intKeyLeaf = 0; - pPage->xCellSize = cellSizePtr; - pPage->xParseCell = btreeParseCellPtrIndex; - return SQLITE_CORRUPT_PAGE(pPage); } - pPage->max1bytePayload = pBt->max1bytePayload; return SQLITE_OK; } From 1e62057436a904f02e710adb264f539c51a0b66c Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 19 Nov 2022 14:18:48 +0000 Subject: [PATCH 02/21] Improved comments on the pageFreeArray() routine of btree.c. No changes to code. FossilOrigin-Name: 0c2adc6d3547b07e950ae49f07f688f71a21b3ad5a51f16f0e8d49ab91564582 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/btree.c | 7 +++++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 4507d9d171..9d1924cb8e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Streamline\sthe\sdecodeFlags()\sroutine\sin\sbtree.c\sfor\sa\ssmall\sperformance\nincrease. -D 2022-11-19T13:09:03.004 +C Improved\scomments\son\sthe\spageFreeArray()\sroutine\sof\sbtree.c.\s\sNo\schanges\sto\ncode. +D 2022-11-19T14:18:48.226 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -578,7 +578,7 @@ F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7 F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca -F src/btree.c 405994e58bdf8f58adb5b238cda4b428de2bfe67e8dac5577082f2fd70faeade +F src/btree.c c98cf491cbb8aa930bc9deb2cf794d2a32005c97c9cde01b7b8a10ef7c3d8451 F src/btree.h 4fcbb0b041013071dd5e9f53c538d49916c092e6ad8842185985e5270a0792de F src/btreeInt.h 8ce1332edd89dfd2461d561ac10a0ab5601c8e06200cb5230596c3caaf54482e F src/build.c d3e43e950e4e377c1d451a4862556792acdef1faba14a03f899d30d09731c48b @@ -2057,8 +2057,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2e783670e10b59e67c14b0db7f4803b41790cc7730de221d54fa2d4483cfba33 -R b0bb099cec1bed805505fb24b4006305 +P 4cb285210b4a2b14c80962bf2ecb35be310d3444c329c15d86b3073096455704 +R 08dfc1f1d36db05c00bfb06ac1037121 U drh -Z 40c7b0608af0db932c6182b2b48b07d6 +Z 7815819acfb2ddb8c0f5e3f3b0dc41f8 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e953848055..b2733321bc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4cb285210b4a2b14c80962bf2ecb35be310d3444c329c15d86b3073096455704 \ No newline at end of file +0c2adc6d3547b07e950ae49f07f688f71a21b3ad5a51f16f0e8d49ab91564582 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 569b596c57..33762cc906 100644 --- a/src/btree.c +++ b/src/btree.c @@ -7448,8 +7448,8 @@ static int pageFreeArray( int nRet = 0; int i; int iEnd = iFirst + nCell; - u8 *pFree = 0; - int szFree = 0; + u8 *pFree = 0; /* \__ Parameters for pending call to */ + int szFree = 0; /* / freeSpace() */ for(i=iFirst; iapCell[i]; @@ -7470,6 +7470,9 @@ static int pageFreeArray( return 0; } }else{ + /* The current cell is adjacent to and before the pFree cell. + ** Combine the two regions into one to reduce the number of calls + ** to freeSpace(). */ pFree = pCell; szFree += sz; } From 8d0d409876b2bfb6ebe6163ebedefeb8fb9b337f Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 19 Nov 2022 16:16:40 +0000 Subject: [PATCH 03/21] Get tester1.js working via an ES6 worker module and add that variant to the dist zipfile. FossilOrigin-Name: 90480586f1b2ad82118e19536b095431b8457f294c0afaa9b4f883f184cc804c --- ext/wasm/GNUmakefile | 36 ++++++++++++++++-------- ext/wasm/dist.make | 3 +- ext/wasm/index-dist.html | 12 ++++++-- ext/wasm/index.html | 13 +++++++-- ext/wasm/tester1-esm.html | 4 +-- ext/wasm/tester1-worker.html | 19 +++++++++++-- ext/wasm/{tester1.js => tester1.c-pp.js} | 25 ++++++++++++++-- manifest | 26 ++++++++--------- manifest.uuid | 2 +- 9 files changed, 99 insertions(+), 41 deletions(-) rename ext/wasm/{tester1.js => tester1.c-pp.js} (99%) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 03b7689f2d..3d952c2615 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -227,12 +227,13 @@ bin.c-pp := ./c-pp $(bin.c-pp): c-pp.c $(sqlite3.c) $(MAKEFILE) $(CC) -O0 -o $@ c-pp.c $(sqlite3.c) '-DCMPP_DEFAULT_DELIM="//#"' -I$(dir.top) define C-PP.JS -# $1 c-pp -D... flags -# $2 = c-pp -f X.js -# $3 = c-pp -o X.js -$(3): $(2) $$(MAKEFILE) $$(bin.c-pp) - $$(bin.c-pp) -f $(2) -o $$@ $(1) -CLEAN_FILES += $(3) +# Create $2 from $1 using $(bin.c-pp) +# $1 = Input file: c-pp -f X.js +# $2 = Output file: c-pp -o X.js +# $3 = optional c-pp -D... flags +$(2): $(1) $$(MAKEFILE) $$(bin.c-pp) + $$(bin.c-pp) -f $(1) -o $$@ $(3) +CLEAN_FILES += $(2) endef c-pp.D.vanilla ?= c-pp.D.esm ?= -Dsqlite3-es6-module-build @@ -300,8 +301,8 @@ $(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE) pre-js.js.in := $(dir.api)/pre-js.js pre-js.js.esm := $(dir.tmp)/pre-js.esm.js pre-js.js.vanilla := $(dir.tmp)/pre-js.vanilla.js -$(eval $(call C-PP.JS,$(c-pp.D.vanilla),$(pre-js.js.in),$(pre-js.js.vanilla))) -$(eval $(call C-PP.JS,$(c-pp.D.esm),$(pre-js.js.in),$(pre-js.js.esm))) +$(eval $(call C-PP.JS,$(pre-js.js.in),$(pre-js.js.vanilla),$(c-pp.D.vanilla))) +$(eval $(call C-PP.JS,$(pre-js.js.in),$(pre-js.js.esm),$(c-pp.D.esm))) post-js.js.in := $(dir.tmp)/post-js.js post-js.js.vanilla := $(dir.tmp)/post-js.vanilla.js post-js.js.esm := $(dir.tmp)/post-js.esm.js @@ -316,14 +317,14 @@ $(post-js.js.in): $(post-jses.js) $(MAKEFILE) cat $$i; \ echo "/* END FILE: $$i */"; \ done > $@ -$(eval $(call C-PP.JS,$(c-pp.D.vanilla),$(post-js.js.in),$(post-js.js.vanilla))) -$(eval $(call C-PP.JS,$(c-pp.D.esm),$(post-js.js.in),$(post-js.js.esm))) +$(eval $(call C-PP.JS,$(post-js.js.in),$(post-js.js.vanilla),$(c-pp.D.vanilla))) +$(eval $(call C-PP.JS,$(post-js.js.in),$(post-js.js.esm),$(c-pp.D.esm))) extern-post-js.js.in := $(dir.api)/extern-post-js.js extern-post-js.js.vanilla := $(dir.tmp)/extern-post-js.vanilla.js extern-post-js.js.esm := $(dir.tmp)/extern-post-js.esm.js -$(eval $(call C-PP.JS,$(c-pp.D.vanilla),$(extern-post-js.js.in),$(extern-post-js.js.vanilla))) -$(eval $(call C-PP.JS,$(c-pp.D.esm),$(extern-post-js.js.in),$(extern-post-js.js.esm))) +$(eval $(call C-PP.JS,$(extern-post-js.js.in),$(extern-post-js.js.vanilla),$(c-pp.D.vanilla))) +$(eval $(call C-PP.JS,$(extern-post-js.js.in),$(extern-post-js.js.esm),$(c-pp.D.esm))) extern-pre-js.js := $(dir.api)/extern-pre-js.js # Emscripten flags for --[extern-][pre|post]-js=... @@ -642,6 +643,17 @@ CLEAN_FILES += $(speedtest1.js) $(speedtest1.wasm) # end speedtest1.js ######################################################################## +######################################################################## +# tester1 code: +# tester1.js: for main thread and worker thread +# tester1-esm.js: to be loaded from an ES6 Worker Module thread +$(eval $(call C-PP.JS,tester1.c-pp.js,tester1.js)) +$(eval $(call C-PP.JS,tester1.c-pp.js,tester1-esm.js,-Dtester1-esm-worker)) +tester1.js: $(sqlite3.js) +tester1-esm.js: $(sqlite3.mjs) +tester1: tester1.js tester1-esm.js +all: tester1 + ######################################################################## # Convenience rules to rebuild with various -Ox levels. Much # experimentation shows -O2 to be the clear winner in terms of speed. diff --git a/ext/wasm/dist.make b/ext/wasm/dist.make index 07d289ddbf..f33711a19d 100644 --- a/ext/wasm/dist.make +++ b/ext/wasm/dist.make @@ -42,7 +42,8 @@ dist-dir.jswasm := $(dist-dir.top)/$(notdir $(dir.dout)) dist-dir.common := $(dist-dir.top)/common dist.top.extras := \ demo-123.html demo-123-worker.html demo-123.js \ - tester1.html tester1-worker.html tester1-esm.html tester1.js \ + tester1.html tester1-worker.html tester1-esm.html \ + tester1.js tester1-esm.js \ demo-jsstorage.html demo-jsstorage.js \ demo-worker1.html demo-worker1.js \ demo-worker1-promiser.html demo-worker1-promiser.js diff --git a/ext/wasm/index-dist.html b/ext/wasm/index-dist.html index 2333190d95..29891c91e9 100644 --- a/ext/wasm/index-dist.html +++ b/ext/wasm/index-dist.html @@ -56,9 +56,15 @@ utility code.
  • tester1-worker: same thing but running in a Worker.
  • -
  • tester1-esm: same thing - but loaded in the main thread via an ES6 module. Note that - not all browsers permit loading modules in Worker threads. +
  • tester1-esm: same as + tester1 but loads sqlite3 in the main thread via + an ES6 module. +
  • +
  • tester1-worker?esm: + same as tester1-esm but loads a Worker Module which + then loads the sqlite3 API via an ES6 module. Note that + not all browsers permit loading modules in Worker + threads.
  • diff --git a/ext/wasm/index.html b/ext/wasm/index.html index 0aca0661c2..0a6cd0a620 100644 --- a/ext/wasm/index.html +++ b/ext/wasm/index.html @@ -47,9 +47,16 @@ utility code.
  • tester1-worker: same thing but running in a Worker.
  • -
  • tester1-esm: same thing - but loaded in the main thread via an ES6 module. Note that - not all browsers permit loading modules in Worker threads. +
  • tester1-esm: same as + tester1 but loads sqlite3 in the main thread via + an ES6 module. +
  • +
  • tester1-worker?esm: + same as tester1-esm but loads a Worker Module which + then loads the sqlite3 API via an ES6 module. Note that + not all browsers permit loading modules in Worker + threads. +
  • High-level apps and demos... diff --git a/ext/wasm/tester1-esm.html b/ext/wasm/tester1-esm.html index dc63f7cbe6..118ab676bd 100644 --- a/ext/wasm/tester1-esm.html +++ b/ext/wasm/tester1-esm.html @@ -6,7 +6,7 @@ - sqlite3 tester ESM #1 (UI thread) + sqlite3 tester #1: ES6 Module in UI thread -

    sqlite3 WASM/JS tester ESM #1 (UI thread)

    +

    sqlite3 tester #1: ES6 Module in UI thread

    diff --git a/ext/wasm/tester1-worker.html b/ext/wasm/tester1-worker.html index 4d2df0c8d1..b750df9169 100644 --- a/ext/wasm/tester1-worker.html +++ b/ext/wasm/tester1-worker.html @@ -6,7 +6,7 @@ - sqlite3 tester #1 (Worker thread) + sqlite3 tester #1: Worker thread -

    sqlite3 WASM/JS tester #1 (Worker thread)

    +

    sqlite3 tester #1: Worker thread

    See tester1.html for the UI-thread variant.
    @@ -40,7 +40,20 @@ }; cbReverse.addEventListener('change',cbReverseIt,true); cbReverseIt(); - const w = new Worker("tester1.js?sqlite3.dir=jswasm"); + const urlParams = new URL(self.location.href).searchParams; + const workerArgs = []; + if(urlParams.has('esm')){ + logHtml('warning',"Attempting to run an ES6 Worker Module, "+ + "which is not supported by all browsers! "+ + "e.g. Firefox (as of 2022-11) cannot do this."); + workerArgs.push("tester1-esm.js",{type:"module"}); + document.querySelectorAll('title,#color-target').forEach((e)=>{ + e.innerText = "sqlite3 tester #1: ES6 Worker Module"; + }); + }else{ + workerArgs.push("tester1.js?sqlite3.dir=jswasm"); + } + const w = new Worker(...workerArgs); w.onmessage = function({data}){ switch(data.type){ case 'log': diff --git a/ext/wasm/tester1.js b/ext/wasm/tester1.c-pp.js similarity index 99% rename from ext/wasm/tester1.js rename to ext/wasm/tester1.c-pp.js index 99fb5b3184..7aa8ba4a65 100644 --- a/ext/wasm/tester1.js +++ b/ext/wasm/tester1.c-pp.js @@ -29,8 +29,25 @@ a db in an early test and close it in a later test. Each test gets passed the sqlite3 namespace object as its only argument. */ +/* + This file is intended to be processed by c-pp to inject (or not) + code specific to ES6 modules which is illegal in non-module code. + + Non-ES6 module build and ES6 module for the main-thread: + + ./c-pp -f tester1.c-pp.js -o tester1.js + + ES6 worker module build: + + ./c-pp -f tester1.c-pp.js -o tester1-esm.js -Dtester1-esm-worker +*/ +//#if tester1-esm-worker +import {default as sqlite3InitModule} from './jswasm/sqlite3.mjs'; +self.sqlite3InitModule = sqlite3InitModule; +//#else 'use strict'; -(function(){ +//#endif +(function(self){ /** Set up our output channel differently depending on whether we are running in a worker thread or @@ -1817,7 +1834,8 @@ //////////////////////////////////////////////////////////////////////// log("Loading and initializing sqlite3 WASM module..."); - if(!isUIThread()){ + if(!self.sqlite3InitModule && !isUIThread()){ + /* Vanilla worker, as opposed to an ES6 module worker */ /* If sqlite3.js is in a directory other than this script, in order to get sqlite3.js to resolve sqlite3.wasm properly, we have to @@ -1861,4 +1879,5 @@ } TestUtil.runTests(sqlite3); }); -})(); +})(self); + diff --git a/manifest b/manifest index 9d1924cb8e..40a5b2d04c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improved\scomments\son\sthe\spageFreeArray()\sroutine\sof\sbtree.c.\s\sNo\schanges\sto\ncode. -D 2022-11-19T14:18:48.226 +C Get\stester1.js\sworking\svia\san\sES6\sworker\smodule\sand\sadd\sthat\svariant\sto\sthe\sdist\szipfile. +D 2022-11-19T16:16:40.998 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -488,7 +488,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 1e38a4f7147d621bd2138d13938ef34157bcf47908325baa6b06cd02c5e3ef89 +F ext/wasm/GNUmakefile 616c2a3e944483f6f5f66a6f77885eb7a7d3fef1a599014d746a792b6ef7b6b6 F ext/wasm/README-dist.txt 2d670b426fc7c613b90a7d2f2b05b433088fe65181abead970980f0a4a75ea20 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 9120c2f8f51fa85f46dcf4dcb6b12f4a807d428f6089b99cdb08d8ddfcfd88b2 @@ -527,14 +527,14 @@ F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98 F ext/wasm/demo-worker1-promiser.js b85a2bb1b918db4f09dfa24419241cb3edad7791389425c2505092e9b715017d F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d F ext/wasm/demo-worker1.js a619adffc98b75b66c633b00f747b856449a134a9a0357909287d80a182d70fa -F ext/wasm/dist.make 4b55c8a7926bbab4936adab6a08eca524085fc47bc3b08f41918df5b4665da3d +F ext/wasm/dist.make d00562b499096704304d9879f834a76475c8dd7ac58aaa3f039625ecc299aa3d F ext/wasm/fiddle.make 2812c44c9bafb5be9c8767963d1b9f374d77af7795fcaa06483c03e7059dea74 F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f F ext/wasm/fiddle/fiddle-worker.js b4a0c8ab6c0983218543ca771c45f6075449f63a1dcf290ae5a681b2cba8800d F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715 F ext/wasm/fiddle/index.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2 -F ext/wasm/index-dist.html 6bfb3591e40f7c23626730df587f533e983e996d4d1fb67244fb6a88fe6cf9a6 -F ext/wasm/index.html 49f58dddc29f6394b6e8a93e42768de59380c258454b68b9182e1946d13a4a4b +F ext/wasm/index-dist.html c4337617c4d6d4d0796827cec28ac81d128c6f911dcf888a290a32ad50890408 +F ext/wasm/index.html 8289252ca8b25a4a76b8e5a86e84c42f5c7ca3302f2b5b1dbdf269fa96c28d84 F ext/wasm/jaccwabyt/jaccwabyt.js 95f573de1826474c9605dda620ee622fcb1673ae74f191eb324c0853aa4dcb66 F ext/wasm/jaccwabyt/jaccwabyt.md 9aa6951b529a8b29f578ec8f0355713c39584c92cf1708f63ba0cf917cb5b68e F ext/wasm/module-symbols.html b8eebafef8e536624bbe5f7a3da40c07a9062b843dfd3161a0bb72cbb6763dc5 @@ -549,10 +549,10 @@ F ext/wasm/sql/000-mandelbrot.sql 775337a4b80938ac8146aedf88808282f04d02d983d826 F ext/wasm/sql/001-sudoku.sql 35b7cb7239ba5d5f193bc05ec379bcf66891bce6f2a5b3879f2f78d0917299b5 F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555e685bce3da8c3f F ext/wasm/test-opfs-vfs.js 44363db07b2a20e73b0eb1808de4400ca71b703af718d0fa6d962f15e73bf2ac -F ext/wasm/tester1-esm.html 8d226a21b20707dbd66d68a3990141f0392fc781a281291d3dc59f38a3555887 -F ext/wasm/tester1-worker.html 51bf39e2b87f974ae3d5bc3086e2fb36d258f3698c54f6e21ba4b3b99636fa27 +F ext/wasm/tester1-esm.html 821c7a38b4eb753f6f3d7b5cbfda5b36f85466763977f96bff8372621b6b9eb2 +F ext/wasm/tester1-worker.html 84d56db05bcea2b294a89ca13c21b76fa0521ca4ac240f0055f1819934c713fc +F ext/wasm/tester1.c-pp.js f4b96977a48cdfc13d477ede6d2f754865e9bcd1a23ce09359c31de41b24ba0d w ext/wasm/tester1.js F ext/wasm/tester1.html 624ec41cd9f78a1f2b6d7df70aaa7a6394396b1f2455ecbd6de5775c1275b121 -F ext/wasm/tester1.js bff806de454de115922d78c056f11d523ec7ed9ed3839d4e21433a9f72558b88 F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5 F ext/wasm/wasmfs.make 8aa7565f9de8dd3c291ad8c3ceb1a2c67a3eb31a8e531070b25c6c6b1f0278bf F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x @@ -2057,8 +2057,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 4cb285210b4a2b14c80962bf2ecb35be310d3444c329c15d86b3073096455704 -R 08dfc1f1d36db05c00bfb06ac1037121 -U drh -Z 7815819acfb2ddb8c0f5e3f3b0dc41f8 +P 0c2adc6d3547b07e950ae49f07f688f71a21b3ad5a51f16f0e8d49ab91564582 +R 22f7660d86bcdb1d5d00005b75d1164a +U stephan +Z 9963e0b4fa0faa6cb28eaed2062c3627 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b2733321bc..5f460cd815 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0c2adc6d3547b07e950ae49f07f688f71a21b3ad5a51f16f0e8d49ab91564582 \ No newline at end of file +90480586f1b2ad82118e19536b095431b8457f294c0afaa9b4f883f184cc804c \ No newline at end of file From 47de1f9e198c609193fdf0162aba52e171b8c954 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 19 Nov 2022 18:17:40 +0000 Subject: [PATCH 04/21] Small performance improvement and size reduction in btree. FossilOrigin-Name: daa07149c0a0fcb6a6a1ace6020ca68802588ed309f5aaaf99c871088bc46908 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/btree.c | 8 +++++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 40a5b2d04c..41ca62e5cc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Get\stester1.js\sworking\svia\san\sES6\sworker\smodule\sand\sadd\sthat\svariant\sto\sthe\sdist\szipfile. -D 2022-11-19T16:16:40.998 +C Small\sperformance\simprovement\sand\ssize\sreduction\sin\sbtree. +D 2022-11-19T18:17:40.978 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -551,7 +551,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555 F ext/wasm/test-opfs-vfs.js 44363db07b2a20e73b0eb1808de4400ca71b703af718d0fa6d962f15e73bf2ac F ext/wasm/tester1-esm.html 821c7a38b4eb753f6f3d7b5cbfda5b36f85466763977f96bff8372621b6b9eb2 F ext/wasm/tester1-worker.html 84d56db05bcea2b294a89ca13c21b76fa0521ca4ac240f0055f1819934c713fc -F ext/wasm/tester1.c-pp.js f4b96977a48cdfc13d477ede6d2f754865e9bcd1a23ce09359c31de41b24ba0d w ext/wasm/tester1.js +F ext/wasm/tester1.c-pp.js f4b96977a48cdfc13d477ede6d2f754865e9bcd1a23ce09359c31de41b24ba0d F ext/wasm/tester1.html 624ec41cd9f78a1f2b6d7df70aaa7a6394396b1f2455ecbd6de5775c1275b121 F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5 F ext/wasm/wasmfs.make 8aa7565f9de8dd3c291ad8c3ceb1a2c67a3eb31a8e531070b25c6c6b1f0278bf @@ -578,7 +578,7 @@ F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7 F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca -F src/btree.c c98cf491cbb8aa930bc9deb2cf794d2a32005c97c9cde01b7b8a10ef7c3d8451 +F src/btree.c 80f29390eedbdac7f0fd3312df1a2df5ecd3c5b55c5e22dab4fc3fc52d5584dd F src/btree.h 4fcbb0b041013071dd5e9f53c538d49916c092e6ad8842185985e5270a0792de F src/btreeInt.h 8ce1332edd89dfd2461d561ac10a0ab5601c8e06200cb5230596c3caaf54482e F src/build.c d3e43e950e4e377c1d451a4862556792acdef1faba14a03f899d30d09731c48b @@ -2057,8 +2057,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0c2adc6d3547b07e950ae49f07f688f71a21b3ad5a51f16f0e8d49ab91564582 -R 22f7660d86bcdb1d5d00005b75d1164a -U stephan -Z 9963e0b4fa0faa6cb28eaed2062c3627 +P 90480586f1b2ad82118e19536b095431b8457f294c0afaa9b4f883f184cc804c +R 66ae91579f9086a7ec56fccf1b9beb6e +U drh +Z c7f53017341eeb656837188f25a22942 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5f460cd815..172b29b5b7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -90480586f1b2ad82118e19536b095431b8457f294c0afaa9b4f883f184cc804c \ No newline at end of file +daa07149c0a0fcb6a6a1ace6020ca68802588ed309f5aaaf99c871088bc46908 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 33762cc906..efa83dd520 100644 --- a/src/btree.c +++ b/src/btree.c @@ -7239,14 +7239,16 @@ struct CellArray { ** computed. */ static void populateCellCache(CellArray *p, int idx, int N){ + MemPage *pRef = p->pRef; + u16 *szCell = p->szCell; assert( idx>=0 && idx+N<=p->nCell ); while( N>0 ){ assert( p->apCell[idx]!=0 ); - if( p->szCell[idx]==0 ){ - p->szCell[idx] = p->pRef->xCellSize(p->pRef, p->apCell[idx]); + if( szCell[idx]==0 ){ + szCell[idx] = pRef->xCellSize(pRef, p->apCell[idx]); }else{ assert( CORRUPT_DB || - p->szCell[idx]==p->pRef->xCellSize(p->pRef, p->apCell[idx]) ); + szCell[idx]==pRef->xCellSize(pRef, p->apCell[idx]) ); } idx++; N--; From 16635fa777cbd83eecb1c6a293ff7f4e4fa341ea Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 19 Nov 2022 18:43:32 +0000 Subject: [PATCH 05/21] Performance improvement and size reduction in balance_nonroot(). FossilOrigin-Name: 715bc81eb833ad4834d139a04085e0386c54c30d7395207e48972c4dfe5879c1 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/btree.c | 10 ++++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 41ca62e5cc..e9ef88380c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Small\sperformance\simprovement\sand\ssize\sreduction\sin\sbtree. -D 2022-11-19T18:17:40.978 +C Performance\simprovement\sand\ssize\sreduction\sin\sbalance_nonroot(). +D 2022-11-19T18:43:32.814 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -578,7 +578,7 @@ F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7 F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca -F src/btree.c 80f29390eedbdac7f0fd3312df1a2df5ecd3c5b55c5e22dab4fc3fc52d5584dd +F src/btree.c b9e66886f09b33cfa5058a6a3f3eddae92b5b9d566ba65bea26928f0b9860754 F src/btree.h 4fcbb0b041013071dd5e9f53c538d49916c092e6ad8842185985e5270a0792de F src/btreeInt.h 8ce1332edd89dfd2461d561ac10a0ab5601c8e06200cb5230596c3caaf54482e F src/build.c d3e43e950e4e377c1d451a4862556792acdef1faba14a03f899d30d09731c48b @@ -2057,8 +2057,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 90480586f1b2ad82118e19536b095431b8457f294c0afaa9b4f883f184cc804c -R 66ae91579f9086a7ec56fccf1b9beb6e +P daa07149c0a0fcb6a6a1ace6020ca68802588ed309f5aaaf99c871088bc46908 +R 486fbd2f4ae2f2943d0cbb110a637a8e U drh -Z c7f53017341eeb656837188f25a22942 +Z 537c9962ecec2516b80c7b85babce28a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 172b29b5b7..d910060e29 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -daa07149c0a0fcb6a6a1ace6020ca68802588ed309f5aaaf99c871088bc46908 \ No newline at end of file +715bc81eb833ad4834d139a04085e0386c54c30d7395207e48972c4dfe5879c1 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index efa83dd520..965897f894 100644 --- a/src/btree.c +++ b/src/btree.c @@ -8244,15 +8244,17 @@ static int balance_nonroot( d = r + 1 - leafData; (void)cachedCellSize(&b, d); do{ + int szR, szD; assert( d szLeft-(b.szCell[r]+(i==k-1?0:2)))){ + && (bBulk || szRight+szD+2 > szLeft-(szR+(i==k-1?0:2)))){ break; } - szRight += b.szCell[d] + 2; - szLeft -= b.szCell[r] + 2; + szRight += szD + 2; + szLeft -= szR + 2; cntNew[i-1] = r; r--; d--; From 5a1d659d79604ff96f550e8ebcd2144e3cb665c3 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 19 Nov 2022 19:37:26 +0000 Subject: [PATCH 06/21] Performance optimization in sqlite3BtreeInsert(). FossilOrigin-Name: 9776fa31758161970a50995a487b6543ed71e9610460b7324304ef21d9248707 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/btree.c | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index e9ef88380c..740a9fb5eb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Performance\simprovement\sand\ssize\sreduction\sin\sbalance_nonroot(). -D 2022-11-19T18:43:32.814 +C Performance\soptimization\sin\ssqlite3BtreeInsert(). +D 2022-11-19T19:37:26.733 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -578,7 +578,7 @@ F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7 F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca -F src/btree.c b9e66886f09b33cfa5058a6a3f3eddae92b5b9d566ba65bea26928f0b9860754 +F src/btree.c 52e71b216c4c8e661f01f70840d2cfe64677b07dd301e2ae684b8785328e7870 F src/btree.h 4fcbb0b041013071dd5e9f53c538d49916c092e6ad8842185985e5270a0792de F src/btreeInt.h 8ce1332edd89dfd2461d561ac10a0ab5601c8e06200cb5230596c3caaf54482e F src/build.c d3e43e950e4e377c1d451a4862556792acdef1faba14a03f899d30d09731c48b @@ -2057,8 +2057,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P daa07149c0a0fcb6a6a1ace6020ca68802588ed309f5aaaf99c871088bc46908 -R 486fbd2f4ae2f2943d0cbb110a637a8e +P 715bc81eb833ad4834d139a04085e0386c54c30d7395207e48972c4dfe5879c1 +R e1e21840abf2d0e625480a11eaf71aa4 U drh -Z 537c9962ecec2516b80c7b85babce28a +Z 802aa656f8405b91947fb6fe179ec5a2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d910060e29..650f1faa10 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -715bc81eb833ad4834d139a04085e0386c54c30d7395207e48972c4dfe5879c1 \ No newline at end of file +9776fa31758161970a50995a487b6543ed71e9610460b7324304ef21d9248707 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 965897f894..a79e81734e 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9182,12 +9182,13 @@ int sqlite3BtreeInsert( if( info.nPayload!=info.nLocal ){ Pgno ovfl = get4byte(&newCell[szNew-4]); ptrmapPut(pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, &rc); + if( NEVER(rc) ) goto end_insert; } } }else{ rc = fillInCell(pPage, newCell, pX, &szNew); + if( rc ) goto end_insert; } - if( rc ) goto end_insert; assert( szNew==pPage->xCellSize(pPage, newCell) ); assert( szNew <= MX_CELL_SIZE(pBt) ); idx = pCur->ix; From ecba10730d032485d1067a819c7a3cc966db3d9e Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 19 Nov 2022 20:10:55 +0000 Subject: [PATCH 07/21] New assert()s confirm that BTREE_PREFORMAT must be the same value as OPFLAG_PREFORMAT. FossilOrigin-Name: f40bf2c642643ae61d331e8d4815f601224fa258ab34344c6756966163a89f4a --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/btree.c | 1 + src/vdbe.c | 1 + 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 740a9fb5eb..d9beffb9d9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Performance\soptimization\sin\ssqlite3BtreeInsert(). -D 2022-11-19T19:37:26.733 +C New\sassert()s\sconfirm\sthat\sBTREE_PREFORMAT\smust\sbe\sthe\ssame\svalue\sas\nOPFLAG_PREFORMAT. +D 2022-11-19T20:10:55.364 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -578,7 +578,7 @@ F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7 F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca -F src/btree.c 52e71b216c4c8e661f01f70840d2cfe64677b07dd301e2ae684b8785328e7870 +F src/btree.c 308474d81388fa8b4fb92da7b2c73cae864c1ac468a7a5ffab61670af4b488f0 F src/btree.h 4fcbb0b041013071dd5e9f53c538d49916c092e6ad8842185985e5270a0792de F src/btreeInt.h 8ce1332edd89dfd2461d561ac10a0ab5601c8e06200cb5230596c3caaf54482e F src/build.c d3e43e950e4e377c1d451a4862556792acdef1faba14a03f899d30d09731c48b @@ -711,7 +711,7 @@ F src/upsert.c 5303dc6c518fa7d4b280ec65170f465c7a70b7ac2b22491598f6d0b4875b3145 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 F src/util.c 0be191521ff6d2805995f4910f0b6231b42843678b2efdc1abecaf39929a673f F src/vacuum.c 84ce7f01f8a7a08748e107a441db83bcec13970190ddcb0c9ff522adbc1c23fd -F src/vdbe.c 0c7cb1b934ad8611e14e7efaf2c3a95df7dd3f7964d63ea07fef42a23df86131 +F src/vdbe.c c2d6d0c0c343d8ebffef996c73cbb69e337225f757fea7fe5c0e3ea14662adec F src/vdbe.h 58675f47dcf3105bab182c3ad3726efd60ffd003e954386904ac9107d0d2b743 F src/vdbeInt.h 17b7461ffcf9ee760d1341731715a419f6b8c763089a7ece25c2e8098d702b3f F src/vdbeapi.c 1e8713d0b653acb43cd1bdf579c40e005c4844ea90f414f065946a83db3c27fb @@ -2057,8 +2057,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 715bc81eb833ad4834d139a04085e0386c54c30d7395207e48972c4dfe5879c1 -R e1e21840abf2d0e625480a11eaf71aa4 +P 9776fa31758161970a50995a487b6543ed71e9610460b7324304ef21d9248707 +R bee5cd2196754b460638bc4389e4c820 U drh -Z 802aa656f8405b91947fb6fe179ec5a2 +Z 72dd876552688ca64c7de697dec658ae # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 650f1faa10..83c0e52e7b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9776fa31758161970a50995a487b6543ed71e9610460b7324304ef21d9248707 \ No newline at end of file +f40bf2c642643ae61d331e8d4815f601224fa258ab34344c6756966163a89f4a \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index a79e81734e..114136bc50 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9172,6 +9172,7 @@ int sqlite3BtreeInsert( assert( pPage->isInit || CORRUPT_DB ); newCell = pBt->pTmpSpace; assert( newCell!=0 ); + assert( BTREE_PREFORMAT==OPFLAG_PREFORMAT ); if( flags & BTREE_PREFORMAT ){ rc = SQLITE_OK; szNew = pBt->nPreformatSize; diff --git a/src/vdbe.c b/src/vdbe.c index 4eb1c03271..a1c2afbb41 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -5579,6 +5579,7 @@ case OP_Insert: { x.nZero = 0; } x.pKey = 0; + assert( BTREE_PREFORMAT==OPFLAG_PREFORMAT ); rc = sqlite3BtreeInsert(pC->uc.pCursor, &x, (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION|OPFLAG_PREFORMAT)), seekResult From 0a94ef8b52fac73d7c200adc876eb38a88664b4e Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 20 Nov 2022 01:15:22 +0000 Subject: [PATCH 08/21] Minor cleanups in the ESM-related preprocessor filtering. FossilOrigin-Name: 205884a273128bb666b496b659b4fa9f031ebdbbc1aa704fdeb4b7e015740098 --- ext/wasm/GNUmakefile | 43 +++++++++++++++++++------------- ext/wasm/api/extern-post-js.js | 8 +++--- ext/wasm/api/pre-js.js | 2 +- ext/wasm/api/sqlite3-api-opfs.js | 2 +- ext/wasm/tester1-esm.html | 7 +----- ext/wasm/tester1.c-pp.js | 4 +-- manifest | 24 +++++++++--------- manifest.uuid | 2 +- 8 files changed, 47 insertions(+), 45 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 3d952c2615..1c74531403 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -226,17 +226,17 @@ DISTCLEAN_FILES += $(bin.stripccomments) bin.c-pp := ./c-pp $(bin.c-pp): c-pp.c $(sqlite3.c) $(MAKEFILE) $(CC) -O0 -o $@ c-pp.c $(sqlite3.c) '-DCMPP_DEFAULT_DELIM="//#"' -I$(dir.top) -define C-PP.JS +define C-PP.FILTER # Create $2 from $1 using $(bin.c-pp) -# $1 = Input file: c-pp -f X.js -# $2 = Output file: c-pp -o X.js +# $1 = Input file: c-pp -f $(1).js +# $2 = Output file: c-pp -o $(2).js # $3 = optional c-pp -D... flags $(2): $(1) $$(MAKEFILE) $$(bin.c-pp) $$(bin.c-pp) -f $(1) -o $$@ $(3) CLEAN_FILES += $(2) endef c-pp.D.vanilla ?= -c-pp.D.esm ?= -Dsqlite3-es6-module-build +c-pp.D.esm ?= -Dtarget=es6-module # /end CPP-of-JS bits ######################################################################## @@ -301,8 +301,8 @@ $(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE) pre-js.js.in := $(dir.api)/pre-js.js pre-js.js.esm := $(dir.tmp)/pre-js.esm.js pre-js.js.vanilla := $(dir.tmp)/pre-js.vanilla.js -$(eval $(call C-PP.JS,$(pre-js.js.in),$(pre-js.js.vanilla),$(c-pp.D.vanilla))) -$(eval $(call C-PP.JS,$(pre-js.js.in),$(pre-js.js.esm),$(c-pp.D.esm))) +$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.vanilla),$(c-pp.D.vanilla))) +$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.esm),$(c-pp.D.esm))) post-js.js.in := $(dir.tmp)/post-js.js post-js.js.vanilla := $(dir.tmp)/post-js.vanilla.js post-js.js.esm := $(dir.tmp)/post-js.esm.js @@ -317,14 +317,14 @@ $(post-js.js.in): $(post-jses.js) $(MAKEFILE) cat $$i; \ echo "/* END FILE: $$i */"; \ done > $@ -$(eval $(call C-PP.JS,$(post-js.js.in),$(post-js.js.vanilla),$(c-pp.D.vanilla))) -$(eval $(call C-PP.JS,$(post-js.js.in),$(post-js.js.esm),$(c-pp.D.esm))) +$(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.vanilla),$(c-pp.D.vanilla))) +$(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.esm),$(c-pp.D.esm))) extern-post-js.js.in := $(dir.api)/extern-post-js.js extern-post-js.js.vanilla := $(dir.tmp)/extern-post-js.vanilla.js extern-post-js.js.esm := $(dir.tmp)/extern-post-js.esm.js -$(eval $(call C-PP.JS,$(extern-post-js.js.in),$(extern-post-js.js.vanilla),$(c-pp.D.vanilla))) -$(eval $(call C-PP.JS,$(extern-post-js.js.in),$(extern-post-js.js.esm),$(c-pp.D.esm))) +$(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.vanilla),$(c-pp.D.vanilla))) +$(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.esm),$(c-pp.D.esm))) extern-pre-js.js := $(dir.api)/extern-pre-js.js # Emscripten flags for --[extern-][pre|post]-js=... @@ -644,13 +644,22 @@ CLEAN_FILES += $(speedtest1.js) $(speedtest1.wasm) ######################################################################## ######################################################################## -# tester1 code: -# tester1.js: for main thread and worker thread -# tester1-esm.js: to be loaded from an ES6 Worker Module thread -$(eval $(call C-PP.JS,tester1.c-pp.js,tester1.js)) -$(eval $(call C-PP.JS,tester1.c-pp.js,tester1-esm.js,-Dtester1-esm-worker)) -tester1.js: $(sqlite3.js) -tester1-esm.js: $(sqlite3.mjs) +# tester1 is the main unit and regression test application and needs to +# be able to run in 4 separate modes to cover the primary use cases: +# +# 1) Load sqlite3 in the main UI thread of a conventional script. +# 2) Load sqlite3 in a conventional Worker thread. +# 3) Load sqlite3 as an ES6 module (ESM) in the main thread. +# 4) Load sqlite3 as an ESM worker. (Not all browsers support this.) +# +# To that end, we require two separate builds of tester1.js: +# +# tester1.js: cases 1 and 2 +# tester1-esm.js: cases 3 and 4 +# +# To create those, we filter tester1.c-pp.js with $(bin.c-pp)... +$(eval $(call C-PP.FILTER,tester1.c-pp.js,tester1.js)) +$(eval $(call C-PP.FILTER,tester1.c-pp.js,tester1-esm.js,$(c-pp.D.esm))) tester1: tester1.js tester1-esm.js all: tester1 diff --git a/ext/wasm/api/extern-post-js.js b/ext/wasm/api/extern-post-js.js index 3dc61ae050..acf7068fef 100644 --- a/ext/wasm/api/extern-post-js.js +++ b/ext/wasm/api/extern-post-js.js @@ -8,7 +8,7 @@ most of the associated JS code, runs outside of the Emscripten-generated module init scope, in the current global scope. */ -//#if sqlite3-es6-module-build +//#if target=es6-module const toExportForES6 = //#endif (function(){ @@ -110,10 +110,8 @@ const toExportForES6 = exports["sqlite3InitModule"] = sqlite3InitModule; /* AMD modules get injected in a way we cannot override, so we can't handle those here. */ -//#if sqlite3-es6-module-build - return self.sqlite3InitModule; -//#endif + return self.sqlite3InitModule /* required for ESM */; })(); -//#if sqlite3-es6-module-build +//#if target=es6-module export default toExportForES6; //#endif diff --git a/ext/wasm/api/pre-js.js b/ext/wasm/api/pre-js.js index 41d13d6853..2e2fe66bc9 100644 --- a/ext/wasm/api/pre-js.js +++ b/ext/wasm/api/pre-js.js @@ -29,7 +29,7 @@ sqlite3InitModuleState.debugModule('self.location =',self.location); 4) If none of the above apply, (prefix+path) is returned. */ Module['locateFile'] = function(path, prefix) { -//#if sqlite3-es6-module-build +//#if target=es6-module return new URL(path, import.meta.url).href; //#else 'use strict'; diff --git a/ext/wasm/api/sqlite3-api-opfs.js b/ext/wasm/api/sqlite3-api-opfs.js index 31fe45eda0..a3f73cc7b2 100644 --- a/ext/wasm/api/sqlite3-api-opfs.js +++ b/ext/wasm/api/sqlite3-api-opfs.js @@ -167,7 +167,7 @@ const installOpfsVfs = function callee(options){ return promiseReject_(err); }; const W = -//#if sqlite3-es6-module-build +//#if target=es6-module new Worker(new URL(options.proxyUri, import.meta.url)); //#else new Worker(options.proxyUri); diff --git a/ext/wasm/tester1-esm.html b/ext/wasm/tester1-esm.html index 118ab676bd..498a1ab6a7 100644 --- a/ext/wasm/tester1-esm.html +++ b/ext/wasm/tester1-esm.html @@ -20,11 +20,6 @@
    - - + diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js index 7aa8ba4a65..2a5da8407c 100644 --- a/ext/wasm/tester1.c-pp.js +++ b/ext/wasm/tester1.c-pp.js @@ -39,9 +39,9 @@ ES6 worker module build: - ./c-pp -f tester1.c-pp.js -o tester1-esm.js -Dtester1-esm-worker + ./c-pp -f tester1.c-pp.js -o tester1-esm.js -Dtarget=es6-module */ -//#if tester1-esm-worker +//#if target=es6-module import {default as sqlite3InitModule} from './jswasm/sqlite3.mjs'; self.sqlite3InitModule = sqlite3InitModule; //#else diff --git a/manifest b/manifest index d9beffb9d9..ae619fc516 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C New\sassert()s\sconfirm\sthat\sBTREE_PREFORMAT\smust\sbe\sthe\ssame\svalue\sas\nOPFLAG_PREFORMAT. -D 2022-11-19T20:10:55.364 +C Minor\scleanups\sin\sthe\sESM-related\spreprocessor\sfiltering. +D 2022-11-20T01:15:22.201 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -488,21 +488,21 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 616c2a3e944483f6f5f66a6f77885eb7a7d3fef1a599014d746a792b6ef7b6b6 +F ext/wasm/GNUmakefile 3de890d61bccab21dce204848a9aaa4b009acee6e399604a1c9ecc5d1b418e7b F ext/wasm/README-dist.txt 2d670b426fc7c613b90a7d2f2b05b433088fe65181abead970980f0a4a75ea20 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 9120c2f8f51fa85f46dcf4dcb6b12f4a807d428f6089b99cdb08d8ddfcfd88b2 F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287 F ext/wasm/api/README.md 29276a845e57004e82efba61fa5866fd05f9137380a1dc26dc4c6d65264cd81c -F ext/wasm/api/extern-post-js.js 015121df2c903cf12d51507227b756ab3626036d8e9d610a2a2c15b3f54afe4d +F ext/wasm/api/extern-post-js.js 5a92c0afe8edbdfffc6831e60d7fd108594e37c4a364507035e7d3296589b153 F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41 F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1 F ext/wasm/api/post-js-header.js d6ab3dfef4a06960d28a7eaa338d4e2a1a5981e9b38718168bbde8fdb2a439b8 -F ext/wasm/api/pre-js.js 1156a7fb9de817bb1cb39ad90b76aa93fbb9dcf950a1f2d6f547e5976872be36 +F ext/wasm/api/pre-js.js b88499dc303c21fc3f55f2c364a0f814f587b60a95784303881169f9e91c1d5f F ext/wasm/api/sqlite3-api-cleanup.js ecdc69dbfccfe26146f04799fcfd4a6f5790d46e7e3b9b6e9b0491f92ed8ae34 F ext/wasm/api/sqlite3-api-glue.js 056f44b82c126358a0175e08a892d56fadfce177b0d7a0012502a6acf67ea6d5 F ext/wasm/api/sqlite3-api-oo1.js e9a83489bbb4838ce0aee46eaaa9350e0e25a5b926b565e4f5ae8e840e4fbaed -F ext/wasm/api/sqlite3-api-opfs.js 9f115a37dafe8067bce8812996d2deff45741c6e39f7aad7b48f5fbbd822dba5 +F ext/wasm/api/sqlite3-api-opfs.js b4ece97f94aacd408b37fbe5f6d6bb2cbfbed484ce700b17d1d446a55e6b7e81 F ext/wasm/api/sqlite3-api-prologue.js fd526fa017fa2578673ca18158354515c719e719a5d93f2f6d0e43f39170430e F ext/wasm/api/sqlite3-api-worker1.js e94ba98e44afccfa482874cd9acb325883ade50ed1f9f9526beb9de1711f182f F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3 @@ -549,9 +549,9 @@ F ext/wasm/sql/000-mandelbrot.sql 775337a4b80938ac8146aedf88808282f04d02d983d826 F ext/wasm/sql/001-sudoku.sql 35b7cb7239ba5d5f193bc05ec379bcf66891bce6f2a5b3879f2f78d0917299b5 F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555e685bce3da8c3f F ext/wasm/test-opfs-vfs.js 44363db07b2a20e73b0eb1808de4400ca71b703af718d0fa6d962f15e73bf2ac -F ext/wasm/tester1-esm.html 821c7a38b4eb753f6f3d7b5cbfda5b36f85466763977f96bff8372621b6b9eb2 +F ext/wasm/tester1-esm.html aef2e711655660ece4f726ff88332238da2811b9fe7e4987d621f35f9f41d6b6 F ext/wasm/tester1-worker.html 84d56db05bcea2b294a89ca13c21b76fa0521ca4ac240f0055f1819934c713fc -F ext/wasm/tester1.c-pp.js f4b96977a48cdfc13d477ede6d2f754865e9bcd1a23ce09359c31de41b24ba0d +F ext/wasm/tester1.c-pp.js 0c129495d057c77788b59715152d51f9bf9002ebbcce759ef8b028272ce3519d F ext/wasm/tester1.html 624ec41cd9f78a1f2b6d7df70aaa7a6394396b1f2455ecbd6de5775c1275b121 F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5 F ext/wasm/wasmfs.make 8aa7565f9de8dd3c291ad8c3ceb1a2c67a3eb31a8e531070b25c6c6b1f0278bf @@ -2057,8 +2057,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9776fa31758161970a50995a487b6543ed71e9610460b7324304ef21d9248707 -R bee5cd2196754b460638bc4389e4c820 -U drh -Z 72dd876552688ca64c7de697dec658ae +P f40bf2c642643ae61d331e8d4815f601224fa258ab34344c6756966163a89f4a +R bd56fdaa00a2ddbbb971d4117ea354ba +U stephan +Z faec45069379feabec016e0ee445a4ae # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 83c0e52e7b..4f65f59d3a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f40bf2c642643ae61d331e8d4815f601224fa258ab34344c6756966163a89f4a \ No newline at end of file +205884a273128bb666b496b659b4fa9f031ebdbbc1aa704fdeb4b7e015740098 \ No newline at end of file From 8e1bd8264d53a4042447a1ed4208f5db0b33891d Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 20 Nov 2022 04:13:16 +0000 Subject: [PATCH 09/21] Add 'snapshot' target to create distinctly-named snapshot builds of the wasm deliverables zip file. FossilOrigin-Name: f7620aa09e4893971e00cdee5c6f1fe15c3bd21f985bec90fbd90fdfc457ac31 --- ext/wasm/dist.make | 51 +++++++++++++++++++++++----------------------- manifest | 12 +++++------ manifest.uuid | 2 +- 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/ext/wasm/dist.make b/ext/wasm/dist.make index f33711a19d..b64663c105 100644 --- a/ext/wasm/dist.make +++ b/ext/wasm/dist.make @@ -10,31 +10,30 @@ MAKEFILE.dist := $(lastword $(MAKEFILE_LIST)) ######################################################################## -# Chicken/egg situation: we need $(bin.version-info) to get the version -# info for the archive name, but that binary may not yet be built, and -# won't be built until we expand the dependencies. We have to use a -# temporary name for the archive. -dist-name = sqlite-wasm-TEMP -#ifeq (0,1) -# $(info WARNING *******************************************************************) -# $(info ** Be sure to create the desired build configuration before creating the) -# $(info ** distribution archive. Use one of the following targets to do so:) -# $(info **) -# $(info ** o2: builds with -O2, resulting in the fastest builds) -# $(info ** oz: builds with -Oz, resulting in the smallest builds) -# $(info /WARNING *******************************************************************) -#endif +# Chicken/egg situation: we need $(bin.version-info) to get the +# version info for the archive name, but that binary may not yet be +# built, and won't be built until we expand the dependencies. Thus we +# have to use a temporary name for the archive until we can get +# that binary built. +ifeq (,$(filter snapshot,$(MAKECMDGOALS))) +dist-name-prefix := sqlite-wasm +else +dist-name-prefix := sqlite-wasm-snapshot-$(shell /usr/bin/date +%Y%m%d) +endif +dist-name := $(dist-name-prefix)-TEMP ######################################################################## -# dist.build must be the name of a target which triggers the -# build of the files to be packed into the dist archive. The -# intention is that it be one of (o0, o1, o2, o3, os, oz), each of -# which uses like-named -Ox optimization level flags. The o2 target -# provides the best overall runtime speeds. The oz target provides -# slightly slower speeds (roughly 10%) with significantly smaller WASM -# file sizes. Note that -O2 (the o2 target) results in faster binaries -# than both -O3 and -Os (the o3 and os targets) in all tests run to -# date. +# dist.build must be the name of a target which triggers the build of +# the files to be packed into the dist archive. The intention is that +# it be one of (o0, o1, o2, o3, os, oz), each of which uses like-named +# -Ox optimization level flags. The o2 target provides the best +# overall runtime speeds. The oz target provides slightly slower +# speeds (roughly 10%) with significantly smaller WASM file +# sizes. Note that -O2 (the o2 target) results in faster binaries than +# both -O3 and -Os (the o3 and os targets) in all tests run to +# date. Our general policy is that we want the smallest binaries for +# dist zip files, so use the oz build unless there is a compelling +# reason not to. dist.build ?= oz dist-dir.top := $(dist-name) @@ -52,7 +51,7 @@ dist.common.extras := \ $(wildcard $(dir.common)/*.css) \ $(dir.common)/SqliteTestUtil.js -.PHONY: dist +.PHONY: dist snapshot ######################################################################## # dist: create the end-user deliverable archive. # @@ -84,7 +83,7 @@ dist: \ @cp -p $(dist.common.extras) $(dist-dir.common) @set -e; \ vnum=$$($(bin.version-info) --download-version); \ - vdir=sqlite-wasm-$$vnum; \ + vdir=$(dist-name-prefix)-$$vnum; \ arczip=$$vdir.zip; \ echo "Making $$arczip ..."; \ rm -fr $$arczip $$vdir; \ @@ -94,7 +93,7 @@ dist: \ ls -la $$arczip; \ set +e; \ unzip -lv $$arczip || echo "Missing unzip app? Not fatal." - +snapshot: dist # We need a separate `clean` rule to account for weirdness in # a sub-make, where we get a copy of the $(dist-name) dir # copied into the new $(dist-name) dir. diff --git a/manifest b/manifest index ae619fc516..03022549e2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Minor\scleanups\sin\sthe\sESM-related\spreprocessor\sfiltering. -D 2022-11-20T01:15:22.201 +C Add\s'snapshot'\starget\sto\screate\sdistinctly-named\ssnapshot\sbuilds\sof\sthe\swasm\sdeliverables\szip\sfile. +D 2022-11-20T04:13:16.594 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -527,7 +527,7 @@ F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98 F ext/wasm/demo-worker1-promiser.js b85a2bb1b918db4f09dfa24419241cb3edad7791389425c2505092e9b715017d F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d F ext/wasm/demo-worker1.js a619adffc98b75b66c633b00f747b856449a134a9a0357909287d80a182d70fa -F ext/wasm/dist.make d00562b499096704304d9879f834a76475c8dd7ac58aaa3f039625ecc299aa3d +F ext/wasm/dist.make ff970852dbf879c8e29a3b060b4451d54ea309cc5373feb746bce96a256cfce8 F ext/wasm/fiddle.make 2812c44c9bafb5be9c8767963d1b9f374d77af7795fcaa06483c03e7059dea74 F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f F ext/wasm/fiddle/fiddle-worker.js b4a0c8ab6c0983218543ca771c45f6075449f63a1dcf290ae5a681b2cba8800d @@ -2057,8 +2057,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f40bf2c642643ae61d331e8d4815f601224fa258ab34344c6756966163a89f4a -R bd56fdaa00a2ddbbb971d4117ea354ba +P 205884a273128bb666b496b659b4fa9f031ebdbbc1aa704fdeb4b7e015740098 +R 68583681205ba1b84e3374ab2ab4b57b U stephan -Z faec45069379feabec016e0ee445a4ae +Z 0d4fea2843b4049473725debb938394b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4f65f59d3a..d32aa7bfc4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -205884a273128bb666b496b659b4fa9f031ebdbbc1aa704fdeb4b7e015740098 \ No newline at end of file +f7620aa09e4893971e00cdee5c6f1fe15c3bd21f985bec90fbd90fdfc457ac31 \ No newline at end of file From b2873a30140d495df32a20a4a6e0769e45974b1b Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 20 Nov 2022 04:14:00 +0000 Subject: [PATCH 10/21] Generic cleanups and doc additions in the wasm build files. FossilOrigin-Name: d10f385e36ee7fe3077d80d8d6e7ce55732d20ef73e2a63533d8d2932ec8bf62 --- ext/wasm/GNUmakefile | 327 ++++++++++++++++++++++++++----------------- ext/wasm/wasmfs.make | 2 +- manifest | 14 +- manifest.uuid | 2 +- 4 files changed, 206 insertions(+), 139 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 1c74531403..f803696c6e 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -20,6 +20,13 @@ # above-listed o? target names. # # clean = clean up +# +# Required tools beyond those needed for the canonical builds: +# +# - Emscripten SDK: https://emscripten.org/docs/getting_started/downloads.html +# - GNU make, GNU sed, GNU awk, GNU grep +# - wasm-strip for release builds: https://github.com/WebAssembly/wabt +# - InfoZip for 'dist' zip file ######################################################################## SHELL := $(shell which bash 2>/dev/null) MAKEFILE := $(lastword $(MAKEFILE_LIST)) @@ -71,17 +78,19 @@ dir.jacc := jaccwabyt dir.common := common dir.fiddle := fiddle dir.tool := $(dir.top)/tool +CLEAN_FILES += *~ $(dir.jacc)/*~ $(dir.api)/*~ $(dir.common)/*~ $(dir.fiddle)/*~ + ######################################################################## # dir.dout = output dir for deliverables. # -# MAINTENANCE REMINDER: the output .js and .wasm files of emcc must be -# in _this_ dir, rather than a subdir, or else parts of the generated -# code get confused and cannot load property. Specifically, when X.js -# loads X.wasm, whether or not X.js uses the correct path for X.wasm -# depends on how it's loaded: an HTML script tag will resolve it -# intuitively, whereas a Worker's call to importScripts() will not. -# That's a fundamental incompatibility with how URL resolution in -# JS happens between those two contexts. See: +# MAINTENANCE REMINDER: the output .js and .wasm files of certain emcc +# buildables must be in _this_ dir, rather than a subdir, or else +# parts of the generated code get confused and cannot load +# property. Specifically, when X.js loads X.wasm, whether or not X.js +# uses the correct path for X.wasm depends on how it's loaded: an HTML +# script tag will resolve it intuitively, whereas a Worker's call to +# importScripts() will not. That's a fundamental incompatibility with +# how URL resolution in JS happens between those two contexts. See: # # https://zzz.buzz/2017/03/14/relative-uris-in-web-development/ # @@ -104,11 +113,10 @@ ifeq (,$(wildcard $(dir.tmp))) dir._tmp := $(shell mkdir -p $(dir.tmp)) endif -cflags.common := -I. -I.. -I$(dir.top) -CLEAN_FILES += *~ $(dir.jacc)/*~ $(dir.api)/*~ $(dir.common)/*~ -emcc.WASM_BIGINT ?= 1 sqlite3.c := $(dir.top)/sqlite3.c sqlite3.h := $(dir.top)/sqlite3.h +# Most SQLITE_OPT flags are set in sqlite3-wasm.c but we need them +# made explicit here for building speedtest1.c. SQLITE_OPT = \ -DSQLITE_ENABLE_FTS5 \ -DSQLITE_ENABLE_RTREE \ @@ -130,43 +138,6 @@ SQLITE_OPT = \ '-DSQLITE_DEFAULT_UNIX_VFS="unix-none"' \ -DSQLITE_USE_URI=1 \ -DSQLITE_WASM_ENABLE_C_TESTS -# ^^^ most flags are set in sqlite3-wasm.c but we need them -# made explicit here for building speedtest1.c. - -ifneq (,$(filter release,$(MAKECMDGOALS))) -emcc_opt ?= -Oz -flto -else -emcc_opt ?= -O0 -# ^^^^ build times for -O levels higher than 0 are painful at -# dev-time. -endif -# When passing emcc_opt from the CLI, += and re-assignment have no -# effect, so emcc_opt+=-g3 doesn't work. So... -emcc_opt_full := $(emcc_opt) -g3 -# ^^^ ALWAYS use -g3. See below for why. -# -# ^^^ -flto improves runtime speed at -O0 considerably but doubles -# build time. -# -# ^^^^ -O3, -Oz, -Os minify symbol names and there appears to be no -# way around that except to use -g3, but -g3 causes the binary file -# size to absolutely explode (approx. 5x larger). This minification -# utterly breaks the resulting module, making it unsable except as -# self-contained/self-referential-only code, as ALL of the exported -# symbols get minified names. -# -# However, we have an option for using -Oz or -Os: -# -# Build with (-Os -g3) or (-Oz -g3) then use wasm-strip, from the wabt -# tools package (https://github.com/WebAssembly/wabt), to strip the -# debugging symbols. That results in a small build with unmangled -# symbol names. -Oz gives ever-so-slightly better compression than -# -Os: not quite 1% in some completely unscientific tests. Runtime -# speed for the unit tests is all over the place either way so it's -# difficult to say whether -Os gives any speed benefit over -Oz. -# -# (Much later: -O2 consistently gives the best speeds.) -######################################################################## $(sqlite3.c) $(sqlite3.h): $(MAKE) -C $(dir.top) sqlite3.c @@ -186,13 +157,20 @@ else $(info Development build. Use '$(MAKE) release' for a smaller release build.) endif +# bin.version-info = binary to output various sqlite3 version info for +# embedding in the JS files and in building the distribution zip file. +# It must NOT be in $(dir.tmp) because we need it to survive the +# cleanup process for the dist build to work properly. bin.version-info := $(dir.wasm)/version-info -# ^^^^ NOT in $(dir.tmp) because we need it to survive the cleanup -# process for the dist build to work properly. $(bin.version-info): $(dir.wasm)/version-info.c $(sqlite3.h) $(MAKEFILE) $(CC) -O0 -I$(dir.top) -o $@ $< DISTCLEAN_FILES += $(bin.version-info) +# bin.stripcomments is used for stripping C/C++-style comments from JS +# files. The JS files contain large chunks of documentation which we +# don't need for all builds. That app's -k flag is of particular +# importance here, as it allows us to retain the opening comment +# blocks, which contain the license header and version info. bin.stripccomments := $(dir.tool)/stripccomments $(bin.stripccomments): $(bin.stripccomments).c $(MAKEFILE) $(CC) -o $@ $< @@ -200,7 +178,8 @@ DISTCLEAN_FILES += $(bin.stripccomments) ######################################################################## -# Transform $(1) to $(2) via ./c-pp -f $(1) ... +# C-PP.FILTER: a $(call)able to transform $(1) to $(2) via ./c-pp -f +# $(1) ... # # Historical notes: # @@ -237,17 +216,67 @@ CLEAN_FILES += $(2) endef c-pp.D.vanilla ?= c-pp.D.esm ?= -Dtarget=es6-module -# /end CPP-of-JS bits +# /end C-PP.FILTER ######################################################################## +# cflags.common = C compiler flags for all builds +cflags.common := -I. -I.. -I$(dir.top) +# emcc.WASM_BIGINT = 1 for BigInt (C int64) support, else 0. The API +# disables certain features if BigInt is not enabled and such builds +# _are not tested_ on any regular basis. +emcc.WASM_BIGINT ?= 1 + +# emcc_opt = optimization-related flags. These are primarily used by +# the various oX targets. build times for -O levels higher than 0 are +# painful at dev-time. +emcc_opt ?= -O0 + +# When passing emcc_opt from the CLI, += and re-assignment have no +# effect, so emcc_opt+=-g3 doesn't work. So... +emcc_opt_full := $(emcc_opt) -g3 +# ^^^ ALWAYS use -g3. See below for why. +# +# ^^^ -flto improves runtime speed at -O0 considerably but doubles +# build time. +# +# ^^^^ -O3, -Oz, -Os minify symbol names and there appears to be no +# way around that except to use -g3, but -g3 causes the binary file +# size to absolutely explode (approx. 5x larger). This minification +# utterly breaks the resulting module, making it unsable except as +# self-contained/self-referential-only code, as ALL of the exported +# symbols get minified names. +# +# However, we have an option for using -Oz or -Os: +# +# Build with (-Os -g3) or (-Oz -g3) then use wasm-strip, from the wabt +# tools package (https://github.com/WebAssembly/wabt), to strip the +# debugging symbols. That results in a small build with unmangled +# symbol names. -Oz gives ever-so-slightly better compression than +# -Os: not quite 1% in some completely unscientific tests. Runtime +# speed for the unit tests is all over the place either way so it's +# difficult to say whether -Os gives any speed benefit over -Oz. +# +# Much practice has demonstrated that -O2 consistently gives the best +# runtime speeds, but not by a large enough factor to rule out use of +# -Oz when small deliverable size is a priority. +######################################################################## + +# EXPORTED_FUNCTIONS.* = files for use with Emscripten's +# -sEXPORTED_FUNCTION flag. EXPORTED_FUNCTIONS.api.in := $(abspath $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-api) EXPORTED_FUNCTIONS.api := $(dir.tmp)/EXPORTED_FUNCTIONS.api $(EXPORTED_FUNCTIONS.api): $(EXPORTED_FUNCTIONS.api.in) $(MAKEFILE) - cat $(EXPORTED_FUNCTIONS.api.in) > $@ + cp $(EXPORTED_FUNCTIONS.api.in) $@ +# sqlite3-license-version.js = generated JS file with the license +# header and version info. sqlite3-license-version.js := $(dir.tmp)/sqlite3-license-version.js +# sqlite3-license-version-header.js = JS file containing only the +# license header. sqlite3-license-version-header.js := $(dir.api)/sqlite3-license-version-header.js +# sqlite3-api-build-version.js = generated JS file which populates the +# sqlite3.version object using $(bin.version-info). sqlite3-api-build-version.js := $(dir.tmp)/sqlite3-api-build-version.js # sqlite3-api.jses = the list of JS files which make up $(sqlite3-api.js), in # the order they need to be assembled. @@ -267,6 +296,8 @@ sqlite3-api.jses += $(dir.api)/sqlite3-api-cleanup.js SOAP.js := $(dir.api)/sqlite3-opfs-async-proxy.js sqlite3-worker1.js := $(dir.api)/sqlite3-worker1.js sqlite3-worker1-promiser.js := $(dir.api)/sqlite3-worker1-promiser.js +# COPY_XAPI = a $(call)able function to copy $1 to $(dir.dout), where +# $1 must be one of the "external" JS API files. define COPY_XAPI sqlite3-api.ext.jses += $$(dir.dout)/$$(notdir $(1)) $$(dir.dout)/$$(notdir $(1)): $(1) $$(MAKEFILE) @@ -276,6 +307,9 @@ $(foreach X,$(SOAP.js) $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js),\ $(eval $(call COPY_XAPI,$(X)))) all: $(sqlite3-api.ext.jses) +# sqlite3-api.js.in = the generated sqlite3-api.js before it gets +# preprocessed. It contains all of $(sqlite3-api.jses) but none of the +# Emscripten-specific headers and footers. sqlite3-api.js.in := $(dir.tmp)/sqlite3-api.c-pp.js $(sqlite3-api.js.in): $(sqlite3-api.jses) $(MAKEFILE) @echo "Making $@..." @@ -294,10 +328,22 @@ $(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE) echo ';'; \ echo '});'; \ } > $@ +$(sqlite3-license-version.js): $(sqlite3.h) $(sqlite3-license-version-header.js) \ + $(MAKEFILE) + @echo "Making $@..."; { \ + cat $(sqlite3-license-version-header.js); \ + echo '/*'; \ + echo '** This code was built from sqlite3 version...'; \ + echo "** "; \ + awk -e '/define SQLITE_VERSION/{$$1=""; print "**" $$0}' \ + -e '/define SQLITE_SOURCE_ID/{$$1=""; print "**" $$0}' $(sqlite3.h); \ + echo '*/'; \ + } > $@ ######################################################################## # --post-js and --pre-js are emcc flags we use to append/prepend JS to -# the generated emscripten module file. +# the generated emscripten module file. The following rules generate +# various versions of those files for the vanilla and ESM builds. pre-js.js.in := $(dir.api)/pre-js.js pre-js.js.esm := $(dir.tmp)/pre-js.esm.js pre-js.js.vanilla := $(dir.tmp)/pre-js.vanilla.js @@ -320,6 +366,9 @@ $(post-js.js.in): $(post-jses.js) $(MAKEFILE) $(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.vanilla),$(c-pp.D.vanilla))) $(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.esm),$(c-pp.D.esm))) +# extern-post-js* and extern-pre-js* are files for use with +# Emscripten's --extern-pre-js and --extern-post-js flags. These +# rules make different copies for the vanilla and ESM builds. extern-post-js.js.in := $(dir.api)/extern-post-js.js extern-post-js.js.vanilla := $(dir.tmp)/extern-post-js.vanilla.js extern-post-js.js.esm := $(dir.tmp)/extern-post-js.esm.js @@ -327,7 +376,8 @@ $(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.vanilla),$ $(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.esm),$(c-pp.D.esm))) extern-pre-js.js := $(dir.api)/extern-pre-js.js -# Emscripten flags for --[extern-][pre|post]-js=... +# Emscripten flags for --[extern-][pre|post]-js=... for the +# various builds. pre-post-common.flags := \ --extern-pre-js=$(sqlite3-license-version.js) pre-post-common.flags.vanilla := \ @@ -339,26 +389,21 @@ pre-post-common.flags.esm := \ --post-js=$(post-js.js.esm) \ --extern-post-js=$(extern-post-js.js.esm) +# pre-post-jses.deps.* = a list of dependencies for the +# --[extern-][pre/post]-js files. pre-post-jses.deps.common := $(extern-pre-js.js) $(sqlite3-license-version.js) pre-post-jses.deps.vanilla := $(pre-post-jses.deps.common) \ $(post-js.js.vanilla) $(extern-post-js.js.vanilla) pre-post-jses.deps.esm := $(pre-post-jses.deps.common) \ $(post-js.js.esm) $(extern-post-js.js.esm) -$(sqlite3-license-version.js): $(sqlite3.h) $(sqlite3-license-version-header.js) $(MAKEFILE) - @echo "Making $@..."; { \ - cat $(sqlite3-license-version-header.js); \ - echo '/*'; \ - echo '** This code was built from sqlite3 version...'; \ - echo "** "; \ - awk -e '/define SQLITE_VERSION/{$$1=""; print "**" $$0}' \ - -e '/define SQLITE_SOURCE_ID/{$$1=""; print "**" $$0}' $(sqlite3.h); \ - echo '*/'; \ - } > $@ ######################################################################## -# call-make-pre-js creates rules for pre-js-$(1).js. $1 = the base -# name of the JS file on whose behalf this pre-js is for. $2 is the -# build mode: one of (vanilla, esm). +# call-make-pre-js is a $(call)able which creates rules for +# pre-js-$(1).js. $1 = the base name of the JS file on whose behalf +# this pre-js is for. $2 is the build mode: one of (vanilla, esm). +# This sets up --[extern-][pre/post]-js flags in +# $(pre-post-$(1).flags.$(2)) and dependencies in +# $(pre-post-$(1).deps.$(2)). define call-make-pre-js pre-post-$(1).flags.$(2) ?= $$(dir.tmp)/pre-js-$(1)-$(2).js: $$(pre-js.js.$(2)) $$(MAKEFILE) @@ -375,29 +420,30 @@ pre-post-$(1).flags.$(2) += \ $$(pre-post-common.flags.$(2)) \ --pre-js=$$(dir.tmp)/pre-js-$(1)-$(2).js endef -#$(error $(call call-make-pre-js,sqlite3-wasmfs)) # /post-js and pre-js ######################################################################## ######################################################################## # emcc flags for .c/.o/.wasm/.js. emcc.flags := -#emcc.flags += -v # _very_ loud but also informative about what it's doing -# -g3 is needed to keep -O2 and higher from creating broken JS via -# minification. +ifeq (1,$(verbose)) +emcc.flags += -v +# -v is _very_ loud but also informative about what it's doing +endif ######################################################################## # emcc flags for .c/.o. emcc.cflags := emcc.cflags += -std=c99 -fPIC -# -------------^^^^^^^^ we currently need c99 for WASM-specific sqlite3 APIs. +# -------------^^^^^^^^ we need c99 for $(sqlite3-wasm.c). emcc.cflags += -I. -I$(dir.top) ######################################################################## -# emcc flags specific to building the final .js/.wasm file... +# emcc flags specific to building .js/.wasm files... emcc.jsflags := -fPIC emcc.jsflags += --minify 0 emcc.jsflags += --no-entry +emcc.jsflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT) emcc.jsflags += -sMODULARIZE emcc.jsflags += -sSTRICT_JS emcc.jsflags += -sDYNAMIC_EXECUTION=0 @@ -405,7 +451,9 @@ emcc.jsflags += -sNO_POLYFILL emcc.jsflags += -sEXPORTED_FUNCTIONS=@$(EXPORTED_FUNCTIONS.api) emcc.exportedRuntimeMethods := \ -sEXPORTED_RUNTIME_METHODS=FS,wasmMemory - # FS ==> stdio/POSIX I/O proxies + # FS ==> stdio/POSIX I/O proxies. Currently used explicitly only + # by the fiddle app, and it must never be exposed to client code + # via our APIs. # wasmMemory ==> required by our code for use with -sIMPORTED_MEMORY emcc.jsflags += $(emcc.exportedRuntimeMethods) emcc.jsflags += -sUSE_CLOSURE_COMPILER=0 @@ -439,32 +487,35 @@ emcc.jsflags += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.$(emcc.INITIAL_MEMORY)) emcc.jsflags += $(emcc.environment) #emcc.jsflags += -sTOTAL_STACK=4194304 - -sqlite3.js.init-func := sqlite3InitModule -# ^^^^ $(sqlite3.js.init-func) symbol name is hard-coded in +######################################################################## +# $(sqlite3.js.init-func) is the name Emscripten assigns our exported +# module init/load function. This symbol name is hard-coded in # $(extern-post-js.js) as well as in numerous docs. If changed, it # needs to be globally modified in *.js and all related documentation. - +# Note that changing it will break client applications, so never +# change it unless you're creating a custom deliverable. +sqlite3.js.init-func := sqlite3InitModule emcc.jsflags += -sEXPORT_NAME=$(sqlite3.js.init-func) emcc.jsflags += -sGLOBAL_BASE=4096 # HYPOTHETICALLY keep func table indexes from overlapping w/ heap addr. #emcc.jsflags += -sSTRICT # fails due to missing __syscall_...() #emcc.jsflags += -sALLOW_UNIMPLEMENTED_SYSCALLS #emcc.jsflags += -sFILESYSTEM=0 # only for experimentation. sqlite3 needs the FS API -#emcc.jsflags += -sABORTING_MALLOC +#emcc.jsflags += -sABORTING_MALLOC # only for experimentation emcc.jsflags += -sALLOW_TABLE_GROWTH -# -sALLOW_TABLE_GROWTH is required for installing new SQL UDFs +# ^^^^ -sALLOW_TABLE_GROWTH is required for installing new SQL UDFs emcc.jsflags += -Wno-limited-postlink-optimizations -# ^^^^^ it likes to warn when we have "limited optimizations" via the -g3 flag. -#emcc.jsflags += -sSTANDALONE_WASM # causes OOM errors, not sure why -# https://lld.llvm.org/WebAssembly.html -emcc.jsflags += -sERROR_ON_UNDEFINED_SYMBOLS=0 +# ^^^^ emcc likes to warn when we have "limited optimizations" via the +# -g3 flag. +# emcc.jsflags += -sSTANDALONE_WASM # causes OOM errors, not sure why. + +# Re. undefined symbol handling, see: https://lld.llvm.org/WebAssembly.html +emcc.jsflags += -sERROR_ON_UNDEFINED_SYMBOLS=1 emcc.jsflags += -sLLD_REPORT_UNDEFINED #emcc.jsflags += --allow-undefined #emcc.jsflags += --import-undefined #emcc.jsflags += --unresolved-symbols=import-dynamic --experimental-pic #emcc.jsflags += --experimental-pic --unresolved-symbols=ingore-all --import-undefined #emcc.jsflags += --unresolved-symbols=ignore-all -emcc.jsflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT) ######################################################################## # -sMEMORY64=1 fails to load, erroring with: @@ -476,18 +527,21 @@ emcc.jsflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT) # new Uint8Array(wasm.heap8u().buffer, ptr, n) # # because ptr is now a BigInt, so is invalid for passing to arguments -# which have strict must-be-a-Number requirements. +# which have strict must-be-a-Number requirements. That aspect will +# make any eventual port to 64-bit address space extremely painful, as +# such constructs are found all over the place in the source code. ######################################################################## ######################################################################## # -sSINGLE_FILE: -# https://github.com/emscripten-core/emscripten/blob/main/src/settings.js#L1704 -# -sSINGLE_FILE=1 would be really nice but we have to build with -g3 +# https://github.com/emscripten-core/emscripten/blob/main/src/settings.js +# +# -sSINGLE_FILE=1 would be _really_ nice but we have to build with -g3 # for -O2 and higher to work (else minification breaks the code) and # cannot wasm-strip the binary before it gets encoded into the JS -# file. The result is that the generated JS file is, because of the -g3 -# debugging info, _huge_. +# file. The result is that the generated JS file is, because of the +# -g3 debugging info, _huge_. ######################################################################## sqlite3.js := $(dir.dout)/sqlite3.js @@ -504,36 +558,41 @@ sqlite3-wasm.c := $(dir.api)/sqlite3-wasm.c # instead of building a shared copy of sqlite3-wasm.o. $(eval $(call call-make-pre-js,sqlite3,vanilla)) $(eval $(call call-make-pre-js,sqlite3,esm)) -$(sqlite3.js): $(sqlite3.js) $(sqlite3.mjs): $(MAKEFILE) $(sqlite3.wasm.obj) \ $(EXPORTED_FUNCTIONS.api) $(sqlite3.js): $(pre-post-sqlite3.deps.vanilla) $(sqlite3.mjs): $(pre-post-sqlite3.deps.esm) -# SQLITE3.xJS.RECIPE = Recipe body for $(sqlite3.js) and -# $(sqlite3.mjs). $1 = one of (vanilla, esm). +# SQLITE3.xJS.RECIPE = the $(call)able recipe body for $(sqlite3.js) +# and $(sqlite3.mjs). $1 = one of (vanilla, esm). define SQLITE3.xJS.RECIPE @echo "Building $@ ..." $(emcc.bin) -o $@ $(emcc_opt_full) $(emcc.flags) \ $(emcc.jsflags) \ $(pre-post-sqlite3.flags.$(1)) $(emcc.flags.sqlite3.$(1)) \ $(cflags.common) $(SQLITE_OPT) $(sqlite3-wasm.c) - if [ esm = $(1) ]; then \ - sed -i -e '0,/^export default/{/^export default/d}' $@; \ - fi # work around an Emscripten annoyance. See emcc.flags.esm + @if [ esm = $(1) ]; then \ + echo "Fragile workaround for an Emscripten annoyance. See emcc.flags.sqlite3.esm."; \ + sed -i -e '0,/^export default/{/^export default/d}' $@ || exit $$?; \ + if ! grep -q '^export default' $@; then \ + echo "Cannot find export default." 1>&2; \ + exit 1; \ + fi; \ + fi chmod -x $(sqlite3.wasm) $(maybe-wasm-strip) $(sqlite3.wasm) @ls -la $@ $(sqlite3.wasm) endef emcc.flags.sqlite3.vanilla := emcc.flags.sqlite3.esm := -sEXPORT_ES6 -sUSE_ES6_IMPORT_META -# Reminder: even if we use -sEXPORT_ES6=0, emcc _still_ adds: +# Reminder for ESM build: even if we use -sEXPORT_ES6=0, emcc _still_ +# adds: # # export default $(sqlite3.js.init-func); # # when building *.mjs, which is bad because we need to export an # overwritten version of that function and cannot "export default" # twice. Because of this, we have to sed $(sqlite3.mjs) to remove the -# first instance of /^export default/. +# _first_ instance (only) of /^export default/. $(sqlite3.js): $(call SQLITE3.xJS.RECIPE,vanilla) $(sqlite3.mjs): @@ -542,17 +601,18 @@ $(sqlite3.wasm): $(sqlite3.js) $(sqlite3.mjs): $(sqlite3.js) # We have to ensure that we do not build both $(sqlite3.js) and # $(sqlite3.mjs) in parallel because both result in the build of -# $(sqlite3.wasm). We have no way to build just the .mjs file without -# also building the .wasm file. i.e. we're building $(sqlite3.wasm) -# twice, but that's unavoidable. +# $(sqlite3.wasm). We have no(?) way to build just the .mjs file +# without also building the .wasm file. i.e. we're building +# $(sqlite3.wasm) twice, but that's apparently unavoidable. CLEAN_FILES += $(sqlite3.js) $(sqlite3.mjs) $(sqlite3.wasm) all: $(sqlite3.mjs) wasm: $(sqlite3.mjs) -# End main Emscripten-based module build +# End main $(sqlite3.js) build ######################################################################## ######################################################################## -# batch-runner.js... +# batch-runner.js is part of one of the test apps which reads in SQL +# dumps generated by $(speedtest1) and executes them. dir.sql := sql speedtest1 := ../../speedtest1 speedtest1.c := ../../test/speedtest1.c @@ -574,29 +634,30 @@ batch: batch-runner.list all: batch # end batch-runner.js ######################################################################## -# speedtest1.js... -# speedtest1-common.eflags = emcc flags used by multiple builds of speedtest1 +# Wasmified speedtest1 is our primary benchmarking tool. +# +# speedtest1.eflags.common = emcc flags used by multiple builds of speedtest1 # speedtest1.eflags = emcc flags used by main build of speedtest1 -speedtest1-common.eflags := $(emcc_opt_full) +speedtest1.eflags.common := $(emcc_opt_full) speedtest1.eflags := speedtest1.eflags += -sENVIRONMENT=web speedtest1.eflags += -sALLOW_MEMORY_GROWTH speedtest1.eflags += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.$(emcc.INITIAL_MEMORY)) -speedtest1-common.eflags += -sINVOKE_RUN=0 -speedtest1-common.eflags += --no-entry -#speedtest1-common.eflags += -flto -speedtest1-common.eflags += -sABORTING_MALLOC -speedtest1-common.eflags += -sSTRICT_JS -speedtest1-common.eflags += -sMODULARIZE -speedtest1-common.eflags += -Wno-limited-postlink-optimizations +speedtest1.eflags.common += -sINVOKE_RUN=0 +speedtest1.eflags.common += --no-entry +#speedtest1.eflags.common += -flto +speedtest1.eflags.common += -sABORTING_MALLOC +speedtest1.eflags.common += -sSTRICT_JS +speedtest1.eflags.common += -sMODULARIZE +speedtest1.eflags.common += -Wno-limited-postlink-optimizations EXPORTED_FUNCTIONS.speedtest1 := $(abspath $(dir.tmp)/EXPORTED_FUNCTIONS.speedtest1) -speedtest1-common.eflags += -sEXPORTED_FUNCTIONS=@$(EXPORTED_FUNCTIONS.speedtest1) -speedtest1-common.eflags += $(emcc.exportedRuntimeMethods) -speedtest1-common.eflags += -sALLOW_TABLE_GROWTH -speedtest1-common.eflags += -sDYNAMIC_EXECUTION=0 -speedtest1-common.eflags += --minify 0 -speedtest1-common.eflags += -sEXPORT_NAME=$(sqlite3.js.init-func) -speedtest1-common.eflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT) +speedtest1.eflags.common += -sEXPORTED_FUNCTIONS=@$(EXPORTED_FUNCTIONS.speedtest1) +speedtest1.eflags.common += $(emcc.exportedRuntimeMethods) +speedtest1.eflags.common += -sALLOW_TABLE_GROWTH +speedtest1.eflags.common += -sDYNAMIC_EXECUTION=0 +speedtest1.eflags.common += --minify 0 +speedtest1.eflags.common += -sEXPORT_NAME=$(sqlite3.js.init-func) +speedtest1.eflags.common += -sWASM_BIGINT=$(emcc.WASM_BIGINT) speedtest1.exit-runtime0 := -sEXIT_RUNTIME=0 speedtest1.exit-runtime1 := -sEXIT_RUNTIME=1 # Re -sEXIT_RUNTIME=1 vs 0: if it's 1 and speedtest1 crashes, we get @@ -629,8 +690,8 @@ $(speedtest1.js): $(MAKEFILE) $(speedtest1.cses) \ $(EXPORTED_FUNCTIONS.speedtest1) @echo "Building $@ ..." $(emcc.bin) \ - $(speedtest1.eflags) $(speedtest1-common.eflags) $(speedtest1.cflags) \ - $(pre-post-speedtest1.flags.vanilla) \ + $(speedtest1.eflags) $(speedtest1.eflags.common) \ + $(speedtest1.cflags) $(pre-post-speedtest1.flags.vanilla) \ $(SQLITE_OPT) \ $(speedtest1.exit-runtime0) \ -o $@ $(speedtest1.cses) -lm @@ -644,8 +705,9 @@ CLEAN_FILES += $(speedtest1.js) $(speedtest1.wasm) ######################################################################## ######################################################################## -# tester1 is the main unit and regression test application and needs to -# be able to run in 4 separate modes to cover the primary use cases: +# tester1 is the main unit and regression test application and needs +# to be able to run in 4 separate modes to cover the primary +# client-side use cases: # # 1) Load sqlite3 in the main UI thread of a conventional script. # 2) Load sqlite3 in a conventional Worker thread. @@ -672,8 +734,8 @@ all: tester1 .PHONY: o0 o1 o2 o3 os oz o-xtra := -flto # ^^^^ -flto can have a considerably performance boost at -O0 but -# doubles the build time and seems to have negligible effect on -# higher optimization levels. +# doubles the build time and seems to have negligible, if any, effect +# on higher optimization levels. o0: clean $(MAKE) -e "emcc_opt=-O0" o1: clean @@ -691,16 +753,21 @@ oz: clean ######################################################################## # Sub-makes... +# sqlite.org/fiddle application... include fiddle.make # Only add wasmfs if wasmfs.enable=1 or we're running (dist)clean +ifneq (,$(filter wasmfs,$(MAKECMDGOALS))) +wasmfs.enable ?= 1 +else wasmfs.enable ?= $(if $(filter %clean,$(MAKECMDGOALS)),1,0) +endif ifeq (1,$(wasmfs.enable)) # wasmfs build disabled 2022-10-19 per /chat discussion. # OPFS-over-wasmfs was initially a stopgap measure and a convenient # point of comparison for the OPFS sqlite3_vfs's performance, but it # currently doubles our deliverables and build maintenance burden for -# little, if any, benefit. +# little benefit. # ######################################################################## # Some platforms do not support the WASMFS build. Raspberry Pi OS is one @@ -720,8 +787,8 @@ endif ######################################################################## ######################################################################## -# Create deliverables: -ifneq (,$(filter dist,$(MAKECMDGOALS))) +# Create main client downloadable zip file: +ifneq (,$(filter dist snapshot,$(MAKECMDGOALS))) include dist.make endif diff --git a/ext/wasm/wasmfs.make b/ext/wasm/wasmfs.make index 33f812aac6..e4d72059a4 100644 --- a/ext/wasm/wasmfs.make +++ b/ext/wasm/wasmfs.make @@ -101,7 +101,7 @@ $(speedtest1-wasmfs.js): $(speedtest1.cses) $(sqlite3-wasmfs.js) \ $(EXPORTED_FUNCTIONS.speedtest1) @echo "Building $@ ..." $(emcc.bin) \ - $(speedtest1-wasmfs.eflags) $(speedtest1-common.eflags) \ + $(speedtest1-wasmfs.eflags) $(speedtest1.eflags.common) \ $(pre-post-speedtest1-wasmfs.flags) \ $(speedtest1.cflags) \ $(sqlite3-wasmfs.cflags) \ diff --git a/manifest b/manifest index 03022549e2..d2b3c2ece4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\s'snapshot'\starget\sto\screate\sdistinctly-named\ssnapshot\sbuilds\sof\sthe\swasm\sdeliverables\szip\sfile. -D 2022-11-20T04:13:16.594 +C Generic\scleanups\sand\sdoc\sadditions\sin\sthe\swasm\sbuild\sfiles. +D 2022-11-20T04:14:00.750 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -488,7 +488,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 3de890d61bccab21dce204848a9aaa4b009acee6e399604a1c9ecc5d1b418e7b +F ext/wasm/GNUmakefile 003235fe1156e208d66cefe43ff20248e190dd8e4a6d58c3bcf12039af514dce F ext/wasm/README-dist.txt 2d670b426fc7c613b90a7d2f2b05b433088fe65181abead970980f0a4a75ea20 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 9120c2f8f51fa85f46dcf4dcb6b12f4a807d428f6089b99cdb08d8ddfcfd88b2 @@ -554,7 +554,7 @@ F ext/wasm/tester1-worker.html 84d56db05bcea2b294a89ca13c21b76fa0521ca4ac240f005 F ext/wasm/tester1.c-pp.js 0c129495d057c77788b59715152d51f9bf9002ebbcce759ef8b028272ce3519d F ext/wasm/tester1.html 624ec41cd9f78a1f2b6d7df70aaa7a6394396b1f2455ecbd6de5775c1275b121 F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5 -F ext/wasm/wasmfs.make 8aa7565f9de8dd3c291ad8c3ceb1a2c67a3eb31a8e531070b25c6c6b1f0278bf +F ext/wasm/wasmfs.make 8fea9b4f3cde06141de1fc4c586ab405bd32c3f401554f4ebb18c797401a678d F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 @@ -2057,8 +2057,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 205884a273128bb666b496b659b4fa9f031ebdbbc1aa704fdeb4b7e015740098 -R 68583681205ba1b84e3374ab2ab4b57b +P f7620aa09e4893971e00cdee5c6f1fe15c3bd21f985bec90fbd90fdfc457ac31 +R 7c89dac6ffbc92dde31ec50f0fbc1ade U stephan -Z 0d4fea2843b4049473725debb938394b +Z 0b0ddc4c7b7acf4fd988a55bdb70d0c8 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d32aa7bfc4..9492a7d53a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f7620aa09e4893971e00cdee5c6f1fe15c3bd21f985bec90fbd90fdfc457ac31 \ No newline at end of file +d10f385e36ee7fe3077d80d8d6e7ce55732d20ef73e2a63533d8d2932ec8bf62 \ No newline at end of file From 59a9654715f0dd8e20f9de8ddd97c4f52f391ce9 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 20 Nov 2022 04:14:29 +0000 Subject: [PATCH 11/21] Remove an obsolete reference to WASMFS from ext/wasm/index.html. FossilOrigin-Name: 51ff681864ec19844f8e7a46aef132e8a8601a1b64e1f5a243a53c6413f2a61a --- ext/wasm/index.html | 4 ---- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ext/wasm/index.html b/ext/wasm/index.html index 0a6cd0a620..37d66603f6 100644 --- a/ext/wasm/index.html +++ b/ext/wasm/index.html @@ -32,10 +32,6 @@ and testing is currently done against a dev-channel release of Chrome (v107 as of 2022-09-26).
  • -
  • Whether or not WASMFS/OPFS support is enabled on any given - page may depend on build-time options which are off by - default. -
  • The tests and demos... diff --git a/manifest b/manifest index d2b3c2ece4..8aaeeb13df 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Generic\scleanups\sand\sdoc\sadditions\sin\sthe\swasm\sbuild\sfiles. -D 2022-11-20T04:14:00.750 +C Remove\san\sobsolete\sreference\sto\sWASMFS\sfrom\sext/wasm/index.html. +D 2022-11-20T04:14:29.454 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -534,7 +534,7 @@ F ext/wasm/fiddle/fiddle-worker.js b4a0c8ab6c0983218543ca771c45f6075449f63a1dcf2 F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715 F ext/wasm/fiddle/index.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2 F ext/wasm/index-dist.html c4337617c4d6d4d0796827cec28ac81d128c6f911dcf888a290a32ad50890408 -F ext/wasm/index.html 8289252ca8b25a4a76b8e5a86e84c42f5c7ca3302f2b5b1dbdf269fa96c28d84 +F ext/wasm/index.html 5393ced912ee9af18cc8cefbda96fac922839d192d7c3d4ec4f4b42dd7f1cf8b F ext/wasm/jaccwabyt/jaccwabyt.js 95f573de1826474c9605dda620ee622fcb1673ae74f191eb324c0853aa4dcb66 F ext/wasm/jaccwabyt/jaccwabyt.md 9aa6951b529a8b29f578ec8f0355713c39584c92cf1708f63ba0cf917cb5b68e F ext/wasm/module-symbols.html b8eebafef8e536624bbe5f7a3da40c07a9062b843dfd3161a0bb72cbb6763dc5 @@ -2057,8 +2057,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f7620aa09e4893971e00cdee5c6f1fe15c3bd21f985bec90fbd90fdfc457ac31 -R 7c89dac6ffbc92dde31ec50f0fbc1ade +P d10f385e36ee7fe3077d80d8d6e7ce55732d20ef73e2a63533d8d2932ec8bf62 +R 37857805b3b6071fa9b37ce0a0873f80 U stephan -Z 0b0ddc4c7b7acf4fd988a55bdb70d0c8 +Z f1048ad4ae84ec54ea82e7fb7b483cf6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9492a7d53a..6db9a839dc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d10f385e36ee7fe3077d80d8d6e7ce55732d20ef73e2a63533d8d2932ec8bf62 \ No newline at end of file +51ff681864ec19844f8e7a46aef132e8a8601a1b64e1f5a243a53c6413f2a61a \ No newline at end of file From 6d97c1a844f297043c0ca49e117af599dd0915ff Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 20 Nov 2022 05:36:52 +0000 Subject: [PATCH 12/21] Further minor cleanups in the JS build related to vanilla vs ESM. FossilOrigin-Name: 100a596800eca61477d9880092465d594c22be3707f2a11aaf6eb9e234fc6f2d --- ext/wasm/GNUmakefile | 68 +++++++++++++------- ext/wasm/api/extern-post-js.js | 20 +++--- ext/wasm/dist.make | 4 ++ ext/wasm/tester1-esm.html | 25 ------- ext/wasm/tester1-worker.html | 2 +- ext/wasm/{tester1.html => tester1.c-pp.html} | 18 +++++- manifest | 21 +++--- manifest.uuid | 2 +- 8 files changed, 87 insertions(+), 73 deletions(-) delete mode 100644 ext/wasm/tester1-esm.html rename ext/wasm/{tester1.html => tester1.c-pp.html} (69%) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index f803696c6e..647044665c 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -24,7 +24,8 @@ # Required tools beyond those needed for the canonical builds: # # - Emscripten SDK: https://emscripten.org/docs/getting_started/downloads.html -# - GNU make, GNU sed, GNU awk, GNU grep +# - The bash shell +# - GNU make, GNU sed, GNU awk, GNU grep (all in the $PATH) # - wasm-strip for release builds: https://github.com/WebAssembly/wabt # - InfoZip for 'dist' zip file ######################################################################## @@ -426,7 +427,7 @@ endef ######################################################################## # emcc flags for .c/.o/.wasm/.js. emcc.flags := -ifeq (1,$(verbose)) +ifeq (1,$(emcc.verbose)) emcc.flags += -v # -v is _very_ loud but also informative about what it's doing endif @@ -490,10 +491,19 @@ emcc.jsflags += $(emcc.environment) ######################################################################## # $(sqlite3.js.init-func) is the name Emscripten assigns our exported # module init/load function. This symbol name is hard-coded in -# $(extern-post-js.js) as well as in numerous docs. If changed, it -# needs to be globally modified in *.js and all related documentation. -# Note that changing it will break client applications, so never -# change it unless you're creating a custom deliverable. +# $(extern-post-js.js) as well as in numerous docs. +# +# "sqlite3InitModule" is the symbol we document for client use, so +# that's the symbol name which must be exported, whether it comes from +# Emscripten or our own code in extern-post-js.js. +# +# That said... we can change $(sqlite3.js.init-func) as long as the +# name "sqlite3InitModule" is the one which gets exposed via the +# resulting JS files. That can be accomplished via +# extern-post-js.js. However... using a temporary symbol name here +# and then adding sqlite3InitModule() ourselves results in 2 global +# symbols: we cannot "delete" the Emscripten-defined +# $(sqlite3.js.init-func) because it's declared with "var". sqlite3.js.init-func := sqlite3InitModule emcc.jsflags += -sEXPORT_NAME=$(sqlite3.js.init-func) emcc.jsflags += -sGLOBAL_BASE=4096 # HYPOTHETICALLY keep func table indexes from overlapping w/ heap addr. @@ -562,8 +572,23 @@ $(sqlite3.js) $(sqlite3.mjs): $(MAKEFILE) $(sqlite3.wasm.obj) \ $(EXPORTED_FUNCTIONS.api) $(sqlite3.js): $(pre-post-sqlite3.deps.vanilla) $(sqlite3.mjs): $(pre-post-sqlite3.deps.esm) +######################################################################## # SQLITE3.xJS.RECIPE = the $(call)able recipe body for $(sqlite3.js) # and $(sqlite3.mjs). $1 = one of (vanilla, esm). +# +# Reminder for ESM builds: even if we use -sEXPORT_ES6=0, emcc _still_ +# adds: +# +# export default $(sqlite3.js.init-func); +# +# when building *.mjs, which is bad because we need to export an +# overwritten version of that function and cannot "export default" +# twice. Because of this, we have to sed $(sqlite3.mjs) to remove the +# _first_ instance (only) of /^export default/. +# +# Upstream RFE: +# https://github.com/emscripten-core/emscripten/issues/18237 +######################################################################## define SQLITE3.xJS.RECIPE @echo "Building $@ ..." $(emcc.bin) -o $@ $(emcc_opt_full) $(emcc.flags) \ @@ -584,26 +609,19 @@ define SQLITE3.xJS.RECIPE endef emcc.flags.sqlite3.vanilla := emcc.flags.sqlite3.esm := -sEXPORT_ES6 -sUSE_ES6_IMPORT_META -# Reminder for ESM build: even if we use -sEXPORT_ES6=0, emcc _still_ -# adds: -# -# export default $(sqlite3.js.init-func); -# -# when building *.mjs, which is bad because we need to export an -# overwritten version of that function and cannot "export default" -# twice. Because of this, we have to sed $(sqlite3.mjs) to remove the -# _first_ instance (only) of /^export default/. $(sqlite3.js): $(call SQLITE3.xJS.RECIPE,vanilla) $(sqlite3.mjs): $(call SQLITE3.xJS.RECIPE,esm) -$(sqlite3.wasm): $(sqlite3.js) -$(sqlite3.mjs): $(sqlite3.js) +######################################################################## # We have to ensure that we do not build both $(sqlite3.js) and -# $(sqlite3.mjs) in parallel because both result in the build of +# $(sqlite3.mjs) in parallel because both result in the creation of # $(sqlite3.wasm). We have no(?) way to build just the .mjs file # without also building the .wasm file. i.e. we're building -# $(sqlite3.wasm) twice, but that's apparently unavoidable. +# $(sqlite3.wasm) twice, but that's apparently unavoidable (and +# harmless, just a waste of build time). +$(sqlite3.wasm): $(sqlite3.js) +$(sqlite3.mjs): $(sqlite3.js) CLEAN_FILES += $(sqlite3.js) $(sqlite3.mjs) $(sqlite3.wasm) all: $(sqlite3.mjs) wasm: $(sqlite3.mjs) @@ -717,12 +735,14 @@ CLEAN_FILES += $(speedtest1.js) $(speedtest1.wasm) # To that end, we require two separate builds of tester1.js: # # tester1.js: cases 1 and 2 -# tester1-esm.js: cases 3 and 4 +# tester1.mjs: cases 3 and 4 # # To create those, we filter tester1.c-pp.js with $(bin.c-pp)... $(eval $(call C-PP.FILTER,tester1.c-pp.js,tester1.js)) -$(eval $(call C-PP.FILTER,tester1.c-pp.js,tester1-esm.js,$(c-pp.D.esm))) -tester1: tester1.js tester1-esm.js +$(eval $(call C-PP.FILTER,tester1.c-pp.js,tester1.mjs,$(c-pp.D.esm))) +$(eval $(call C-PP.FILTER,tester1.c-pp.html,tester1.html)) +$(eval $(call C-PP.FILTER,tester1.c-pp.html,tester1-esm.html,$(c-pp.D.esm))) +tester1: tester1.js tester1.mjs tester1.html tester1-esm.html all: tester1 ######################################################################## @@ -794,8 +814,8 @@ endif ######################################################################## # Push files to public wasm-testing.sqlite.org server -wasm-testing.include = $(dir.dout) *.js *.html \ - batch-runner.list $(dir.sql) $(dir.common) $(dir.fiddle) $(dir.jacc) +wasm-testing.include = *.js *.html batch-runner.list \ + $(dir.dout) $(dir.sql) $(dir.common) $(dir.fiddle) $(dir.jacc) wasm-testing.exclude = sql/speedtest1.sql wasm-testing.dir = /jail/sites/wasm-testing wasm-testing.dest ?= wasm-testing:$(wasm-testing.dir) diff --git a/ext/wasm/api/extern-post-js.js b/ext/wasm/api/extern-post-js.js index acf7068fef..cace6ed51c 100644 --- a/ext/wasm/api/extern-post-js.js +++ b/ext/wasm/api/extern-post-js.js @@ -13,19 +13,20 @@ const toExportForES6 = //#endif (function(){ /** - In order to hide the sqlite3InitModule()'s resulting Emscripten - module from downstream clients (and simplify our documentation by - being able to elide those details), we rewrite - sqlite3InitModule() to return the sqlite3 object. + In order to hide the sqlite3InitModule()'s resulting + Emscripten module from downstream clients (and simplify our + documentation by being able to elide those details), we hide that + function and expose a hand-written sqlite3InitModule() to return + the sqlite3 object (most of the time). Unfortunately, we cannot modify the module-loader/exporter-based impls which Emscripten installs at some point in the file above this. */ const originalInit = - /*Maintenance reminde: DO NOT use `self.` here. It's correct - for non-ES6 Module cases but wrong for ES6 modules because those - resolve this symbol differently! */ sqlite3InitModule; + /* Maintenance reminder: DO NOT use `self.` here. It's correct + for non-ES6 Module cases but wrong for ES6 modules because those + resolve this symbol differently. */ sqlite3InitModule; if(!originalInit){ throw new Error("Expecting self.sqlite3InitModule to be defined by the Emscripten build."); } @@ -104,10 +105,11 @@ const toExportForES6 = } /* Replace the various module exports performed by the Emscripten glue... */ - if (typeof exports === 'object' && typeof module === 'object') + if (typeof exports === 'object' && typeof module === 'object'){ module.exports = sqlite3InitModule; - else if (typeof exports === 'object') + }else if (typeof exports === 'object'){ exports["sqlite3InitModule"] = sqlite3InitModule; + } /* AMD modules get injected in a way we cannot override, so we can't handle those here. */ return self.sqlite3InitModule /* required for ESM */; diff --git a/ext/wasm/dist.make b/ext/wasm/dist.make index b64663c105..6cd4e48e6b 100644 --- a/ext/wasm/dist.make +++ b/ext/wasm/dist.make @@ -6,6 +6,10 @@ # 'make dist' rules for creating a distribution archive of the WASM/JS # pieces, noting that we only build a dist of the built files, not the # numerous pieces required to build them. +# +# Use 'make snapshot' to create "snapshot" releases. They use a +# distinctly different zip file and top directory name to distinguish +# them from release builds. ####################################################################### MAKEFILE.dist := $(lastword $(MAKEFILE_LIST)) diff --git a/ext/wasm/tester1-esm.html b/ext/wasm/tester1-esm.html deleted file mode 100644 index 498a1ab6a7..0000000000 --- a/ext/wasm/tester1-esm.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - sqlite3 tester #1: ES6 Module in UI thread - - - -

    sqlite3 tester #1: ES6 Module in UI thread

    -
    - - -
    -
    - - - diff --git a/ext/wasm/tester1-worker.html b/ext/wasm/tester1-worker.html index b750df9169..33ffa64186 100644 --- a/ext/wasm/tester1-worker.html +++ b/ext/wasm/tester1-worker.html @@ -46,7 +46,7 @@ logHtml('warning',"Attempting to run an ES6 Worker Module, "+ "which is not supported by all browsers! "+ "e.g. Firefox (as of 2022-11) cannot do this."); - workerArgs.push("tester1-esm.js",{type:"module"}); + workerArgs.push("tester1.mjs",{type:"module"}); document.querySelectorAll('title,#color-target').forEach((e)=>{ e.innerText = "sqlite3 tester #1: ES6 Worker Module"; }); diff --git a/ext/wasm/tester1.html b/ext/wasm/tester1.c-pp.html similarity index 69% rename from ext/wasm/tester1.html rename to ext/wasm/tester1.c-pp.html index f7a2fba4af..b1b68e486e 100644 --- a/ext/wasm/tester1.html +++ b/ext/wasm/tester1.c-pp.html @@ -6,7 +6,13 @@ - sqlite3 tester #1 (UI thread) + sqlite3 tester #1: +//#if target=es6-module +ES6 Module in UI thread +//#else +UI thread +//#endif + -

    sqlite3 WASM/JS tester #1 (UI thread)

    +

    See tester1-worker.html for the Worker-thread variant.
    @@ -22,7 +28,15 @@
    + +//#if target=es6-module + +//#else +//#endif diff --git a/manifest b/manifest index 8aaeeb13df..85775d3bfd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\san\sobsolete\sreference\sto\sWASMFS\sfrom\sext/wasm/index.html. -D 2022-11-20T04:14:29.454 +C Further\sminor\scleanups\sin\sthe\sJS\sbuild\srelated\sto\svanilla\svs\sESM. +D 2022-11-20T05:36:52.173 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -488,13 +488,13 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 003235fe1156e208d66cefe43ff20248e190dd8e4a6d58c3bcf12039af514dce +F ext/wasm/GNUmakefile 712795c4893ea65f8d30fe414937a33b677a194dd58372b4074aee17039c845e F ext/wasm/README-dist.txt 2d670b426fc7c613b90a7d2f2b05b433088fe65181abead970980f0a4a75ea20 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 9120c2f8f51fa85f46dcf4dcb6b12f4a807d428f6089b99cdb08d8ddfcfd88b2 F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287 F ext/wasm/api/README.md 29276a845e57004e82efba61fa5866fd05f9137380a1dc26dc4c6d65264cd81c -F ext/wasm/api/extern-post-js.js 5a92c0afe8edbdfffc6831e60d7fd108594e37c4a364507035e7d3296589b153 +F ext/wasm/api/extern-post-js.js 59e52f579cd3a332d73dae94c91b9579daafb10dd6ada03803f1afa6bdad7689 F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41 F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1 F ext/wasm/api/post-js-header.js d6ab3dfef4a06960d28a7eaa338d4e2a1a5981e9b38718168bbde8fdb2a439b8 @@ -527,7 +527,7 @@ F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98 F ext/wasm/demo-worker1-promiser.js b85a2bb1b918db4f09dfa24419241cb3edad7791389425c2505092e9b715017d F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d F ext/wasm/demo-worker1.js a619adffc98b75b66c633b00f747b856449a134a9a0357909287d80a182d70fa -F ext/wasm/dist.make ff970852dbf879c8e29a3b060b4451d54ea309cc5373feb746bce96a256cfce8 +F ext/wasm/dist.make c9f06b520390fc5ab354b4b124e69c1cc648f97daf52df9de36a852fbdd7a4ea F ext/wasm/fiddle.make 2812c44c9bafb5be9c8767963d1b9f374d77af7795fcaa06483c03e7059dea74 F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f F ext/wasm/fiddle/fiddle-worker.js b4a0c8ab6c0983218543ca771c45f6075449f63a1dcf290ae5a681b2cba8800d @@ -549,10 +549,9 @@ F ext/wasm/sql/000-mandelbrot.sql 775337a4b80938ac8146aedf88808282f04d02d983d826 F ext/wasm/sql/001-sudoku.sql 35b7cb7239ba5d5f193bc05ec379bcf66891bce6f2a5b3879f2f78d0917299b5 F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555e685bce3da8c3f F ext/wasm/test-opfs-vfs.js 44363db07b2a20e73b0eb1808de4400ca71b703af718d0fa6d962f15e73bf2ac -F ext/wasm/tester1-esm.html aef2e711655660ece4f726ff88332238da2811b9fe7e4987d621f35f9f41d6b6 -F ext/wasm/tester1-worker.html 84d56db05bcea2b294a89ca13c21b76fa0521ca4ac240f0055f1819934c713fc +F ext/wasm/tester1-worker.html 5ef353348c37cf2e4fd0b23da562d3275523e036260b510734e9a3239ba8c987 +F ext/wasm/tester1.c-pp.html 74aa9b31c75f12490653f814b53c3dd39f40cd3f70d6a53a716f4e8587107399 w ext/wasm/tester1.html F ext/wasm/tester1.c-pp.js 0c129495d057c77788b59715152d51f9bf9002ebbcce759ef8b028272ce3519d -F ext/wasm/tester1.html 624ec41cd9f78a1f2b6d7df70aaa7a6394396b1f2455ecbd6de5775c1275b121 F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5 F ext/wasm/wasmfs.make 8fea9b4f3cde06141de1fc4c586ab405bd32c3f401554f4ebb18c797401a678d F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x @@ -2057,8 +2056,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d10f385e36ee7fe3077d80d8d6e7ce55732d20ef73e2a63533d8d2932ec8bf62 -R 37857805b3b6071fa9b37ce0a0873f80 +P 51ff681864ec19844f8e7a46aef132e8a8601a1b64e1f5a243a53c6413f2a61a +R b4563c289dd01589021977b3acf0c574 U stephan -Z f1048ad4ae84ec54ea82e7fb7b483cf6 +Z ab7f6de1db50f486d71ae6e36cd71c04 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 6db9a839dc..3140f0d9ea 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -51ff681864ec19844f8e7a46aef132e8a8601a1b64e1f5a243a53c6413f2a61a \ No newline at end of file +100a596800eca61477d9880092465d594c22be3707f2a11aaf6eb9e234fc6f2d \ No newline at end of file From ae276719f002a92d1262fc45e67118922f4707b8 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 20 Nov 2022 05:47:17 +0000 Subject: [PATCH 13/21] js dist: account for a file rename in the previous checkin. FossilOrigin-Name: 469f9011a885e19b99210c5e3e582afa140b8b5f0aa7a720334848df5ab6ae98 --- ext/wasm/dist.make | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/wasm/dist.make b/ext/wasm/dist.make index 6cd4e48e6b..9b0267dac5 100644 --- a/ext/wasm/dist.make +++ b/ext/wasm/dist.make @@ -46,7 +46,7 @@ dist-dir.common := $(dist-dir.top)/common dist.top.extras := \ demo-123.html demo-123-worker.html demo-123.js \ tester1.html tester1-worker.html tester1-esm.html \ - tester1.js tester1-esm.js \ + tester1.js tester1.mjs \ demo-jsstorage.html demo-jsstorage.js \ demo-worker1.html demo-worker1.js \ demo-worker1-promiser.html demo-worker1-promiser.js diff --git a/manifest b/manifest index 85775d3bfd..1c39089785 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Further\sminor\scleanups\sin\sthe\sJS\sbuild\srelated\sto\svanilla\svs\sESM. -D 2022-11-20T05:36:52.173 +C js\sdist:\saccount\sfor\sa\sfile\srename\sin\sthe\sprevious\scheckin. +D 2022-11-20T05:47:17.093 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -527,7 +527,7 @@ F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98 F ext/wasm/demo-worker1-promiser.js b85a2bb1b918db4f09dfa24419241cb3edad7791389425c2505092e9b715017d F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d F ext/wasm/demo-worker1.js a619adffc98b75b66c633b00f747b856449a134a9a0357909287d80a182d70fa -F ext/wasm/dist.make c9f06b520390fc5ab354b4b124e69c1cc648f97daf52df9de36a852fbdd7a4ea +F ext/wasm/dist.make 11b98da79385701a568a4728671821fe2524c1d1ecd05ff2e24cb3e33b2c6c4f F ext/wasm/fiddle.make 2812c44c9bafb5be9c8767963d1b9f374d77af7795fcaa06483c03e7059dea74 F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f F ext/wasm/fiddle/fiddle-worker.js b4a0c8ab6c0983218543ca771c45f6075449f63a1dcf290ae5a681b2cba8800d @@ -550,7 +550,7 @@ F ext/wasm/sql/001-sudoku.sql 35b7cb7239ba5d5f193bc05ec379bcf66891bce6f2a5b3879f F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555e685bce3da8c3f F ext/wasm/test-opfs-vfs.js 44363db07b2a20e73b0eb1808de4400ca71b703af718d0fa6d962f15e73bf2ac F ext/wasm/tester1-worker.html 5ef353348c37cf2e4fd0b23da562d3275523e036260b510734e9a3239ba8c987 -F ext/wasm/tester1.c-pp.html 74aa9b31c75f12490653f814b53c3dd39f40cd3f70d6a53a716f4e8587107399 w ext/wasm/tester1.html +F ext/wasm/tester1.c-pp.html 74aa9b31c75f12490653f814b53c3dd39f40cd3f70d6a53a716f4e8587107399 F ext/wasm/tester1.c-pp.js 0c129495d057c77788b59715152d51f9bf9002ebbcce759ef8b028272ce3519d F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5 F ext/wasm/wasmfs.make 8fea9b4f3cde06141de1fc4c586ab405bd32c3f401554f4ebb18c797401a678d @@ -2056,8 +2056,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 51ff681864ec19844f8e7a46aef132e8a8601a1b64e1f5a243a53c6413f2a61a -R b4563c289dd01589021977b3acf0c574 +P 100a596800eca61477d9880092465d594c22be3707f2a11aaf6eb9e234fc6f2d +R fd97f4afc2e7676e23b759586618b38f U stephan -Z ab7f6de1db50f486d71ae6e36cd71c04 +Z 42f144497d0f844aac38afbea462a28b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3140f0d9ea..6d344e429d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -100a596800eca61477d9880092465d594c22be3707f2a11aaf6eb9e234fc6f2d \ No newline at end of file +469f9011a885e19b99210c5e3e582afa140b8b5f0aa7a720334848df5ab6ae98 \ No newline at end of file From 27c4cd183d91d09e34e310d6349cda2b33c255ba Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 21 Nov 2022 03:50:52 +0000 Subject: [PATCH 14/21] Add test app for experimenting with multi-worker OPFS concurrency. Tweak OPFS VFS to significantly improve the otherwise "unfortunate" concurrency situation. FossilOrigin-Name: 96f76e7616f8157a342b9e1c42f7b1feab200d182268871a2b25f67d4ee2564c --- ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api | 1 + ext/wasm/api/extern-post-js.js | 3 + ext/wasm/api/sqlite3-api-opfs.js | 12 +- ext/wasm/api/sqlite3-api-prologue.js | 1 + ext/wasm/api/sqlite3-opfs-async-proxy.js | 187 +++++++++++--------- ext/wasm/index.html | 3 + ext/wasm/tests/opfs/concurrency/index.html | 34 ++++ ext/wasm/tests/opfs/concurrency/test.js | 97 ++++++++++ ext/wasm/tests/opfs/concurrency/worker.js | 95 ++++++++++ manifest | 25 +-- manifest.uuid | 2 +- 11 files changed, 364 insertions(+), 96 deletions(-) create mode 100644 ext/wasm/tests/opfs/concurrency/index.html create mode 100644 ext/wasm/tests/opfs/concurrency/test.js create mode 100644 ext/wasm/tests/opfs/concurrency/worker.js diff --git a/ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api b/ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api index b903bedee6..1f7908e3b8 100644 --- a/ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api +++ b/ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api @@ -7,6 +7,7 @@ _sqlite3_bind_null _sqlite3_bind_parameter_count _sqlite3_bind_parameter_index _sqlite3_bind_text +_sqlite3_busy_timeout _sqlite3_changes _sqlite3_changes64 _sqlite3_clear_bindings diff --git a/ext/wasm/api/extern-post-js.js b/ext/wasm/api/extern-post-js.js index cace6ed51c..b327837814 100644 --- a/ext/wasm/api/extern-post-js.js +++ b/ext/wasm/api/extern-post-js.js @@ -59,6 +59,9 @@ const toExportForES6 = li.pop(); initModuleState.sqlite3Dir = li.join('/') + '/'; } + if(initModuleState.sqlite3Dir){ + initModuleState.sqlite3Dir = initModuleState.sqlite3Dir.replace(/[/]{2,}/g,'/'); + } self.sqlite3InitModule = (...args)=>{ //console.warn("Using replaced sqlite3InitModule()",self.location); diff --git a/ext/wasm/api/sqlite3-api-opfs.js b/ext/wasm/api/sqlite3-api-opfs.js index a3f73cc7b2..1fd50dcc6f 100644 --- a/ext/wasm/api/sqlite3-api-opfs.js +++ b/ext/wasm/api/sqlite3-api-opfs.js @@ -92,7 +92,8 @@ const installOpfsVfs = function callee(options){ } const urlParams = new URL(self.location.href).searchParams; if(undefined===options.verbose){ - options.verbose = urlParams.has('opfs-verbose') ? 3 : 2; + options.verbose = urlParams.has('opfs-verbose') + ? (+urlParams.get('opfs-verbose') || 2) : 1; } if(undefined===options.sanityChecks){ options.sanityChecks = urlParams.has('opfs-sanity-check'); @@ -101,6 +102,8 @@ const installOpfsVfs = function callee(options){ options.proxyUri = callee.defaultProxyUri; } + //console.warn("OPFS options =",options,self.location); + if('function' === typeof options.proxyUri){ options.proxyUri = options.proxyUri(); } @@ -1154,7 +1157,10 @@ const installOpfsVfs = function callee(options){ [ /* Truncate journal mode is faster than delete or wal for this vfs, per speedtest1. */ - "pragma journal_mode=truncate;" + "pragma journal_mode=truncate;", + /* Set a default busy-timeout handler to help OPFS dbs + deal with multi-tab/multi-worker contention. */ + "pragma busy_timeout=2000;", /* This vfs benefits hugely from cache on moderate/large speedtest1 --size 50 and --size 100 workloads. We currently @@ -1162,7 +1168,7 @@ const installOpfsVfs = function callee(options){ sqlite3.wasm. If that policy changes, the cache can be set here. */ - //"pragma cache_size=-8388608;" + //"pragma cache_size=-16384;" ].join("") ); } diff --git a/ext/wasm/api/sqlite3-api-prologue.js b/ext/wasm/api/sqlite3-api-prologue.js index fed1c56669..8b2ce0936d 100644 --- a/ext/wasm/api/sqlite3-api-prologue.js +++ b/ext/wasm/api/sqlite3-api-prologue.js @@ -897,6 +897,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap( the lines of sqlite3_prepare_v3(). The slightly problematic part is the final argument (text destructor). */ ], + ["sqlite3_busy_timeout","int", "sqlite3*", "int"], ["sqlite3_close_v2", "int", "sqlite3*"], ["sqlite3_changes", "int", "sqlite3*"], ["sqlite3_clear_bindings","int", "sqlite3_stmt*"], diff --git a/ext/wasm/api/sqlite3-opfs-async-proxy.js b/ext/wasm/api/sqlite3-opfs-async-proxy.js index e4657484ef..3701e8c30d 100644 --- a/ext/wasm/api/sqlite3-opfs-async-proxy.js +++ b/ext/wasm/api/sqlite3-opfs-async-proxy.js @@ -53,7 +53,7 @@ const state = Object.create(null); 2 = warnings and errors 3 = debug, warnings, and errors */ -state.verbose = 2; +state.verbose = 1; const loggers = { 0:console.error.bind(console), @@ -150,70 +150,6 @@ const getDirForFilename = async function f(absFilename, createDirs = false){ return [dh, filename]; }; -/** - An error class specifically for use with getSyncHandle(), the goal - of which is to eventually be able to distinguish unambiguously - between locking-related failures and other types, noting that we - cannot currently do so because createSyncAccessHandle() does not - define its exceptions in the required level of detail. -*/ -class GetSyncHandleError extends Error { - constructor(errorObject, ...msg){ - super(); - this.error = errorObject; - this.message = [ - ...msg, ': Original exception ['+errorObject.name+']:', - errorObject.message - ].join(' '); - this.name = 'GetSyncHandleError'; - } -}; - -/** - Returns the sync access handle associated with the given file - handle object (which must be a valid handle object, as created by - xOpen()), lazily opening it if needed. - - In order to help alleviate cross-tab contention for a dabase, - if an exception is thrown while acquiring the handle, this routine - will wait briefly and try again, up to 3 times. If acquisition - still fails at that point it will give up and propagate the - exception. -*/ -const getSyncHandle = async (fh)=>{ - if(!fh.syncHandle){ - const t = performance.now(); - log("Acquiring sync handle for",fh.filenameAbs); - const maxTries = 4, msBase = 300; - let i = 1, ms = msBase; - for(; true; ms = msBase * ++i){ - try { - //if(i<3) toss("Just testing getSyncHandle() wait-and-retry."); - //TODO? A config option which tells it to throw here - //randomly every now and then, for testing purposes. - fh.syncHandle = await fh.fileHandle.createSyncAccessHandle(); - break; - }catch(e){ - if(i === maxTries){ - throw new GetSyncHandleError( - e, "Error getting sync handle.",maxTries, - "attempts failed.",fh.filenameAbs - ); - } - warn("Error getting sync handle. Waiting",ms, - "ms and trying again.",fh.filenameAbs,e); - Atomics.wait(state.sabOPView, state.opIds.retry, 0, ms); - } - } - log("Got sync handle for",fh.filenameAbs,'in',performance.now() - t,'ms'); - if(!fh.xLock){ - __autoLocks.add(fh.fid); - log("Auto-locked",fh.fid,fh.filenameAbs); - } - } - return fh.syncHandle; -}; - /** If the given file-holding object has a sync handle attached to it, that handle is remove and asynchronously closed. Though it may @@ -253,6 +189,101 @@ const closeSyncHandleNoThrow = async (fh)=>{ } }; +/* Release all auto-locks. */ +const closeAutoLocks = async ()=>{ + if(__autoLocks.size){ + /* Release all auto-locks. */ + for(const fid of __autoLocks){ + const fh = __openFiles[fid]; + await closeSyncHandleNoThrow(fh); + log("Auto-unlocked",fid,fh.filenameAbs); + } + } +}; + +/** + An error class specifically for use with getSyncHandle(), the goal + of which is to eventually be able to distinguish unambiguously + between locking-related failures and other types, noting that we + cannot currently do so because createSyncAccessHandle() does not + define its exceptions in the required level of detail. +*/ +class GetSyncHandleError extends Error { + constructor(errorObject, ...msg){ + super(); + this.error = errorObject; + this.message = [ + ...msg, ': Original exception ['+errorObject.name+']:', + errorObject.message + ].join(' '); + this.name = 'GetSyncHandleError'; + } +}; +GetSyncHandleError.convertRc = (e,rc)=>{ + if(1){ + /* This approach returns SQLITE_LOCKED to the C API + when getSyncHandle() fails but makes the very + wild assumption that such a failure _is_ a locking + error. In practice that appears to be the most + common error, by far, but we cannot unambiguously + distinguish that from other errors. + + This approach demonstrably reduces concurrency-related + errors but is highly questionable. + */ + return (e instanceof GetSyncHandleError) + ? state.sq3Codes.SQLITE_LOCKED + : rc; + }else{ + return ec; + } +} +/** + Returns the sync access handle associated with the given file + handle object (which must be a valid handle object, as created by + xOpen()), lazily opening it if needed. + + In order to help alleviate cross-tab contention for a dabase, + if an exception is thrown while acquiring the handle, this routine + will wait briefly and try again, up to 3 times. If acquisition + still fails at that point it will give up and propagate the + exception. +*/ +const getSyncHandle = async (fh)=>{ + if(!fh.syncHandle){ + const t = performance.now(); + log("Acquiring sync handle for",fh.filenameAbs); + const maxTries = 4, msBase = 300; + let i = 1, ms = msBase; + for(; true; ms = msBase * ++i){ + try { + //if(i<3) toss("Just testing getSyncHandle() wait-and-retry."); + //TODO? A config option which tells it to throw here + //randomly every now and then, for testing purposes. + fh.syncHandle = await fh.fileHandle.createSyncAccessHandle(); + break; + }catch(e){ + if(i === maxTries){ + throw new GetSyncHandleError( + e, "Error getting sync handle.",maxTries, + "attempts failed.",fh.filenameAbs + ); + } + warn("Error getting sync handle. Waiting",ms, + "ms and trying again.",fh.filenameAbs,e); + //await closeAutoLocks(); + Atomics.wait(state.sabOPView, state.opIds.retry, 0, ms); + } + } + log("Got sync handle for",fh.filenameAbs,'in',performance.now() - t,'ms'); + if(!fh.xLock){ + __autoLocks.add(fh.fid); + log("Auto-locked",fh.fid,fh.filenameAbs); + } + } + return fh.syncHandle; +}; + /** Stores the given value at state.sabOPView[state.opIds.rc] and then Atomics.notify()'s it. @@ -451,7 +482,7 @@ const vfsAsyncImpls = { rc = 0; }catch(e){ state.s11n.storeException(2,e); - rc = state.sq3Codes.SQLITE_IOERR; + rc = GetSyncHandleError.convertRc(e,state.sq3Codes.SQLITE_IOERR); } wTimeEnd(); storeAndNotify('xFileSize', rc); @@ -471,7 +502,7 @@ const vfsAsyncImpls = { __autoLocks.delete(fid); }catch(e){ state.s11n.storeException(1,e); - rc = state.sq3Codes.SQLITE_IOERR_LOCK; + rc = GetSyncHandleError.convertRc(e,state.sq3Codes.SQLITE_IOERR_LOCK); fh.xLock = oldLockType; } wTimeEnd(); @@ -545,7 +576,7 @@ const vfsAsyncImpls = { if(undefined===nRead) wTimeEnd(); error("xRead() failed",e,fh); state.s11n.storeException(1,e); - rc = state.sq3Codes.SQLITE_IOERR_READ; + rc = GetSyncHandleError.convertRc(e,state.sq3Codes.SQLITE_IOERR_READ); } storeAndNotify('xRead',rc); mTimeEnd(); @@ -579,7 +610,7 @@ const vfsAsyncImpls = { }catch(e){ error("xTruncate():",e,fh); state.s11n.storeException(2,e); - rc = state.sq3Codes.SQLITE_IOERR_TRUNCATE; + rc = GetSyncHandleError.convertRc(e,state.sq3Codes.SQLITE_IOERR_TRUNCATE); } wTimeEnd(); storeAndNotify('xTruncate',rc); @@ -619,7 +650,7 @@ const vfsAsyncImpls = { }catch(e){ error("xWrite():",e,fh); state.s11n.storeException(1,e); - rc = state.sq3Codes.SQLITE_IOERR_WRITE; + rc = GetSyncHandleError.convertRc(e,state.sq3Codes.SQLITE_IOERR_WRITE); } wTimeEnd(); storeAndNotify('xWrite',rc); @@ -746,22 +777,16 @@ const waitLoop = async function f(){ /** waitTime is how long (ms) to wait for each Atomics.wait(). We need to wake up periodically to give the thread a chance - to do other things. + to do other things. If this is too high (e.g. 500ms) then + even two workers/tabs can easily run into locking errors. */ - const waitTime = 500; + const waitTime = 150; while(!flagAsyncShutdown){ try { if('timed-out'===Atomics.wait( state.sabOPView, state.opIds.whichOp, 0, waitTime )){ - if(__autoLocks.size){ - /* Release all auto-locks. */ - for(const fid of __autoLocks){ - const fh = __openFiles[fid]; - await closeSyncHandleNoThrow(fh); - log("Auto-unlocked",fid,fh.filenameAbs); - } - } + await closeAutoLocks(); continue; } const opId = Atomics.load(state.sabOPView, state.opIds.whichOp); @@ -791,7 +816,7 @@ navigator.storage.getDirectory().then(function(d){ const opt = data.args; state.littleEndian = opt.littleEndian; state.asyncS11nExceptions = opt.asyncS11nExceptions; - state.verbose = opt.verbose ?? 2; + state.verbose = opt.verbose ?? 1; state.fileBufferSize = opt.fileBufferSize; state.sabS11nOffset = opt.sabS11nOffset; state.sabS11nSize = opt.sabS11nSize; diff --git a/ext/wasm/index.html b/ext/wasm/index.html index 37d66603f6..9fa5bbdf49 100644 --- a/ext/wasm/index.html +++ b/ext/wasm/index.html @@ -104,6 +104,9 @@ synchronous sqlite3_vfs interface and the async OPFS impl. +
  • OPFS concurrency + tests using multiple workers. +
  • diff --git a/ext/wasm/tests/opfs/concurrency/index.html b/ext/wasm/tests/opfs/concurrency/index.html new file mode 100644 index 0000000000..79a46692cc --- /dev/null +++ b/ext/wasm/tests/opfs/concurrency/index.html @@ -0,0 +1,34 @@ + + + + + + + + sqlite3 OPFS Worker concurrency tester + + + +

    +

    + OPFS concurrency tester using multiple independent Workers. + This app is incomplete. +

    +
    + + +
    +
    + + + + diff --git a/ext/wasm/tests/opfs/concurrency/test.js b/ext/wasm/tests/opfs/concurrency/test.js new file mode 100644 index 0000000000..d045f3271f --- /dev/null +++ b/ext/wasm/tests/opfs/concurrency/test.js @@ -0,0 +1,97 @@ +(async function(self){ + + const logClass = (function(){ + const mapToString = (v)=>{ + switch(typeof v){ + case 'number': case 'string': case 'boolean': + case 'undefined': case 'bigint': + return ''+v; + default: break; + } + if(null===v) return 'null'; + if(v instanceof Error){ + v = { + message: v.message, + stack: v.stack, + errorClass: v.name + }; + } + return JSON.stringify(v,undefined,2); + }; + const normalizeArgs = (args)=>args.map(mapToString); + const logTarget = document.querySelector('#test-output'); + const logClass = function(cssClass,...args){ + const ln = document.createElement('div'); + if(cssClass){ + for(const c of (Array.isArray(cssClass) ? cssClass : [cssClass])){ + ln.classList.add(c); + } + } + ln.append(document.createTextNode(normalizeArgs(args).join(' '))); + logTarget.append(ln); + }; + const cbReverse = document.querySelector('#cb-log-reverse'); + const cbReverseKey = 'tester1:cb-log-reverse'; + const cbReverseIt = ()=>{ + logTarget.classList[cbReverse.checked ? 'add' : 'remove']('reverse'); + localStorage.setItem(cbReverseKey, cbReverse.checked ? 1 : 0); + }; + cbReverse.addEventListener('change', cbReverseIt, true); + if(localStorage.getItem(cbReverseKey)){ + cbReverse.checked = !!(+localStorage.getItem(cbReverseKey)); + } + cbReverseIt(); + return logClass; + })(); + const stdout = (...args)=>logClass('',...args); + const stderr = (...args)=>logClass('error',...args); + + const wait = async (ms)=>{ + return new Promise((resolve)=>setTimeout(resolve,ms)); + }; + + const urlArgsJs = new URL(document.currentScript.src).searchParams; + const urlArgsHtml = new URL(self.location.href).searchParams; + const options = Object.create(null); + options.sqlite3Dir = urlArgsJs.get('sqlite3.dir'); + options.workerCount = ( + urlArgsHtml.has('workers') ? +urlArgsHtml.get('workers') : 3 + ) || 3; + const workers = []; + workers.post = (type,...args)=>{ + for(const w of workers) w.postMessage({type, payload:args}); + }; + workers.loadedCount = 0; + workers.onmessage = function(msg){ + msg = msg.data; + const wName = msg.worker; + const prefix = 'Worker ['+wName+']:'; + switch(msg.type){ + case 'stdout': stdout(prefix,...msg.payload); break; + case 'stderr': stderr(prefix,...msg.payload); break; + case 'error': stderr(prefix,"ERROR:",...msg.payload); break; + case 'loaded': + stdout(prefix,"loaded"); + if(++workers.loadedCount === workers.length){ + stdout("All workers loaded. Telling them to run..."); + workers.post('run'); + } + break; + default: logClass('error',"Unhandled message type:",msg); break; + } + }; + + stdout("Launching",options.workerCount,"workers..."); + workers.uri = ( + 'worker.js?' + + 'sqlite3.dir='+options.sqlite3Dir + + '&opfs-verbose=2' + ); + for(let i = 0; i < options.workerCount; ++i){ + stdout("Launching worker..."); + workers.push(new Worker(workers.uri+(i ? '' : '&unlink-db'))); + } + // Have to delay onmessage assignment until after the loop + // to avoid that early workers get an undue head start. + workers.forEach((w)=>w.onmessage = workers.onmessage); +})(self); diff --git a/ext/wasm/tests/opfs/concurrency/worker.js b/ext/wasm/tests/opfs/concurrency/worker.js new file mode 100644 index 0000000000..7ba15bf8c1 --- /dev/null +++ b/ext/wasm/tests/opfs/concurrency/worker.js @@ -0,0 +1,95 @@ +importScripts( + (new URL(self.location.href).searchParams).get('sqlite3.dir') + '/sqlite3.js' +); +self.sqlite3InitModule().then(async function(sqlite3){ + const wName = Math.round(Math.random()*10000); + const wPost = (type,...payload)=>{ + postMessage({type, worker: wName, payload}); + }; + const stdout = (...args)=>wPost('stdout',...args); + const stderr = (...args)=>wPost('stderr',...args); + const postErr = (...args)=>wPost('error',...args); + if(!sqlite3.opfs){ + stderr("OPFS support not detected. Aborting."); + return; + } + + const wait = async (ms)=>{ + return new Promise((resolve)=>setTimeout(resolve,ms)); + }; + + const dbName = 'concurrency-tester.db'; + if((new URL(self.location.href).searchParams).has('unlink-db')){ + await sqlite3.opfs.unlink(dbName); + stdout("Unlinked",dbName); + } + wPost('loaded'); + + const run = async function(){ + const db = new sqlite3.opfs.OpfsDb(dbName); + //sqlite3.capi.sqlite3_busy_timeout(db.pointer, 2000); + db.transaction((db)=>{ + db.exec([ + "create table if not exists t1(w TEXT UNIQUE ON CONFLICT REPLACE,v);", + "create table if not exists t2(w TEXT UNIQUE ON CONFLICT REPLACE,v);" + ]); + }); + + const maxIterations = 10; + const interval = Object.assign(Object.create(null),{ + delay: 300, + handle: undefined, + count: 0 + }); + stdout("Starting interval-based db updates with delay of",interval.delay,"ms."); + const doWork = async ()=>{ + const tm = new Date().getTime(); + ++interval.count; + const prefix = "v(#"+interval.count+")"; + stdout("Setting",prefix,"=",tm); + try{ + db.exec({ + sql:"INSERT OR REPLACE INTO t1(w,v) VALUES(?,?)", + bind: [wName, new Date().getTime()] + }); + //stdout("Set",prefix); + }catch(e){ + interval.error = e; + } + }; + const finish = ()=>{ + if(interval.error) stderr("Ending work due to error:",e.message); + else stdout("Ending work after",interval.count,"interval(s)"); + db.close(); + }; + if(1){/*use setInterval()*/ + interval.handle = setInterval(async ()=>{ + await doWork(); + if(interval.error || maxIterations === interval.count){ + clearInterval(interval.handle); + finish(); + } + }, interval.delay); + }else{ + /*This approach provides no concurrency whatsoever: each worker + is run to completion before any others can work.*/ + let i; + for(i = 0; i < maxIterations; ++i){ + await doWork(); + if(interval.error) break; + await wait(interval.ms); + } + finish(); + } + }/*run()*/; + + self.onmessage = function({data}){ + switch(data.type){ + case 'run': run().catch((e)=>postErr(e.message)); + break; + default: + stderr("Unhandled message type '"+data.type+"'."); + break; + } + }; +}); diff --git a/manifest b/manifest index 1c39089785..ccf4fd8d76 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C js\sdist:\saccount\sfor\sa\sfile\srename\sin\sthe\sprevious\scheckin. -D 2022-11-20T05:47:17.093 +C Add\stest\sapp\sfor\sexperimenting\swith\smulti-worker\sOPFS\sconcurrency.\sTweak\sOPFS\sVFS\sto\ssignificantly\simprove\sthe\sotherwise\s"unfortunate"\sconcurrency\ssituation. +D 2022-11-21T03:50:52.240 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -491,10 +491,10 @@ F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34ce F ext/wasm/GNUmakefile 712795c4893ea65f8d30fe414937a33b677a194dd58372b4074aee17039c845e F ext/wasm/README-dist.txt 2d670b426fc7c613b90a7d2f2b05b433088fe65181abead970980f0a4a75ea20 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 -F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 9120c2f8f51fa85f46dcf4dcb6b12f4a807d428f6089b99cdb08d8ddfcfd88b2 +F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api b4d68c97d14944b48d55e06aa44f544a6f56a7fa2bcb6f9e030936a5b2a9479a F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287 F ext/wasm/api/README.md 29276a845e57004e82efba61fa5866fd05f9137380a1dc26dc4c6d65264cd81c -F ext/wasm/api/extern-post-js.js 59e52f579cd3a332d73dae94c91b9579daafb10dd6ada03803f1afa6bdad7689 +F ext/wasm/api/extern-post-js.js 31400dd1c0ae3458a0e6510229e59318e45eac402a75dd703c2950b9b5758b46 F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41 F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1 F ext/wasm/api/post-js-header.js d6ab3dfef4a06960d28a7eaa338d4e2a1a5981e9b38718168bbde8fdb2a439b8 @@ -502,11 +502,11 @@ F ext/wasm/api/pre-js.js b88499dc303c21fc3f55f2c364a0f814f587b60a95784303881169f F ext/wasm/api/sqlite3-api-cleanup.js ecdc69dbfccfe26146f04799fcfd4a6f5790d46e7e3b9b6e9b0491f92ed8ae34 F ext/wasm/api/sqlite3-api-glue.js 056f44b82c126358a0175e08a892d56fadfce177b0d7a0012502a6acf67ea6d5 F ext/wasm/api/sqlite3-api-oo1.js e9a83489bbb4838ce0aee46eaaa9350e0e25a5b926b565e4f5ae8e840e4fbaed -F ext/wasm/api/sqlite3-api-opfs.js b4ece97f94aacd408b37fbe5f6d6bb2cbfbed484ce700b17d1d446a55e6b7e81 -F ext/wasm/api/sqlite3-api-prologue.js fd526fa017fa2578673ca18158354515c719e719a5d93f2f6d0e43f39170430e +F ext/wasm/api/sqlite3-api-opfs.js 4c75ed11df5efff6bcd8dad4ad904d8b11efac2e1dd4cc2c84d1ee8ace4129ef +F ext/wasm/api/sqlite3-api-prologue.js 08e96d26d329e8c1e08813fe0b84ee93e0e78b087efdd6eb2809ae2672902437 F ext/wasm/api/sqlite3-api-worker1.js e94ba98e44afccfa482874cd9acb325883ade50ed1f9f9526beb9de1711f182f F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3 -F ext/wasm/api/sqlite3-opfs-async-proxy.js 24d1c1982a012d998907105a4ff1ff6881bf462395e90c06326817701e69f093 +F ext/wasm/api/sqlite3-opfs-async-proxy.js 97cf1909670575eced940d36f1b5ea35c51a431d1035dc2f7ea6982faee97c1b F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9 F ext/wasm/api/sqlite3-wasm.c 8fc8f47680df0e9a6c0f2f03cb004148645ecc983aa216daba09cb21f7e092a2 F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b @@ -534,7 +534,7 @@ F ext/wasm/fiddle/fiddle-worker.js b4a0c8ab6c0983218543ca771c45f6075449f63a1dcf2 F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715 F ext/wasm/fiddle/index.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2 F ext/wasm/index-dist.html c4337617c4d6d4d0796827cec28ac81d128c6f911dcf888a290a32ad50890408 -F ext/wasm/index.html 5393ced912ee9af18cc8cefbda96fac922839d192d7c3d4ec4f4b42dd7f1cf8b +F ext/wasm/index.html 5be176de5be8ae96889798f803fef4f6a2ef31cee305a0430ca4629f6ae04c27 F ext/wasm/jaccwabyt/jaccwabyt.js 95f573de1826474c9605dda620ee622fcb1673ae74f191eb324c0853aa4dcb66 F ext/wasm/jaccwabyt/jaccwabyt.md 9aa6951b529a8b29f578ec8f0355713c39584c92cf1708f63ba0cf917cb5b68e F ext/wasm/module-symbols.html b8eebafef8e536624bbe5f7a3da40c07a9062b843dfd3161a0bb72cbb6763dc5 @@ -552,6 +552,9 @@ F ext/wasm/test-opfs-vfs.js 44363db07b2a20e73b0eb1808de4400ca71b703af718d0fa6d96 F ext/wasm/tester1-worker.html 5ef353348c37cf2e4fd0b23da562d3275523e036260b510734e9a3239ba8c987 F ext/wasm/tester1.c-pp.html 74aa9b31c75f12490653f814b53c3dd39f40cd3f70d6a53a716f4e8587107399 F ext/wasm/tester1.c-pp.js 0c129495d057c77788b59715152d51f9bf9002ebbcce759ef8b028272ce3519d +F ext/wasm/tests/opfs/concurrency/index.html c7cf329e5b206dd8226d94ab9fec02f5f350d8ed69a57c96d84e876afd3d3d1b +F ext/wasm/tests/opfs/concurrency/test.js 44cfcc04503593256abe2dd663349718f80ee7ab25e19eb066de220101bd604a +F ext/wasm/tests/opfs/concurrency/worker.js f8f3e4f9b21726bef354a74ec9c90f6736df5b16b4f655bfd16a3b9c6ee063ff F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5 F ext/wasm/wasmfs.make 8fea9b4f3cde06141de1fc4c586ab405bd32c3f401554f4ebb18c797401a678d F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x @@ -2056,8 +2059,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 100a596800eca61477d9880092465d594c22be3707f2a11aaf6eb9e234fc6f2d -R fd97f4afc2e7676e23b759586618b38f +P 469f9011a885e19b99210c5e3e582afa140b8b5f0aa7a720334848df5ab6ae98 +R c87fca3e6d0a9c36a2598013e36db2a5 U stephan -Z 42f144497d0f844aac38afbea462a28b +Z b0030359261e278f67d2690556943dbd # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 6d344e429d..2e8d22d1e3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -469f9011a885e19b99210c5e3e582afa140b8b5f0aa7a720334848df5ab6ae98 \ No newline at end of file +96f76e7616f8157a342b9e1c42f7b1feab200d182268871a2b25f67d4ee2564c \ No newline at end of file From 36d5554c9abaa3080e85e3b7b517605c6106587d Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 21 Nov 2022 04:12:38 +0000 Subject: [PATCH 15/21] Resolve missing SQLITE_LOCKED result code which triggered a new (since last checkin) exception in the OPFS VFS. Improve output of the OPFS contention tester app. FossilOrigin-Name: 2debbbca33bd4170a1dc4dbb5eb3e68523e51d289b06c551e5560ac4e32e433b --- ext/wasm/api/sqlite3-api-opfs.js | 1 + ext/wasm/api/sqlite3-opfs-async-proxy.js | 4 ++-- ext/wasm/tests/opfs/concurrency/test.js | 24 ++++++++++++++--------- ext/wasm/tests/opfs/concurrency/worker.js | 12 ++++++++---- manifest | 18 ++++++++--------- manifest.uuid | 2 +- 6 files changed, 36 insertions(+), 25 deletions(-) diff --git a/ext/wasm/api/sqlite3-api-opfs.js b/ext/wasm/api/sqlite3-api-opfs.js index 1fd50dcc6f..deb4c923ab 100644 --- a/ext/wasm/api/sqlite3-api-opfs.js +++ b/ext/wasm/api/sqlite3-api-opfs.js @@ -343,6 +343,7 @@ const installOpfsVfs = function callee(options){ 'SQLITE_LOCK_PENDING', 'SQLITE_LOCK_RESERVED', 'SQLITE_LOCK_SHARED', + 'SQLITE_LOCKED', 'SQLITE_MISUSE', 'SQLITE_NOTFOUND', 'SQLITE_OPEN_CREATE', diff --git a/ext/wasm/api/sqlite3-opfs-async-proxy.js b/ext/wasm/api/sqlite3-opfs-async-proxy.js index 3701e8c30d..58cf8ca3c7 100644 --- a/ext/wasm/api/sqlite3-opfs-async-proxy.js +++ b/ext/wasm/api/sqlite3-opfs-async-proxy.js @@ -477,8 +477,8 @@ const vfsAsyncImpls = { wTimeStart('xFileSize'); try{ affirmLocked('xFileSize',fh); - rc = await (await getSyncHandle(fh)).getSize(); - state.s11n.serialize(Number(rc)); + const sz = await (await getSyncHandle(fh)).getSize(); + state.s11n.serialize(Number(sz)); rc = 0; }catch(e){ state.s11n.storeException(2,e); diff --git a/ext/wasm/tests/opfs/concurrency/test.js b/ext/wasm/tests/opfs/concurrency/test.js index d045f3271f..b80dad24c4 100644 --- a/ext/wasm/tests/opfs/concurrency/test.js +++ b/ext/wasm/tests/opfs/concurrency/test.js @@ -1,6 +1,6 @@ (async function(self){ - const logClass = (function(){ + const logCss = (function(){ const mapToString = (v)=>{ switch(typeof v){ case 'number': case 'string': case 'boolean': @@ -20,7 +20,7 @@ }; const normalizeArgs = (args)=>args.map(mapToString); const logTarget = document.querySelector('#test-output'); - const logClass = function(cssClass,...args){ + const logCss = function(cssClass,...args){ const ln = document.createElement('div'); if(cssClass){ for(const c of (Array.isArray(cssClass) ? cssClass : [cssClass])){ @@ -41,10 +41,10 @@ cbReverse.checked = !!(+localStorage.getItem(cbReverseKey)); } cbReverseIt(); - return logClass; + return logCss; })(); - const stdout = (...args)=>logClass('',...args); - const stderr = (...args)=>logClass('error',...args); + const stdout = (...args)=>logCss('',...args); + const stderr = (...args)=>logCss('error',...args); const wait = async (ms)=>{ return new Promise((resolve)=>setTimeout(resolve,ms)); @@ -67,9 +67,6 @@ const wName = msg.worker; const prefix = 'Worker ['+wName+']:'; switch(msg.type){ - case 'stdout': stdout(prefix,...msg.payload); break; - case 'stderr': stderr(prefix,...msg.payload); break; - case 'error': stderr(prefix,"ERROR:",...msg.payload); break; case 'loaded': stdout(prefix,"loaded"); if(++workers.loadedCount === workers.length){ @@ -77,7 +74,16 @@ workers.post('run'); } break; - default: logClass('error',"Unhandled message type:",msg); break; + case 'stdout': stdout(prefix,...msg.payload); break; + case 'stderr': stderr(prefix,...msg.payload); break; + case 'error': stderr(prefix,"ERROR:",...msg.payload); break; + case 'finished': + logCss('tests-pass',prefix,...msg.payload); + break; + case 'failed': + logCss('tests-fail',prefix,"FAILED:",...msg.payload); + break; + default: logCss('error',"Unhandled message type:",msg); break; } }; diff --git a/ext/wasm/tests/opfs/concurrency/worker.js b/ext/wasm/tests/opfs/concurrency/worker.js index 7ba15bf8c1..9aaa2f4c78 100644 --- a/ext/wasm/tests/opfs/concurrency/worker.js +++ b/ext/wasm/tests/opfs/concurrency/worker.js @@ -26,7 +26,7 @@ self.sqlite3InitModule().then(async function(sqlite3){ wPost('loaded'); const run = async function(){ - const db = new sqlite3.opfs.OpfsDb(dbName); + const db = new sqlite3.opfs.OpfsDb(dbName,'c'); //sqlite3.capi.sqlite3_busy_timeout(db.pointer, 2000); db.transaction((db)=>{ db.exec([ @@ -37,7 +37,7 @@ self.sqlite3InitModule().then(async function(sqlite3){ const maxIterations = 10; const interval = Object.assign(Object.create(null),{ - delay: 300, + delay: 500, handle: undefined, count: 0 }); @@ -58,9 +58,13 @@ self.sqlite3InitModule().then(async function(sqlite3){ } }; const finish = ()=>{ - if(interval.error) stderr("Ending work due to error:",e.message); - else stdout("Ending work after",interval.count,"interval(s)"); db.close(); + if(interval.error){ + wPost('failed',"Ending work after interval #"+interval.count, + "due to error:",interval.error); + }else{ + wPost('finished',"Ending work after",interval.count,"intervals."); + } }; if(1){/*use setInterval()*/ interval.handle = setInterval(async ()=>{ diff --git a/manifest b/manifest index ccf4fd8d76..75a05f7f6c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stest\sapp\sfor\sexperimenting\swith\smulti-worker\sOPFS\sconcurrency.\sTweak\sOPFS\sVFS\sto\ssignificantly\simprove\sthe\sotherwise\s"unfortunate"\sconcurrency\ssituation. -D 2022-11-21T03:50:52.240 +C Resolve\smissing\sSQLITE_LOCKED\sresult\scode\swhich\striggered\sa\snew\s(since\slast\scheckin)\sexception\sin\sthe\sOPFS\sVFS.\sImprove\soutput\sof\sthe\sOPFS\scontention\stester\sapp. +D 2022-11-21T04:12:38.735 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -502,11 +502,11 @@ F ext/wasm/api/pre-js.js b88499dc303c21fc3f55f2c364a0f814f587b60a95784303881169f F ext/wasm/api/sqlite3-api-cleanup.js ecdc69dbfccfe26146f04799fcfd4a6f5790d46e7e3b9b6e9b0491f92ed8ae34 F ext/wasm/api/sqlite3-api-glue.js 056f44b82c126358a0175e08a892d56fadfce177b0d7a0012502a6acf67ea6d5 F ext/wasm/api/sqlite3-api-oo1.js e9a83489bbb4838ce0aee46eaaa9350e0e25a5b926b565e4f5ae8e840e4fbaed -F ext/wasm/api/sqlite3-api-opfs.js 4c75ed11df5efff6bcd8dad4ad904d8b11efac2e1dd4cc2c84d1ee8ace4129ef +F ext/wasm/api/sqlite3-api-opfs.js 38d368e33f470f9ba196f1a2b0c9ce076c930c70df233c345a246f1ad4c26d3b F ext/wasm/api/sqlite3-api-prologue.js 08e96d26d329e8c1e08813fe0b84ee93e0e78b087efdd6eb2809ae2672902437 F ext/wasm/api/sqlite3-api-worker1.js e94ba98e44afccfa482874cd9acb325883ade50ed1f9f9526beb9de1711f182f F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3 -F ext/wasm/api/sqlite3-opfs-async-proxy.js 97cf1909670575eced940d36f1b5ea35c51a431d1035dc2f7ea6982faee97c1b +F ext/wasm/api/sqlite3-opfs-async-proxy.js 021af8b3d1754e308c09eebee5f8d235fb245bea1f9b1c1414141cc2ebd5649c F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9 F ext/wasm/api/sqlite3-wasm.c 8fc8f47680df0e9a6c0f2f03cb004148645ecc983aa216daba09cb21f7e092a2 F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b @@ -553,8 +553,8 @@ F ext/wasm/tester1-worker.html 5ef353348c37cf2e4fd0b23da562d3275523e036260b51073 F ext/wasm/tester1.c-pp.html 74aa9b31c75f12490653f814b53c3dd39f40cd3f70d6a53a716f4e8587107399 F ext/wasm/tester1.c-pp.js 0c129495d057c77788b59715152d51f9bf9002ebbcce759ef8b028272ce3519d F ext/wasm/tests/opfs/concurrency/index.html c7cf329e5b206dd8226d94ab9fec02f5f350d8ed69a57c96d84e876afd3d3d1b -F ext/wasm/tests/opfs/concurrency/test.js 44cfcc04503593256abe2dd663349718f80ee7ab25e19eb066de220101bd604a -F ext/wasm/tests/opfs/concurrency/worker.js f8f3e4f9b21726bef354a74ec9c90f6736df5b16b4f655bfd16a3b9c6ee063ff +F ext/wasm/tests/opfs/concurrency/test.js 6f7d49d97c27906f8f5a39d6da176122350f375cd811e51182128bc2db74e464 +F ext/wasm/tests/opfs/concurrency/worker.js 571bcc525520fedfc71e25486265247633a4bf8aee554923aa7219399ed749fd F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5 F ext/wasm/wasmfs.make 8fea9b4f3cde06141de1fc4c586ab405bd32c3f401554f4ebb18c797401a678d F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x @@ -2059,8 +2059,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 469f9011a885e19b99210c5e3e582afa140b8b5f0aa7a720334848df5ab6ae98 -R c87fca3e6d0a9c36a2598013e36db2a5 +P 96f76e7616f8157a342b9e1c42f7b1feab200d182268871a2b25f67d4ee2564c +R 37b708b698da9468667dd15ac1e5f125 U stephan -Z b0030359261e278f67d2690556943dbd +Z 415bce67c5fc2cb5709db14ccdfe0252 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 2e8d22d1e3..7de2c9eef7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -96f76e7616f8157a342b9e1c42f7b1feab200d182268871a2b25f67d4ee2564c \ No newline at end of file +2debbbca33bd4170a1dc4dbb5eb3e68523e51d289b06c551e5560ac4e32e433b \ No newline at end of file From b38ac0986e86d56115396c36355d4e751cc4f7f5 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 21 Nov 2022 05:18:24 +0000 Subject: [PATCH 16/21] More tweaking of OPFS concurrency measures and the related test app. FossilOrigin-Name: a8d4da1501d411085ec2fd48c4a056c8b1d97ef3c3203c5b403a854ac2864870 --- ext/wasm/api/sqlite3-opfs-async-proxy.js | 21 +++++----- ext/wasm/tests/opfs/concurrency/index.html | 16 +++++++- ext/wasm/tests/opfs/concurrency/test.js | 9 ++++- ext/wasm/tests/opfs/concurrency/worker.js | 46 ++++++++++++---------- manifest | 18 ++++----- manifest.uuid | 2 +- 6 files changed, 68 insertions(+), 44 deletions(-) diff --git a/ext/wasm/api/sqlite3-opfs-async-proxy.js b/ext/wasm/api/sqlite3-opfs-async-proxy.js index 58cf8ca3c7..c208932e17 100644 --- a/ext/wasm/api/sqlite3-opfs-async-proxy.js +++ b/ext/wasm/api/sqlite3-opfs-async-proxy.js @@ -220,22 +220,19 @@ class GetSyncHandleError extends Error { } }; GetSyncHandleError.convertRc = (e,rc)=>{ - if(1){ - /* This approach returns SQLITE_LOCKED to the C API - when getSyncHandle() fails but makes the very - wild assumption that such a failure _is_ a locking - error. In practice that appears to be the most - common error, by far, but we cannot unambiguously + if(0){ + /* This approach makes the very wild assumption that such a + failure _is_ a locking error. In practice that appears to be + the most common error, by far, but we cannot unambiguously distinguish that from other errors. - This approach demonstrably reduces concurrency-related - errors but is highly questionable. + This approach is highly questionable. */ return (e instanceof GetSyncHandleError) - ? state.sq3Codes.SQLITE_LOCKED + ? state.sq3Codes.SQLITE_IOERR_LOCK : rc; }else{ - return ec; + return rc; } } /** @@ -253,7 +250,7 @@ const getSyncHandle = async (fh)=>{ if(!fh.syncHandle){ const t = performance.now(); log("Acquiring sync handle for",fh.filenameAbs); - const maxTries = 4, msBase = 300; + const maxTries = 6, msBase = 300; let i = 1, ms = msBase; for(; true; ms = msBase * ++i){ try { @@ -271,7 +268,7 @@ const getSyncHandle = async (fh)=>{ } warn("Error getting sync handle. Waiting",ms, "ms and trying again.",fh.filenameAbs,e); - //await closeAutoLocks(); + await closeAutoLocks(); Atomics.wait(state.sabOPView, state.opIds.retry, 0, ms); } } diff --git a/ext/wasm/tests/opfs/concurrency/index.html b/ext/wasm/tests/opfs/concurrency/index.html index 79a46692cc..a082dfe997 100644 --- a/ext/wasm/tests/opfs/concurrency/index.html +++ b/ext/wasm/tests/opfs/concurrency/index.html @@ -18,7 +18,21 @@

    OPFS concurrency tester using multiple independent Workers. - This app is incomplete. + Disclaimer: concurrency in OPFS is currently a pain point + and timing/concurrency mitigation in this environment is + highly unpredictable! +

    +

    + URL flags: pass a number of workers using + the workers=N URL flag and the worker work interval + as interval=N (milliseconds). Enable OPFS VFS + verbosity with verbose=1-3 (output goes to the + dev console). +

    +

    Achtung: if it does not start to do anything within a couple of + seconds, check the dev console: Chrome often fails with "cannot allocate + WasmMemory" at startup. Closing and re-opening the tab usually resolves + it.

    diff --git a/ext/wasm/tests/opfs/concurrency/test.js b/ext/wasm/tests/opfs/concurrency/test.js index b80dad24c4..8b75ea4c78 100644 --- a/ext/wasm/tests/opfs/concurrency/test.js +++ b/ext/wasm/tests/opfs/concurrency/test.js @@ -57,6 +57,12 @@ options.workerCount = ( urlArgsHtml.has('workers') ? +urlArgsHtml.get('workers') : 3 ) || 3; + options.opfsVerbose = ( + urlArgsHtml.has('verbose') ? +urlArgsHtml.get('verbose') : 1 + ) || 1; + options.interval = ( + urlArgsHtml.has('interval') ? +urlArgsHtml.get('interval') : 750 + ) || 750; const workers = []; workers.post = (type,...args)=>{ for(const w of workers) w.postMessage({type, payload:args}); @@ -91,7 +97,8 @@ workers.uri = ( 'worker.js?' + 'sqlite3.dir='+options.sqlite3Dir - + '&opfs-verbose=2' + + '&interval='+options.interval + + '&opfs-verbose='+options.opfsVerbose ); for(let i = 0; i < options.workerCount; ++i){ stdout("Launching worker..."); diff --git a/ext/wasm/tests/opfs/concurrency/worker.js b/ext/wasm/tests/opfs/concurrency/worker.js index 9aaa2f4c78..85a5cf19b7 100644 --- a/ext/wasm/tests/opfs/concurrency/worker.js +++ b/ext/wasm/tests/opfs/concurrency/worker.js @@ -8,7 +8,6 @@ self.sqlite3InitModule().then(async function(sqlite3){ }; const stdout = (...args)=>wPost('stdout',...args); const stderr = (...args)=>wPost('stderr',...args); - const postErr = (...args)=>wPost('error',...args); if(!sqlite3.opfs){ stderr("OPFS support not detected. Aborting."); return; @@ -19,15 +18,33 @@ self.sqlite3InitModule().then(async function(sqlite3){ }; const dbName = 'concurrency-tester.db'; - if((new URL(self.location.href).searchParams).has('unlink-db')){ + const urlArgs = new URL(self.location.href).searchParams; + if(urlArgs.has('unlink-db')){ await sqlite3.opfs.unlink(dbName); stdout("Unlinked",dbName); } wPost('loaded'); - + let db; + const interval = Object.assign(Object.create(null),{ + delay: urlArgs.has('interval') ? (+urlArgs.get('interval') || 750) : 750, + handle: undefined, + count: 0 + }); + const finish = ()=>{ + if(db){ + if(!db.pointer) return; + db.close(); + } + if(interval.error){ + wPost('failed',"Ending work after interval #"+interval.count, + "due to error:",interval.error); + }else{ + wPost('finished',"Ending work after",interval.count,"intervals."); + } + }; const run = async function(){ - const db = new sqlite3.opfs.OpfsDb(dbName,'c'); - //sqlite3.capi.sqlite3_busy_timeout(db.pointer, 2000); + db = new sqlite3.opfs.OpfsDb(dbName,'c'); + sqlite3.capi.sqlite3_busy_timeout(db.pointer, 5000); db.transaction((db)=>{ db.exec([ "create table if not exists t1(w TEXT UNIQUE ON CONFLICT REPLACE,v);", @@ -36,11 +53,6 @@ self.sqlite3InitModule().then(async function(sqlite3){ }); const maxIterations = 10; - const interval = Object.assign(Object.create(null),{ - delay: 500, - handle: undefined, - count: 0 - }); stdout("Starting interval-based db updates with delay of",interval.delay,"ms."); const doWork = async ()=>{ const tm = new Date().getTime(); @@ -57,15 +69,6 @@ self.sqlite3InitModule().then(async function(sqlite3){ interval.error = e; } }; - const finish = ()=>{ - db.close(); - if(interval.error){ - wPost('failed',"Ending work after interval #"+interval.count, - "due to error:",interval.error); - }else{ - wPost('finished',"Ending work after",interval.count,"intervals."); - } - }; if(1){/*use setInterval()*/ interval.handle = setInterval(async ()=>{ await doWork(); @@ -89,7 +92,10 @@ self.sqlite3InitModule().then(async function(sqlite3){ self.onmessage = function({data}){ switch(data.type){ - case 'run': run().catch((e)=>postErr(e.message)); + case 'run': run().catch((e)=>{ + if(!interval.error) interval.error = e; + finish(); + }); break; default: stderr("Unhandled message type '"+data.type+"'."); diff --git a/manifest b/manifest index 75a05f7f6c..0d16ed6e6d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Resolve\smissing\sSQLITE_LOCKED\sresult\scode\swhich\striggered\sa\snew\s(since\slast\scheckin)\sexception\sin\sthe\sOPFS\sVFS.\sImprove\soutput\sof\sthe\sOPFS\scontention\stester\sapp. -D 2022-11-21T04:12:38.735 +C More\stweaking\sof\sOPFS\sconcurrency\smeasures\sand\sthe\srelated\stest\sapp. +D 2022-11-21T05:18:24.071 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -506,7 +506,7 @@ F ext/wasm/api/sqlite3-api-opfs.js 38d368e33f470f9ba196f1a2b0c9ce076c930c70df233 F ext/wasm/api/sqlite3-api-prologue.js 08e96d26d329e8c1e08813fe0b84ee93e0e78b087efdd6eb2809ae2672902437 F ext/wasm/api/sqlite3-api-worker1.js e94ba98e44afccfa482874cd9acb325883ade50ed1f9f9526beb9de1711f182f F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3 -F ext/wasm/api/sqlite3-opfs-async-proxy.js 021af8b3d1754e308c09eebee5f8d235fb245bea1f9b1c1414141cc2ebd5649c +F ext/wasm/api/sqlite3-opfs-async-proxy.js 1ec10873f1d59d305f6f3b435c50a1b75d693d5fb739b226f3da46fcbb11261a F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9 F ext/wasm/api/sqlite3-wasm.c 8fc8f47680df0e9a6c0f2f03cb004148645ecc983aa216daba09cb21f7e092a2 F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b @@ -552,9 +552,9 @@ F ext/wasm/test-opfs-vfs.js 44363db07b2a20e73b0eb1808de4400ca71b703af718d0fa6d96 F ext/wasm/tester1-worker.html 5ef353348c37cf2e4fd0b23da562d3275523e036260b510734e9a3239ba8c987 F ext/wasm/tester1.c-pp.html 74aa9b31c75f12490653f814b53c3dd39f40cd3f70d6a53a716f4e8587107399 F ext/wasm/tester1.c-pp.js 0c129495d057c77788b59715152d51f9bf9002ebbcce759ef8b028272ce3519d -F ext/wasm/tests/opfs/concurrency/index.html c7cf329e5b206dd8226d94ab9fec02f5f350d8ed69a57c96d84e876afd3d3d1b -F ext/wasm/tests/opfs/concurrency/test.js 6f7d49d97c27906f8f5a39d6da176122350f375cd811e51182128bc2db74e464 -F ext/wasm/tests/opfs/concurrency/worker.js 571bcc525520fedfc71e25486265247633a4bf8aee554923aa7219399ed749fd +F ext/wasm/tests/opfs/concurrency/index.html bb9b0f6da86df34c67fa506db9c45b7c4cf0045a211611cc6b8d2b53fa983481 +F ext/wasm/tests/opfs/concurrency/test.js cea04456ffae7bbfd726ef0e859d2afc2a51ead66940fc4a2499884ac44d16dd +F ext/wasm/tests/opfs/concurrency/worker.js a92fa4da1431d3c6db3e1dd0b98794e09d1021e23a8c490335410cce283b11c1 F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5 F ext/wasm/wasmfs.make 8fea9b4f3cde06141de1fc4c586ab405bd32c3f401554f4ebb18c797401a678d F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x @@ -2059,8 +2059,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 96f76e7616f8157a342b9e1c42f7b1feab200d182268871a2b25f67d4ee2564c -R 37b708b698da9468667dd15ac1e5f125 +P 2debbbca33bd4170a1dc4dbb5eb3e68523e51d289b06c551e5560ac4e32e433b +R cdfdba12cf28ae07442f6b59e52570f8 U stephan -Z 415bce67c5fc2cb5709db14ccdfe0252 +Z bce379ce157581c096a0eabd8577e81e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7de2c9eef7..8ac00ec32b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2debbbca33bd4170a1dc4dbb5eb3e68523e51d289b06c551e5560ac4e32e433b \ No newline at end of file +a8d4da1501d411085ec2fd48c4a056c8b1d97ef3c3203c5b403a854ac2864870 \ No newline at end of file From a303392a2cadec50082344a266c16e5dabd34d37 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 21 Nov 2022 06:07:22 +0000 Subject: [PATCH 17/21] Add new JS tests dir to those pushed to the test server. FossilOrigin-Name: 07182dca9f2a4ffea1af0684c93e55e105465b2ee9820c70764e3e7bc1c28efc --- ext/wasm/GNUmakefile | 1 + manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 647044665c..38c1cdaca8 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -815,6 +815,7 @@ endif ######################################################################## # Push files to public wasm-testing.sqlite.org server wasm-testing.include = *.js *.html batch-runner.list \ + ./tests \ $(dir.dout) $(dir.sql) $(dir.common) $(dir.fiddle) $(dir.jacc) wasm-testing.exclude = sql/speedtest1.sql wasm-testing.dir = /jail/sites/wasm-testing diff --git a/manifest b/manifest index 0d16ed6e6d..e7f833fab3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\stweaking\sof\sOPFS\sconcurrency\smeasures\sand\sthe\srelated\stest\sapp. -D 2022-11-21T05:18:24.071 +C Add\snew\sJS\stests\sdir\sto\sthose\spushed\sto\sthe\stest\sserver. +D 2022-11-21T06:07:22.911 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -488,7 +488,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 712795c4893ea65f8d30fe414937a33b677a194dd58372b4074aee17039c845e +F ext/wasm/GNUmakefile bc1696a1189f4c571b3d878b8f3a67c1f4b52c222f52d356027a5a0c707337c7 F ext/wasm/README-dist.txt 2d670b426fc7c613b90a7d2f2b05b433088fe65181abead970980f0a4a75ea20 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api b4d68c97d14944b48d55e06aa44f544a6f56a7fa2bcb6f9e030936a5b2a9479a @@ -2059,8 +2059,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2debbbca33bd4170a1dc4dbb5eb3e68523e51d289b06c551e5560ac4e32e433b -R cdfdba12cf28ae07442f6b59e52570f8 +P a8d4da1501d411085ec2fd48c4a056c8b1d97ef3c3203c5b403a854ac2864870 +R de977a34ec9f33a01661a43c62f057f6 U stephan -Z bce379ce157581c096a0eabd8577e81e +Z 6c2e6c110bc94fae29d67ff59b3bd9c5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 8ac00ec32b..b925e621f1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a8d4da1501d411085ec2fd48c4a056c8b1d97ef3c3203c5b403a854ac2864870 \ No newline at end of file +07182dca9f2a4ffea1af0684c93e55e105465b2ee9820c70764e3e7bc1c28efc \ No newline at end of file From d01dee5e6aef8aebc2932f743c90f41db70e2a7c Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 21 Nov 2022 13:35:00 +0000 Subject: [PATCH 18/21] Small performance improvement in sqlite3BtreeTransferRow(). FossilOrigin-Name: dab959ea3edf99788bfd76352cd46a3e56876b0e7d7008c6927aa14534853c50 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/btree.c | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index e7f833fab3..4cd29a45bd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\snew\sJS\stests\sdir\sto\sthose\spushed\sto\sthe\stest\sserver. -D 2022-11-21T06:07:22.911 +C Small\sperformance\simprovement\sin\ssqlite3BtreeTransferRow(). +D 2022-11-21T13:35:00.374 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -580,7 +580,7 @@ F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7 F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca -F src/btree.c 308474d81388fa8b4fb92da7b2c73cae864c1ac468a7a5ffab61670af4b488f0 +F src/btree.c 89e0e5af46d1921a0a1d17bc5ec95cd0ec89b050b32373d825c76b5d3f3a2ec9 F src/btree.h 4fcbb0b041013071dd5e9f53c538d49916c092e6ad8842185985e5270a0792de F src/btreeInt.h 8ce1332edd89dfd2461d561ac10a0ab5601c8e06200cb5230596c3caaf54482e F src/build.c d3e43e950e4e377c1d451a4862556792acdef1faba14a03f899d30d09731c48b @@ -2059,8 +2059,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a8d4da1501d411085ec2fd48c4a056c8b1d97ef3c3203c5b403a854ac2864870 -R de977a34ec9f33a01661a43c62f057f6 -U stephan -Z 6c2e6c110bc94fae29d67ff59b3bd9c5 +P 07182dca9f2a4ffea1af0684c93e55e105465b2ee9820c70764e3e7bc1c28efc +R 06d7ab66cd3f5a521e55d8df4889b401 +U drh +Z a6fa3008dc4759fddba2bf18530ff99d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b925e621f1..e7e8aac79f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -07182dca9f2a4ffea1af0684c93e55e105465b2ee9820c70764e3e7bc1c28efc \ No newline at end of file +dab959ea3edf99788bfd76352cd46a3e56876b0e7d7008c6927aa14534853c50 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 114136bc50..83ebc3d3f5 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9314,7 +9314,6 @@ end_insert: ** SQLITE_OK is returned if successful, or an SQLite error code otherwise. */ int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){ - int rc = SQLITE_OK; BtShared *pBt = pDest->pBt; u8 *aOut = pBt->pTmpSpace; /* Pointer to next output buffer */ const u8 *aIn; /* Pointer to next input buffer */ @@ -9337,7 +9336,9 @@ int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){ if( nIn==nRem && nInpPage->maxLocal ){ memcpy(aOut, aIn, nIn); pBt->nPreformatSize = nIn + (aOut - pBt->pTmpSpace); + return SQLITE_OK; }else{ + int rc = SQLITE_OK; Pager *pSrcPager = pSrc->pBt->pPager; u8 *pPgnoOut = 0; Pgno ovflIn = 0; @@ -9405,9 +9406,8 @@ int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){ releasePage(pPageOut); sqlite3PagerUnref(pPageIn); + return rc; } - - return rc; } /* From e7d53844184be4e6fb3806c5e7950b2f02174953 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 21 Nov 2022 14:13:10 +0000 Subject: [PATCH 19/21] Performance optimization to sqlite3BtreeInsert(). FossilOrigin-Name: b8976ebfe03fbc1e09a38d598a62493a7f19ff7a2a3acd1ec54d0dee190471e9 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/btree.c | 37 ++++++++++++++++++------------------- src/btreeInt.h | 4 ++-- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/manifest b/manifest index 4cd29a45bd..a769291001 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Small\sperformance\simprovement\sin\ssqlite3BtreeTransferRow(). -D 2022-11-21T13:35:00.374 +C Performance\soptimization\sto\ssqlite3BtreeInsert(). +D 2022-11-21T14:13:10.344 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -580,9 +580,9 @@ F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7 F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca -F src/btree.c 89e0e5af46d1921a0a1d17bc5ec95cd0ec89b050b32373d825c76b5d3f3a2ec9 +F src/btree.c 6fc3f0c6db7ec2296778cca7c696bb10be9de42f531f106c43d0f410cec0ee2a F src/btree.h 4fcbb0b041013071dd5e9f53c538d49916c092e6ad8842185985e5270a0792de -F src/btreeInt.h 8ce1332edd89dfd2461d561ac10a0ab5601c8e06200cb5230596c3caaf54482e +F src/btreeInt.h 88ad499c92b489afedbfefc3f067c4d15023ec021afe622db240dc9d2277cfa5 F src/build.c d3e43e950e4e377c1d451a4862556792acdef1faba14a03f899d30d09731c48b F src/callback.c 4cd7225b26a97f7de5fee5ae10464bed5a78f2adefe19534cc2095b3a8ca484a F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e @@ -2059,8 +2059,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 07182dca9f2a4ffea1af0684c93e55e105465b2ee9820c70764e3e7bc1c28efc -R 06d7ab66cd3f5a521e55d8df4889b401 +P dab959ea3edf99788bfd76352cd46a3e56876b0e7d7008c6927aa14534853c50 +R 2eb76fb48a48a84e8cbe3f1574fa7eb8 U drh -Z a6fa3008dc4759fddba2bf18530ff99d +Z 44675fc68f20e0cf82e7b5bf3a25ed71 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e7e8aac79f..62bf73f605 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dab959ea3edf99788bfd76352cd46a3e56876b0e7d7008c6927aa14534853c50 \ No newline at end of file +b8976ebfe03fbc1e09a38d598a62493a7f19ff7a2a3acd1ec54d0dee190471e9 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 83ebc3d3f5..f56ff8d4c3 100644 --- a/src/btree.c +++ b/src/btree.c @@ -6606,7 +6606,7 @@ static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){ /* If the database supports auto-vacuum, write an entry in the pointer-map ** to indicate that the page is free. */ - if( ISAUTOVACUUM ){ + if( ISAUTOVACUUM(pBt) ){ ptrmapPut(pBt, iPage, PTRMAP_FREEPAGE, 0, &rc); if( rc ) goto freepage_out; } @@ -7682,7 +7682,7 @@ static int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){ ** be marked as dirty. Returning an error code will cause a ** rollback, undoing any changes made to the parent page. */ - if( ISAUTOVACUUM ){ + if( ISAUTOVACUUM(pBt) ){ ptrmapPut(pBt, pgnoNew, PTRMAP_BTREE, pParent->pgno, &rc); if( szCell>pNew->minLocal ){ ptrmapPutOvflPtr(pNew, pNew, pCell, &rc); @@ -7820,7 +7820,7 @@ static void copyNodeContent(MemPage *pFrom, MemPage *pTo, int *pRC){ /* If this is an auto-vacuum database, update the pointer-map entries ** for any b-tree or overflow pages that pTo now contains the pointers to. */ - if( ISAUTOVACUUM ){ + if( ISAUTOVACUUM(pBt) ){ *pRC = setChildPtrmaps(pTo); } } @@ -8308,7 +8308,7 @@ static int balance_nonroot( cntOld[i] = b.nCell; /* Set the pointer-map entry for the new sibling page. */ - if( ISAUTOVACUUM ){ + if( ISAUTOVACUUM(pBt) ){ ptrmapPut(pBt, pNew->pgno, PTRMAP_BTREE, pParent->pgno, &rc); if( rc!=SQLITE_OK ){ goto balance_cleanup; @@ -8401,7 +8401,7 @@ static int balance_nonroot( ** updated. This happens below, after the sibling pages have been ** populated, not here. */ - if( ISAUTOVACUUM ){ + if( ISAUTOVACUUM(pBt) ){ MemPage *pOld; MemPage *pNew = pOld = apNew[0]; int cntOldNext = pNew->nCell + pNew->nOverflow; @@ -8594,7 +8594,7 @@ static int balance_nonroot( ); copyNodeContent(apNew[0], pParent, &rc); freePage(apNew[0], &rc); - }else if( ISAUTOVACUUM && !leafCorrection ){ + }else if( ISAUTOVACUUM(pBt) && !leafCorrection ){ /* Fix the pointer map entries associated with the right-child of each ** sibling page. All other pointer map entries have already been taken ** care of. */ @@ -8615,7 +8615,7 @@ static int balance_nonroot( } #if 0 - if( ISAUTOVACUUM && rc==SQLITE_OK && apNew[0]->isInit ){ + if( ISAUTOVACUUM(pBt) && rc==SQLITE_OK && apNew[0]->isInit ){ /* The ptrmapCheckPages() contains assert() statements that verify that ** all pointer map pages are set correctly. This is helpful while ** debugging. This is usually disabled because a corrupt database may @@ -8677,7 +8677,7 @@ static int balance_deeper(MemPage *pRoot, MemPage **ppChild){ if( rc==SQLITE_OK ){ rc = allocateBtreePage(pBt,&pChild,&pgnoChild,pRoot->pgno,0); copyNodeContent(pRoot, pChild, &rc); - if( ISAUTOVACUUM ){ + if( ISAUTOVACUUM(pBt) ){ ptrmapPut(pBt, pgnoChild, PTRMAP_BTREE, pRoot->pgno, &rc); } } @@ -9009,7 +9009,6 @@ int sqlite3BtreeInsert( int idx; MemPage *pPage; Btree *p = pCur->pBtree; - BtShared *pBt = p->pBt; unsigned char *oldCell; unsigned char *newCell = 0; @@ -9028,7 +9027,7 @@ int sqlite3BtreeInsert( ** not to clear the cursor here. */ if( pCur->curFlags & BTCF_Multiple ){ - rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur); + rc = saveAllCursors(p->pBt, pCur->pgnoRoot, pCur); if( rc ) return rc; if( loc && pCur->iPage<0 ){ /* This can only happen if the schema is corrupt such that there is more @@ -9052,8 +9051,8 @@ int sqlite3BtreeInsert( assert( cursorOwnsBtShared(pCur) ); assert( (pCur->curFlags & BTCF_WriteFlag)!=0 - && pBt->inTransaction==TRANS_WRITE - && (pBt->btsFlags & BTS_READ_ONLY)==0 ); + && p->pBt->inTransaction==TRANS_WRITE + && (p->pBt->btsFlags & BTS_READ_ONLY)==0 ); assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) ); /* Assert that the caller has been consistent. If this cursor was opened @@ -9170,19 +9169,19 @@ int sqlite3BtreeInsert( pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno, loc==0 ? "overwrite" : "new entry")); assert( pPage->isInit || CORRUPT_DB ); - newCell = pBt->pTmpSpace; + newCell = p->pBt->pTmpSpace; assert( newCell!=0 ); assert( BTREE_PREFORMAT==OPFLAG_PREFORMAT ); if( flags & BTREE_PREFORMAT ){ rc = SQLITE_OK; - szNew = pBt->nPreformatSize; + szNew = p->pBt->nPreformatSize; if( szNew<4 ) szNew = 4; - if( ISAUTOVACUUM && szNew>pPage->maxLocal ){ + if( ISAUTOVACUUM(p->pBt) && szNew>pPage->maxLocal ){ CellInfo info; pPage->xParseCell(pPage, newCell, &info); if( info.nPayload!=info.nLocal ){ Pgno ovfl = get4byte(&newCell[szNew-4]); - ptrmapPut(pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, &rc); + ptrmapPut(p->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, &rc); if( NEVER(rc) ) goto end_insert; } } @@ -9191,7 +9190,7 @@ int sqlite3BtreeInsert( if( rc ) goto end_insert; } assert( szNew==pPage->xCellSize(pPage, newCell) ); - assert( szNew <= MX_CELL_SIZE(pBt) ); + assert( szNew <= MX_CELL_SIZE(p->pBt) ); idx = pCur->ix; if( loc==0 ){ CellInfo info; @@ -9211,7 +9210,7 @@ int sqlite3BtreeInsert( testcase( pCur->curFlags & BTCF_ValidOvfl ); invalidateOverflowCache(pCur); if( info.nSize==szNew && info.nLocal==info.nPayload - && (!ISAUTOVACUUM || szNewminLocal) + && (!ISAUTOVACUUM(p->pBt) || szNewminLocal) ){ /* Overwrite the old cell with the new if they are the same size. ** We could also try to do this if the old cell is smaller, then add @@ -9390,7 +9389,7 @@ int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){ MemPage *pNew = 0; rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0); put4byte(pPgnoOut, pgnoNew); - if( ISAUTOVACUUM && pPageOut ){ + if( ISAUTOVACUUM(pBt) && pPageOut ){ ptrmapPut(pBt, pgnoNew, PTRMAP_OVERFLOW2, pPageOut->pgno, &rc); } releasePage(pPageOut); diff --git a/src/btreeInt.h b/src/btreeInt.h index 1f45553dc9..af295dd507 100644 --- a/src/btreeInt.h +++ b/src/btreeInt.h @@ -674,9 +674,9 @@ struct BtCursor { ** So, this macro is defined instead. */ #ifndef SQLITE_OMIT_AUTOVACUUM -#define ISAUTOVACUUM (pBt->autoVacuum) +#define ISAUTOVACUUM(pBt) (pBt->autoVacuum) #else -#define ISAUTOVACUUM 0 +#define ISAUTOVACUUM(pBt) 0 #endif From b53d8fa9f262f77fd1ae2835773cf26a8de4e78b Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 21 Nov 2022 15:55:57 +0000 Subject: [PATCH 20/21] Performance optimization and size reduction in insertCell() by omitting the "pRC" argument and instead returning the result code as an integer. FossilOrigin-Name: bee94d1bb0daade023cc1e274339daafc249e1978c0765fc45042b5f9060e478 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/btree.c | 28 +++++++++++++--------------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/manifest b/manifest index a769291001..d57ebb0958 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Performance\soptimization\sto\ssqlite3BtreeInsert(). -D 2022-11-21T14:13:10.344 +C Performance\soptimization\sand\ssize\sreduction\sin\sinsertCell()\sby\somitting\nthe\s"pRC"\sargument\sand\sinstead\sreturning\sthe\sresult\scode\sas\san\sinteger. +D 2022-11-21T15:55:57.369 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -580,7 +580,7 @@ F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7 F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca -F src/btree.c 6fc3f0c6db7ec2296778cca7c696bb10be9de42f531f106c43d0f410cec0ee2a +F src/btree.c 522df0f1173495e06c5589f0b17a61f53a212017b82be53171133fcfc0e1e90a F src/btree.h 4fcbb0b041013071dd5e9f53c538d49916c092e6ad8842185985e5270a0792de F src/btreeInt.h 88ad499c92b489afedbfefc3f067c4d15023ec021afe622db240dc9d2277cfa5 F src/build.c d3e43e950e4e377c1d451a4862556792acdef1faba14a03f899d30d09731c48b @@ -2059,8 +2059,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P dab959ea3edf99788bfd76352cd46a3e56876b0e7d7008c6927aa14534853c50 -R 2eb76fb48a48a84e8cbe3f1574fa7eb8 +P b8976ebfe03fbc1e09a38d598a62493a7f19ff7a2a3acd1ec54d0dee190471e9 +R 6d5890069b8a565895abb49912f71e80 U drh -Z 44675fc68f20e0cf82e7b5bf3a25ed71 +Z df511e58d09c8af289615762e74d854c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 62bf73f605..5bdfc3f30e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b8976ebfe03fbc1e09a38d598a62493a7f19ff7a2a3acd1ec54d0dee190471e9 \ No newline at end of file +bee94d1bb0daade023cc1e274339daafc249e1978c0765fc45042b5f9060e478 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index f56ff8d4c3..cabcf675e3 100644 --- a/src/btree.c +++ b/src/btree.c @@ -7046,24 +7046,20 @@ static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){ ** in pTemp or the original pCell) and also record its index. ** Allocating a new entry in pPage->aCell[] implies that ** pPage->nOverflow is incremented. -** -** *pRC must be SQLITE_OK when this routine is called. */ -static void insertCell( +static int insertCell( MemPage *pPage, /* Page into which we are copying */ int i, /* New cell becomes the i-th cell of the page */ u8 *pCell, /* Content of the new cell */ int sz, /* Bytes of content in pCell */ u8 *pTemp, /* Temp storage space for pCell, if needed */ - Pgno iChild, /* If non-zero, replace first 4 bytes with this value */ - int *pRC /* Read and write return code from here */ + Pgno iChild /* If non-zero, replace first 4 bytes with this value */ ){ int idx = 0; /* Where to write new cell content in data[] */ int j; /* Loop counter */ u8 *data; /* The content of the whole page */ u8 *pIns; /* The point in pPage->aCellIdx[] where no cell inserted */ - assert( *pRC==SQLITE_OK ); assert( i>=0 && i<=pPage->nCell+pPage->nOverflow ); assert( MX_CELL(pPage->pBt)<=10921 ); assert( pPage->nCell<=MX_CELL(pPage->pBt) || CORRUPT_DB ); @@ -7098,14 +7094,13 @@ static void insertCell( }else{ int rc = sqlite3PagerWrite(pPage->pDbPage); if( rc!=SQLITE_OK ){ - *pRC = rc; - return; + return rc; } assert( sqlite3PagerIswriteable(pPage->pDbPage) ); data = pPage->aData; assert( &data[pPage->cellOffset]==pPage->aCellIdx ); rc = allocateSpace(pPage, sz, &idx); - if( rc ){ *pRC = rc; return; } + if( rc ){ return rc; } /* The allocateSpace() routine guarantees the following properties ** if it returns successfully */ assert( idx >= 0 ); @@ -7132,13 +7127,16 @@ static void insertCell( assert( get2byte(&data[pPage->hdrOffset+3])==pPage->nCell || CORRUPT_DB ); #ifndef SQLITE_OMIT_AUTOVACUUM if( pPage->pBt->autoVacuum ){ + int rc = SQLITE_OK; /* The cell may contain a pointer to an overflow page. If so, write ** the entry for the overflow page into the pointer map. */ - ptrmapPutOvflPtr(pPage, pPage, pCell, pRC); + ptrmapPutOvflPtr(pPage, pPage, pCell, &rc); + if( rc ) return rc; } #endif } + return SQLITE_OK; } /* @@ -7710,8 +7708,8 @@ static int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){ /* Insert the new divider cell into pParent. */ if( rc==SQLITE_OK ){ - insertCell(pParent, pParent->nCell, pSpace, (int)(pOut-pSpace), - 0, pPage->pgno, &rc); + rc = insertCell(pParent, pParent->nCell, pSpace, (int)(pOut-pSpace), + 0, pPage->pgno); } /* Set the right-child pointer of pParent to point to the new page. */ @@ -8498,7 +8496,7 @@ static int balance_nonroot( rc = SQLITE_CORRUPT_BKPT; goto balance_cleanup; } - insertCell(pParent, nxDiv+i, pCell, sz, pTemp, pNew->pgno, &rc); + rc = insertCell(pParent, nxDiv+i, pCell, sz, pTemp, pNew->pgno); if( rc!=SQLITE_OK ) goto balance_cleanup; assert( sqlite3PagerIswriteable(pParent->pDbPage) ); } @@ -9240,7 +9238,7 @@ int sqlite3BtreeInsert( }else{ assert( pPage->leaf ); } - insertCell(pPage, idx, newCell, szNew, 0, 0, &rc); + rc = insertCell(pPage, idx, newCell, szNew, 0, 0); assert( pPage->nOverflow==0 || rc==SQLITE_OK ); assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 ); @@ -9561,7 +9559,7 @@ int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ assert( pTmp!=0 ); rc = sqlite3PagerWrite(pLeaf->pDbPage); if( rc==SQLITE_OK ){ - insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n, &rc); + rc = insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n); } dropCell(pLeaf, pLeaf->nCell-1, nCell, &rc); if( rc ) return rc; From 9f2be5db04ddc73466f068a6cda3b196d09eaf86 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 21 Nov 2022 16:00:26 +0000 Subject: [PATCH 21/21] OPFS contention test: give each worker a distinct recognizable name instead of a random one. FossilOrigin-Name: 5f564bf7de7ce3ad7bedb5f06b3086ceaec55da768a60d74059fa4fba4328567 --- ext/wasm/tests/opfs/concurrency/test.js | 7 ++++--- ext/wasm/tests/opfs/concurrency/worker.js | 4 ++-- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ext/wasm/tests/opfs/concurrency/test.js b/ext/wasm/tests/opfs/concurrency/test.js index 8b75ea4c78..27bc47b19d 100644 --- a/ext/wasm/tests/opfs/concurrency/test.js +++ b/ext/wasm/tests/opfs/concurrency/test.js @@ -70,8 +70,7 @@ workers.loadedCount = 0; workers.onmessage = function(msg){ msg = msg.data; - const wName = msg.worker; - const prefix = 'Worker ['+wName+']:'; + const prefix = 'Worker #'+msg.worker+':'; switch(msg.type){ case 'loaded': stdout(prefix,"loaded"); @@ -102,7 +101,9 @@ ); for(let i = 0; i < options.workerCount; ++i){ stdout("Launching worker..."); - workers.push(new Worker(workers.uri+(i ? '' : '&unlink-db'))); + workers.push(new Worker( + workers.uri+'&workerId='+(i+1)+(i ? '' : '&unlink-db') + )); } // Have to delay onmessage assignment until after the loop // to avoid that early workers get an undue head start. diff --git a/ext/wasm/tests/opfs/concurrency/worker.js b/ext/wasm/tests/opfs/concurrency/worker.js index 85a5cf19b7..c315508e0b 100644 --- a/ext/wasm/tests/opfs/concurrency/worker.js +++ b/ext/wasm/tests/opfs/concurrency/worker.js @@ -2,7 +2,8 @@ importScripts( (new URL(self.location.href).searchParams).get('sqlite3.dir') + '/sqlite3.js' ); self.sqlite3InitModule().then(async function(sqlite3){ - const wName = Math.round(Math.random()*10000); + const urlArgs = new URL(self.location.href).searchParams; + const wName = urlArgs.get('workerId') || Math.round(Math.random()*10000); const wPost = (type,...payload)=>{ postMessage({type, worker: wName, payload}); }; @@ -18,7 +19,6 @@ self.sqlite3InitModule().then(async function(sqlite3){ }; const dbName = 'concurrency-tester.db'; - const urlArgs = new URL(self.location.href).searchParams; if(urlArgs.has('unlink-db')){ await sqlite3.opfs.unlink(dbName); stdout("Unlinked",dbName); diff --git a/manifest b/manifest index d57ebb0958..ab782561db 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Performance\soptimization\sand\ssize\sreduction\sin\sinsertCell()\sby\somitting\nthe\s"pRC"\sargument\sand\sinstead\sreturning\sthe\sresult\scode\sas\san\sinteger. -D 2022-11-21T15:55:57.369 +C OPFS\scontention\stest:\sgive\seach\sworker\sa\sdistinct\srecognizable\sname\sinstead\sof\sa\srandom\sone. +D 2022-11-21T16:00:26.047 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -553,8 +553,8 @@ F ext/wasm/tester1-worker.html 5ef353348c37cf2e4fd0b23da562d3275523e036260b51073 F ext/wasm/tester1.c-pp.html 74aa9b31c75f12490653f814b53c3dd39f40cd3f70d6a53a716f4e8587107399 F ext/wasm/tester1.c-pp.js 0c129495d057c77788b59715152d51f9bf9002ebbcce759ef8b028272ce3519d F ext/wasm/tests/opfs/concurrency/index.html bb9b0f6da86df34c67fa506db9c45b7c4cf0045a211611cc6b8d2b53fa983481 -F ext/wasm/tests/opfs/concurrency/test.js cea04456ffae7bbfd726ef0e859d2afc2a51ead66940fc4a2499884ac44d16dd -F ext/wasm/tests/opfs/concurrency/worker.js a92fa4da1431d3c6db3e1dd0b98794e09d1021e23a8c490335410cce283b11c1 +F ext/wasm/tests/opfs/concurrency/test.js 5993c08657d547d3a26b78ff3480122aed2b7361823bc127e96e558931093aff +F ext/wasm/tests/opfs/concurrency/worker.js df065bb386ff994951f7fbdd76e12f16e58fbef0e929b2caf74553359da40afc F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5 F ext/wasm/wasmfs.make 8fea9b4f3cde06141de1fc4c586ab405bd32c3f401554f4ebb18c797401a678d F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x @@ -2059,8 +2059,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b8976ebfe03fbc1e09a38d598a62493a7f19ff7a2a3acd1ec54d0dee190471e9 -R 6d5890069b8a565895abb49912f71e80 -U drh -Z df511e58d09c8af289615762e74d854c +P bee94d1bb0daade023cc1e274339daafc249e1978c0765fc45042b5f9060e478 +R 24e9b381879a473eda77c6d52873b2a6 +U stephan +Z 5200ed97b9b65f90e5d50e34624e223d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5bdfc3f30e..2dbda6c4cc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bee94d1bb0daade023cc1e274339daafc249e1978c0765fc45042b5f9060e478 \ No newline at end of file +5f564bf7de7ce3ad7bedb5f06b3086ceaec55da768a60d74059fa4fba4328567 \ No newline at end of file