Skip to content

Compiler failing at optimization step with a big .ts file #2810

Closed
@sebpiq

Description

@sebpiq

Bug description

I am trying to compile a big file (~130k lines) that was machine generated, and is doing audio synthesis.
After a while the compiler returns the following error :

▌ Whoops, the AssemblyScript compiler has crashed during optimize :-(
▌ 
▌ Here is the stack trace hinting at the problem, perhaps it's useful?
▌ 
▌ RuntimeError: Aborted(). Build with -sASSERTIONS for more info.
▌     at x (file:///home/spiq/code/webpd/WebPd/node_modules/binaryen/index.js:6:3024)
▌     at p (file:///home/spiq/code/webpd/WebPd/node_modules/binaryen/index.js:9:3988)
▌     at wasm://wasm/016d0f36:wasm-function[92]:0x10aba
▌     at QB (file:///home/spiq/code/webpd/WebPd/node_modules/binaryen/index.js:9:108051)
▌     at wasm://wasm/016d0f36:wasm-function[1802]:0x1af2da
▌     at wasm://wasm/016d0f36:wasm-function[4982]:0x360e60
▌     at wasm://wasm/016d0f36:wasm-function[854]:0xee235
▌     at wasm://wasm/016d0f36:wasm-function[4984]:0x360ed2
▌     at DB (file:///home/spiq/code/webpd/WebPd/node_modules/binaryen/index.js:9:108308)
▌     at wasm://wasm/016d0f36:wasm-function[1388]:0x1396c6
▌ 
▌ If you see where the error is, feel free to send us a pull request. If not,
▌ please let us know: https://github.com/AssemblyScript/assemblyscript/issues
▌ 
▌ Thank you!

Some of the things I have tried :

  • doing only compile without optimization step : it works
  • reducing the file to a minimal test case : I couldn't. When I remove some of the code, it invariably starts working at some point.
  • dividing the code in two parts and trying to compile them separately : each of the two parts compiles + optimizes without any problem, which makes me think that it is probably due to the size of the file itself.

Steps to reproduce

Run npx asc -O tmp/bla.ts with the enclosed file (zipped because github doesn't support uploading .ts files) :
bla.zip

AssemblyScript version

v0.27.22

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions