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] - Make Realm shareable between functions #2801

Closed
wants to merge 4 commits into from

Conversation

jedel1043
Copy link
Member

This Pull Request fixes #2317 and #1835, finally giving our engine proper realms 🥳.

It changes the following:

  • Extracts the compile environment stack from Realm and into Vm.
  • Adjusts the bytecompiler to accommodate this change.
  • Adjusts call/construct_internal to accommodate this change. This also coincidentally fixed Panic while executing eval inside block inside function #2317, which I'm pretty happy about.
  • Adjusts several APIs (NativeJob, Realm) and builtins (eval, initializers) to accommodate this change.
  • Adjusts JsNativeErrors to hold a reference to the Realm from which they were created. This only affects errors created within calls to function objects. Native calls don't need to set the realm because it's inherited by the next outer active function object. TLDR: JsError API stays the same, we just set the origin Realm of errors in JsObject::call/construct_internal.

@jedel1043 jedel1043 added enhancement New feature or request API Internal Category for changelog labels Apr 10, 2023
@jedel1043 jedel1043 added this to the v0.17.0 milestone Apr 10, 2023
@jedel1043 jedel1043 linked an issue Apr 10, 2023 that may be closed by this pull request
@github-actions
Copy link

github-actions bot commented Apr 10, 2023

Test262 conformance changes

Test result main count PR count difference
Total 94,781 94,781 0
Passed 71,167 71,207 +40
Ignored 17,824 17,824 0
Failed 5,790 5,750 -40
Panics 0 0 0
Conformance 75.09% 75.13% +0.04%
Fixed tests (40):
test/built-ins/Function/call-bind-this-realm-undef.js [strict mode] (previously Failed)
test/built-ins/Function/call-bind-this-realm-undef.js (previously Failed)
test/built-ins/Function/proto-from-ctor-realm-prototype.js [strict mode] (previously Failed)
test/built-ins/Function/proto-from-ctor-realm-prototype.js (previously Failed)
test/built-ins/Function/prototype/apply/this-not-callable-realm.js [strict mode] (previously Failed)
test/built-ins/Function/prototype/apply/this-not-callable-realm.js (previously Failed)
test/built-ins/Function/prototype/apply/argarray-not-object-realm.js [strict mode] (previously Failed)
test/built-ins/Function/prototype/apply/argarray-not-object-realm.js (previously Failed)
test/built-ins/Function/internals/Call/class-ctor-realm.js [strict mode] (previously Failed)
test/built-ins/Function/internals/Call/class-ctor-realm.js (previously Failed)
test/built-ins/AsyncGeneratorFunction/proto-from-ctor-realm-prototype.js [strict mode] (previously Failed)
test/built-ins/AsyncGeneratorFunction/proto-from-ctor-realm-prototype.js (previously Failed)
test/built-ins/GeneratorFunction/proto-from-ctor-realm-prototype.js [strict mode] (previously Failed)
test/built-ins/GeneratorFunction/proto-from-ctor-realm-prototype.js (previously Failed)
test/built-ins/RegExp/prototype/dotAll/cross-realm.js [strict mode] (previously Failed)
test/built-ins/RegExp/prototype/dotAll/cross-realm.js (previously Failed)
test/built-ins/RegExp/prototype/global/cross-realm.js [strict mode] (previously Failed)
test/built-ins/RegExp/prototype/global/cross-realm.js (previously Failed)
test/built-ins/RegExp/prototype/source/cross-realm.js [strict mode] (previously Failed)
test/built-ins/RegExp/prototype/source/cross-realm.js (previously Failed)
test/built-ins/RegExp/prototype/multiline/cross-realm.js [strict mode] (previously Failed)
test/built-ins/RegExp/prototype/multiline/cross-realm.js (previously Failed)
test/built-ins/RegExp/prototype/ignoreCase/cross-realm.js [strict mode] (previously Failed)
test/built-ins/RegExp/prototype/ignoreCase/cross-realm.js (previously Failed)
test/built-ins/RegExp/prototype/Symbol.split/splitter-proto-from-ctor-realm.js [strict mode] (previously Failed)
test/built-ins/RegExp/prototype/Symbol.split/splitter-proto-from-ctor-realm.js (previously Failed)
test/built-ins/RegExp/prototype/unicode/cross-realm.js [strict mode] (previously Failed)
test/built-ins/RegExp/prototype/unicode/cross-realm.js (previously Failed)
test/built-ins/RegExp/prototype/sticky/cross-realm.js [strict mode] (previously Failed)
test/built-ins/RegExp/prototype/sticky/cross-realm.js (previously Failed)
test/built-ins/RegExp/prototype/hasIndices/cross-realm.js [strict mode] (previously Failed)
test/built-ins/RegExp/prototype/hasIndices/cross-realm.js (previously Failed)
test/built-ins/String/prototype/valueOf/non-generic-realm.js [strict mode] (previously Failed)
test/built-ins/String/prototype/valueOf/non-generic-realm.js (previously Failed)
test/built-ins/String/prototype/toString/non-generic-realm.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toString/non-generic-realm.js (previously Failed)
test/language/eval-code/indirect/realm.js [strict mode] (previously Failed)
test/language/eval-code/indirect/realm.js (previously Failed)
test/language/types/reference/get-value-prop-base-primitive-realm.js [strict mode] (previously Failed)
test/language/types/reference/get-value-prop-base-primitive-realm.js (previously Failed)

Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

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

I looked into everything but the code block, and it looks great to me :) good job!!

@codecov
Copy link

codecov bot commented Apr 10, 2023

Codecov Report

Merging #2801 (0619af4) into main (34d6b93) will increase coverage by 0.83%.
The diff coverage is 79.82%.

@@            Coverage Diff             @@
##             main    #2801      +/-   ##
==========================================
+ Coverage   50.57%   51.41%   +0.83%     
==========================================
  Files         415      416       +1     
  Lines       41207    41081     -126     
==========================================
+ Hits        20841    21122     +281     
+ Misses      20366    19959     -407     
Impacted Files Coverage Δ
boa_engine/src/bytecompiler/statement/with.rs 0.00% <0.00%> (ø)
boa_engine/src/context/hooks.rs 70.83% <ø> (ø)
boa_engine/src/object/mod.rs 31.19% <ø> (ø)
boa_engine/src/vm/opcode/push/new_target.rs 0.00% <0.00%> (ø)
boa_examples/src/bin/derive.rs 0.00% <ø> (ø)
boa_engine/src/bytecompiler/class.rs 13.54% <21.31%> (-0.02%) ⬇️
boa_engine/src/builtins/function/mod.rs 39.51% <50.00%> (+1.54%) ⬆️
boa_engine/src/error.rs 36.26% <55.00%> (+2.93%) ⬆️
boa_engine/src/builtins/async_generator/mod.rs 32.37% <60.00%> (-1.34%) ⬇️
boa_engine/src/builtins/generator/mod.rs 12.99% <60.00%> (+4.32%) ⬆️
... and 89 more

... and 7 files with indirect coverage changes

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.

Greak work! Really nice refactor of the call/construct code.

@jedel1043
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Apr 10, 2023
This Pull Request fixes #2317 and #1835, finally giving our engine proper realms 🥳.

It changes the following:

- Extracts the compile environment stack from `Realm` and into `Vm`.
- Adjusts the bytecompiler to accommodate this change.
- Adjusts `call/construct_internal` to accommodate this change. This also coincidentally fixed #2317, which I'm pretty happy about.
- Adjusts several APIs (`NativeJob`, `Realm`) and builtins (`eval`, initializers) to accommodate this change. 
- Adjusts `JsNativeError`s to hold a reference to the Realm from which they were created. This only affects errors created within calls to function objects. Native calls don't need to set the realm because it's inherited by the next outer active function object. TLDR: `JsError` API stays the same, we just set the origin Realm of errors in `JsObject::call/construct_internal`.
@boa-dev boa-dev deleted a comment from bors bot Apr 10, 2023
@bors
Copy link

bors bot commented Apr 10, 2023

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Make Realm shareable between functions [Merged by Bors] - Make Realm shareable between functions Apr 10, 2023
@bors bors bot closed this Apr 10, 2023
@bors bors bot deleted the proper-realms branch April 10, 2023 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API enhancement New feature or request Internal Category for changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic while executing eval inside block inside function Adjust Realm visibility
3 participants