-
-
Notifications
You must be signed in to change notification settings - Fork 672
Description
Question
Hi,
I’m experimenting with a system that automatically creates Proxies for manipulating assemblyscript memory. It generates a constructable proxy per class, which can then be instantiated and that creates an object in wasm, keeps track of the pointer (with pinning / releasing) and it has getters / setters for the data (which return new proxies for objects, and caches them).
To achieve this, I made a build step using a transform which adds accessor functions for everything I need access to, but there might be a better way. I tried enabling “export table” but the table always only has 2 entries, the first of which is null, and I can’t find much information on this.
The second part of this system is generating metadata (ie reflection data) about field order and types, class ids, parameters etc, which I prefer during the transform phase, and I just generate a bunch of code and start the build over with the patched files.
It’s al a bit fragile doing both these things manually since there’s a bunch of features that I haven’t used before or that I’m not even aware of which likely could break things.
I believe it would be extremely useful if assemblyscript has an option to auto generate a json file with info on all classes, and - if that’s not already possible - ways to externally call any function.
Maybe the easiest way for the external calls would be adjusting the .wat file so everything gets exported, and using that?