feat(erm): implement block-scoped disposal semantics for using declarations#5252
Closed
mrhapile wants to merge 1 commit intoboa-dev:mainfrom
Closed
feat(erm): implement block-scoped disposal semantics for using declarations#5252mrhapile wants to merge 1 commit intoboa-dev:mainfrom
using declarations#5252mrhapile wants to merge 1 commit intoboa-dev:mainfrom
Conversation
Add initial runtime support for Explicit Resource Management (ERM): - Introduce DisposableResource, DisposableResourceStack, and disposal helpers - Integrate and into bytecompiler - Add VM opcodes for tracking disposable resources - Implement block-scoped disposal via lexical environments (PopEnvironment) - Ensure correct LIFO disposal across nested scopes - Fix scope analyzer to preserve scopes containing - Handle abrupt completion (return/throw/yield) without double-disposal - Enable Test262 tests (57/78 passing) - Remove all compiler warnings and ensure clean build Limitations: - SuppressedError aggregation not implemented - Async disposal () not fully supported - DisposableStack builtins not implemented No regressions in overall Test262 suite. Signed-off-by: mrhapile <allinonegaming3456@gmail.com>
Contributor
Author
|
@jedel1043 I’ll continue working on this....... |
Test262 conformance changes
Fixed tests (108):Tested main commit: |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5252 +/- ##
===========================================
+ Coverage 47.24% 59.55% +12.30%
===========================================
Files 476 591 +115
Lines 46892 63527 +16635
===========================================
+ Hits 22154 37831 +15677
- Misses 24738 25696 +958 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
|
Duplicate of #5079 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces initial support for Explicit Resource Management (ERM) in Boa by implementing synchronous
usingdeclarations with correct block-scoped disposal semantics.It transitions ERM from a parsed-but-ignored feature to an executable runtime feature aligned with the ECMAScript proposal (partial implementation).
What’s implemented
1. Runtime scaffolding
DisposableResourceDisposableResourceStackDisposableResourceHintdispose_resourceshelperCallFrame2. Bytecompiler integration
LexicalDeclaration::UsingLexicalDeclaration::AwaitUsing(partial)AddDisposableResourceAddAsyncDisposableResource3. VM execution support
Symbol.dispose4. Block-scoped disposal (core feature)
DisposableResourceStackPopEnvironment)5. Scope analysis fixes (critical)
usinghas_using_declarationstrackingforloops6. Abrupt completion handling
returnthrowyield7. Test262 integration
Enabled synchronous
usingtest suite:~73% conformance for
usingsemantics.8. Code quality
-D warnings)#[allow(dead_code)]cargo fmtFull Test262 Results
No regressions observed.
Known limitations
The following are intentionally left for follow-up work:
SuppressedErroraggregationawait using)DisposableStack/AsyncDisposableStackbuiltinsNotes
Conclusion
This PR moves ERM in Boa from:
to:
and significantly improves Test262 coverage without introducing regressions.