mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-24 09:53:10 +03:00
Get about 1/3rd of the tests running with MEMORY64=1, but the code noise level added by the BigInt/Number discrepancy is making this very unattractive. There are apparently irreconcilable differences between MEMORY64=1 and 2, in that they have different argument type expectations for methods such as WebAssembly.Table.get(), where MEMORY64=1 requires a BigInt a MEMORY64=2 requires a Number. We have no way to make that distinction from the JS code, and don't know what other APIs are affected by that quirk.
FossilOrigin-Name: 1e3b003ff99d2788d93e179504b711cb78846605774bf472589440d0136f20fa
This commit is contained in:
@@ -477,7 +477,7 @@ emcc.MEMORY64 ?= 0
|
||||
|
||||
ifneq (0,$(emcc.MEMORY64))
|
||||
$(info WARNING: MEMORY64 mode is known to not work)
|
||||
SQLITE.CALL.C-PP.FILTER.global += -D64bit
|
||||
SQLITE.CALL.C-PP.FILTER.global += -DsMEMORY64=$(emcc.MEMORY64)
|
||||
emcc.WASM_BIGINT = 1
|
||||
# -sMEMORY64=1+ assumes -sWASM_BIGINT=1, so we'll make it explicit
|
||||
endif
|
||||
|
||||
@@ -21,8 +21,10 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
'use strict';
|
||||
const toss = (...args)=>{throw new Error(args.join(' '))};
|
||||
const capi = sqlite3.capi, wasm = sqlite3.wasm, util = sqlite3.util;
|
||||
//#if 64bit
|
||||
//#if sMEMORY64=1
|
||||
wasm.pointerIR = 'i64';
|
||||
//#elif sMEMORY64=2
|
||||
wasm.pointerIR = 'i64'/*???*/;
|
||||
//#else
|
||||
wasm.pointerIR = 'i32';
|
||||
//#endif
|
||||
@@ -732,7 +734,8 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
alloc: wasm.alloc,
|
||||
dealloc: wasm.dealloc,
|
||||
bigIntEnabled: wasm.bigIntEnabled,
|
||||
ptrIR: wasm.pointerIR,
|
||||
pointerIR: wasm.pointerIR,
|
||||
pointerSizeof: wasm.pointerSizeof,
|
||||
memberPrefix: /* Never change this: this prefix is baked into any
|
||||
amount of code and client-facing docs. (Much
|
||||
later: it probably should have been '$$', but see
|
||||
|
||||
@@ -1143,7 +1143,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
const mem = wasm.pstack.alloc(n * sz);
|
||||
const rc = [];
|
||||
let i = 0, offset = 0;
|
||||
for(; i < n; ++i, offset += sz) rc.push(mem + offset);
|
||||
for(; i < n; ++i, offset += sz) rc.push(wasm.ptrAdd(mem, offset));
|
||||
return rc;
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -377,13 +377,18 @@ typedef struct WasmTestStruct WasmTestStruct;
|
||||
SQLITE_WASM_EXPORT
|
||||
void sqlite3__wasm_test_struct(WasmTestStruct * s){
|
||||
if(s){
|
||||
if( 1 ){
|
||||
fprintf(stderr,"%s:%s()@%p s=@%p xFunc=@%p\n",
|
||||
__FILE__, __func__,
|
||||
(void*)sqlite3__wasm_test_struct,
|
||||
s, (void*)s->xFunc);
|
||||
}
|
||||
s->v4 *= 2;
|
||||
s->v8 = s->v4 * 2;
|
||||
s->ppV = s;
|
||||
s->cstr = __FILE__;
|
||||
if(s->xFunc) s->xFunc(s);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif /* SQLITE_WASM_ENABLE_C_TESTS */
|
||||
|
||||
|
||||
@@ -164,6 +164,8 @@
|
||||
pointer size. If set it must be either 'i32' or 'i64'. If not
|
||||
set, it defaults to whatever this code thinks the pointer size
|
||||
is. Modifying it after this call has no effect.
|
||||
target.pointerSizeof gets set to either 4 or 8, depending on
|
||||
this option.
|
||||
|
||||
|
||||
This code is developed and maintained in conjunction with the
|
||||
@@ -225,11 +227,11 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
Pointers in WASM are currently assumed to be 32-bit, but someday
|
||||
that will certainly change.
|
||||
*/
|
||||
const ptrIR = target.pointerIR || 'i32';
|
||||
const ptrSizeof = target.ptrSizeof =
|
||||
const ptrIR = target.pointerIR || (target.pointerIR = 'i32');
|
||||
const ptrSizeof = target.pointerSizeof =
|
||||
('i32'===ptrIR ? 4
|
||||
: ('i64'===ptrIR
|
||||
? 8 : toss("Unhandled ptrSizeof:",ptrIR)));
|
||||
? 8 : toss("Unhandled pointerIR:",ptrIR)));
|
||||
|
||||
/**
|
||||
If target.pointerIR=='i32' then this is equivalent to
|
||||
@@ -304,7 +306,7 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
For the given IR-like string in the set ('i8', 'i16', 'i32',
|
||||
'f32', 'float', 'i64', 'f64', 'double', '*'), or any string value
|
||||
ending in '*', returns the sizeof for that value
|
||||
(target.ptrSizeof in the latter case). For any other value, it
|
||||
(target.pointerSizeof in the latter case). For any other value, it
|
||||
returns the undefined value.
|
||||
*/
|
||||
target.sizeofIR = (n)=>{
|
||||
@@ -432,6 +434,9 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
*/
|
||||
target.functionEntry = function(fptr){
|
||||
const ft = target.functionTable();
|
||||
console.debug("functionEntry(",arguments,")", __asPtrType(fptr));
|
||||
//-sMEMORY64=1: we get a BigInt fptr and ft.get() wants a BigInt.
|
||||
//-sMEMORY64=2: we get a Number fptr and ft.get() wants a Number.
|
||||
return fptr < ft.length ? ft.get(__asPtrType(fptr)) : undefined;
|
||||
};
|
||||
|
||||
@@ -483,7 +488,7 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
f._ = {
|
||||
// Map of signature letters to type IR values
|
||||
sigTypes: Object.assign(Object.create(null),{
|
||||
i: 'i32', p: 'i32', P: 'i32', s: 'i32',
|
||||
i: 'i32', p: ptrIR, P: ptrIR, s: ptrIR,
|
||||
j: 'i64', f: 'f32', d: 'f64'
|
||||
}),
|
||||
// Map of type IR values to WASM type code values
|
||||
@@ -756,17 +761,16 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
let rc;
|
||||
do{
|
||||
if(list) ptr = arguments[0].shift();
|
||||
const pNumber = Number(ptr);
|
||||
switch(type){
|
||||
case 'i1':
|
||||
case 'i8': rc = c.HEAP8[pNumber>>0]; break;
|
||||
case 'i16': rc = c.HEAP16[pNumber>>1]; break;
|
||||
case 'i32': rc = c.HEAP32[pNumber>>2]; break;
|
||||
case 'float': case 'f32': rc = c.HEAP32F[pNumber>>2]; break;
|
||||
case 'double': case 'f64': rc = Number(c.HEAP64F[pNumber>>3]); break;
|
||||
case 'i8': rc = c.HEAP8[Number(ptr/*tag:64bit*/)>>0]; break;
|
||||
case 'i16': rc = c.HEAP16[Number(ptr/*tag:64bit*/)>>1]; break;
|
||||
case 'i32': rc = c.HEAP32[Number(ptr/*tag:64bit*/)>>2]; break;
|
||||
case 'float': case 'f32': rc = c.HEAP32F[Number(ptr/*tag:64bit*/)>>2]; break;
|
||||
case 'double': case 'f64': rc = Number(c.HEAP64F[Number(ptr/*tag:64bit*/)>>3]); break;
|
||||
case 'i64':
|
||||
if(target.bigIntEnabled){
|
||||
rc = BigInt(c.HEAP64[pNumber>>3]);
|
||||
rc = BigInt(c.HEAP64[Number(ptr/*tag:64bit*/)>>3]);
|
||||
break;
|
||||
}
|
||||
/* fallthru */
|
||||
@@ -802,17 +806,16 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
const c = (cache.memory && cache.heapSize === cache.memory.buffer.byteLength)
|
||||
? cache : heapWrappers();
|
||||
for(const p of (Array.isArray(ptr) ? ptr : [ptr])){
|
||||
const pNumber = Number(p)/*tag:64bit*/;
|
||||
switch (type) {
|
||||
case 'i1':
|
||||
case 'i8': c.HEAP8[pNumber>>0] = value; continue;
|
||||
case 'i16': c.HEAP16[pNumber>>1] = value; continue;
|
||||
case 'i32': c.HEAP32[pNumber>>2] = value; continue;
|
||||
case 'float': case 'f32': c.HEAP32F[pNumber>>2] = value; continue;
|
||||
case 'double': case 'f64': c.HEAP64F[pNumber>>3] = value; continue;
|
||||
case 'i8': c.HEAP8[Number(p/*tag:64bit*/)>>0] = value; continue;
|
||||
case 'i16': c.HEAP16[Number(p/*tag:64bit*/)>>1] = value; continue;
|
||||
case 'i32': c.HEAP32[Number(p/*tag:64bit*/)>>2] = value; continue;
|
||||
case 'float': case 'f32': c.HEAP32F[Number(p/*tag:64bit*/)>>2] = value; continue;
|
||||
case 'double': case 'f64': c.HEAP64F[Number(p/*tag:64bit*/)>>3] = value; continue;
|
||||
case 'i64':
|
||||
if(c.HEAP64){
|
||||
c.HEAP64[pNumber>>3] = BigInt(value);
|
||||
c.HEAP64[Number(p/*tag:64bit*/)>>3] = BigInt(value);
|
||||
continue;
|
||||
}
|
||||
/* fallthru */
|
||||
@@ -936,6 +939,10 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
const __SAB = ('undefined'===typeof SharedArrayBuffer)
|
||||
? function(){} : SharedArrayBuffer;
|
||||
const __utf8Decode = function(arrayBuffer, begin, end){
|
||||
if( 8===ptrSizeof ){
|
||||
begin = Number(begin);
|
||||
end = Number(end);
|
||||
}
|
||||
return cache.utf8Decoder.decode(
|
||||
(arrayBuffer.buffer instanceof __SAB)
|
||||
? arrayBuffer.slice(begin, end)
|
||||
@@ -1298,15 +1305,15 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
const __allocMainArgv = function(isScoped, list){
|
||||
const pList = target[
|
||||
isScoped ? 'scopedAlloc' : 'alloc'
|
||||
]((list.length + 1) * target.ptrSizeof);
|
||||
]((list.length + 1) * target.pointerSizeof);
|
||||
let i = 0;
|
||||
list.forEach((e)=>{
|
||||
target.pokePtr(pList + (target.ptrSizeof * i++),
|
||||
target.pokePtr(pList + (target.pointerSizeof * i++),
|
||||
target[
|
||||
isScoped ? 'scopedAllocCString' : 'allocCString'
|
||||
](""+e));
|
||||
});
|
||||
target.pokePtr(pList + (target.ptrSizeof * i), 0);
|
||||
target.pokePtr(pList + (target.pointerSizeof * i), 0);
|
||||
return pList;
|
||||
};
|
||||
|
||||
@@ -1351,7 +1358,7 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
target.cArgvToJs = (argc, pArgv)=>{
|
||||
const list = [];
|
||||
for(let i = 0; i < argc; ++i){
|
||||
const arg = target.peekPtr(pArgv + (target.ptrSizeof * i));
|
||||
const arg = target.peekPtr(pArgv + (target.pointerSizeof * i));
|
||||
list.push( arg ? target.cstrToJs(arg) : null );
|
||||
}
|
||||
return list;
|
||||
@@ -1383,7 +1390,7 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
for(let i = 1; i < howMany; ++i){
|
||||
m = __ptrAdd(m, (safePtrSize ? 8 : ptrSizeof));
|
||||
a[i] = m;
|
||||
target.poke(m, __NullPtr, pIr);
|
||||
target.poke(m, 0, pIr);
|
||||
}
|
||||
return a;
|
||||
};
|
||||
@@ -2085,7 +2092,7 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
abstracting it into this API (and taking on the associated
|
||||
costs) may well not make good sense.
|
||||
*/
|
||||
target.xWrap = function(fArg, resultType, ...argTypes){
|
||||
target.xWrap = function callee(fArg, resultType, ...argTypes){
|
||||
if(3===arguments.length && Array.isArray(arguments[2])){
|
||||
argTypes = arguments[2];
|
||||
}
|
||||
@@ -2143,7 +2150,9 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
for(; i < args.length; ++i) args[i] = cxw.convertArgNoCheck(
|
||||
argTypes[i], args[i], args, i
|
||||
);
|
||||
//console.warn("resultType ",resultType, 'xf',xf,"argTypes",argTypes,"args",args);
|
||||
if( callee.debug ){
|
||||
console.debug("xWrap() calling: resultType ",resultType, 'xf',xf,"argTypes",argTypes,"args",args);
|
||||
}
|
||||
return cxw.convertResultNoCheck(resultType, xf.apply(null,args));
|
||||
}finally{
|
||||
target.scopedAllocPop(scope);
|
||||
|
||||
@@ -64,8 +64,12 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
|
||||
BigInt = globalThis['BigInt'],
|
||||
BigInt64Array = globalThis['BigInt64Array'],
|
||||
/* Undocumented (on purpose) config options: */
|
||||
ptrIR = config.ptrIR || 'i32',
|
||||
ptrSizeof = config.ptrSizeof || ('i32'===ptrIR ? 4 : 8)
|
||||
ptrIR = config.pointerIR
|
||||
|| config.ptrIR/*deprecated*/
|
||||
|| 'i32',
|
||||
ptrSizeof = config.pointerSizeof
|
||||
|| config.ptrSizeof/*deprecated*/
|
||||
|| ('i32'===ptrIR ? 4 : 8)
|
||||
;
|
||||
const __asPtrType = ('i32'==ptrIR)
|
||||
? Number
|
||||
@@ -375,12 +379,17 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
|
||||
const __SAB = ('undefined'===typeof SharedArrayBuffer)
|
||||
? function(){} : SharedArrayBuffer;
|
||||
const __utf8Decode = function(arrayBuffer, begin, end){
|
||||
if( 8===ptrSizeof ){
|
||||
begin = Number(begin);
|
||||
end = Number(end);
|
||||
}
|
||||
return __utf8Decoder.decode(
|
||||
(arrayBuffer.buffer instanceof __SAB)
|
||||
? arrayBuffer.slice(begin, end)
|
||||
: arrayBuffer.subarray(begin, end)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
Uses __lookupMember() to find the given obj.structInfo key.
|
||||
Returns that member if it is a string, else returns false. If the
|
||||
@@ -455,8 +464,8 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
|
||||
const h = heap();
|
||||
//let i = 0;
|
||||
//for( ; i < u.length; ++i ) h[mem + i] = u[i];
|
||||
h.set(u, mem);
|
||||
h[mem + u.length] = 0;
|
||||
h.set(u, Number(mem));
|
||||
h[__ptrAdd(mem, u.length)] = 0;
|
||||
//log("allocCString @",mem," =",u);
|
||||
return mem;
|
||||
};
|
||||
|
||||
@@ -160,7 +160,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
|
||||
const roundMs = (ms)=>Math.round(ms*100)/100;
|
||||
|
||||
const looksLikePtr = (v)=> v>=0;
|
||||
const looksLikePtr = (v,positive=true)=> positive ? v>0 : v>=0;
|
||||
|
||||
/**
|
||||
Helpers for writing sqlite3-specific tests.
|
||||
@@ -842,7 +842,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
T.assert(12n===rc);
|
||||
|
||||
w.scopedAllocCall(function(){
|
||||
const pI1 = w.scopedAlloc(8), pI2 = w.ptrAdd(pI1, 4);
|
||||
const pI1 = w.scopedAlloc(w.pointerSizeof), pI2 = w.ptrAdd(pI1, w.pointerSizeof);
|
||||
w.pokePtr([pI1, pI2], w.NullPtr);
|
||||
const f = w.xWrap('sqlite3__wasm_test_int64_minmax',undefined,['i64*','i64*']);
|
||||
const [r1, r2] = w.peek64([pI1, pI2]);
|
||||
@@ -870,14 +870,14 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
};
|
||||
const msd = MyStructDef;
|
||||
addMember(msd, 'p4', {sizeof: 4, signature: "i"});
|
||||
addMember(msd, 'pP', {sizeof: wasm.ptrSizeof, signature: "P"});
|
||||
addMember(msd, 'pP', {sizeof: wasm.pointerSizeof, signature: "P"});
|
||||
addMember(msd, 'ro', {
|
||||
sizeof: 4,
|
||||
signature: "i",
|
||||
readOnly: true
|
||||
});
|
||||
addMember(msd, 'cstr', {
|
||||
sizeof: wasm.ptrSizeof,
|
||||
sizeof: wasm.pointerSizeof,
|
||||
signature: "s"
|
||||
});
|
||||
if(W.bigIntEnabled){
|
||||
@@ -885,9 +885,11 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
}
|
||||
const StructType = S.StructBinder.StructType;
|
||||
const K = S.StructBinder('my_struct',MyStructDef);
|
||||
//K.debugFlags(0x03);
|
||||
T.mustThrowMatching(()=>K(), /via 'new'/).
|
||||
mustThrowMatching(()=>new K('hi'), (err)=>{
|
||||
return /^Invalid pointer/.test(err.message) || /.*bigint.*/i.test(err.message);
|
||||
return /^Invalid pointer/.test(err.message)/*32-bit*/
|
||||
|| /.*bigint.*/i.test(err.message)/*64-bit*/;
|
||||
});
|
||||
const k1 = new K(), k2 = new K();
|
||||
try {
|
||||
@@ -921,12 +923,12 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
k1.setMemberCString('cstr', "A C-string.");
|
||||
T.assert(Array.isArray(k1.ondispose)).
|
||||
assert(k1.ondispose[0] === k1.$cstr).
|
||||
assert('number' === typeof k1.$cstr).
|
||||
assert(looksLikePtr(k1.$cstr)).
|
||||
assert('A C-string.' === k1.memberToJsString('cstr'));
|
||||
k1.$pP = k2;
|
||||
T.assert(k1.$pP === k2.pointer);
|
||||
k1.$pP = null/*null is special-cased to 0.*/;
|
||||
T.assert(0===k1.$pP);
|
||||
T.assert(0==k1.$pP);
|
||||
let ptr = k1.pointer;
|
||||
k1.dispose();
|
||||
T.assert(undefined === k1.pointer).
|
||||
@@ -960,10 +962,11 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
assert(wts instanceof WTStruct).
|
||||
assert(wts instanceof StructType).
|
||||
assert(StructType.isA(wts)).
|
||||
assert(wts.pointer>0).assert(0===wts.$v4).assert(0n===wts.$v8).
|
||||
assert(0===wts.$ppV).assert(0===wts.$xFunc);
|
||||
const testFunc =
|
||||
W.xGet('sqlite3__wasm_test_struct'/*name gets mangled in -O3 builds!*/);
|
||||
assert(looksLikePtr(wts.pointer)).assert(0==wts.$v4).assert(0n===wts.$v8).
|
||||
assert(0==wts.$ppV).assert(0==wts.$xFunc);
|
||||
const testFunc = 1
|
||||
? W.xGet('sqlite3__wasm_test_struct'/*name gets mangled in -O3 builds!*/)
|
||||
: W.xWrap('sqlite3__wasm_test_struct', undefined, '*');
|
||||
let counter = 0;
|
||||
//log("wts.pointer =",wts.pointer);
|
||||
const wtsFunc = function(arg){
|
||||
@@ -976,9 +979,11 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
}
|
||||
wts.$v4 = 10; wts.$v8 = 20;
|
||||
wts.$xFunc = W.installFunction(wtsFunc, wts.memberSignature('xFunc'))
|
||||
console.debug("wts.memberSignature('xFunc')",wts.memberSignature('xFunc'));
|
||||
console.debug("wts.$xFunc",wts.$xFunc, W.functionEntry(wts.$xFunc));
|
||||
T.assert(0===counter).assert(10 === wts.$v4).assert(20n === wts.$v8)
|
||||
.assert(0 === wts.$ppV).assert('number' === typeof wts.$xFunc)
|
||||
.assert(0 === wts.$cstr)
|
||||
.assert(0 == wts.$ppV).assert(looksLikePtr(wts.$xFunc))
|
||||
.assert(0 == wts.$cstr)
|
||||
.assert(wts.memberIsString('$cstr'))
|
||||
.assert(!wts.memberIsString('$v4'))
|
||||
.assert(null === wts.memberToJsString('$cstr'))
|
||||
@@ -990,6 +995,8 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
buffer, so merely reading them back is actually part of
|
||||
testing the struct-wrapping API. */
|
||||
|
||||
console.debug("wts",wts,"wts.pointer",wts.pointer,
|
||||
"testFunc",testFunc/*FF v142 emits the wrong function here!*/);
|
||||
testFunc(wts.pointer);
|
||||
//log("wts.pointer, wts.$ppV",wts.pointer, wts.$ppV);
|
||||
T.assert(1===counter).assert(20 === wts.$v4).assert(40n === wts.$v8)
|
||||
@@ -1043,7 +1050,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
const P = wasm.pstack;
|
||||
const isAllocErr = (e)=>e instanceof sqlite3.WasmAllocError;
|
||||
const stack = P.pointer;
|
||||
T.assert(0===stack % 8 /* must be 8-byte aligned */);
|
||||
T.assert(0===Number(stack) % 8 /* must be 8-byte aligned */);
|
||||
try{
|
||||
const remaining = P.remaining;
|
||||
T.assert(P.quota >= 4096)
|
||||
@@ -1056,16 +1063,16 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
);
|
||||
;
|
||||
let p1 = P.alloc(12);
|
||||
T.assert(p1 === stack - 16/*8-byte aligned*/)
|
||||
T.assert(p1 == Number(stack) - 16/*8-byte aligned*/)
|
||||
.assert(P.pointer === p1);
|
||||
let p2 = P.alloc(7);
|
||||
T.assert(p2 === p1-8/*8-byte aligned, stack grows downwards*/)
|
||||
T.assert(p2 == Number(p1)-8/*8-byte aligned, stack grows downwards*/)
|
||||
.mustThrowMatching(()=>P.alloc(remaining), isAllocErr)
|
||||
.assert(24 === stack - p2)
|
||||
.assert(24 == Number(stack) - Number(p2))
|
||||
.assert(P.pointer === p2);
|
||||
let n = remaining - (stack - p2);
|
||||
let n = remaining - (Number(stack) - Number(p2));
|
||||
let p3 = P.alloc(n);
|
||||
T.assert(p3 === stack-remaining)
|
||||
T.assert(p3 == Number(stack)-Number(remaining))
|
||||
.mustThrowMatching(()=>P.alloc(1), isAllocErr);
|
||||
}finally{
|
||||
P.restore(stack);
|
||||
@@ -1074,9 +1081,9 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
T.assert(P.pointer === stack);
|
||||
try {
|
||||
const [p1, p2, p3] = P.allocChunks(3,'i32');
|
||||
T.assert(P.pointer === stack-16/*always rounded to multiple of 8*/)
|
||||
.assert(p2 === p1 + 4)
|
||||
.assert(p3 === p2 + 4);
|
||||
T.assert(P.pointer == Number(stack)-16/*always rounded to multiple of 8*/)
|
||||
.assert(p2 == Number(p1) + 4)
|
||||
.assert(p3 == Number(p2) + 4);
|
||||
T.mustThrowMatching(()=>P.allocChunks(1024, 1024 * 16),
|
||||
(e)=>e instanceof sqlite3.WasmAllocError)
|
||||
}finally{
|
||||
@@ -1086,16 +1093,16 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
T.assert(P.pointer === stack);
|
||||
try {
|
||||
let [p1, p2, p3] = P.allocPtr(3,false);
|
||||
let sPos = stack-16/*always rounded to multiple of 8*/;
|
||||
T.assert(P.pointer === sPos)
|
||||
.assert(p2 === p1 + 4)
|
||||
.assert(p3 === p2 + 4);
|
||||
let sPos = Number(stack)-16/*always rounded to multiple of 8*/;
|
||||
T.assert(P.pointer == sPos)
|
||||
.assert(p2 == Number(p1) + 4)
|
||||
.assert(p3 == Number(p2) + 4);
|
||||
[p1, p2, p3] = P.allocPtr(3);
|
||||
T.assert(P.pointer === sPos-24/*3 x 8 bytes*/)
|
||||
.assert(p2 === p1 + 8)
|
||||
.assert(p3 === p2 + 8);
|
||||
T.assert(P.pointer == sPos-24/*3 x 8 bytes*/)
|
||||
.assert(p2 == Number(p1) + 8)
|
||||
.assert(p3 == Number(p2) + 8);
|
||||
p1 = P.allocPtr();
|
||||
T.assert('number'===typeof p1);
|
||||
T.assert(looksLikePtr(p1));
|
||||
}finally{
|
||||
P.restore(stack);
|
||||
}
|
||||
@@ -2169,7 +2176,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
.assert(wasm.isPtr(pVoid))
|
||||
.assert(wasm.isPtr(aVals))
|
||||
.assert(wasm.isPtr(aCols))
|
||||
.assert(+wasm.cstrToJs(wasm.peekPtr(aVals + wasm.ptrSizeof))
|
||||
.assert(+wasm.cstrToJs(wasm.peekPtr(aVals + wasm.pointerSizeof))
|
||||
=== 2 * +wasm.cstrToJs(wasm.peekPtr(aVals)));
|
||||
return 0;
|
||||
});
|
||||
|
||||
24
manifest
24
manifest
@@ -1,5 +1,5 @@
|
||||
C Baby\ssteps\stowards\s64-bit\spointers.\sGet\sit\sbuilding\sand\stesting\sagain\sin\s32-bit\sbuilds.
|
||||
D 2025-09-20T00:43:47.828
|
||||
C Get\sabout\s1/3rd\sof\sthe\stests\srunning\swith\sMEMORY64=1,\sbut\sthe\scode\snoise\slevel\sadded\sby\sthe\sBigInt/Number\sdiscrepancy\sis\smaking\sthis\svery\sunattractive.\sThere\sare\sapparently\sirreconcilable\sdifferences\sbetween\sMEMORY64=1\sand\s2,\sin\sthat\sthey\shave\sdifferent\sargument\stype\sexpectations\sfor\smethods\ssuch\sas\sWebAssembly.Table.get(),\swhere\sMEMORY64=1\srequires\sa\sBigInt\sa\sMEMORY64=2\srequires\sa\sNumber.\sWe\shave\sno\sway\sto\smake\sthat\sdistinction\sfrom\sthe\sJS\scode,\sand\sdon't\sknow\swhat\sother\sAPIs\sare\saffected\sby\sthat\squirk.
|
||||
D 2025-09-20T03:02:36.219
|
||||
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 9cd47bfefb23c114b7a5d9ee5822d941398902f30516bf0dd
|
||||
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 5a4ce7cd670405e7d638f7138699f1c1d30bc934213ac05e489eb5f9d3f42b57
|
||||
F ext/wasm/GNUmakefile 5ff23f42123e0b40f7583a32f17111b8b145542d3767b3df97a67ce89043eefa
|
||||
F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a
|
||||
F ext/wasm/README.md 66ace67ae98a45e4116f2ca5425b716887bcee4d64febee804ff6398e1ae9ec7
|
||||
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
|
||||
@@ -597,9 +597,9 @@ F ext/wasm/api/post-js-footer.js 365405929f41ca0e6d389ed8a8da3f3c93e11d3ef43a90a
|
||||
F ext/wasm/api/post-js-header.js 53740d824e5d9027eb1e6fd59e216abbd2136740ce260ea5f0699ff2acb0a701
|
||||
F ext/wasm/api/pre-js.c-pp.js 58f823de197e2c10d76179aa05410a593b7ae03e1ece983bb42ffd818e8857e1
|
||||
F ext/wasm/api/sqlite3-api-cleanup.js 3ac1786e461ada63033143be8c3b00b26b939540661f3e839515bb92f2e35359
|
||||
F ext/wasm/api/sqlite3-api-glue.c-pp.js a7e51c50c89146329e5caa1784eed37c95e4fde2a5d872351723dbff372c7362
|
||||
F ext/wasm/api/sqlite3-api-glue.c-pp.js c6a4271411caf9b0ff434436766fcd226e22cad484949fc207045d13ba960354
|
||||
F ext/wasm/api/sqlite3-api-oo1.c-pp.js dc8573267f0dd49ae314a295c0dbe86de921f6d6beabbb7a447029ca1ea4e1d9
|
||||
F ext/wasm/api/sqlite3-api-prologue.js a5e104261e76495715c99837cb51b14a6b78eb959da45258ecce54cad2058f79
|
||||
F ext/wasm/api/sqlite3-api-prologue.js 8ab2b1ad98240821ac98ec6d1c691f6018cdda8b73ba722a32a75c03e1754f6d
|
||||
F ext/wasm/api/sqlite3-api-worker1.c-pp.js 760191cd13416e6f5adfd9fcc8a97fed5645c9e0a5fbac213a2d4ce2d79a4334
|
||||
F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
|
||||
F ext/wasm/api/sqlite3-opfs-async-proxy.js 9654b565b346dc609b75d15337f20acfa7af7d9d558da1afeb9b6d8eaa404966
|
||||
@@ -607,7 +607,7 @@ F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c
|
||||
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 0f68a64e508598910e7c01214ae27d603dfc8baec6a184506fafac603a901931
|
||||
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 4ab0704ee198de7d1059eccedc7703c931510b588d10af0ee36ea5b3ebbac284
|
||||
F ext/wasm/api/sqlite3-vtab-helper.c-pp.js e809739d71e8b35dfe1b55d24d91f02d04239e6aef7ca1ea92a15a29e704f616
|
||||
F ext/wasm/api/sqlite3-wasm.c 268976d5c19e4b44e86c4509e7460cd66db3a963fbe022696c6874e70b28907f
|
||||
F ext/wasm/api/sqlite3-wasm.c 38bf0af6328fd729c3db46843df92af413ed984174220602bf402b3eb3bcd5c0
|
||||
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 4ad256b4ff7f839ad18931ed35d46cced544207bd2209665ec552e193f7f4544
|
||||
F ext/wasm/api/sqlite3-worker1.c-pp.js 5e8706c2c4af2a57fbcdc02f4e7ef79869971bc21bb8ede777687786ce1c92d5
|
||||
F ext/wasm/batch-runner-sahpool.html e9a38fdeb36a13eac7b50241dfe7ae066fe3f51f5c0b0151e7baee5fce0d07a7
|
||||
@@ -618,7 +618,7 @@ F ext/wasm/c-pp.c cca55c5b55ebd8d29916adbedb0e40baa12caa9a2e8429f812683c308f9b0e
|
||||
F ext/wasm/common/SqliteTestUtil.js 7adaeffef757d8708418dc9190f72df22367b531831775804b31598b44f6aa51
|
||||
F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
|
||||
F ext/wasm/common/testing.css e97549bab24126c24e0daabfe2de9bb478fb0a69fdb2ddd0a73a992c091aad6f
|
||||
F ext/wasm/common/whwasmutil.js 2bf2920d2ef25f0e0c7342ab761e91ff6060345e956869dc8e3312e0832af0cb
|
||||
F ext/wasm/common/whwasmutil.js 9b805368c3c6466c4a52237dfe416654ff9fe4a32ef67c302804df5ab581b329
|
||||
F ext/wasm/config.make.in c424ae1cc3c89274520ad312509d36c4daa34a3fce5d0c688e5f8f4365e1049a
|
||||
F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
|
||||
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
|
||||
@@ -637,7 +637,7 @@ F ext/wasm/fiddle/fiddle.js f0b96f978c7c77fea8d092aa79c77849ce111d7b1ba60ffba076
|
||||
F ext/wasm/fiddle/index.html 17c7d6b21f40fbf462162c4311b63d760b065e419d9f5a96534963b0e52af940
|
||||
F ext/wasm/index-dist.html 56132399702b15d70c474c3f1952541e25cb0922942868f70daf188f024b3730
|
||||
F ext/wasm/index.html bcaa00eca521b372a6a62c7e7b17a870b0fcdf3e418a5921df1fd61e5344080d
|
||||
F ext/wasm/jaccwabyt/jaccwabyt.js 8135dff039727ecdfc807d0d4f25f1966a1c50e4e893838f157e685d565bcad6
|
||||
F ext/wasm/jaccwabyt/jaccwabyt.js 45142de663ef1f933b082adcc0f5898d7353cdcebe7e0319178fedbc12132d28
|
||||
F ext/wasm/jaccwabyt/jaccwabyt.md 1128e3563e7eff90b5a373395251fc76cb32386fad1fea6075b0f34a8f1b9bdf
|
||||
F ext/wasm/mkwasmbuilds.c cc66cfaf8673ece3c30ca7fe28f6111481090648098a143ea619a8820b8fbe82
|
||||
F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337
|
||||
@@ -655,7 +655,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
|
||||
F ext/wasm/test-opfs-vfs.js 1618670e466f424aa289859fe0ec8ded223e42e9e69b5c851f809baaaca1a00c
|
||||
F ext/wasm/tester1-worker.html ebc4b820a128963afce328ecf63ab200bd923309eb939f4110510ab449e9814c
|
||||
F ext/wasm/tester1.c-pp.html 1c1bc78b858af2019e663b1a31e76657b73dc24bede28ca92fbe917c3a972af2
|
||||
F ext/wasm/tester1.c-pp.js b20b0771e2e3ec14071f4ab37c505089e6b6f8117333b1fa43cf1116324a893b
|
||||
F ext/wasm/tester1.c-pp.js ff69e6bdf40a7fd7d127a1396a5162926880caa66792cbc868a036174a8d6bbb
|
||||
F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471f4520a99e5b545928668f4285fb5e
|
||||
F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88
|
||||
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
|
||||
@@ -2175,8 +2175,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 cfd5c746a6111f49c9c83a56c3ef65223456306f2de6e20b36b1ca0c98b593e9
|
||||
R da42d6d14ac4ef5c5b8683e064208718
|
||||
P f35bb66e3eb939d321afb3545c184013633ce35fa4cbd67b6be17a64997ece9d
|
||||
R c35320c27f1fa89eaf4dc95d15eedb59
|
||||
U stephan
|
||||
Z 27b1d88685e7413724f033cba49e1430
|
||||
Z b704487a4e2713503ba05326e82a9d55
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
||||
@@ -1 +1 @@
|
||||
f35bb66e3eb939d321afb3545c184013633ce35fa4cbd67b6be17a64997ece9d
|
||||
1e3b003ff99d2788d93e179504b711cb78846605774bf472589440d0136f20fa
|
||||
|
||||
Reference in New Issue
Block a user