From: stephan Date: Thu, 8 Dec 2022 04:19:38 +0000 (+0000) Subject: Remove some dead JS code and tweak some docs. X-Git-Tag: version-3.41.0~291^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ab8b22a03d033adaa61f82e5c080de64c8200549;p=thirdparty%2Fsqlite.git Remove some dead JS code and tweak some docs. FossilOrigin-Name: 0ee495452c014680697aa9035c245024df127a52d1820ab0e02580a015d96ecb --- diff --git a/ext/wasm/api/sqlite3-opfs-async-proxy.js b/ext/wasm/api/sqlite3-opfs-async-proxy.js index 339ec126d0..1456ae08d2 100644 --- a/ext/wasm/api/sqlite3-opfs-async-proxy.js +++ b/ext/wasm/api/sqlite3-opfs-async-proxy.js @@ -13,7 +13,7 @@ A Worker which manages asynchronous OPFS handles on behalf of a synchronous API which controls it via a combination of Worker messages, SharedArrayBuffer, and Atomics. It is the asynchronous - counterpart of the API defined in sqlite3-api-opfs.js. + counterpart of the API defined in sqlite3-vfs-opfs.js. Highly indebted to: @@ -343,16 +343,6 @@ const installAsyncProxy = function(self){ const affirmNotRO = function(opName,fh){ if(fh.readOnly) toss(opName+"(): File is read-only: "+fh.filenameAbs); }; - const affirmLocked = function(opName,fh){ - //if(!fh.syncHandle) toss(opName+"(): File does not have a lock: "+fh.filenameAbs); - /** - Currently a no-op, as speedtest1 triggers xRead() without a - lock (that seems like a bug but it's currently uninvestigated). - This means, however, that some OPFS VFS routines may trigger - acquisition of a lock but never let it go until xUnlock() is - called (which it likely won't be if xLock() was not called). - */ - }; /** We track 2 different timers: the "metrics" timer records how much @@ -393,7 +383,6 @@ const installAsyncProxy = function(self){ */ let flagAsyncShutdown = false; - /** Asynchronous wrappers for sqlite3_vfs and sqlite3_io_methods methods, as well as helpers like mkdir(). Maintenance reminder: @@ -427,11 +416,11 @@ const installAsyncProxy = function(self){ }, xAccess: async (filename)=>{ mTimeStart('xAccess'); - /* OPFS cannot support the full range of xAccess() queries sqlite3 - calls for. We can essentially just tell if the file is - accessible, but if it is it's automatically writable (unless - it's locked, which we cannot(?) know without trying to open - it). OPFS does not have the notion of read-only. + /* OPFS cannot support the full range of xAccess() queries + sqlite3 calls for. We can essentially just tell if the file + is accessible, but if it is then it's automatically writable + (unless it's locked, which we cannot(?) know without trying + to open it). OPFS does not have the notion of read-only. The return semantics of this function differ from sqlite3's xAccess semantics because we are limited in what we can @@ -519,7 +508,6 @@ const installAsyncProxy = function(self){ let rc = 0; wTimeStart('xFileSize'); try{ - affirmLocked('xFileSize',fh); const sz = await (await getSyncHandle(fh,'xFileSize')).getSize(); state.s11n.serialize(Number(sz)); }catch(e){ @@ -615,7 +603,6 @@ const installAsyncProxy = function(self){ let rc = 0, nRead; const fh = __openFiles[fid]; try{ - affirmLocked('xRead',fh); wTimeStart('xRead'); nRead = (await getSyncHandle(fh,'xRead')).read( fh.sabView.subarray(0, n), @@ -659,7 +646,6 @@ const installAsyncProxy = function(self){ const fh = __openFiles[fid]; wTimeStart('xTruncate'); try{ - affirmLocked('xTruncate',fh); affirmNotRO('xTruncate', fh); await (await getSyncHandle(fh,'xTruncate')).truncate(size); }catch(e){ @@ -696,7 +682,6 @@ const installAsyncProxy = function(self){ const fh = __openFiles[fid]; wTimeStart('xWrite'); try{ - affirmLocked('xWrite',fh); affirmNotRO('xWrite', fh); rc = ( n === (await getSyncHandle(fh,'xWrite')) diff --git a/ext/wasm/api/sqlite3-v-helper.js b/ext/wasm/api/sqlite3-v-helper.js index 73ba8cc49e..88c86a6a0a 100644 --- a/ext/wasm/api/sqlite3-v-helper.js +++ b/ext/wasm/api/sqlite3-v-helper.js @@ -538,6 +538,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ try{return func(...arguments) || 0;} catch(e){ if(!(e instanceof sqlite3.WasmAllocError)){ + wasm.dealloc(wasm.getPtrValue(pzErr)); wasm.setPtrValue(pzErr, wasm.allocCString(e.message)); } return vt.xError(methodName, e); diff --git a/ext/wasm/speedtest1-worker.html b/ext/wasm/speedtest1-worker.html index 9fcd29ea72..cd0fdb027c 100644 --- a/ext/wasm/speedtest1-worker.html +++ b/ext/wasm/speedtest1-worker.html @@ -75,7 +75,7 @@
  • The easiest way to try different optimization levels is, from this directory: -
    $ rm -f speedtest1.js; make -e emcc_opt='-O2' speedtest1.js
    +
    $ rm -f jswasm/speedtest1.js; make -e emcc_opt='-O2' speedtest1
    Then reload this page. -O2 seems to consistently produce the fastest results.
  • diff --git a/ext/wasm/speedtest1.html b/ext/wasm/speedtest1.html index 5286b9e482..9cc20924e9 100644 --- a/ext/wasm/speedtest1.html +++ b/ext/wasm/speedtest1.html @@ -40,9 +40,9 @@