Looking into why EVAL_CTORs isn't helping with my project, I've come across a limitation that seems to only exist for WASM, not asm.js. Notably some of the initializers in my project invoke malloc (I believe by way of shared pointer initialization). It looks like malloc invokes sbrk (which is explicitly disallowed by the asm.js ctor_evaller). In the case of binaryen this fails by way of sbrk trying to access DYNAMICTOP_PTR, which ends up as a '...stopping since could not eval: tried to access a dangerous (import-initialized) global: global$0'
It does seem like something that could be handled, and would be a big win for more dynamic initialization type scenarios. I believe it works when targetting asm.js as that handles its memory allocation differently. Another point is that constructor evaluation order is flexible. I know there is some machinery to control initializer ordering, which may limit this approach in cases where it does matter, but it's possible for the constructor evaluator to re-order constructors so that eval-able ones are moved to the front of the execution list. -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
