mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-25 20:58:26 +03:00
Initial experimentation with a -sMEMORY64=1 wasm build (full 64-bit). This compiles but does not pass tests due to friction between BigInt and Number types (e.g. Number(null)===0 but BigInt(null) throws, many functions are fussy about which of those types they'll take, and we cannot simply mix and match the two types transparently (1n+1 is not legal (but 1n>=1 is), so we can no longer do pointer arithmatic without hoop-jumping)). The library bootstraps but it's failing early on in tests due to this friction.
FossilOrigin-Name: cfd5c746a6111f49c9c83a56c3ef65223456306f2de6e20b36b1ca0c98b593e9
This commit is contained in:
@@ -443,7 +443,7 @@ cflags.common = -I. -I$(dir $(sqlite3.c))
|
||||
# disables certain features if BigInt is not enabled and such builds
|
||||
# _are not tested_ on any regular basis.
|
||||
emcc.WASM_BIGINT ?= 1
|
||||
emcc.MEMORY64 ?= 0
|
||||
emcc.MEMORY64 ?= 1
|
||||
########################################################################
|
||||
# https://emscripten.org/docs/tools_reference/settings_reference.html#memory64
|
||||
#
|
||||
@@ -465,14 +465,12 @@ emcc.MEMORY64 ?= 0
|
||||
# Notes related to getting it working with MEMORY64 with emcc
|
||||
# versions 4.0.11-15:
|
||||
#
|
||||
# - sqlite3-wasm.c:sqlite3__wasm_enum_json() mysteriously fails
|
||||
# (returns 0) with MEMORY64=2. That call is critical to the
|
||||
# library bootstrapping process.
|
||||
#
|
||||
# - MEMORY64=1 fails to compile with: "tables may not be 64-bit" with
|
||||
# - MEMORY64=1 fails to build with: "tables may not be 64-bit" with
|
||||
# emcc 4.0.11, but no location information about where that error is
|
||||
# coming from. The only reference to it on the web is:
|
||||
# https://chromium.googlesource.com/external/github.com/WebAssembly/wabt/+/refs/tags/1.0.20/src/binary-reader.cc
|
||||
# It turns out that we need a newer wasm-strip for this (1.0.36 does
|
||||
# the job).
|
||||
#
|
||||
# [^wasm3]: https://webassembly.org/news/2025-09-17-wasm-3.0/
|
||||
########################################################################
|
||||
|
||||
@@ -21,6 +21,11 @@ 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
|
||||
wasm.pointerIR = 'i64';
|
||||
//#else
|
||||
wasm.pointerIR = 'i32';
|
||||
//#endif
|
||||
globalThis.WhWasmUtilInstaller(wasm);
|
||||
delete globalThis.WhWasmUtilInstaller;
|
||||
|
||||
@@ -913,7 +918,6 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
toss("Maintenance required: increase sqlite3__wasm_enum_json()'s",
|
||||
"static buffer size!");
|
||||
}
|
||||
//console.debug('wasm.ctype length =',wasm.cstrlen(cJson));
|
||||
wasm.ctype = JSON.parse(wasm.cstrToJs(cJson));
|
||||
// Groups of SQLITE_xyz macros...
|
||||
const defineGroups = ['access', 'authorizer',
|
||||
|
||||
@@ -953,7 +953,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
affirmBindableTypedArray(srcTypedArray);
|
||||
const pRet = wasm.alloc(srcTypedArray.byteLength || 1);
|
||||
wasm.heapForSize(srcTypedArray.constructor).set(
|
||||
srcTypedArray.byteLength ? srcTypedArray : [0], pRet
|
||||
srcTypedArray.byteLength ? srcTypedArray : [0], Number(pRet)
|
||||
);
|
||||
return pRet;
|
||||
};
|
||||
@@ -973,11 +973,15 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
};
|
||||
wasm.alloc.impl = wasm.exports[keyAlloc];
|
||||
wasm.realloc = function f(m,n){
|
||||
m = wasm.asPtrType(m)/*tag:64bit*/;
|
||||
const m2 = f.impl(m,n);
|
||||
return n ? (m2 || WasmAllocError.toss("Failed to reallocate",n," bytes.")) : 0;
|
||||
return n ? (m2 || WasmAllocError.toss("Failed to reallocate",n," bytes.")) : wasm.NullPtr;
|
||||
};
|
||||
wasm.realloc.impl = wasm.exports[keyRealloc];
|
||||
wasm.dealloc = wasm.exports[keyDealloc];
|
||||
wasm.dealloc = function f(m){
|
||||
f.impl(wasm.asPtrType(m)/*tag:64bit*/);
|
||||
};
|
||||
wasm.dealloc.impl = wasm.exports[keyDealloc];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1354,7 +1358,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
*/
|
||||
capi.sqlite3_js_vfs_list = function(){
|
||||
const rc = [];
|
||||
let pVfs = capi.sqlite3_vfs_find(0);
|
||||
let pVfs = capi.sqlite3_vfs_find(wasm.asPtrType(0));
|
||||
while(pVfs){
|
||||
const oVfs = new capi.sqlite3_vfs(pVfs);
|
||||
rc.push(wasm.cstrToJs(oVfs.$zName));
|
||||
|
||||
@@ -230,6 +230,47 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
('i32'===ptrIR ? 4
|
||||
: ('i64'===ptrIR
|
||||
? 8 : toss("Unhandled ptrSizeof:",ptrIR)));
|
||||
|
||||
/**
|
||||
If target.pointerIR=='i32' then this is equivalent to
|
||||
Number(v) else it's equivalent to BigInt(v||0).
|
||||
|
||||
Why? Because Number(null)===0, but BigInt(null) throws.
|
||||
*/
|
||||
const __asPtrType = ('i32'==ptrIR)
|
||||
? Number
|
||||
: (target.bigIntEnabled
|
||||
? ((v)=>BigInt(v || 0))
|
||||
: toss("Missing BigInt support"));
|
||||
|
||||
target.asPtrType = __asPtrType;
|
||||
|
||||
/**
|
||||
Expects any number of numeric arguments, each one of either type
|
||||
Number or BigInt. It sums them up (from an implicit starting
|
||||
point of 0 or 0n) and returns them as a number of the same type
|
||||
which target.asPtrType() uses.
|
||||
|
||||
This is a workaround for not being able to mix Number/BigInt in
|
||||
addition/subtraction expressions (which we frequently need for
|
||||
calculating pointer offsets).
|
||||
*/
|
||||
const __ptrAdd = function(...args){
|
||||
let rc = __asPtrType(0);
|
||||
for( let i = 0; i < args.length; ++i ){
|
||||
rc += __asPtrType(args[i]);
|
||||
}
|
||||
return rc;
|
||||
};
|
||||
|
||||
target.ptrAdd = __ptrAdd;
|
||||
|
||||
/**
|
||||
The number 0 as either type Number or BigInt, depending on
|
||||
target.pointerIR.
|
||||
*/
|
||||
target.NullPtr = __asPtrType(0);
|
||||
|
||||
/** Stores various cached state. */
|
||||
const cache = Object.create(null);
|
||||
/** Previously-recorded size of cache.memory.buffer, noted so that
|
||||
@@ -389,7 +430,7 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
*/
|
||||
target.functionEntry = function(fptr){
|
||||
const ft = target.functionTable();
|
||||
return fptr < ft.length ? ft.get(fptr) : undefined;
|
||||
return fptr < ft.length ? ft.get(__asPtrType(fptr)) : undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -555,7 +596,7 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
}
|
||||
if(!ptr){
|
||||
ptr = oldLen;
|
||||
ft.grow(1);
|
||||
ft.grow(__asPtrType(1));
|
||||
}
|
||||
try{
|
||||
/*this will only work if func is a WASM-exported function*/
|
||||
@@ -713,16 +754,17 @@ 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[ptr>>0]; break;
|
||||
case 'i16': rc = c.HEAP16[ptr>>1]; break;
|
||||
case 'i32': rc = c.HEAP32[ptr>>2]; break;
|
||||
case 'float': case 'f32': rc = c.HEAP32F[ptr>>2]; break;
|
||||
case 'double': case 'f64': rc = Number(c.HEAP64F[ptr>>3]); break;
|
||||
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 'i64':
|
||||
if(target.bigIntEnabled){
|
||||
rc = BigInt(c.HEAP64[ptr>>3]);
|
||||
rc = BigInt(c.HEAP64[pNumber>>3]);
|
||||
break;
|
||||
}
|
||||
/* fallthru */
|
||||
@@ -758,16 +800,17 @@ 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[p>>0] = value; continue;
|
||||
case 'i16': c.HEAP16[p>>1] = value; continue;
|
||||
case 'i32': c.HEAP32[p>>2] = value; continue;
|
||||
case 'float': case 'f32': c.HEAP32F[p>>2] = value; continue;
|
||||
case 'double': case 'f64': c.HEAP64F[p>>3] = value; continue;
|
||||
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 'i64':
|
||||
if(c.HEAP64){
|
||||
c.HEAP64[p>>3] = BigInt(value);
|
||||
c.HEAP64[pNumber>>3] = BigInt(value);
|
||||
continue;
|
||||
}
|
||||
/* fallthru */
|
||||
@@ -850,13 +893,23 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
*/
|
||||
target.isPtr32 = (ptr)=>('number'===typeof ptr && (ptr===(ptr|0)) && ptr>=0);
|
||||
|
||||
/* UNTESTED */
|
||||
target.isPtr64 = (ptr)=>{
|
||||
if( 'bigint'===typeof ptr ){
|
||||
return ptr >= 0;
|
||||
}
|
||||
return ('number'===typeof ptr && (ptr===(ptr|0)) && ptr>=0);
|
||||
};
|
||||
|
||||
/**
|
||||
isPtr() is an alias for isPtr32(). If/when 64-bit WASM pointer
|
||||
support becomes widespread, it will become an alias for either
|
||||
isPtr32() or the as-yet-hypothetical isPtr64(), depending on a
|
||||
configuration option.
|
||||
*/
|
||||
target.isPtr = target.isPtr32;
|
||||
target.isPtr = ('i32'==ptrIR)
|
||||
? target.isPtr32
|
||||
: target.isPtr64;
|
||||
|
||||
/**
|
||||
Expects ptr to be a pointer into the WASM heap memory which
|
||||
@@ -867,7 +920,9 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
target.heap8u().
|
||||
*/
|
||||
target.cstrlen = function(ptr){
|
||||
if(!ptr || !target.isPtr(ptr)) return null;
|
||||
if(!ptr) return null;
|
||||
ptr = Number(ptr) /*tag:64bit*/;
|
||||
if(!target.isPtr(ptr)) return null;
|
||||
const h = heapWrappers().HEAP8U;
|
||||
let pos = ptr;
|
||||
for( ; h[pos] !== 0; ++pos ){}
|
||||
@@ -894,6 +949,7 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
ptr is falsy or not a pointer, `null` is returned.
|
||||
*/
|
||||
target.cstrToJs = function(ptr){
|
||||
ptr = Number(ptr) /*tag:64bit*/;
|
||||
const n = target.cstrlen(ptr);
|
||||
return n ? __utf8Decode(heapWrappers().HEAP8U, ptr, ptr+n) : (null===n ? n : "");
|
||||
};
|
||||
@@ -1028,10 +1084,11 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
else if(!(n>0)) return 0;
|
||||
const heap = target.heap8u();
|
||||
let i = 0, ch;
|
||||
for(; i < n && (ch = heap[srcPtr+i]); ++i){
|
||||
heap[tgtPtr+i] = ch;
|
||||
const tgtNumber = Number(tgtPtr), srcNumber = Number(srcPtr)/*tag:64bit*/;
|
||||
for(; i < n && (ch = heap[srcNumber+i]); ++i){
|
||||
heap[tgtNumber+i] = ch;
|
||||
}
|
||||
if(i<n) heap[tgtPtr + i++] = 0;
|
||||
if(i<n) heap[tgtNumber + i++] = 0;
|
||||
return i;
|
||||
};
|
||||
|
||||
@@ -1089,8 +1146,9 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
const u = cache.utf8Encoder.encode(jstr),
|
||||
ptr = allocator(u.length+1),
|
||||
heap = heapWrappers().HEAP8U;
|
||||
heap.set(u, ptr);
|
||||
heap[ptr + u.length] = 0;
|
||||
//console.warn("ptr =",ptr);
|
||||
heap.set(u, Number(ptr));
|
||||
heap[__ptrAdd(ptr, u.length)] = 0;
|
||||
return returnWithLength ? [ptr, u.length] : ptr;
|
||||
}
|
||||
};
|
||||
@@ -1214,7 +1272,8 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
if(!cache.scopedAlloc.length){
|
||||
toss("No scopedAllocPush() scope is active.");
|
||||
}
|
||||
return cache.scopedAlloc.pushPtr(target.alloc(n));
|
||||
const p = __asPtrType(target.alloc(n));
|
||||
return cache.scopedAlloc.pushPtr(p);
|
||||
};
|
||||
|
||||
Object.defineProperty(target.scopedAlloc, 'level', {
|
||||
@@ -1424,10 +1483,9 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
const xArg = cache.xWrap.convert.arg, xResult = cache.xWrap.convert.result;
|
||||
|
||||
if(target.bigIntEnabled){
|
||||
xArg.set('i64', (i)=>BigInt(i));
|
||||
xArg.set('i64', (i)=>BigInt(i || 0));
|
||||
}
|
||||
const __xArgPtr = ('i32' === ptrIR)
|
||||
? ((i)=>(i | 0)) : ((i)=>(BigInt(i) | BigInt(0)));
|
||||
const __xArgPtr = __asPtrType;
|
||||
xArg.set('i32', (i)=>(i | 0) )
|
||||
.set('i16', (i)=>((i | 0) & 0xFFFF))
|
||||
.set('i8', (i)=>((i | 0) & 0xFF))
|
||||
@@ -1480,7 +1538,7 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
*/
|
||||
const __xArgString = function(v){
|
||||
if('string'===typeof v) return target.scopedAllocCString(v);
|
||||
return v ? __xArgPtr(v) : null;
|
||||
return __asPtrType(v);
|
||||
};
|
||||
xArg.set('string', __xArgString)
|
||||
.set('utf8', __xArgString)
|
||||
@@ -2083,6 +2141,7 @@ 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);
|
||||
return cxw.convertResultNoCheck(resultType, xf.apply(null,args));
|
||||
}finally{
|
||||
target.scopedAllocPop(scope);
|
||||
|
||||
@@ -67,6 +67,11 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
|
||||
ptrSizeof = config.ptrSizeof || 4,
|
||||
ptrIR = config.ptrIR || 'i32'
|
||||
;
|
||||
const __asPtrType = ('i32'==ptrIR)
|
||||
? Number
|
||||
: (target.bigIntEnabled
|
||||
? (v)=>BigInt(v || 0)
|
||||
: toss("Missing BigInt support"));
|
||||
|
||||
if(!SBF.debugFlags){
|
||||
SBF.__makeDebugFlags = function(deriveFrom=null){
|
||||
@@ -275,7 +280,9 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
|
||||
ctor.structName,"instance:",
|
||||
ctor.structInfo.sizeof,"bytes @"+m);
|
||||
}
|
||||
if(fill) heap().fill(0, m, m + ctor.structInfo.sizeof);
|
||||
if(fill){
|
||||
heap().fill(0, Number(m), Number(m) + ctor.structInfo.sizeof);
|
||||
}
|
||||
__instancePointerMap.set(obj, m);
|
||||
}catch(e){
|
||||
__freeStruct(ctor, obj, m);
|
||||
@@ -518,7 +525,12 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
|
||||
memberKey: __memberKeyProp
|
||||
});
|
||||
|
||||
const isNumericValue = (v)=>Number.isFinite(v) || (v instanceof (BigInt || Number));
|
||||
const isNumericValue = (v)=>{
|
||||
return Number.isFinite(v) || (v instanceof Number)
|
||||
|| (bigIntEnabled
|
||||
? ('bigint'===typeof v /*does not work: v instanceof BigInt*/)
|
||||
: false);
|
||||
};
|
||||
|
||||
/**
|
||||
Pass this a StructBinder-generated prototype, and the struct
|
||||
@@ -574,7 +586,7 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
|
||||
xPropName,'@', this.pointer,'+',descr.offset,'sz',descr.sizeof);
|
||||
}
|
||||
let rc = (
|
||||
new DataView(heap().buffer, this.pointer + descr.offset, descr.sizeof)
|
||||
new DataView(heap().buffer, Number(this.pointer) + descr.offset, descr.sizeof)
|
||||
)[f._.getters[sigGlyph]](0, isLittleEndian);
|
||||
if(dbg.getter) log("debug.getter:",xPropName,"result =",rc);
|
||||
return rc;
|
||||
@@ -601,7 +613,7 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
|
||||
toss("Invalid value for pointer-type",xPropName+'.');
|
||||
}
|
||||
(
|
||||
new DataView(heap().buffer, this.pointer + descr.offset, descr.sizeof)
|
||||
new DataView(heap().buffer, Number(this.pointer) + descr.offset, descr.sizeof)
|
||||
)[f._.setters[sigGlyph]](0, f._.sw[sigGlyph](v), isLittleEndian);
|
||||
};
|
||||
}
|
||||
@@ -652,11 +664,13 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
|
||||
}
|
||||
const debugFlags = rop(SBF.__makeDebugFlags(StructBinder.debugFlags));
|
||||
/** Constructor for the StructCtor. */
|
||||
const zeroAsPtr = __asPtrType(0);
|
||||
const StructCtor = function StructCtor(externalMemory){
|
||||
externalMemory = __asPtrType(externalMemory);
|
||||
if(!(this instanceof StructCtor)){
|
||||
toss("The",structName,"constructor may only be called via 'new'.");
|
||||
}else if(arguments.length){
|
||||
if(externalMemory!==(externalMemory|0) || externalMemory<=0){
|
||||
if(externalMemory<=zeroAsPtr){
|
||||
toss("Invalid pointer value for",structName,"constructor.");
|
||||
}
|
||||
__allocStruct(StructCtor, this, externalMemory);
|
||||
|
||||
@@ -405,7 +405,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
.assert(wasm.realloc.impl === wasm.exports.realloc);
|
||||
}else{
|
||||
T.assert(wasm.alloc.impl === wasm.exports.sqlite3_malloc)
|
||||
.assert(wasm.dealloc === wasm.exports.sqlite3_free)
|
||||
.assert(wasm.dealloc.impl === wasm.exports.sqlite3_free)
|
||||
.assert(wasm.realloc.impl === wasm.exports.sqlite3_realloc);
|
||||
}
|
||||
}
|
||||
@@ -502,7 +502,8 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
let m = w.alloc(14);
|
||||
let m2 = w.realloc(m, 16);
|
||||
T.assert(m === m2/* because of alignment */);
|
||||
T.assert(0 === w.realloc(m, 0));
|
||||
let x = w.realloc(m, 0);
|
||||
T.assert(w.NullPtr === x);
|
||||
m = m2 = 0;
|
||||
|
||||
// Check allocation limits and allocator's responses...
|
||||
@@ -511,24 +512,26 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
const tooMuch = sqlite3.capi.SQLITE_MAX_ALLOCATION_SIZE + 1,
|
||||
isAllocErr = (e)=>e instanceof sqlite3.WasmAllocError;
|
||||
T.mustThrowMatching(()=>w.alloc(tooMuch), isAllocErr)
|
||||
.assert(0 === w.alloc.impl(tooMuch))
|
||||
.assert(w.NullPtr === w.alloc.impl(tooMuch))
|
||||
.mustThrowMatching(()=>w.realloc(0, tooMuch), isAllocErr)
|
||||
.assert(0 === w.realloc.impl(0, tooMuch));
|
||||
.assert(w.NullPtr === w.realloc.impl(wasm.NullPtr, tooMuch));
|
||||
}
|
||||
|
||||
// Check allocFromTypedArray()...
|
||||
const byteList = [11,22,33]
|
||||
const u = new Uint8Array(byteList);
|
||||
m = w.allocFromTypedArray(u);
|
||||
let mAsNumber = Number(m);
|
||||
for(let i = 0; i < u.length; ++i){
|
||||
T.assert(u[i] === byteList[i])
|
||||
.assert(u[i] === w.peek8(m + i));
|
||||
.assert(u[i] === w.peek8(mAsNumber + i));
|
||||
}
|
||||
w.dealloc(m);
|
||||
m = w.allocFromTypedArray(u.buffer);
|
||||
mAsNumber = Number(m);
|
||||
for(let i = 0; i < u.length; ++i){
|
||||
T.assert(u[i] === byteList[i])
|
||||
.assert(u[i] === w.peek8(m + i));
|
||||
.assert(u[i] === w.peek8(mAsNumber + i));
|
||||
}
|
||||
|
||||
w.dealloc(m);
|
||||
@@ -623,18 +626,19 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
try {
|
||||
let cStr = w.scopedAllocCString("hello");
|
||||
const n = w.cstrlen(cStr);
|
||||
const nPtr = w.asPtrType(n);
|
||||
let cpy = w.scopedAlloc(n+10);
|
||||
let rc = w.cstrncpy(cpy, cStr, n+10);
|
||||
T.assert(n+1 === rc).
|
||||
assert("hello" === w.cstrToJs(cpy)).
|
||||
assert(chr('o') === w.peek8(cpy+n-1)).
|
||||
assert(0 === w.peek8(cpy+n));
|
||||
assert(chr('o') === w.peek8( w.ptrAdd(cpy,nPtr, -1))).
|
||||
assert(0 === w.peek8( w.ptrAdd(cpy,nPtr) ) );
|
||||
let cStr2 = w.scopedAllocCString("HI!!!");
|
||||
rc = w.cstrncpy(cpy, cStr2, 3);
|
||||
T.assert(3===rc).
|
||||
assert("HI!lo" === w.cstrToJs(cpy)).
|
||||
assert(chr('!') === w.peek8(cpy+2)).
|
||||
assert(chr('l') === w.peek8(cpy+3));
|
||||
assert(chr('!') === w.peek8( w.ptrAdd(cpy, 2) )).
|
||||
assert(chr('l') === w.peek8( w.ptrAdd(cpy, 3) ) );
|
||||
}finally{
|
||||
w.scopedAllocPop(scope);
|
||||
}
|
||||
@@ -657,8 +661,8 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
const jstr = "hällo, world!";
|
||||
const [cstr, n] = w.allocCString(jstr, true);
|
||||
T.assert(14 === n)
|
||||
.assert(0===w.peek8(cstr+n))
|
||||
.assert(chr('!')===w.peek8(cstr+n-1));
|
||||
.assert(0===w.peek8(w.ptrAdd(cstr,n)))
|
||||
.assert(chr('!')===w.peek8(w.ptrAdd(cstr,n,-1)));
|
||||
w.dealloc(cstr);
|
||||
}
|
||||
|
||||
|
||||
25
manifest
25
manifest
@@ -1,5 +1,5 @@
|
||||
C Add\ssome\scomments\sdescribing\sthe\sways\sin\swhich\sbuilding\ssqlite3.wasm\swith\s-sMEMORY64=(non-zero)\sfails.
|
||||
D 2025-09-19T20:10:05.926
|
||||
C Initial\sexperimentation\swith\sa\s-sMEMORY64=1\swasm\sbuild\s(full\s64-bit).\sThis\scompiles\sbut\sdoes\snot\spass\stests\sdue\sto\sfriction\sbetween\sBigInt\sand\sNumber\stypes\s(e.g.\sNumber(null)===0\sbut\sBigInt(null)\sthrows,\smany\sfunctions\sare\sfussy\sabout\swhich\sof\sthose\stypes\sthey'll\stake,\sand\swe\scannot\ssimply\smix\sand\smatch\sthe\stwo\stypes\stransparently\s(1n+1\sis\snot\slegal\s(but\s1n>=1\sis),\sso\swe\scan\sno\slonger\sdo\spointer\sarithmatic\swithout\shoop-jumping)).\sThe\slibrary\sbootstraps\sbut\sit's\sfailing\searly\son\sin\stests\sdue\sto\sthis\sfriction.
|
||||
D 2025-09-19T23:21:00.279
|
||||
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 851ab585ec165066d971d371b265f7d468d326e27107d611f403b5cac170eebb
|
||||
F ext/wasm/GNUmakefile d7f9818a7fca38dc4975422da7de2bf1c8b6e5d617317ed9a2cdb122d35f5716
|
||||
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 fab9a05257119d42f3d26cf4e437198a8c479d2c4751c5de4ac986969bd3dd4b
|
||||
F ext/wasm/api/sqlite3-api-glue.c-pp.js 05cff4e731a667c27451456204c238e6ef2c24dd346d5efdd57f3ec58d7fd190
|
||||
F ext/wasm/api/sqlite3-api-oo1.c-pp.js dc8573267f0dd49ae314a295c0dbe86de921f6d6beabbb7a447029ca1ea4e1d9
|
||||
F ext/wasm/api/sqlite3-api-prologue.js 332bcf0c8a32af38c8b2f308b1cb37002e1db3ec27df9fe629116a591540e375
|
||||
F ext/wasm/api/sqlite3-api-prologue.js a5e104261e76495715c99837cb51b14a6b78eb959da45258ecce54cad2058f79
|
||||
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
|
||||
@@ -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 000232b0a9527af5a73b3c0e46ef91a19517ae027ce73fd8902f06c490b9b97c
|
||||
F ext/wasm/common/whwasmutil.js 0fdbecc28f15b80c2d1170a0c08c5641d3018fe430ac6fff27ecd68ae870ee06
|
||||
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 6e4f26d0edb5c2e7d381b7eff1924832a040a12274afab2d1e1789027e9f6c5c
|
||||
F ext/wasm/jaccwabyt/jaccwabyt.js b0f777ad9038c8b17f109cbae50cb452a4ea25e29d71ec078ba97fa326d2f0df
|
||||
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 de2736de2335a74a9ecbda9005af5c8b1c33fd8729591064ef4795650da65900
|
||||
F ext/wasm/tester1.c-pp.js 4ddf0715915abc98768fb678fa4e06b87136440119821040871c5394cae42225
|
||||
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,11 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
|
||||
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
|
||||
F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P fe2e1681b6dac81508ab67d1247e1f92018c9998386789846d1715c2cc13d6a8
|
||||
R 931dc94e11b34b3371a9dd232a2c1e37
|
||||
P 0b14fd35ca37075bb65b2ab398f3324dc851347b1c042566eac23724013653f8
|
||||
R d6a5d771720545ddaa81aa730696b2f5
|
||||
T *branch * wasm-64bit
|
||||
T *sym-wasm-64bit *
|
||||
T -sym-trunk * Cancelled\sby\sbranch.
|
||||
U stephan
|
||||
Z c76236b811064191d689f221f7e8ce24
|
||||
Z 3266854e43016c8ffb49e94aa674169f
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
branch trunk
|
||||
tag trunk
|
||||
branch wasm-64bit
|
||||
tag wasm-64bit
|
||||
|
||||
@@ -1 +1 @@
|
||||
0b14fd35ca37075bb65b2ab398f3324dc851347b1c042566eac23724013653f8
|
||||
cfd5c746a6111f49c9c83a56c3ef65223456306f2de6e20b36b1ca0c98b593e9
|
||||
|
||||
Reference in New Issue
Block a user