From: stephan Date: Fri, 26 Sep 2025 02:18:28 +0000 (+0000) Subject: More build docs. Add a speedtest1 64-bit build but it's not hooked up to any test... X-Git-Tag: major-release~168 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ace5e0a387e2cd645fb426c8857852b30d00c43;p=thirdparty%2Fsqlite.git More build docs. Add a speedtest1 64-bit build but it's not hooked up to any test apps yet. Improve invalid-arg detection in c-pp. FossilOrigin-Name: 69086be8a155d70d9dd7b655b66809250b24fe6d5bcdc6cb5e0275446a43f51d --- diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 4011fb8969..348aab87eb 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -468,7 +468,7 @@ endif # # Changing this may require a clean rebuild. # -WASM_CUSTOM_INSTANTIATE = 0 +WASM_CUSTOM_INSTANTIATE = 1 ######################################################################## # $(bin.c-pp): a minimal text file preprocessor. Like C's but much diff --git a/ext/wasm/c-pp.c b/ext/wasm/c-pp.c index 791bc319ce..f89c75a54b 100644 --- a/ext/wasm/c-pp.c +++ b/ext/wasm/c-pp.c @@ -1517,7 +1517,7 @@ int main(int argc, char const * const * argv){ } ISFLAG("debug"){ ++g.doDebug; - }else if('-'!=*zArg){ + }else if(zArg==argv[i]/*not a flag*/){ goto do_infile; }else{ fatal("Unhandled flag: %s", argv[i]); diff --git a/ext/wasm/mkwasmbuilds.c b/ext/wasm/mkwasmbuilds.c index d39a87fe33..b24bfebec7 100644 --- a/ext/wasm/mkwasmbuilds.c +++ b/ext/wasm/mkwasmbuilds.c @@ -63,9 +63,18 @@ enum { /* Indicates a wasmfs build (untested and unsupported). */ F_WASMFS = 1<<6, - /** - Which compiled files from $(dir.dout)/buildName/*.{js,mjs,wasm} - to copy to $(dir.dout) after creating them. + /* + ** Which compiled files from $(dir.dout)/buildName/*.{js,mjs,wasm} + ** to copy to $(dir.dout) after creating them. This should only be + ** applied to builds which result in end-user deliverables. Some + ** builds, like the bundler-friendly ones, are a hybrid: we keep + ** only their JS file and patch their JS to use the WASM file from a + ** canonical build which uses that same WASM file. Reusing X.wasm + ** that way can only work for builds which are processed identically + ** by Emscripten. For a given set of C flags (as opposed to + ** JS-influencing flags), all builds of X.js and Y.js will produce + ** identical X.wasm and Y.wasm files. Their JS files may well + ** differ, however. */ CP_JS = 1 << 30, CP_WASM = 1 << 31, @@ -74,6 +83,24 @@ enum { /* ** Info needed for building one concrete JS/WASM combination.. +** +** Notes about Emscripten builds... +** +** When emcc processes X.js it also generates X.wasm and hard-codes +** the name "X.wasm" into the JS file (it has to - there's no reliable +** way to derive that name at runtime for certain modes of loading the +** WASM file). Because we only need two sqlite3.wasm files (one each +** for 32- and 64-bit), the build then copies just those into the +** final build directory $(dir.dout). +** +** To keep parallel builds from stepping on each other, each distinct +** build goes into its own subdir $(dir.dout.BuildName)[^1], i.e. +** $(dir.dout)/BuildName. Builds which produce deliverables we'd like +** to keep/distribute copy their final results into the build dir +** $(dir.dout). See the notes for the CP_JS enum entry for more +** details on that. +** +** [^1]: The legal BuildNames are in this file's BuildDef_map macro. */ struct BuildDef { /** @@ -116,28 +143,6 @@ struct BuildDef { }; typedef struct BuildDef BuildDef; -/* -** WASM_CUSTOM_INSTANTIATE changes how the JS pieces load the .wasm -** file from the .js file. When set, our JS takes over that step from -** Emscripten. Both modes are functionally equivalent but -** customization gives us access to wasm module state which we don't -** otherwise have. That said, the library also does not _need_ that -** state, so we don't _need_ to customize that step. -*/ -#if !defined(WASM_CUSTOM_INSTANTIATE) -# define WASM_CUSTOM_INSTANTIATE 0 -#elif (WASM_CUSTOM_INSTANTIATE+0)==0 -# undef WASM_CUSTOM_INSTANTIATE -# define WASM_CUSTOM_INSTANTIATE 0 -#endif - -#if WASM_CUSTOM_INSTANTIATE -/* c-pp -D... flags for the custom instantiateWasm(). */ -#define C_PP_D_CUSTOM_INSTANTIATE " -Dcustom-Module.instantiateWasm " -#else -#define C_PP_D_CUSTOM_INSTANTIATE -#endif - /* ** List of distinct library builds. Each one has to be set up in ** oBuildDefs. See the next comment block. @@ -154,7 +159,7 @@ typedef struct BuildDef BuildDef; E(vanilla) E(vanilla64) \ E(esm) E(esm64) \ E(bundler) E(bundler64) \ - E(speedtest1) \ + E(speedtest1) E(speedtest164) \ E(node) E(node64) \ E(wasmfs) @@ -235,7 +240,7 @@ const BuildDefs oBuildDefs = { .flags = CP_JS | F_ESM | F_64BIT }, - /* speedtest1, our primary benchmarking tool */ + /* speedtest1, our primary benchmarking tool */ .speedtest1 = { .zEmo = "🛼", .zBaseName = "speedtest1", @@ -262,6 +267,35 @@ const BuildDefs oBuildDefs = { .flags = CP_ALL }, + /* speedtest1, 64-bit */ + .speedtest164 = { + .zEmo = "🛼64", + .zBaseName = "speedtest1-64bit", + .zDotWasm = 0, + .zCmppD = "-D64bit", + .zEmcc = + "$(emcc.speedtest1)" + " $(emcc.speedtest1.common)" + " -sMEMORY64=1 -sWASM_BIGINT=1" + " $(pre-post.speedtest1.flags)" + " $(cflags.common)" + " -DSQLITE_SPEEDTEST1_WASM" + " $(SQLITE_OPT)" + " -USQLITE_WASM_BARE_BONES" + " -USQLITE_C -DSQLITE_C=$(sqlite3.canonical.c)" + " $(speedtest1.exit-runtime0)" + " $(speedtest1.c.in)" + " -lm", + .zEmccExtra = 0, + .zEmccExtra = 0, + .zEnv = 0, + .zDeps = + "$(speedtest1.c.in)" + " $(EXPORTED_FUNCTIONS.speedtest1)", + .zIfCond = 0, + .flags = CP_ALL | F_NOT_IN_ALL + }, + /* ** Core bundler-friendly build. Untested and "not really" supported, ** but required by the downstream npm subproject. @@ -480,6 +514,28 @@ static void mk_prologue(void){ ps("more: all"); } +/* +** WASM_CUSTOM_INSTANTIATE changes how the JS pieces load the .wasm +** file from the .js file. When set, our JS takes over that step from +** Emscripten. Both modes are functionally equivalent but +** customization gives us access to wasm module state which we don't +** otherwise have. That said, the library also does not _need_ that +** state, so we don't _need_ to customize that step. +*/ +#if !defined(WASM_CUSTOM_INSTANTIATE) +# define WASM_CUSTOM_INSTANTIATE 0 +#elif (WASM_CUSTOM_INSTANTIATE+0)==0 +# undef WASM_CUSTOM_INSTANTIATE +# define WASM_CUSTOM_INSTANTIATE 0 +#endif + +#if WASM_CUSTOM_INSTANTIATE +/* c-pp -D... flags for the custom instantiateWasm(). */ +#define C_PP_D_CUSTOM_INSTANTIATE " -Dcustom-Module.instantiateWasm " +#else +#define C_PP_D_CUSTOM_INSTANTIATE +#endif + /* ** Emits makefile code for setting up values for the --pre-js=FILE, ** --post-js=FILE, and --extern-post-js=FILE emcc flags, as well as diff --git a/manifest b/manifest index 1a8b229e47..6ce5caeab7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Build\scleanups\sand\sdead\scode\sremoval. -D 2025-09-26T01:38:07.516 +C More\sbuild\sdocs.\sAdd\sa\sspeedtest1\s64-bit\sbuild\sbut\sit's\snot\shooked\sup\sto\sany\stest\sapps\syet.\sImprove\sinvalid-arg\sdetection\sin\sc-pp. +D 2025-09-26T02:18:28.663 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -578,7 +578,7 @@ F ext/session/sqlite3session.c b3de195ce668cace9b324599bf6255a70290cbfb5451e826e F ext/session/sqlite3session.h 7404723606074fcb2afdc6b72c206072cdb2b7d8ba097ca1559174a80bc26f7a F ext/session/test_session.c 8766b5973a6323934cb51248f621c3dc87ad2a98f023c3cc280d79e7d78d36fb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 552729e81c67b249cb1a502b2efa1d264c26058a190f080620d16da8ae1a5c91 +F ext/wasm/GNUmakefile c6cd306a0b078daf7da2af2decd2f60d84aacc3cd6775b5481285628291c877b F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a F ext/wasm/README.md 66ace67ae98a45e4116f2ca5425b716887bcee4d64febee804ff6398e1ae9ec7 F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff @@ -610,7 +610,7 @@ F ext/wasm/api/sqlite3-vtab-helper.c-pp.js 9097074724172e31e56ce20ccd7482259cf72 F ext/wasm/api/sqlite3-wasm.c ff2dc011e17b06186b8b35e408626d7ace69a362b92c197a34d78bef25c7105a F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 8fb6adfbae6270344f43f2652e63780df3f86521755bde8f92cf6b809ba7891d F ext/wasm/api/sqlite3-worker1.c-pp.js 69483df1df2d0988e708390f7b1feda769c16e9e9efd4683557f8e7197099cc0 -F ext/wasm/c-pp.c 7692739ac435120c37b9de993f152c90e5dbf6a340ca6331de81d7b8b06b5307 +F ext/wasm/c-pp.c e13ab389eeb3d95858373ca7cf6129cfd8f39277746db4c2d06553fa5becf875 F ext/wasm/common/SqliteTestUtil.js 7adaeffef757d8708418dc9190f72df22367b531831775804b31598b44f6aa51 F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15 F ext/wasm/common/testing.css e97549bab24126c24e0daabfe2de9bb478fb0a69fdb2ddd0a73a992c091aad6f @@ -634,7 +634,7 @@ F ext/wasm/index.html 1b329fb63e057c02a17ce178308d6b06aac62d92af7dd6d821fb0e183e F ext/wasm/jaccwabyt/jaccwabyt.js bbac67bc7a79dca34afe6215fd16b27768d84e22273507206f888c117e2ede7d F ext/wasm/jaccwabyt/jaccwabyt.md 167fc0b624c9bc2c477846e336de9403842d81b1a24fc4d3b24317cb9eba734f F ext/wasm/mkdist.sh 29f8a37a7aba41fa5df8e89b1fab02b83b35c43473c5cf808584872e022514b8 x -F ext/wasm/mkwasmbuilds.c 3a5318125a18586820aa616c1b1a04ae9cb22a14d08314c29064f7ed170107da +F ext/wasm/mkwasmbuilds.c e3f9e1d4b86498d621397f3a617816df51df019191ee259f9178705300225c07 F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337 F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96 F ext/wasm/scratchpad-wasmfs.mjs 66034b9256b218de59248aad796760a1584c1dd842231505895eff00dbd57c63 @@ -2170,8 +2170,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e9a6391b377b6964620285192262a4dc9fe1712799f7aa8a8b37c5f718544ed2 -R dea7fcf911bad446482b33822a2cc98a +P b516109e5accc885b71900402c800ae855407552648861334c895f0e5dea4ee5 +R 4a576219489317c06f99b90fe74d6efc U stephan -Z 1ba071457baea55e6abdc250bb9597e3 +Z f500aa84b704bc32aed6ae603d71df57 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index bbc5c8e349..b935aae979 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b516109e5accc885b71900402c800ae855407552648861334c895f0e5dea4ee5 +69086be8a155d70d9dd7b655b66809250b24fe6d5bcdc6cb5e0275446a43f51d