Skip to content
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

inline #6

Closed
blooddy opened this issue Dec 28, 2017 · 1 comment
Closed

inline #6

blooddy opened this issue Dec 28, 2017 · 1 comment
Labels

Comments

@blooddy
Copy link

blooddy commented Dec 28, 2017

Is it possible to add support for inline functions and constants?

An example of code

const pos:i32 = 10;
store<i32>( pos + 10, 10 );

That should be optimized to

store<i32>( 20, 10 );
@dcodeIO
Copy link
Member

dcodeIO commented Dec 28, 2017

Inlining like in your example should be fully supported already. Constants are precomputed at compile time and replaced with their constant value where used. When optimizing the module, Binaryen takes care of all the rest, like precomputing expressions comprised of constants and inlining small functions.

Edit: Might be that constants within functions are not handled this way, yet, but supposed to. Let me take a look.

@dcodeIO dcodeIO closed this as completed Jan 13, 2018
radu-matei pushed a commit to radu-matei/assemblyscript that referenced this issue Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants