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

[Merged by Bors] - Implement async functions using generators #2821

Closed
wants to merge 1 commit into from

Conversation

jedel1043
Copy link
Member

@jedel1043 jedel1043 commented Apr 14, 2023

This should hopefully fix more async/futures issues related to resuming execution in the future, since we can leverage generator logic to handle this for us.

It changes the following:

  • Refactors GeneratorContext to handle context preparation.
  • Reuses the functionality of GeneratorContext in Await.
  • Removes EarlyReturnType in favour of a single r#await bool flag in CallFrame.

@jedel1043 jedel1043 added vm Issues and PRs related to the Boa Virtual Machine. Internal Category for changelog labels Apr 14, 2023
@jedel1043 jedel1043 added this to the v0.17.0 milestone Apr 14, 2023
@github-actions
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 94,781 94,781 0
Passed 71,519 71,520 +1
Ignored 17,824 17,824 0
Failed 5,438 5,437 -1
Panics 0 0 0
Conformance 75.46% 75.46% +0.00%
Fixed tests (1):
test/language/expressions/async-function/named-reassign-fn-name-in-body-in-eval.js (previously Failed)

@codecov
Copy link

codecov bot commented Apr 14, 2023

Codecov Report

Merging #2821 (04212e4) into main (236012d) will increase coverage by 0.04%.
The diff coverage is 48.50%.

@@            Coverage Diff             @@
##             main    #2821      +/-   ##
==========================================
+ Coverage   51.32%   51.36%   +0.04%     
==========================================
  Files         417      417              
  Lines       41356    41258      -98     
==========================================
- Hits        21224    21194      -30     
+ Misses      20132    20064      -68     
Impacted Files Coverage Δ
boa_cli/src/debug/function.rs 0.00% <0.00%> (ø)
boa_engine/src/builtins/async_function/mod.rs 39.13% <0.00%> (ø)
boa_engine/src/builtins/function/mod.rs 39.50% <ø> (-0.11%) ⬇️
boa_engine/src/environments/runtime.rs 69.73% <ø> (-0.65%) ⬇️
boa_engine/src/vm/call_frame/mod.rs 100.00% <ø> (ø)
boa_engine/src/vm/opcode/generator/mod.rs 24.13% <0.00%> (ø)
boa_engine/src/builtins/generator/mod.rs 32.89% <32.92%> (+19.90%) ⬆️
boa_engine/src/vm/opcode/await_stm/mod.rs 76.92% <70.58%> (+10.94%) ⬆️
boa_engine/src/vm/code_block.rs 61.58% <73.68%> (+0.35%) ⬆️
boa_engine/src/builtins/async_generator/mod.rs 29.60% <75.00%> (-2.78%) ⬇️
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@raskad raskad left a comment

Choose a reason for hiding this comment

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

Looks like good changes. Some nice refactors!

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

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

Nice! Looks good to me! :)

@HalidOdat
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Apr 15, 2023
This should hopefully fix more async/futures issues related to resuming execution in the future, since we can leverage generator logic to handle this for us.

It changes the following:

- Refactors `GeneratorContext` to handle context preparation.
- Reuses the functionality of `GeneratorContext` in `Await`.
- Removes `EarlyReturnType` in favour of a single `r#await` bool flag in `CallFrame`.
@bors
Copy link

bors bot commented Apr 15, 2023

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Implement async functions using generators [Merged by Bors] - Implement async functions using generators Apr 15, 2023
@bors bors bot closed this Apr 15, 2023
@bors bors bot deleted the async-with-gen branch April 15, 2023 00:25
bors bot pushed a commit that referenced this pull request Apr 18, 2023
Just some small improvements that increase the strictness of our generator state handling.

Also rollbacks the implementation of `GeneratorValidate` because I forgot to remove it after I did modifications to #2821, and it doesn't make sense to have that if it isn't used by async functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internal Category for changelog vm Issues and PRs related to the Boa Virtual Machine.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants