]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove two features of jaccwabyt which were fundamentally flawed, along with approx...
authorstephan <stephan@noemail.net>
Mon, 5 Dec 2022 15:05:46 +0000 (15:05 +0000)
committerstephan <stephan@noemail.net>
Mon, 5 Dec 2022 15:05:46 +0000 (15:05 +0000)
FossilOrigin-Name: a190abc307847174f36421eaa3f47ef349c6f84a2bb35857fa64f64bbe722708

ext/wasm/jaccwabyt/jaccwabyt.js
ext/wasm/jaccwabyt/jaccwabyt.md
ext/wasm/tester1.c-pp.js
manifest
manifest.uuid

index 960aae7936dc03b1628f148a9e0e15445f3e7f5e..0bd7869bc6f8766d251488845f201d41cd9e52ac 100644 (file)
@@ -200,30 +200,6 @@ self.Jaccwabyt = function StructBinderFactory(config){
     return ()=>toss(sPropName(structName,propName),"is read-only.");
   };
 
-  /**
-     When C code passes a pointer of a bound struct to back into
-     a JS function via a function pointer struct member, it
-     arrives in JS as a number (pointer).
-     StructType.instanceForPointer(ptr) can be used to get the
-     instance associated with that pointer, and __ptrBacklinks
-     holds that mapping. WeakMap keys must be objects, so we
-     cannot use a weak map to map pointers to instances. We use
-     the StructType constructor as the WeakMap key, mapped to a
-     plain, prototype-less Object which maps the pointers to
-     struct instances. That arrangement gives us a
-     per-StructType type-safe way to resolve pointers.
-  */
-  const __ptrBacklinks = new WeakMap();
-  /**
-     Similar to __ptrBacklinks but is scoped at the StructBinder
-     level and holds pointer-to-object mappings for all struct
-     instances created by any struct from any StructFactory
-     which this specific StructBinder has created. The intention
-     of this is to help implement more transparent handling of
-     pointer-type property resolution.
-  */
-  const __ptrBacklinksGlobal = Object.create(null);
-
   /**
      In order to completely hide StructBinder-bound struct
      pointers from JS code, we store them in a scope-local
@@ -265,8 +241,6 @@ self.Jaccwabyt = function StructBinderFactory(config){
         });
       }
       delete obj.ondispose;
-      delete __ptrBacklinks.get(ctor)[m];
-      delete __ptrBacklinksGlobal[m];
       __instancePointerMap.delete(obj);
       if(ctor.debugFlags.__flags.dealloc){
         log("debug.dealloc:",(obj[xPtrPropName]?"EXTERNAL":""),
@@ -299,8 +273,6 @@ self.Jaccwabyt = function StructBinderFactory(config){
       }
       if(fill) heap().fill(0, m, m + ctor.structInfo.sizeof);
       __instancePointerMap.set(obj, m);
-      __ptrBacklinks.get(ctor)[m] = obj;
-      __ptrBacklinksGlobal[m] = obj;
     }catch(e){
       __freeStruct(ctor, obj, m);
       throw e;
@@ -349,16 +321,6 @@ self.Jaccwabyt = function StructBinderFactory(config){
     return emscriptenFormat ? f._(m.signature) : m.signature;
   };
 
-  /**
-     Returns the instanceForPointer() impl for the given
-     StructType constructor.
-  */
-  const __instanceBacklinkFactory = function(ctor){
-    const b = Object.create(null);
-    __ptrBacklinks.set(ctor, b);
-    return (ptr)=>b[ptr];
-  };
-
   const __ptrPropDescriptor = {
     configurable: false, enumerable: false,
     get: function(){return __instancePointerMap.get(this)},
@@ -533,7 +495,6 @@ self.Jaccwabyt = function StructBinderFactory(config){
   */
   Object.defineProperties(StructType, {
     allocCString: rop(__allocCString),
-    instanceForPointer: rop((ptr)=>__ptrBacklinksGlobal[ptr]),
     isA: rop((v)=>v instanceof StructType),
     hasExternalPointer: rop((v)=>(v instanceof StructType) && !!v[xPtrPropName]),
     memberKey: __memberKeyProp
@@ -598,13 +559,6 @@ self.Jaccwabyt = function StructBinderFactory(config){
         new DataView(heap().buffer, this.pointer + descr.offset, descr.sizeof)
       )[f._.getters[sigGlyph]](0, isLittleEndian);
       if(dbg.getter) log("debug.getter:",xPropName,"result =",rc);
-      /* // Removed: it is legal for multiple StructType instances to
-         // proxy the same pointer, and instanceForPointer() cannot account
-         // for that.
-        if(rc && isAutoPtrSig(descr.signature)){
-        rc = StructType.instanceForPointer(rc) || rc;
-        if(dbg.getter) log("debug.getter:",xPropName,"resolved =",rc);
-      }*/               
       return rc;
     };
     if(descr.readOnly){
@@ -694,27 +648,9 @@ self.Jaccwabyt = function StructBinderFactory(config){
     };
     Object.defineProperties(StructCtor,{
       debugFlags: debugFlags,
-      disposeAll: rop(function(){
-        const map = __ptrBacklinks.get(StructCtor);
-        Object.keys(map).forEach(function(ptr){
-          const b = map[ptr];
-          if(b) __freeStruct(StructCtor, b, ptr);
-        });
-        __ptrBacklinks.set(StructCtor, Object.create(null));
-        return StructCtor;
-      }),
-      instanceForPointer: rop(__instanceBacklinkFactory(StructCtor)),
       isA: rop((v)=>v instanceof StructCtor),
       memberKey: __memberKeyProp,
       memberKeys: __structMemberKeys,
-      resolveToInstance: rop(function(v, throwIfNot=false){
-        if(!(v instanceof StructCtor)){
-          v = Number.isSafeInteger(v)
-            ? StructCtor.instanceForPointer(v) : undefined;
-        }
-        if(!v && throwIfNot) toss("Value is-not-a",StructCtor.structName);
-        return v;
-      }),
       methodInfoForKey: rop(function(mKey){
       }),
       structInfo: rop(structInfo),
@@ -732,7 +668,6 @@ self.Jaccwabyt = function StructBinderFactory(config){
     );
     return StructCtor;
   };
-  StructBinder.instanceForPointer = StructType.instanceForPointer;
   StructBinder.StructType = StructType;
   StructBinder.config = config;
   StructBinder.allocCString = __allocCString;
index 855a1d16a071c5280e1c3d42ad30fad9d3646a14..c6cf5c8a253afe6adccf238b62ae6112ac4594a9 100644 (file)
@@ -345,15 +345,6 @@ special use of unsigned numbers). A capital `P` changes the semantics
 of plain member pointers (but not, as of this writing, function
 pointer members) as follows:
 
-- <s>When a `P`-type member is **fetched** via `myStruct.x` and its
-  value is a non-0 integer,
-  [`StructBinder.instanceForPointer()`][StructBinder] is used to try
-  to map that pointer to a struct instance. If a match is found, the
-  "get" operation returns that instance instead of the integer. If no
-  match is found, it behaves exactly as for `p`, returning the integer
-  value.</s> Removed because it's legal and possible to for multiple
-  instances to proxy the same pointer and this infrastructure cannot
-  account for that.
 - When a `P`-type member is **set** via `myStruct.x=y`, if
   [`(y instanceof StructType)`][StructType] then the value of `y.pointer` is
   stored in `myStruct.x`. If `y` is neither a number nor
@@ -399,9 +390,7 @@ It is important to understand that creating a new instance allocates
 memory on the WASM heap. We must not simply rely on garbage collection
 to clean up the instances because doing so will not free up the WASM
 heap memory. The correct way to free up that memory is to use the
-object's `dispose()` method. Alternately, there is a "nuclear option":
-`MyBinder.disposeAll()` will free the memory allocated for _all_
-instances which have not been manually disposed.
+object's `dispose()` method.
 
 The following usage pattern offers one way to easily ensure proper
 cleanup of struct instances:
@@ -563,23 +552,6 @@ The Struct Binder has the following members:
   any of its "significant" configuration values may have undefined
   results.
 
-- <s>`instanceForPointer(pointer)`</s> (DEPRECATED)  
-  *Do not use this - it will be removed* because it is legal for
-  multiple StructType instances to proxy the same pointer, and
-  instanceForPointer() cannot account for that.\  
-  Given a pointer value relative to `config.memory`, if that pointer
-  resolves to a struct of _any type_ generated via the same Struct
-  Binder, this returns the struct instance associated with it, or
-  `undefined` if no struct object is mapped to that pointer. This
-  differs from the struct-type-specific member of the same name in
-  that this one is not "type-safe": it does not know the type of the
-  returned object (if any) and may return a struct of any
-  [StructType][] for which this Struct Binder has created a
-  constructor. It cannot return instances created via a different
-  [StructBinderFactory][] because each factory can hypothetically have
-  a different memory heap.
-
-
 <a name='api-structtype'></a>
 API: Struct Type
 ------------------------------------------------------------
@@ -608,9 +580,6 @@ individual instances via `theInstance.constructor`.):
   [struct's constructor][StructCtors]. If true, the memory is owned by
   someone other than the object and must outlive the object.
 
-- <s>`instanceForPointer(pointer)`</s> (DEPRECATED)  
-  Works identically to the [StructBinder][] method of the same name.
-
 - `isA(value)`  
   Returns true if its argument is a StructType instance _from the same
   [StructBinder][]_ as this StructType.
@@ -755,21 +724,6 @@ pointer can be taken over using something like
 
 These constructors have the following "static" members:
 
-- `disposeAll()`  
-  For each instance of this struct, the equivalent of its `dispose()`
-  method is called. This frees all WASM-allocated memory associated
-  with _all_ instances and clears the `instanceForPointer()`
-  mappings. Returns `this`.
-
-- <s>`instanceForPointer(pointer)`</s> (DEPRECATED)  
-  Given a pointer value (accessible via the `pointer` property of all
-  struct instances) which ostensibly refers to an instance of this
-  class, this returns the instance associated with it, or `undefined`
-  if no object _of this specific struct type_ is mapped to that
-  pointer. When C-side code calls back into JS code and passes a
-  pointer to an object, this function can be used to type-safely
-  "cast" that pointer back to its original object.
-
 - `isA(value)`  
   Returns true if its argument was created by this constructor.
 
@@ -779,15 +733,6 @@ These constructors have the following "static" members:
 - `memberKeys(string)`  
   Works exactly as documented for [StructType][].
 
-- `resolveToInstance(value [,throwIfNot=false])`  
-  Works like `instanceForPointer()` but accepts either an instance
-  of this struct type or a pointer which resolves to one.
-  It returns an instance of this struct type on success.
-  By default it returns a falsy value if its argument is not,
-  or does not resolve to, an instance of this struct type,
-  but if passed a truthy second argument then it will throw
-  instead.
-
 - `structInfo`  
   The structure description passed to [StructBinder][] when this
   constructor was generated.
index 2d1b634e55805fd9442ac147dd6491181b8368a6..5db00cee64b7f5d538a829ee33648856027c87e0 100644 (file)
@@ -740,9 +740,6 @@ self.sqlite3InitModule = sqlite3InitModule;
           assert(undefined === K.prototype.lookupMember('nope',false)).
           assert(k1 instanceof StructType).
           assert(StructType.isA(k1)).
-          assert(K.resolveToInstance(k1.pointer)===k1).
-          mustThrowMatching(()=>K.resolveToInstance(null,true), /is-not-a my_struct/).
-          assert(k1 === StructType.instanceForPointer(k1.pointer)).
           mustThrowMatching(()=>k1.$ro = 1, /read-only/);
         Object.keys(MyStructDef.members).forEach(function(key){
           key = K.memberKey(key);
@@ -752,8 +749,7 @@ self.sqlite3InitModule = sqlite3InitModule;
                    " from "+k1.memoryDump());
         });
         T.assert('number' === typeof k1.pointer).
-          mustThrowMatching(()=>k1.pointer = 1, /pointer/).
-          assert(K.instanceForPointer(k1.pointer) === k1);
+          mustThrowMatching(()=>k1.pointer = 1, /pointer/);
         k1.$p4 = 1; k1.$pP = 2;
         T.assert(1 === k1.$p4).assert(2 === k1.$pP);
         if(MyStructDef.members.$p8){
@@ -768,22 +764,13 @@ self.sqlite3InitModule = sqlite3InitModule;
           assert('number' === typeof k1.$cstr).
           assert('A C-string.' === k1.memberToJsString('cstr'));
         k1.$pP = k2;
-        T.assert(k1.$pP === k2);
+        T.assert(k1.$pP === k2.pointer);
         k1.$pP = null/*null is special-cased to 0.*/;
         T.assert(0===k1.$pP);
         let ptr = k1.pointer;
         k1.dispose();
         T.assert(undefined === k1.pointer).
-          assert(undefined === K.instanceForPointer(ptr)).
           mustThrowMatching(()=>{k1.$pP=1}, /disposed instance/);
-        const k3 = new K();
-        ptr = k3.pointer;
-        T.assert(k3 === K.instanceForPointer(ptr));
-        K.disposeAll();
-        T.assert(ptr).
-          assert(undefined === k2.pointer).
-          assert(undefined === k3.pointer).
-          assert(undefined === K.instanceForPointer(ptr));
       }finally{
         k1.dispose();
         k2.dispose();
@@ -813,10 +800,8 @@ self.sqlite3InitModule = sqlite3InitModule;
           assert(wts instanceof WTStruct).
           assert(wts instanceof StructType).
           assert(StructType.isA(wts)).
-          assert(wts === StructType.instanceForPointer(wts.pointer));
-        T.assert(wts.pointer>0).assert(0===wts.$v4).assert(0n===wts.$v8).
-          assert(0===wts.$ppV).assert(0===wts.$xFunc).
-          assert(WTStruct.instanceForPointer(wts.pointer) === 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!*/);
         let counter = 0;
@@ -825,7 +810,6 @@ self.sqlite3InitModule = sqlite3InitModule;
           /*log("This from a JS function called from C, "+
               "which itself was called from JS. arg =",arg);*/
           ++counter;
-          T.assert(WTStruct.instanceForPointer(arg) === wts);
           if(3===counter){
             tossQuietly("Testing exception propagation.");
           }
@@ -849,7 +833,7 @@ self.sqlite3InitModule = sqlite3InitModule;
         testFunc(wts.pointer);
         //log("wts.pointer, wts.$ppV",wts.pointer, wts.$ppV);
         T.assert(1===counter).assert(20 === wts.$v4).assert(40n === wts.$v8)
-          .assert(autoResolvePtr ? (wts.$ppV === wts) : (wts.$ppV === wts.pointer))
+          .assert(wts.$ppV === wts.pointer)
           .assert('string' === typeof wts.memberToJsString('cstr'))
           .assert(wts.memberToJsString('cstr') === wts.memberToJsString('$cstr'))
           .mustThrowMatching(()=>wts.memberToJsString('xFunc'),
@@ -857,279 +841,30 @@ self.sqlite3InitModule = sqlite3InitModule;
         ;
         testFunc(wts.pointer);
         T.assert(2===counter).assert(40 === wts.$v4).assert(80n === wts.$v8)
-          .assert(autoResolvePtr ? (wts.$ppV === wts) : (wts.$ppV === wts.pointer));
+          .assert(wts.$ppV === wts.pointer);
         /** The 3rd call to wtsFunc throw from JS, which is called
             from C, which is called from JS. Let's ensure that
             that exception propagates back here... */
         T.mustThrowMatching(()=>testFunc(wts.pointer),/^Testing/);
         W.uninstallFunction(wts.$xFunc);
         wts.$xFunc = 0;
-        if(autoResolvePtr){
-          wts.$ppV = 0;
-          T.assert(!wts.$ppV);
-          //WTStruct.debugFlags(0x03);
-          wts.$ppV = wts;
-          T.assert(wts === wts.$ppV)
-          //WTStruct.debugFlags(0);
-        }
+        wts.$ppV = 0;
+        T.assert(!wts.$ppV);
+        //WTStruct.debugFlags(0x03);
+        wts.$ppV = wts;
+        T.assert(wts.pointer === wts.$ppV)
         wts.setMemberCString('cstr', "A C-string.");
         T.assert(Array.isArray(wts.ondispose)).
           assert(wts.ondispose[0] === wts.$cstr).
           assert('A C-string.' === wts.memberToJsString('cstr'));
         const ptr = wts.pointer;
         wts.dispose();
-        T.assert(ptr).assert(undefined === wts.pointer).
-          assert(undefined === WTStruct.instanceForPointer(ptr))
+        T.assert(ptr).assert(undefined === wts.pointer);
       }finally{
         wts.dispose();
       }
     }/*StructBinder*/)
 
-  ////////////////////////////////////////////////////////////////////
-    .t('sqlite3.StructBinder part 2', function(sqlite3){
-      // https://www.sqlite.org/c3ref/vfs.html
-      // https://www.sqlite.org/c3ref/io_methods.html
-      const sqlite3_io_methods = capi.sqlite3_io_methods,
-            sqlite3_vfs = capi.sqlite3_vfs,
-            sqlite3_file = capi.sqlite3_file;
-      //log("struct sqlite3_file", sqlite3_file.memberKeys());
-      //log("struct sqlite3_vfs", sqlite3_vfs.memberKeys());
-      //log("struct sqlite3_io_methods", sqlite3_io_methods.memberKeys());
-      const installMethod = function callee(tgt, name, func){
-        if(1===arguments.length){
-          return (n,f)=>callee(tgt,n,f);
-        }
-        if(!callee.argcProxy){
-          callee.argcProxy = function(func,sig){
-            return function(...args){
-              if(func.length!==arguments.length){
-                toss("Argument mismatch. Native signature is:",sig);
-              }
-              return func.apply(this, args);
-            }
-          };
-          callee.ondisposeRemoveFunc = function(){
-            if(this.__ondispose){
-              const who = this;
-              this.__ondispose.forEach(
-                (v)=>{
-                  if('number'===typeof v){
-                    try{wasm.uninstallFunction(v)}
-                    catch(e){/*ignore*/}
-                  }else{/*wasm function wrapper property*/
-                    delete who[v];
-                  }
-                }
-              );
-              delete this.__ondispose;
-            }
-          };
-        }/*static init*/
-        const sigN = tgt.memberSignature(name),
-              memKey = tgt.memberKey(name);
-        //log("installMethod",tgt, name, sigN);
-        if(!tgt.__ondispose){
-          T.assert(undefined === tgt.ondispose);
-          tgt.ondispose = [callee.ondisposeRemoveFunc];
-          tgt.__ondispose = [];
-        }
-        const fProxy = callee.argcProxy(func, sigN);
-        const pFunc = wasm.installFunction(fProxy, tgt.memberSignature(name, true));
-        tgt[memKey] = pFunc;
-        /**
-           ACHTUNG: function pointer IDs are from a different pool than
-           allocation IDs, starting at 1 and incrementing in steps of 1,
-           so if we set tgt[memKey] to those values, we'd very likely
-           later misinterpret them as plain old pointer addresses unless
-           unless we use some silly heuristic like "all values <5k are
-           presumably function pointers," or actually perform a function
-           lookup on every pointer to first see if it's a function. That
-           would likely work just fine, but would be kludgy.
-
-           It turns out that "all values less than X are functions" is
-           essentially how it works in wasm: a function pointer is
-           reported to the client as its index into the
-           __indirect_function_table.
-
-           So... once jaccwabyt can be told how to access the
-           function table, it could consider all pointer values less
-           than that table's size to be functions.  As "real" pointer
-           values start much, much higher than the function table size,
-           that would likely work reasonably well. e.g. the object
-           pointer address for sqlite3's default VFS is (in this local
-           setup) 65104, whereas the function table has fewer than 600
-           entries.
-        */
-        const wrapperKey = '$'+memKey;
-        tgt[wrapperKey] = fProxy;
-        tgt.__ondispose.push(pFunc, wrapperKey);
-        //log("tgt.__ondispose =",tgt.__ondispose);
-        return (n,f)=>callee(tgt, n, f);
-      }/*installMethod*/;
-
-      const installIOMethods = function instm(iom){
-        (iom instanceof capi.sqlite3_io_methods) || toss("Invalid argument type.");
-        if(!instm._requireFileArg){
-          instm._requireFileArg = function(arg,methodName){
-            arg = capi.sqlite3_file.resolveToInstance(arg);
-            if(!arg){
-              err("sqlite3_io_methods::xClose() was passed a non-sqlite3_file.");
-            }
-            return arg;
-          };
-          instm._methods = {
-            // https://sqlite.org/c3ref/io_methods.html
-            xClose: /*i(P)*/function(f){
-              /* int (*xClose)(sqlite3_file*) */
-              log("xClose(",f,")");
-              if(!(f = instm._requireFileArg(f,'xClose'))) return capi.SQLITE_MISUSE;
-              f.dispose(/*noting that f has externally-owned memory*/);
-              return 0;
-            },
-            xRead: /*i(Ppij)*/function(f,dest,n,offset){
-              /* int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst) */
-              log("xRead(",arguments,")");
-              if(!(f = instm._requireFileArg(f))) return capi.SQLITE_MISUSE;
-              wasm.heap8().fill(0, dest + offset, n);
-              return 0;
-            },
-            xWrite: /*i(Ppij)*/function(f,dest,n,offset){
-              /* int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst) */
-              log("xWrite(",arguments,")");
-              if(!(f=instm._requireFileArg(f,'xWrite'))) return capi.SQLITE_MISUSE;
-              return 0;
-            },
-            xTruncate: /*i(Pj)*/function(f){
-              /* int (*xTruncate)(sqlite3_file*, sqlite3_int64 size) */
-              log("xTruncate(",arguments,")");
-              if(!(f=instm._requireFileArg(f,'xTruncate'))) return capi.SQLITE_MISUSE;
-              return 0;
-            },
-            xSync: /*i(Pi)*/function(f){
-              /* int (*xSync)(sqlite3_file*, int flags) */
-              log("xSync(",arguments,")");
-              if(!(f=instm._requireFileArg(f,'xSync'))) return capi.SQLITE_MISUSE;
-              return 0;
-            },
-            xFileSize: /*i(Pp)*/function(f,pSz){
-              /* int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize) */
-              log("xFileSize(",arguments,")");
-              if(!(f=instm._requireFileArg(f,'xFileSize'))) return capi.SQLITE_MISUSE;
-              wasm.setMemValue(pSz, 0/*file size*/);
-              return 0;
-            },
-            xLock: /*i(Pi)*/function(f){
-              /* int (*xLock)(sqlite3_file*, int) */
-              log("xLock(",arguments,")");
-              if(!(f=instm._requireFileArg(f,'xLock'))) return capi.SQLITE_MISUSE;
-              return 0;
-            },
-            xUnlock: /*i(Pi)*/function(f){
-              /* int (*xUnlock)(sqlite3_file*, int) */
-              log("xUnlock(",arguments,")");
-              if(!(f=instm._requireFileArg(f,'xUnlock'))) return capi.SQLITE_MISUSE;
-              return 0;
-            },
-            xCheckReservedLock: /*i(Pp)*/function(){
-              /* int (*xCheckReservedLock)(sqlite3_file*, int *pResOut) */
-              log("xCheckReservedLock(",arguments,")");
-              return 0;
-            },
-            xFileControl: /*i(Pip)*/function(){
-              /* int (*xFileControl)(sqlite3_file*, int op, void *pArg) */
-              log("xFileControl(",arguments,")");
-              return capi.SQLITE_NOTFOUND;
-            },
-            xSectorSize: /*i(P)*/function(){
-              /* int (*xSectorSize)(sqlite3_file*) */
-              log("xSectorSize(",arguments,")");
-              return 0/*???*/;
-            },
-            xDeviceCharacteristics:/*i(P)*/function(){
-              /* int (*xDeviceCharacteristics)(sqlite3_file*) */
-              log("xDeviceCharacteristics(",arguments,")");
-              return 0;
-            }
-          };
-        }/*static init*/
-        iom.$iVersion = 1;
-        Object.keys(instm._methods).forEach(
-          (k)=>installMethod(iom, k, instm._methods[k])
-        );
-      }/*installIOMethods()*/;
-
-      const iom = new sqlite3_io_methods, sfile = new sqlite3_file;
-      const err = console.error.bind(console);
-      try {
-        const IOM = sqlite3_io_methods, S3F = sqlite3_file;
-        //log("iom proto",iom,iom.constructor.prototype);
-        //log("sfile",sfile,sfile.constructor.prototype);
-        T.assert(0===sfile.$pMethods).assert(iom.pointer > 0);
-        //log("iom",iom);
-        sfile.$pMethods = iom.pointer;
-        T.assert(iom.pointer === sfile.$pMethods)
-          .assert(IOM.resolveToInstance(iom))
-          .assert(undefined ===IOM.resolveToInstance(sfile))
-          .mustThrow(()=>IOM.resolveToInstance(0,true))
-          .assert(S3F.resolveToInstance(sfile.pointer))
-          .assert(undefined===S3F.resolveToInstance(iom))
-          .assert(iom===IOM.resolveToInstance(sfile.$pMethods));
-        T.assert(0===iom.$iVersion);
-        installIOMethods(iom);
-        T.assert(1===iom.$iVersion);
-        //log("iom.__ondispose",iom.__ondispose);
-        T.assert(Array.isArray(iom.__ondispose)).assert(iom.__ondispose.length>10);
-      }finally{
-        iom.dispose();
-        T.assert(undefined === iom.__ondispose);
-      }
-
-      const dVfs = new sqlite3_vfs(capi.sqlite3_vfs_find(null));
-      try {
-        const SB = sqlite3.StructBinder;
-        T.assert(dVfs instanceof SB.StructType)
-          .assert(dVfs.pointer)
-          .assert('sqlite3_vfs' === dVfs.structName)
-          .assert(!!dVfs.structInfo)
-          .assert(SB.StructType.hasExternalPointer(dVfs))
-          .assert(dVfs.$iVersion>0)
-          .assert('number'===typeof dVfs.$zName)
-          .assert('number'===typeof dVfs.$xSleep)
-          .assert(wasm.functionEntry(dVfs.$xOpen))
-          .assert(dVfs.memberIsString('zName'))
-          .assert(dVfs.memberIsString('$zName'))
-          .assert(!dVfs.memberIsString('pAppData'))
-          .mustThrowMatching(()=>dVfs.memberToJsString('xSleep'),
-                             /Invalid member type signature for C-string/)
-          .mustThrowMatching(()=>dVfs.memberSignature('nope'), /nope is not a mapped/)
-          .assert('string' === typeof dVfs.memberToJsString('zName'))
-          .assert(dVfs.memberToJsString('zName')===dVfs.memberToJsString('$zName'))
-        ;
-        //log("Default VFS: @",dVfs.pointer);
-        Object.keys(sqlite3_vfs.structInfo.members).forEach(function(mname){
-          const mk = sqlite3_vfs.memberKey(mname), mbr = sqlite3_vfs.structInfo.members[mname],
-                addr = dVfs[mk], prefix = 'defaultVfs.'+mname;
-          if(1===mbr.signature.length){
-            let sep = '?', val = undefined;
-            switch(mbr.signature[0]){
-                  // TODO: move this into an accessor, e.g. getPreferredValue(member)
-                case 'i': case 'j': case 'f': case 'd': sep = '='; val = dVfs[mk]; break
-                case 'p': case 'P': sep = '@'; val = dVfs[mk]; break;
-                case 's': sep = '=';
-                  val = dVfs.memberToJsString(mname);
-                  break;
-            }
-            //log(prefix, sep, val);
-          }else{
-            //log(prefix," = funcptr @",addr, wasm.functionEntry(addr));
-          }
-        });
-      }finally{
-        dVfs.dispose();
-        T.assert(undefined===dVfs.pointer);
-      }
-    }/*StructBinder part 2*/)
-  
   ////////////////////////////////////////////////////////////////////
     .t('sqlite3.wasm.pstack', function(sqlite3){
       const P = wasm.pstack;
index 0a6cf576d7f65bcfd90254f39aac7b9f3c45a006..a3f0d928c30b521b4875f2238b490dce7476d529 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Jaccwabyt\s(JS)\sdoc\supdates.
-D 2022-12-05T14:32:35.107
+C Remove\stwo\sfeatures\sof\sjaccwabyt\swhich\swere\sfundamentally\sflawed,\salong\swith\sapprox.\s250\slines\sof\sunit\stests\swhich\sheavily\srelied\son\sthem.\sThankfully,\snone\sof\sthe\ssqlite3.js-level\scode\sused\sthose\sbits.
+D 2022-12-05T15:05:46.306
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -539,8 +539,8 @@ F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5
 F ext/wasm/fiddle/index.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2
 F ext/wasm/index-dist.html c806b6005145b71d64240606e9c6e0bf56878ee8829c66fe7486cebf34b0e6b1
 F ext/wasm/index.html f151b7c7b5cfdc066567d556acd168e769efd4e982286dc5f849a5ee69ecd0ff
-F ext/wasm/jaccwabyt/jaccwabyt.js 199f3a0a7513692dac8e843fed210d4e7da12b1e3f168aff6b796e941424e8da
-F ext/wasm/jaccwabyt/jaccwabyt.md c0172c0795522a137a5591ccc63703e5fc0410d7d7677884edfa8d6a9ab093f4
+F ext/wasm/jaccwabyt/jaccwabyt.js b7261221133cda8d363f16ddbac8e5b671fd51ce962fc34dc10e738a293b696d
+F ext/wasm/jaccwabyt/jaccwabyt.md 72742a3205f1477de68086e7e4a854ed5f7d08dfcd6db54cdbea4dba4866f159
 F ext/wasm/module-symbols.html 980680c8acfa3c8ae6a5aa223512d1b8e78040ced20f8ba2c382129bc73ec028
 F ext/wasm/scratchpad-wasmfs-main.html 20cf6f1a8f368e70d01e8c17200e3eaa90f1c8e1029186d836d14b83845fbe06
 F ext/wasm/scratchpad-wasmfs-main.js 4c140457f4d6da9d646a49addd91edb6e9ad1643c6c48e3258b5bce24725dc18
@@ -555,7 +555,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
 F ext/wasm/test-opfs-vfs.js 44363db07b2a20e73b0eb1808de4400ca71b703af718d0fa6d962f15e73bf2ac
 F ext/wasm/tester1-worker.html d43f3c131d88f10d00aff3e328fed13c858d674ea2ff1ff90225506137f85aa9
 F ext/wasm/tester1.c-pp.html d34bef3d48e5cbc1c7c06882ad240fec49bf88f5f65696cc2c72c416933aa406
-F ext/wasm/tester1.c-pp.js 419a2fd31b0230e0495ed38a56dbe1e2bbc93c5953b796de43e2a70901970b83
+F ext/wasm/tester1.c-pp.js 8ed17c0e1f271e536cb7ccd86d3992785fc8bf2f94f9c2e0088ca670601ee087
 F ext/wasm/tests/opfs/concurrency/index.html 86d8ac435074d1e7007b91105f4897f368c165e8cecb6a9aa3d81f5cf5dcbe70
 F ext/wasm/tests/opfs/concurrency/test.js a98016113eaf71e81ddbf71655aa29b0fed9a8b79a3cdd3620d1658eb1cc9a5d
 F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
@@ -2065,8 +2065,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 44659ad32a9fe6363badfc5dbb0bd51d6fb2ee1c8aa47b71e9cf3dbd631fde9e
-R b435a2d94f66e49b4a6802642705f112
+P a329a809b5da135a9c251e4d5f637d45d01d0248110ac05f2ad8f01d9df38c64
+R 3d4ed37777b015bac598ce3a6734f5aa
 U stephan
-Z 58b6d11303c3251b731643b22a0a2877
+Z 002b2dd6406bdc41efd7e7f9f5d7918f
 # Remove this line to create a well-formed Fossil manifest.
index a3e46a1ef58f6b50fae090531029af1535fc34b0..14e600f31ef26e9eb37331424b8324abd4205416 100644 (file)
@@ -1 +1 @@
-a329a809b5da135a9c251e4d5f637d45d01d0248110ac05f2ad8f01d9df38c64
\ No newline at end of file
+a190abc307847174f36421eaa3f47ef349c6f84a2bb35857fa64f64bbe722708
\ No newline at end of file