Skip to content

Loader __getArray, "unsupported align: -1" #1807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
data-ux opened this issue Apr 15, 2021 · 2 comments · Fixed by #1808
Closed

Loader __getArray, "unsupported align: -1" #1807

data-ux opened this issue Apr 15, 2021 · 2 comments · Fixed by #1808

Comments

@data-ux
Copy link

data-ux commented Apr 15, 2021

I'm following along the Loader documentation examples about reading arrays from AssemblyScript. While trying to implement the example exactly as in the documentation, calling __getArray produces the error "unsupported align: -1".

An minimal project reproducing the problem is here:
https://github.com/data-ux/unsupported-align

I have tried importing the loader both from node_modules and from jsdelivr with the same effects. I'm on Assemblyscript version 0.18.25

@MaxGraey
Copy link
Member

Make sure you add exportRuntime: true to debug and release configs: https://github.com/data-ux/unsupported-align/blob/master/asconfig.json#L3. It described in NOTE section of Loader's documentation

@data-ux
Copy link
Author

data-ux commented Apr 15, 2021

Thanks. I saw the note but somehow understood it as "Allocating objects [...] externally requires..." and thought that allocating objects on the AssemblyScript side would not need the exportRuntime: true flag.

It seems the relevant thing exportRuntime does in this case is adding the __rtti_base export to the module. The export is then used in the loader in getInfo(), getBase() and __instanceof(). I'm wondering if there is any valid case where calling these functions when __rtti_base == -1? Or could we just always throw Error(E_NOEXPORTRUNTIME) when the the value is -1 within these functions? It would be alot more helpful to get the error "Operation requires compiling with --exportRuntime" than "unsupported align: -1".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants