From: stephan Date: Sat, 3 Sep 2022 11:41:44 +0000 (+0000) Subject: wasm: minor text and build cleanups. X-Git-Tag: version-3.40.0~169^2~142 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cdefd5d046db3baa83e18b82cac15c54c8e8d60a;p=thirdparty%2Fsqlite.git wasm: minor text and build cleanups. FossilOrigin-Name: 36ceef94e1935f5e85f79e489cd0ed265a77820fb68329c190794df5e076bf84 --- diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 39cf8b26e4..11b1402662 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -167,9 +167,12 @@ $(post-js.js): $(post-jses) $(MAKEFILE) ######################################################################## -# emcc flags for .c/.o/.wasm. +# emcc flags for .c/.o/.wasm/.js. emcc.flags = #emcc.flags += -v # _very_ loud but also informative about what it's doing +# -g is needed to keep -O2 and higher from creating broken JS via +# minification. +emcc.flags += -g ######################################################################## # emcc flags for .c/.o. @@ -181,6 +184,7 @@ emcc.cflags += -I. -I$(dir.top) # $(SQLITE_OPT) ######################################################################## # emcc flags specific to building the final .js/.wasm file... emcc.jsflags := -fPIC +emcc.jsflags := --minify 0 emcc.jsflags += --no-entry emcc.jsflags += -sMODULARIZE emcc.jsflags += -sSTRICT_JS @@ -303,7 +307,11 @@ $(speedtest1.sql): $(speedtest1) batch-runner.list: $(MAKEFILE) $(speedtest1.sql) $(dir.sql)/000-mandelbrot.sql bash split-speedtest1-script.sh $(dir.sql)/speedtest1.sql ls -1 $(dir.sql)/*.sql | grep -v speedtest1.sql | sort > $@ -CLEAN_FILES += batch-runner.list $(dir.sql)/speedtest1*.sql +clean-batch: + rm -f batch-runner.list $(dir.sql)/speedtest1*.sql +# ^^^ we don't do this along with 'clean' because we clean/rebuild on +# a regular basis with different -Ox flags and rebuilding the batch +# pieces each time is an unnecessary time sink. batch: batch-runner.list all: batch diff --git a/ext/wasm/batch-runner.js b/ext/wasm/batch-runner.js index 909a140047..6cee157051 100644 --- a/ext/wasm/batch-runner.js +++ b/ext/wasm/batch-runner.js @@ -10,12 +10,11 @@ *********************************************************************** - A basic batch SQL running for sqlite3-api.js. This file must be run in + A basic batch SQL runner for sqlite3-api.js. This file must be run in main JS thread and sqlite3.js must have been loaded before it. */ 'use strict'; (function(){ - const T = self.SqliteTestUtil; const toss = function(...args){throw new Error(args.join(' '))}; const warn = console.warn.bind(console); @@ -218,7 +217,7 @@ const url = URL.createObjectURL(b); const a = document.createElement('a'); a.href = url; - a.download = 'batch-runner-metrics-'+((new Date().getTime()/1000) | 0)+'.csv'; + a.download = 'batch-runner-js-'+((new Date().getTime()/1000) | 0)+'.csv'; this.logHtml("Triggering download of",a.download); document.body.appendChild(a); a.click(); @@ -376,10 +375,10 @@ } }, false); this.e.btnExportMetrics.addEventListener('click', function(){ - who.logHtml2('warning',"Metrics export is a Work in Progress. See output in dev console."); + who.logHtml2('warning',"Triggering download of metrics CSV. Check your downloads folder."); who.downloadMetrics(); - const m = who.metricsToArrays(); - console.log("Metrics:",who.metrics, m); + //const m = who.metricsToArrays(); + //console.log("Metrics:",who.metrics, m); }); this.e.btnRunRemaining.addEventListener('click', async function(){ let v = who.e.selSql.value; diff --git a/ext/wasm/common/SqliteTestUtil.js b/ext/wasm/common/SqliteTestUtil.js index c21469c9b0..51cd64108e 100644 --- a/ext/wasm/common/SqliteTestUtil.js +++ b/ext/wasm/common/SqliteTestUtil.js @@ -122,6 +122,11 @@ sqlite3InitModule() factory function. */ self.sqlite3TestModule = { + /** + Array of functions to call after Emscripten has initialized the + wasm module. Each gets passed the Emscripten module object + (which is _this_ object). + */ postRun: [ /* function(theModule){...} */ ], @@ -135,10 +140,10 @@ console.error.apply(console, Array.prototype.slice.call(arguments)); }, /** - Called by the module init bits to report loading - progress. It gets passed an empty argument when loading is - done (after onRuntimeInitialized() and any this.postRun - callbacks have been run). + Called by the Emscripten module init bits to report loading + progress. It gets passed an empty argument when loading is done + (after onRuntimeInitialized() and any this.postRun callbacks + have been run). */ setStatus: function f(text){ if(!f.last){ diff --git a/manifest b/manifest index d6ecf92b24..ddfd3bdce4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C batch-runner.js:\sadd\srudimentary\smetrics\sexport\sto\sCSV.\sAdd\sa\stoggle\sto\sreverse\sthe\slog\soutput\smode\s(in\snormal\sorder\sor\smost\srecent\sfirst). -D 2022-08-30T17:57:50.778 +C wasm:\sminor\stext\sand\sbuild\scleanups. +D 2022-09-03T11:41:44.176 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -474,7 +474,7 @@ F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle db7a4602f043cf4a5e4135be3609a487f9f1c83f05778bfbdf93766be4541b96 F ext/wasm/EXPORTED_RUNTIME_METHODS.fiddle a004bd5eeeda6d3b28d16779b7f1a80305bfe009dfc7f0721b042967f0d39d02 -F ext/wasm/GNUmakefile fd1ba419c38d79f742849cc96a1f1e1dd63821e6173bc5727f0a5439f04b4131 +F ext/wasm/GNUmakefile 49d76f7b4c45d6ff8cb573ba0d1dd7b4712e59582bdc1dfb2f96a4b89f47e34c F ext/wasm/README.md e1ee1e7c321c6a250bf78a84ca6f5882890a237a450ba5a0649c7a8399194c52 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 77ef4bcf37e362b9ad61f9c175dfc0f1b3e571563fb311b96581cf422ee6a8ec F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287 @@ -490,8 +490,8 @@ F ext/wasm/api/sqlite3-api-worker1.js 73579555563b789785ae83724014eaf31811073aad F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9 F ext/wasm/api/sqlite3-wasm.c 0d81282eaeff2a6e9fc5c28a388c5c5b45cf25a9393992fa511ac009b27df982 F ext/wasm/batch-runner.html 439245594711981831f2775f1426fd20d73a9b1bbf53f2cbbfc1194fa069891c -F ext/wasm/batch-runner.js dfe194ff87dac20e641aeee7080b74a877ca4a24ea107d6a80ff8115b28b7f0b -F ext/wasm/common/SqliteTestUtil.js eb96275bed43fdb364b7d65bcded0ca5e22aaacff120d593d1385f852f486247 +F ext/wasm/batch-runner.js a727cbbffe63fd17fb5a590dc679f0b13bd51880e8f84b461d7df246417689e8 +F ext/wasm/common/SqliteTestUtil.js 7a543e238c2ebda922c85076abda017d0480944fdfee576692a0c3a580319ebd F ext/wasm/common/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f F ext/wasm/common/testing.css 572cf1ffae0b6eb7ca63684d3392bf350217a07b90e7a896e4fa850700c989b0 F ext/wasm/common/whwasmutil.js 3d68a9cd87a2d8f7e6d5a78f3b829a927f2e28422685e029139f6e75d4ed42e4 @@ -2013,8 +2013,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 ba08f7a7f12601aa580a8dc493b43cdd5ab65c87d5e4b3fd2f549343e45c2d2a -R cd46865d209bc499b87d03a53afeb5f7 +P b26e2bc05537a1f451db1bdd36a824d71c3ea25a130b6285f31ff9799d65fa7a +R be49009f54e0ae14227cc16ba0e36553 U stephan -Z a638c92d95e9388486f91bc003769b2d +Z eee0918a1e799dd377ca7c8eb624a8df # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9cdf828810..99f4bce223 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b26e2bc05537a1f451db1bdd36a824d71c3ea25a130b6285f31ff9799d65fa7a \ No newline at end of file +36ceef94e1935f5e85f79e489cd0ed265a77820fb68329c190794df5e076bf84 \ No newline at end of file