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

WASM: Support bind C for array passing to JavaScript #153

Merged
merged 8 commits into from Aug 14, 2022

Conversation

Shaikh-Ubaid
Copy link
Member

This PR adds support of using bind(c) in the wasm backend to import functions from JavaScript.

More details at https://gitlab.com/lfortran/lfortran/-/issues/761

@Shaikh-Ubaid Shaikh-Ubaid added the wasm WebAssembly Backend label Aug 13, 2022
@Shaikh-Ubaid
Copy link
Member Author

This is ready.

I currently used bind(C) to support importing functions from JavaScript. It does not look very-hackish to me. Please possibly review and please share feedback.

Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good. Do you want to add some tests for this, say WAT tests using run_tests.py?

@Shaikh-Ubaid
Copy link
Member Author

Do you want to add some tests for this, say WAT tests using run_tests.py?

Since the code for importing functions from JavaScript is only included/defined when compiling lfortran to wasm, it seems supporting WAT tests might not be possible with the current implementation.

@Shaikh-Ubaid
Copy link
Member Author

Shaikh-Ubaid commented Aug 14, 2022

Please, could you possibly share if we should start supporting bind(js)? I would wish to keep features as close to original fortran as possible. At the same time, it seems there is not a better option (at-least, at the moment).

@Shaikh-Ubaid
Copy link
Member Author

Shaikh-Ubaid commented Aug 14, 2022

I am merging this for the moment. I will work on supporting WAT tests in subsequent PR(s).

@Shaikh-Ubaid Shaikh-Ubaid merged commit d03679c into lfortran:main Aug 14, 2022
@Shaikh-Ubaid Shaikh-Ubaid deleted the wasm_bind_c_for_arr_passing branch August 14, 2022 05:04
@certik
Copy link
Contributor

certik commented Aug 14, 2022

I think the bind(c) might work well for this. I would only introduce bind(js) if we can't use bind(c).

@Shaikh-Ubaid
Copy link
Member Author

I think the bind(c) might work well for this. I would only introduce bind(js) if we can't use bind(c).

Got it. Thank you.

Since the code for importing functions from JavaScript is only included/defined when compiling lfortran to wasm, please, could you possibly share how to add WAT tests for this?

@certik
Copy link
Contributor

certik commented Aug 14, 2022

I would do it like this: https://gitlab.com/lfortran/lfortran/-/issues/771

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

Successfully merging this pull request may close these issues.

None yet

2 participants