]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Part 2 of the fix from [a0f808363318c00fd1db78b].
authorstephan <stephan@noemail.net>
Thu, 3 Aug 2023 20:02:49 +0000 (20:02 +0000)
committerstephan <stephan@noemail.net>
Thu, 3 Aug 2023 20:02:49 +0000 (20:02 +0000)
FossilOrigin-Name: ce0674b1925138f8f878b11aae0f8420bd968df0959f6dd7e208fb84bcbad07e

ext/wasm/common/whwasmutil.js
manifest
manifest.uuid

index 8e69132d5cc88fda1464516c70f637974c040414..65421e3facd92b300ee2ff291dc5d21b0dea8ac6 100644 (file)
@@ -1178,7 +1178,7 @@ globalThis.WhWasmUtilInstaller = function(target){
     cache.scopedAlloc.splice(n,1);
     for(let p; (p = state.pop()); ){
       if(target.functionEntry(p)){
-        //console.warn("scopedAllocPop() uninstalling transient function",p);
+        //console.warn("scopedAllocPop() uninstalling function",p);
         target.uninstallFunction(p);
       }
       else target.dealloc(p);
@@ -1639,6 +1639,7 @@ globalThis.WhWasmUtilInstaller = function(target){
                      'and is not intended to be invoked from',
                      'client-level code. Invoked with:',opt);
       }
+      this.name = opt.name || "unnamed";
       this.signature = opt.signature;
       if(opt.contextKey instanceof Function){
         this.contextKey = opt.contextKey;
@@ -1700,14 +1701,16 @@ globalThis.WhWasmUtilInstaller = function(target){
        exactly the 2nd and 3rd arguments are.
     */
     convertArg(v,argv,argIndex){
-      //FuncPtrAdapter.debugOut("FuncPtrAdapter.convertArg()",this.signature,this.transient,v);
+      //FuncPtrAdapter.debugOut("FuncPtrAdapter.convertArg()",this.name,this.signature,this.transient,v);
       let pair = this.singleton;
       if(!pair && this.isContext){
         pair = this.contextMap(this.contextKey(argv,argIndex));
+        //FuncPtrAdapter.debugOut(this.name, this.signature, "contextKey() =",this.contextKey(argv,argIndex), pair);
       }
       if(pair && pair[0]===v) return pair[1];
       if(v instanceof Function){
         /* Install a WASM binding and return its pointer. */
+        //FuncPtrAdapter.debugOut("FuncPtrAdapter.convertArg()",this.name,this.signature,this.transient,v,pair);
         if(this.callProxy) v = this.callProxy(v);
         const fp = __installFunction(v, this.signature, this.isTransient);
         if(FuncPtrAdapter.debugFuncInstall){
@@ -1740,13 +1743,14 @@ globalThis.WhWasmUtilInstaller = function(target){
         }
         return fp;
       }else if(target.isPtr(v) || null===v || undefined===v){
+        //FuncPtrAdapter.debugOut("FuncPtrAdapter.convertArg()",this.name,this.signature,this.transient,v,pair);
         if(pair && pair[1] && pair[1]!==v){
           /* uninstall stashed mapping and replace stashed mapping with v. */
           if(FuncPtrAdapter.debugFuncInstall){
             FuncPtrAdapter.debugOut("FuncPtrAdapter uninstalling", this,
                                     this.contextKey(argv,argIndex), '@'+pair[1], v);
           }
-          try{target.uninstallFunction(pair[1])}
+          try{ cache.scopedAlloc[cache.scopedAlloc.length-1].push(pair[1]) }
           catch(e){/*ignored*/}
           pair[0] = pair[1] = (v | 0);
         }
index 183bde6fb0847220f732f8761b7ff70838eb1bd0..7db3bf87c73043982a694bd910082fb70a38d0c5 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Resolve\sthe\stiming/ordering\sissue\sof\sa\sJS-to-WASM-converted\sxDestroy()\sfunction\sbeing\suninstalled\sfrom\sWASM\sright\sbefore\sthe\sunderlying\snative\scall\stries\sto\scall\sit.\sThis\shas\sbeen\sa\slong-unnoticed\sbug\swhich\sappears\sonly\swhen\sremoving\ssuch\sfunctions\sor\sreplacing\sthen.
-D 2023-08-03T18:46:44.153
+C Part\s2\sof\sthe\sfix\sfrom\s[a0f808363318c00fd1db78b].
+D 2023-08-03T20:02:49.776
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -520,7 +520,7 @@ F ext/wasm/c-pp.c 6d80d8569d85713effe8b0818a3cf51dc779e3f0bf8dc88771b8998552ee25
 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 b9667f34bd2b6c6a7055d37da586f3ad7757ff758407322e23694894519ca5c5
+F ext/wasm/common/whwasmutil.js fc923692f51b9a47cb6c3d0ab350db542cf6774c39d9e4ed9e894b55180d6989
 F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
 F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
 F ext/wasm/demo-123.js 38aa8faec4d0ace1c973bc8a7a1533584463ebeecd4c420daa7d9687beeb9cb5
@@ -2051,8 +2051,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 163e3e44b16caa7ceb2805d29a76d8975e66fe429a911995b1c2f8429b080645
-R 9cf774edaace5bcb1466b82cf288cd32
+P a0f808363318c00fd1db78b4271cef8d05a046a36aab1a383e731e40603c6e2a
+R f0e23b22b28a37c03d5b2048de2190dd
 U stephan
-Z c5c78ad6190e3b9e6cdf7cb5e63b5a37
+Z 9f51c4a5e0c22d8a19d776fe443c68e1
 # Remove this line to create a well-formed Fossil manifest.
index 447fec4a3680c90a4d8af7639850ad84036744a2..5044e3c62c3960dcc06de5a1218c43422f3ce4d8 100644 (file)
@@ -1 +1 @@
-a0f808363318c00fd1db78b4271cef8d05a046a36aab1a383e731e40603c6e2a
\ No newline at end of file
+ce0674b1925138f8f878b11aae0f8420bd968df0959f6dd7e208fb84bcbad07e
\ No newline at end of file