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

feat(jsruntime): async/await #196

Closed
masnagam opened this issue Jun 11, 2024 · 3 comments · Fixed by #340
Closed

feat(jsruntime): async/await #196

masnagam opened this issue Jun 11, 2024 · 3 comments · Fixed by #340
Assignees

Comments

@masnagam
Copy link
Member

masnagam commented Jun 11, 2024

in this ticket, we implement async and await but we don't implement Promise.

@masnagam masnagam moved this to Todo in javascript-engine Jun 11, 2024
@masnagam masnagam moved this from Todo to In Progress in javascript-engine Jun 29, 2024
@masnagam masnagam moved this from In Progress to Todo in javascript-engine Jun 29, 2024
@masnagam masnagam moved this from Todo to In Progress in javascript-engine Jul 20, 2024
@masnagam masnagam moved this from In Progress to Todo in javascript-engine Jul 21, 2024
@masnagam masnagam moved this from Todo to In Progress in javascript-engine Aug 11, 2024
@masnagam masnagam self-assigned this Aug 11, 2024
@masnagam
Copy link
Member Author

masnagam commented Aug 16, 2024

i decided not to use llvm.coro.* intrinsics:

  • we plan to switch IR to others written in Rust, such as cranelift IR
    • it's better to use only instructions that commonly used in others
  • optimizer for llvm.coro.* is great but it does not improve instructions generated from a JavaScript program
    • in many cases, we cannot do inlining JavaScript functions because these are bound to mutable variables and can be changed at runtime
    • of course, functions bound to immutable variables declared with const can be done inlining at compile time, but it's probably minority cases

@masnagam
Copy link
Member Author

basically, existing javascript engines process a javascript module like this:

// The evaluation the source text of the module returns a promise object
// if the source text contains top-level `await` expressions.
runtime.evaluate(&source_text);

// Process all jobs.
runtime.process_jobs();

This is a common design pattern that our javascript engine should follow.

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

Successfully merging a pull request may close this issue.

1 participant