HaxeFoundation/neko — pull request #14 by nanotech (2013-08-23 06:03:49+00:00)
Title: Support modules larger than 1 MiB

While working on an OpenFL project, I started getting a runtime launch error from Neko after adding some new dependencies (`Uncaught exception - std@module_read`). I traced this down to `neko_read_module` rejecting any modules with a `m->codesize` larger than `0xFFFFF` (1MiB).

In addition, the current function table encoding doesn't leave enough space to refer to functions farther than `0xFFFFFF` bytes (15 MiB) away.

Of course these limits are probably here for a reason that I don't understand yet. Testing seems to confirm this with some large modules still not working, now just aborting silently with a misleadingly clean exit code of zero.

The modules that do work with the limits removed were very small originally; I just linked in some extra modules to increase their size (mainly: nape). I suspect that this works because the code above 1 MiB is never actually run.

For completeness, here is a [patch to haxe][1] and [to the ocamllibs][2] to output the modified bytecode for this patch.

tl;dr this patch is incomplete, what else need to change?

[1]: https://github.com/nanotech/haxe/commit/070135d80763f52d4a3ded6ca40655f8493d6fb7
[2]: https://github.com/nanotech/ocamllibs/commit/dc1eceeb6a07de9bcc133b5eb0f22ca5ad9412ac