1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-28 19:36:04 +03:00

General cleanups and dead code removal.

FossilOrigin-Name: 0336fa95e15c53ac6ab8152a840163a5aac64725874ffb848ce1d95e3af90586
This commit is contained in:
stephan
2025-09-21 19:39:06 +00:00
parent cf0f11ac18
commit b10548a7b0
6 changed files with 41 additions and 42 deletions

View File

@@ -727,8 +727,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
alloc: wasm.alloc, alloc: wasm.alloc,
dealloc: wasm.dealloc, dealloc: wasm.dealloc,
bigIntEnabled: wasm.bigIntEnabled, bigIntEnabled: wasm.bigIntEnabled,
pointerIR: wasm.pointerIR, pointerIR: wasm.ptr.ir,
pointerSize: wasm.ptr.size,
memberPrefix: /* Never change this: this prefix is baked into any memberPrefix: /* Never change this: this prefix is baked into any
amount of code and client-facing docs. (Much amount of code and client-facing docs. (Much
later: it probably should have been '$$', but see later: it probably should have been '$$', but see
@@ -1471,9 +1470,10 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
Helper for string:flexible conversions which requires a Helper for string:flexible conversions which requires a
byte-length counterpart argument. Passed a value and its byte-length counterpart argument. Passed a value and its
ostensible length, this function returns [V,N], where V is ostensible length, this function returns [V,N], where V is
either v or a transformed copy of v and N is either Number(n) either v or a transformed copy of v and N is either (if v is a
(if v is a WASM pointer), -1 (if v is a string or Array), or WASM pointer, in which case n might be a BigInt), -1 (if v is a
the byte length of v (if it's a byte array or ArrayBuffer). string or Array), or the byte length of v (if it's a byte array
or ArrayBuffer).
*/ */
const __flexiString = (v,n)=>{ const __flexiString = (v,n)=>{
if('string'===typeof v){ if('string'===typeof v){
@@ -1486,13 +1486,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}else if(Array.isArray(v)){ }else if(Array.isArray(v)){
v = v.join(""); v = v.join("");
n = -1; n = -1;
}/*else if( 'bigint'===typeof n ){ }
// tag:64bit A workaround for when a stray BigInt, possibly
// calculated via a pointer range, gets passed in here. This
// has been seen to happen in sqlite3_prepare_v3() via
// oo1.DB.exec().
n = Number(n);
}*/
return [v, n]; return [v, n];
}; };
@@ -1531,11 +1525,12 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
if(f.length!==arguments.length){ if(f.length!==arguments.length){
return __dbArgcMismatch(pDb,"sqlite3_prepare_v3",f.length); return __dbArgcMismatch(pDb,"sqlite3_prepare_v3",f.length);
} }
const [xSql, xSqlLen] = __flexiString(sql, sqlLen); const [xSql, xSqlLen] = __flexiString(sql, Number(sqlLen));
switch(typeof xSql){ switch(typeof xSql){
case 'string': return __prepare.basic(pDb, xSql, xSqlLen, prepFlags, ppStmt, null); case 'string': return __prepare.basic(pDb, xSql, xSqlLen, prepFlags, ppStmt, null);
case (typeof wasm.ptr.null): case (typeof wasm.ptr.null):
return __prepare.full(pDb, xSql, xSqlLen, prepFlags, ppStmt, pzTail); return __prepare.full(pDb, wasm.ptr.coerce(xSql), xSqlLen, prepFlags,
ppStmt, pzTail);
default: default:
return util.sqlite3__wasm_db_error( return util.sqlite3__wasm_db_error(
pDb, capi.SQLITE_MISUSE, pDb, capi.SQLITE_MISUSE,
@@ -1921,7 +1916,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
} }
tgt[memKey] = fProxy; tgt[memKey] = fProxy;
}else{ }else{
const pFunc = wasm.installFunction(fProxy, tgt.memberSignature(name, false)); const pFunc = wasm.installFunction(fProxy, tgt.memberSignature(name));
tgt[memKey] = pFunc; tgt[memKey] = pFunc;
if(!tgt.ondispose || !tgt.ondispose.__removeFuncList){ if(!tgt.ondispose || !tgt.ondispose.__removeFuncList){
tgt.addOnDispose('ondispose.__removeFuncList handler', tgt.addOnDispose('ondispose.__removeFuncList handler',

View File

@@ -249,7 +249,7 @@ globalThis.WhWasmUtilInstaller = function(target){
/** Either BigInt or, if !target.bigIntEnabled, a function which /** Either BigInt or, if !target.bigIntEnabled, a function which
throws complaining that BigInt is not enabled. */ throws complaining that BigInt is not enabled. */
const __BigInt = target.bigIntEnabled const __BigInt = target.bigIntEnabled
? BigInt ? (v)=>BigInt(v || 0)
: (v)=>toss("BigInt support is disabled in this build."); : (v)=>toss("BigInt support is disabled in this build.");
/** /**
@@ -259,7 +259,7 @@ globalThis.WhWasmUtilInstaller = function(target){
Why? Because Number(null)===0, but BigInt(null) throws. Why? Because Number(null)===0, but BigInt(null) throws.
*/ */
const __asPtrType = (4===__ptrSize) ? Number : (v)=>__BigInt(v||0); const __asPtrType = (4===__ptrSize) ? Number : __BigInt;
/** /**
The number 0 as either type Number or BigInt, depending on The number 0 as either type Number or BigInt, depending on
@@ -1534,7 +1534,7 @@ globalThis.WhWasmUtilInstaller = function(target){
const __xArgPtr = __asPtrType; const __xArgPtr = __asPtrType;
xArg xArg
.set('i64', (i)=>__BigInt(i || 0)) .set('i64', __BigInt)
.set('i32', (i)=>i|0) .set('i32', (i)=>i|0)
.set('i16', (i)=>((i | 0) & 0xFFFF)) .set('i16', (i)=>((i | 0) & 0xFFFF))
.set('i8', (i)=>((i | 0) & 0xFF)) .set('i8', (i)=>((i | 0) & 0xFF))

View File

@@ -16,7 +16,6 @@
Project homes: Project homes:
- https://fossil.wanderinghorse.net/r/jaccwabyt - https://fossil.wanderinghorse.net/r/jaccwabyt
- https://sqlite.org/src/dir/ext/wasm/jaccwabyt - https://sqlite.org/src/dir/ext/wasm/jaccwabyt
*/ */
'use strict'; 'use strict';
globalThis.Jaccwabyt = function StructBinderFactory(config){ globalThis.Jaccwabyt = function StructBinderFactory(config){
@@ -59,24 +58,28 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
log = config.log || console.log.bind(console), log = config.log || console.log.bind(console),
memberPrefix = (config.memberPrefix || ""), memberPrefix = (config.memberPrefix || ""),
memberSuffix = (config.memberSuffix || ""), memberSuffix = (config.memberSuffix || ""),
bigIntEnabled = (undefined===config.bigIntEnabled
? !!globalThis['BigInt64Array'] : !!config.bigIntEnabled),
BigInt = globalThis['BigInt'], BigInt = globalThis['BigInt'],
BigInt64Array = globalThis['BigInt64Array'], BigInt64Array = globalThis['BigInt64Array'],
bigIntEnabled = config.bigIntEnabled ?? !!BigInt64Array,
/* Undocumented (on purpose) config options: */ /* Undocumented (on purpose) config options: */
ptrIR = config.pointerIR ptrIR = config.pointerIR
|| config.ptrIR/*deprecated*/ || config.ptrIR/*deprecated*/
|| 'i32', || 'i32',
ptrSize = config.pointerSize ptrSize = config.ptrSize/*deprecated*/
|| config.ptrSize/*deprecated*/
|| ('i32'===ptrIR ? 4 : 8) || ('i32'===ptrIR ? 4 : 8)
; ;
const __asPtrType = ('i32'==ptrIR)
? Number if(ptrIR!=='i32' && ptrIR!=='i64') toss("Invalid pointer representation:",ptrIR);
: (bigIntEnabled if(ptrSize!==4 && ptrSize!==8) toss("Invalid pointer size:",ptrSize);
? (v)=>BigInt(v || 0)
: toss("Missing BigInt support")); /** Either BigInt or, if !bigIntEnabled, a function which
throws complaining that BigInt is not enabled. */
const __BigInt = (bigIntEnabled && BigInt)
? (v)=>BigInt(v || 0)
: (v)=>toss("BigInt support is disabled in this build.");
const __asPtrType = ('i32'==ptrIR) ? Number : __BigInt;
const __NullPtr = __asPtrType(0); const __NullPtr = __asPtrType(0);
/** /**
Expects any number of numeric arguments, each one of either type Expects any number of numeric arguments, each one of either type
Number or BigInt. It sums them up (from an implicit starting Number or BigInt. It sums them up (from an implicit starting
@@ -210,11 +213,11 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
const sigDVSetWrapper = function(s){ const sigDVSetWrapper = function(s){
switch(sigLetter(s)) { switch(sigLetter(s)) {
case 'i': case 'f': case 'c': case 'C': case 'd': return Number; case 'i': case 'f': case 'c': case 'C': case 'd': return Number;
case 'j': return affirmBigIntArray() && BigInt; case 'j': return __BigInt;
case 'p': case 'P': case 's': case 'p': case 'P': case 's':
switch(ptrSize){ switch(ptrSize){
case 4: return Number; case 4: return Number;
case 8: return affirmBigIntArray() && BigInt; case 8: return __BigInt;
} }
break; break;
} }

View File

@@ -199,7 +199,8 @@ const MyBinder = StructBinderFactory({
heap: WebAssembly.Memory instance or a function which returns heap: WebAssembly.Memory instance or a function which returns
a Uint8Array or Int8Array view of the WASM memory, a Uint8Array or Int8Array view of the WASM memory,
alloc: function(howMuchMemory){...}, alloc: function(howMuchMemory){...},
dealloc: function(pointerToFree){...} dealloc: function(pointerToFree){...},
pointerIR: 'i32' or 'i64' (WASM pointer type)
}); });
``` ```
@@ -212,7 +213,7 @@ a conventional Emscripten setup, that config might simply look like:
> >
```javascript ```javascript
{ {
heap: Module['asm']['memory'], heap: Module?.asm?.memory || Module['wasmMemory'],
//Or: //Or:
// heap: ()=>Module['HEAP8'], // heap: ()=>Module['HEAP8'],
alloc: (n)=>Module['_malloc'](n), alloc: (n)=>Module['_malloc'](n),

View File

@@ -1,5 +1,5 @@
C Remove\ssome\sdead\scode\sand\sstray\sdebug\soutput.\sFix\s(again)\sthe\sJS\sSQLTester\sfor\s64-bit\s(the\sprevious\sbuild\swas\sset\sto\s32-bit). C General\scleanups\sand\sdead\scode\sremoval.
D 2025-09-21T19:01:15.620 D 2025-09-21T19:39:06.527
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -597,7 +597,7 @@ F ext/wasm/api/post-js-footer.js 365405929f41ca0e6d389ed8a8da3f3c93e11d3ef43a90a
F ext/wasm/api/post-js-header.js 53740d824e5d9027eb1e6fd59e216abbd2136740ce260ea5f0699ff2acb0a701 F ext/wasm/api/post-js-header.js 53740d824e5d9027eb1e6fd59e216abbd2136740ce260ea5f0699ff2acb0a701
F ext/wasm/api/pre-js.c-pp.js 58f823de197e2c10d76179aa05410a593b7ae03e1ece983bb42ffd818e8857e1 F ext/wasm/api/pre-js.c-pp.js 58f823de197e2c10d76179aa05410a593b7ae03e1ece983bb42ffd818e8857e1
F ext/wasm/api/sqlite3-api-cleanup.js d4f1a5e665afaf84015f6ef0ddd766f638cb28501c4569b1d4b527c4b5a2b9a4 F ext/wasm/api/sqlite3-api-cleanup.js d4f1a5e665afaf84015f6ef0ddd766f638cb28501c4569b1d4b527c4b5a2b9a4
F ext/wasm/api/sqlite3-api-glue.c-pp.js 5fb52fb190519e2d9cd8507c5f6c7a9827c80aa254f16ec682e1d2c26ccd0fbd F ext/wasm/api/sqlite3-api-glue.c-pp.js 814bdccd7e7c28520cd9a2480785fda027529061e9187460d7155775034afd0f
F ext/wasm/api/sqlite3-api-oo1.c-pp.js 831ce373495f6a5d9230f31a1e09e8995e317828926e736d58c9e7091c6b1d07 F ext/wasm/api/sqlite3-api-oo1.c-pp.js 831ce373495f6a5d9230f31a1e09e8995e317828926e736d58c9e7091c6b1d07
F ext/wasm/api/sqlite3-api-prologue.js bdf8e553c2142916fd7a2382e1becfed7a5755da95f585f632336634e5728448 F ext/wasm/api/sqlite3-api-prologue.js bdf8e553c2142916fd7a2382e1becfed7a5755da95f585f632336634e5728448
F ext/wasm/api/sqlite3-api-worker1.c-pp.js 760191cd13416e6f5adfd9fcc8a97fed5645c9e0a5fbac213a2d4ce2d79a4334 F ext/wasm/api/sqlite3-api-worker1.c-pp.js 760191cd13416e6f5adfd9fcc8a97fed5645c9e0a5fbac213a2d4ce2d79a4334
@@ -618,7 +618,7 @@ F ext/wasm/c-pp.c cca55c5b55ebd8d29916adbedb0e40baa12caa9a2e8429f812683c308f9b0e
F ext/wasm/common/SqliteTestUtil.js 7adaeffef757d8708418dc9190f72df22367b531831775804b31598b44f6aa51 F ext/wasm/common/SqliteTestUtil.js 7adaeffef757d8708418dc9190f72df22367b531831775804b31598b44f6aa51
F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15 F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
F ext/wasm/common/testing.css e97549bab24126c24e0daabfe2de9bb478fb0a69fdb2ddd0a73a992c091aad6f F ext/wasm/common/testing.css e97549bab24126c24e0daabfe2de9bb478fb0a69fdb2ddd0a73a992c091aad6f
F ext/wasm/common/whwasmutil.js a2c7482ee0c07087a4a6878830a38acefacb0ee4399fab25073b8a3ce99cfacd F ext/wasm/common/whwasmutil.js aff84dc5b7bf1f06a567d4ab43d28422447f5806487210f805d4d85b400b82b8
F ext/wasm/config.make.in c424ae1cc3c89274520ad312509d36c4daa34a3fce5d0c688e5f8f4365e1049a F ext/wasm/config.make.in c424ae1cc3c89274520ad312509d36c4daa34a3fce5d0c688e5f8f4365e1049a
F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508 F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
@@ -637,8 +637,8 @@ F ext/wasm/fiddle/fiddle.js f0b96f978c7c77fea8d092aa79c77849ce111d7b1ba60ffba076
F ext/wasm/fiddle/index.html 17c7d6b21f40fbf462162c4311b63d760b065e419d9f5a96534963b0e52af940 F ext/wasm/fiddle/index.html 17c7d6b21f40fbf462162c4311b63d760b065e419d9f5a96534963b0e52af940
F ext/wasm/index-dist.html 56132399702b15d70c474c3f1952541e25cb0922942868f70daf188f024b3730 F ext/wasm/index-dist.html 56132399702b15d70c474c3f1952541e25cb0922942868f70daf188f024b3730
F ext/wasm/index.html bcaa00eca521b372a6a62c7e7b17a870b0fcdf3e418a5921df1fd61e5344080d F ext/wasm/index.html bcaa00eca521b372a6a62c7e7b17a870b0fcdf3e418a5921df1fd61e5344080d
F ext/wasm/jaccwabyt/jaccwabyt.js 663a4f1a45c21c725884de810c797fdcf2e58f15446c507539fb107f0b5c2b7d F ext/wasm/jaccwabyt/jaccwabyt.js a5809f1b9c4be24fdc5abc436f3ab978f93da626b044db92861db48d67bdd151
F ext/wasm/jaccwabyt/jaccwabyt.md 1128e3563e7eff90b5a373395251fc76cb32386fad1fea6075b0f34a8f1b9bdf F ext/wasm/jaccwabyt/jaccwabyt.md 3eb94b708090edcaba435aa15dc8346553162e0d01ba3eae7b7bf34c92d263b7
F ext/wasm/mkwasmbuilds.c b722a3a44edc1498575d935939dfcbe23172f98b0f40d068998e0950707e749d F ext/wasm/mkwasmbuilds.c b722a3a44edc1498575d935939dfcbe23172f98b0f40d068998e0950707e749d
F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337 F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337
F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96 F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96
@@ -2175,8 +2175,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 0fa1830540bcb86f5c59b1a6a9ffd8727c194a64a131d9d362023c84a3b820cb P a6b9567001dad0293dc6a7fe9a7ec1a220e41d9426448e2ab91dbd551948be15
R dc2d67fd32c35033587eba9e2fc11a68 R b1a746924c607bfa0934fa2cb810d7b7
U stephan U stephan
Z 79efec95b48f9fbd6fa325e464638c1d Z 193b461c45ffcc12495a77014d8c0df4
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
a6b9567001dad0293dc6a7fe9a7ec1a220e41d9426448e2ab91dbd551948be15 0336fa95e15c53ac6ab8152a840163a5aac64725874ffb848ce1d95e3af90586