1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-04-20 08:47:46 +03:00

787 Commits

Author SHA1 Message Date
stephan
e435547beb Internal doc touchups in ext/wasm/mkwasmbuilds.c. No functional changes.
FossilOrigin-Name: 47d34260e74912eeae704bff7c4314b893af86ee66dd96a1bc6f450d3e290702
2025-03-18 13:52:53 +00:00
stephan
d176ef5881 Fix a long-standing filename digest computation bug in the OPFS SAHPool VFS which caused all VFS-stored filenames to have a digest value of 0. See [/forumpost/042d53c928382021] and for full details.
FossilOrigin-Name: 493cbe74504e8eb1ca8f2edf49fdab6bebc7fe36ffab06932a4b8c5a4eea86cd
2025-03-16 14:05:42 +00:00
stephan
5390f95f07 Minor doc corrections for the sahpool-digest fix and merge in current trunk.
FossilOrigin-Name: 500f2e6ec74b4c0e4ac0365ba4e0d81ed6df8dd09dc0f8af65d294c3453f8865
2025-03-14 11:14:52 +00:00
stephan
c9cc6a5474 Use SQLITE_EXTRA_INIT_MUTEXED instead of SQLITE_EXTRA_INIT for the SQLITE_WASM_EXTRA_INIT feature, as suggested in [forum:14183b98fc0b1dea|forum post 14183b98fc0b1dea]. This doesn't make a functional difference now - this is in the name of future-proofing against eventual threading support in wasm.
FossilOrigin-Name: 46479c2e30b9676e0fa8da117ba67f673671fb340c9bea38ece19a1b2371a57b
2025-03-01 23:44:11 +00:00
stephan
da5f813878 Approximately 100 typo corrections spanning the whole tree, submitted via [forum:0db9827f0464bc33|forum post 0db9827f0464bc33] and individually audited and verified. Affects only code comments, innocuous test strings, error message text in tool (not library) code, and configure-level help text.
FossilOrigin-Name: f50c21484d3cac73589da0376c423de39ae8b842218105786c5aa3726e4dcaed
2025-02-27 21:17:55 +00:00
stephan
69eaadbee3 Merge trunk into the sahpool-digest branch.
FossilOrigin-Name: fc1eeb7d1f2880907b0fe71a8c572dd7cd74a5d65ec0177332976ad2f8c2b216
2025-02-26 03:32:52 +00:00
stephan
d804893762 Fix a bug in mkwasmbuilds.c which caused sqlite3.wasm to get deleted directly after it was built.
FossilOrigin-Name: 1a72d1d13e42f69f02861f8ac3058e69b78d4fd2050ca8c53a1ce016b7e0863d
2025-02-26 03:20:26 +00:00
stephan
d2f7dfa619 More work on the sahpool digest fix. New/fixed versions can read legacy (no digest) files but the reverse is only possible in limited circumstances (when files originated from a legacy version). The burning question is whether the real fix would be to remove this digest check altogether, as it only applies in a very limited context, and the fact that it was broken for some 18 months unnoticed suggests that its value might not be worth the CPU cycles.
FossilOrigin-Name: 0df62b776c68bebb0e187b353b6f29b0a41a29f0a1c8d6728fa6b9f7ce0d13f7
2025-02-26 03:03:08 +00:00
stephan
5d60f47001 Approximately 50 typo fixes, spanning the whole tree, contributed via [forum:006c8fa165083ac3|forum post 006c8fa165083ac3] and individually checked for correctness. Affects only code comments, docs, and a single line of debug output in a test app.
FossilOrigin-Name: af928818a030924060ee0762431dae0f16d53a62f4e1132754d052eb9c621ac2
2025-02-25 20:55:14 +00:00
stephan
9e632f5512 wasm: do not build the (untested/unsupported) node-for-node build by default, to cut build time by about 15%. Adjacent cleanups in mkwasmbuilds.c.
FossilOrigin-Name: e4539ebebd89840b76f5a0626393299100685a38f45546a0bf7a62e4df56f863
2025-02-20 05:39:18 +00:00
stephan
b42310a6b9 wasm makefile docs: make explicit that the node.js-for-node.js builds (as opposed to the node.js-for-browser builds) are both untested and unsupported.
FossilOrigin-Name: e1f184889fef4603d61d306c8c0dc86df616290ccf73dbd871fa27bd99e5e5c9
2025-02-20 04:45:02 +00:00
stephan
a32ea731a0 Add the pause/unpause capability to the opfs-sahpool VFS, as discussed in [forum:fe8cdb8431c|forum thread fe8cdb8431c]. Summary: this gives clients a way to eke some degree of multi-page/tab/Worker concurrency out of this VFS but requires that coordination to be implemented client-side, e.g. via a SharedWorker or WebLocks.
FossilOrigin-Name: b5dbd521951e129b4dec69f191a872500dbf387b34a8479ad58b053ffcccbab9
2025-02-20 04:14:26 +00:00
stephan
9ef8399055 Update path on the web server for test/snapshot instances of fiddle.
FossilOrigin-Name: 57caa3136d1bfca06e4f2285734a4977b8d3fa1f75bf87453b975867e9de38fc
2025-02-18 01:16:26 +00:00
stephan
e108f97256 wasm: add some build-time validation to ensure that the problem fixed in [65798c09a00662a3] does not recur. Ensure that files generated via mkwasmbuilds.c have the generated makefile as a dependency.
FossilOrigin-Name: 55e01365946b3432e93da5c08200e476e2a134c98b963b4170e4dfae8408a005
2025-02-09 04:16:01 +00:00
stephan
00bc96c05c wasm: when building in -O0 mode (typical dev mode), use -sASSERTIONS=2, else -sASSERTIONS=0, in response [7e3e35cbff|Emscripten checkin 7e3e35cbff9], which adds assertions to check for the condition reported in [https://github.com/emscripten-core/emscripten/issues/23420|Emscripten ticket 23420]. Update some unrelated JS-side internal docs.
FossilOrigin-Name: 1f554610ba5d9d474ec4570bb7ca09125fd2cdfb4976530a4227cc6ebdf3a962
2025-02-09 03:24:00 +00:00
stephan
f858182689 JS: add a mechanism to the Worker1 exec API to fetch the last_insert_rowid(), as requested in [forum:56bc35390183f5d5|forum post 56bc353901].
FossilOrigin-Name: c22c48360756b1c7e2f5a9c01aff799bc188e100d364931de0dc3686e5de57a9
2025-02-09 02:41:35 +00:00
stephan
d8452a9517 Reorder a piece of ext/wasm/GNUmakefile to correct the timing of various var accesses. Fixes a problem [https://github.com/sqlite/sqlite-wasm/pull/99|reported in the downstream npm subproject] and explains the confusion in [4aa025a943a4024094b9] (which has been reverted).
FossilOrigin-Name: 65798c09a00662a3598f01571d6f3a2dc750c3d0b127c344590539244afe4aa7
2025-02-07 12:33:48 +00:00
stephan
3c013479c3 Fix a dependencies/order-of-operations bug in ext/wasm/GNUmakefile which causes creation of files filtered via c-pp to fail if the ext/wasm/jswasm dir did not exist beforehand.
FossilOrigin-Name: 4bac76138853a89484d3ac0486a9ed5143aa671b13b4b3abb704c1487213b388
2025-02-06 13:18:49 +00:00
stephan
6e5802fc74 Improve the JS-side sqlite3_set_auxdata() test to also trigger the case that the aux data actually gets reused. Test changes only, no library code.
FossilOrigin-Name: 9f27379d860518e6e097a2c999da04176812260a61bf11fe495c3efd76971806
2025-02-03 18:01:42 +00:00
stephan
3cd34ab981 Rework [76c8435a] to eliminate automatic JS-to-WASM function conversions of sqlite3_set_auxdata() destructors because it can leads to leaks on every call of a UDF. This feature never worked before [76c8435a] but fixing it was ill-conceived because of the memory leakage it introduces. WASM function pointers can still be used as destructors in this context.
FossilOrigin-Name: 3fb993af0caf041da934cea29c039b27c468be0b75bce1537a6425767cf9bf8d
2025-02-03 17:34:12 +00:00
stephan
c97abeac0b Add a test app to assist in validating the SAHPool digest calculation fix.
FossilOrigin-Name: a1e304b8020025cc73a658bd8c7697d59b4f3ad96cac0a3e36553a3207d13dc6
2025-02-03 17:21:54 +00:00
stephan
40ce00b546 Initial work on a fix for the SAHPool VFS's effectively-no-op digest calculation, as reported in [https://github.com/sqlite/sqlite-wasm/issues/97|ticket #97 of the downstream npm subproject]. This requires more testing alongside databases created before this version to ensure that it's backwards-compatible.
FossilOrigin-Name: 9234c33f92d92bfddc6211c9c587f1072e70837c0ffe1416ef7d84d59bacd364
2025-02-03 16:26:30 +00:00
stephan
d98689f4d3 Add a more complete test for [76c8435a] and add some commentary about (A) the inability to automatically clean up automatically-generated WASM proxy functions for sqlite3_set_auxdata() destructors and (B) how to deal with (A) to avoid leaking WASM proxy functions.
FossilOrigin-Name: d693c2dddbd10a2e0b77893b04b11502e30b768f1b06814105f7f35172845fb9
2025-02-03 14:55:56 +00:00
stephan
d256b56880 Correct the FuncPtrAdapter signature for the JS binding of sqlite3_set_auxdata(). Reported in [https://github.com/sqlite/sqlite-wasm/issues/92|the npm subproject, ticket #92].
FossilOrigin-Name: 76c8435a5f390001038b8ee94322ff478c9d5f29501ed1c5891c952a41e377aa
2025-02-03 14:04:27 +00:00
stephan
14613b1b1d URL typo fix in code comments. No code changes.
FossilOrigin-Name: 002a123094e4ef14eb5ec28033adca6083ba2717e1eaa23e80595e37a947e6c2
2025-02-02 12:15:25 +00:00
stephan
fdc17e0bc8 JS doc typo fixes. No functional changes.
FossilOrigin-Name: e0d9c74c1cdddb2321131255b94f9cda6530be3f2a06aed4abb54dcda092481e
2025-02-01 09:44:48 +00:00
stephan
82f3052e61 Expose the new SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE/WRITE and SQLITE_DBCONFIG_ENABLE_COMMENTS (from [325e547a21955]) to JS/WASM.
FossilOrigin-Name: 8da1a9af66f905c683e9c3445d609b5c0e11ac912be192c468ddd79f237837f4
2025-01-31 18:45:03 +00:00
stephan
cee7609074 Minor cleanups in the opfs-sahpool pause/unpause API demo.
FossilOrigin-Name: e205cdc468e02eefdeb8d391d921aa2d4d28a8b7b87036d6d937a9928261a413
2025-01-31 17:47:47 +00:00
stephan
a75321d735 Add the conventional license header to sahpool-worker.js and correct the date on the header in sahpool-pausing.js.
FossilOrigin-Name: f7c3026b0d2e33cc4e3b906810d860b155b1ff714bbe4e1eb9ee392122217efa
2025-01-31 16:34:52 +00:00
stephan
cb0da053ed Add a small test app demonstrating cooperative semi-concurrency of the opfs-sahpool VFS using its un/pauseVfs() APIs.
FossilOrigin-Name: 09570c55a23e5af76dd2153a5b28a493f498d7d4a08b0089f3074d0a2c5d3d29
2025-01-31 16:25:18 +00:00
stephan
654c94d683 Cleanups in the opfs-sahpool VFS pause/unpause feature and its tests.
FossilOrigin-Name: 184ba37702f63196deca91d273e798ca895fbb301938e6264bc82815a4e33149
2025-01-31 14:25:38 +00:00
stephan
d4bfa3465e Merge trunk into opfs-sahpool-pause branch.
FossilOrigin-Name: 775a547eca2b0b3dbb6c03990236128a095cc34d28caec44b9a5072510c75b63
2025-01-31 12:39:07 +00:00
stephan
efbf481541 Minor wasm-specific doc touchups.
FossilOrigin-Name: 56b618da9073db8b8d5dafa177a3c9e4c4d927bf512e14b0e6d23937f91ce4cf
2025-01-31 12:30:37 +00:00
stephan
cb46f1bb95 Simplify how OpfsSAHPoolUtil.unpauseVfs()'s returned promise is handled.
FossilOrigin-Name: d651b8da5a84cd54d71f15bd34e4db685674ef73f26f5cc26b7af5321a2ec05e
2025-01-29 11:28:18 +00:00
stephan
8883deb30e Add experimental support to pause/unpause an SAHPool OPFS VFS, as discussed in [forum:fe8cdb8431c32455|forum post fe8cdb8431c32455], the intent being enable a page to relinquish, perhaps temporarily, the VFS such that the VFS's storage can be accessed by another page/tab.
FossilOrigin-Name: 1d2683fe9e4be01c3137e750900f54d287e7d96185e66924d24b50f4647e7ef1
2025-01-29 11:08:11 +00:00
stephan
8bfb186728 Replace a handful of hard tabs in string literals with \t in mkwasmbuilds.c.
FossilOrigin-Name: e8e4d497a7b6aae450cb93927c7583fcce3fe971cd3691f9d9cad605de3cfb1f
2025-01-24 12:54:59 +00:00
stephan
4331e6bd1d Minor additions to ext/wasm/README.md.
FossilOrigin-Name: 85747ea1654c74d330614aa174ede4a989b6456eb1fc5eb0fc9f2d1418b6ef99
2025-01-24 09:21:39 +00:00
stephan
dfb5f32758 Update ext/wasm/README.md to reflect simplifications permitted by the current configure script behavior.
FossilOrigin-Name: 9abb56c6acb1c84c2df8534ca3ebb2894afd68bc7b8331d4d12611896c576749
2025-01-24 09:18:19 +00:00
stephan
c70631623c Remove extraneous are-we-making-clean guards from the generated wasm build rules, as that guard is set at a higher level. Rename a makefile call()able for consistency.
FossilOrigin-Name: 7f9074e2a7ff62bdcf343895e80a51224de62a22afbbf82068ec5fea7eeda0bb
2025-01-24 08:58:54 +00:00
stephan
07a2e5d1ed wasm: de-list demo-worker1-promiser-esm.html from the test pages because (per Chrome 131) "Module scripts don't support importScripts()", where "don't" means "they used to but no longer do".
FossilOrigin-Name: 4aa025a943a4024094b91f13abfb8945bbbb8334e3ec904dee5315852845bfe1
2025-01-23 22:23:31 +00:00
stephan
02e81f72a0 When running wasm-opt, ignore any failure because it will fail for unknown flags and the set of legal flags will change from version to version. Document the size-reduction effect (or non-effect) of a dozen-odd wasm-opt flags and retain those which demonstrate a wasm file size reduction in -Oz builds (our production build mode). Total size savings: roughly 13kb.
FossilOrigin-Name: c9dc581e0287e3462ac55f80ca76e7e98d31157022052c892517363c45287a7b
2025-01-23 19:44:09 +00:00
stephan
726a047a47 Remove some now-dead makefile code, rename a var for consistency, and fix a recipe bug introduced in the previous checkin in the bundler-friendly build.
FossilOrigin-Name: 0acd4ef3addb311476f4a670be0c4c4a0f3f88b0420886d4c1c3c3027dd51d73
2025-01-23 16:11:24 +00:00
stephan
efafde5eb4 Initial support for post-processing wasm files with wasm-opt (if it's available). This currently shaves 12kb off of the release-mode build of sqlite3.wasm but there are many dozens of wasm-opt flags left to try.
FossilOrigin-Name: 5d16e3f28364de2d6b6456a6fc56bf604b9106c3ae15719f2862192ae3020cc1
2025-01-23 15:58:01 +00:00
stephan
72543206e5 Move small parts of ext/wasm/GNUmakefile into ext/wasm/config.make.in and have the configure script populate that, rather than dynamically determining those values on each 'make' invocation. Add a configure-time check for the optional wasm-opt binary in prep for pending experimentation with using it to reduce the wasm file sizes.
FossilOrigin-Name: 0a426a549577b883e2de7cd0605041cc97b57f53ee6657bc318b0bfde7b62677
2025-01-23 14:09:02 +00:00
stephan
c9bf7ed9ad Remove unnecessary --minify 0 emcc flag from the wasm build, as -g3 implies that capability along with other anti-minification features we rely on.
FossilOrigin-Name: 10c91f9cd074e8d35af1c7f8251ac18e5dd91fa14df3fe4e1fb44441c4f08c7a
2025-01-23 11:21:29 +00:00
stephan
ec50c5a2a4 wasm: after generating the .js/.mjs file, strip out all of the generated pieces which create Emscripten call() bindings for the sqlite3 APIs, as we don't use those binding, so both the setup time and the memory they use installing WASM proxy bindings is wasted. This eliminates some 200 superfluous/unused bindings from the init process.
FossilOrigin-Name: 020d2c7528be6f11a5b2b849d7b2f04e47abe2b0842520ff60eb7defb3768e1c
2025-01-16 13:10:06 +00:00
stephan
3202b11f66 Replace use of Emscripten's Module.postRun() with a custom callback so that we get consistent library init timing with both Emscripten 3.1.x and 4.0.x. Details and discussion are in [https://github.com/emscripten-core/emscripten/issues/23420|Emscripten ticket #23420].
FossilOrigin-Name: 4863a70ac61ff6f868429f16f0141484ea98f973fde1a9aff879252d0f1dbb6b
2025-01-16 09:27:40 +00:00
stephan
3ba9adc5c1 Teach tool/stripccomments.c that a backslash immediately preceeding a forward slash means that that forward slash cannot be the start of a comment. This is intended to allow JavaScript regular expressions containing \/* (like [https://github.com/emscripten-core/emscripten/issues/23412|the one introduced in emsdk 4.0.0]) to pass through properly. Re-enable comment-stripping in the JS dist builds.
FossilOrigin-Name: db21d6cc9d1c425deffc0e4e92173caf586e6ac66110c71a4930b21e3e7f84b9
2025-01-15 21:09:19 +00:00
stephan
c738052394 Work around [https://github.com/emscripten-core/emscripten/issues/23420|a behavior change in emsdk 4.0.0] which breaks the load/init timing of the wasm module.
FossilOrigin-Name: 00a750184bcf1a94bf4e7f1d5029a42671e87e2997ae97be07bd900d3702883d
2025-01-15 20:53:14 +00:00
stephan
73d9eb1bb3 Fix a typo in a wasm makefile var name, noting that this doesn't actually fix anything because the var in question is not used when building 'clean' or 'distclean'.
FossilOrigin-Name: 7cfc75a625095e41c3e952d4a209fdbb344df0d3dd9b0103e9e6a986dfe53c89
2025-01-15 15:27:02 +00:00