Hi, each allocator has its own strengths and depending on the use case I wanna run some other code in JavaScript. Is there any way to query in JavaScript if e.g. TLSF or Arena is used?
You'll need to inspect the wasm binary. This is from an arena binary's text file.
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
You could export which one of these, but exporting mutable globals requires a flag and isn't supported on all platforms. So unless you can just export yourself which type you'll have to examine the bits.
I've been working on lib/parser to make it easier, though for now I'd recommend using binaryen.js. My hope for the assemblyscript parser is to help do tasks like merging two binaries at runtime. This way you could switch out which memory allocator without having to recompile and more generally allow for easier dynamic linking and loading, particularly with other non-AS binaries.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
You'll need to inspect the wasm binary. This is from an
arenabinary's text file.You could export which one of these, but exporting mutable globals requires a flag and isn't supported on all platforms. So unless you can just export yourself which type you'll have to examine the bits.
I've been working on
lib/parserto make it easier, though for now I'd recommend usingbinaryen.js. My hope for the assemblyscript parser is to help do tasks like merging two binaries at runtime. This way you could switch out which memory allocator without having to recompile and more generally allow for easier dynamic linking and loading, particularly with other non-AS binaries.