-
-
Notifications
You must be signed in to change notification settings - Fork 400
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
NaN-boxed JsValue
s
#1830
base: main
Are you sure you want to change the base?
NaN-boxed JsValue
s
#1830
Conversation
Test262 conformance changesVM implementation
|
Codecov Report
@@ Coverage Diff @@
## main #1830 +/- ##
==========================================
- Coverage 41.33% 41.09% -0.25%
==========================================
Files 234 236 +2
Lines 22019 22121 +102
==========================================
- Hits 9101 9090 -11
- Misses 12918 13031 +113
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Benchmark for 1c5cdd5Click to view benchmark
|
Benchmark for 48d894dClick to view benchmark
|
Does rust-lang/rust#73328 affect the WebAssembly build? |
I don't think it would, but I'll need to test this :) |
0efcd3d
to
7f71cef
Compare
It works just fine 🚀 |
Benchmark for 9e3317eClick to view benchmark
|
7f71cef
to
5492f43
Compare
Benchmark for 91d24cfClick to view benchmark
|
Didn't want to squash the commits but the rebase was pretty painful otherwise. |
For now I undid returning refs. I'm thinking more carefully about how we can return refs without causing too much havoc, I'll make a PoC soon |
Benchmark for 09d99ddClick to view benchmark
|
The way I thought of doing it was by having a wrapper struct on #[derive(Debug)]
pub struct Ref<'a, T> {
inner: ManuallyDrop<T>,
_marker: PhantomData<&'a T>,
}
impl<T> Ref<'_, T> {
#[inline]
fn new(inner: ManuallyDrop<T>) -> Self {
Self {
inner,
_marker: PhantomData,
}
}
}
impl<T> std::borrow::Borrow<T> for Ref<'_, T> {
fn borrow(&self) -> &T {
&*self.inner
}
}
impl<T> AsRef<T> for Ref<'_, T> {
fn as_ref(&self) -> &T {
&*self.inner
}
}
impl<T> std::ops::Deref for Ref<'_, T> {
type Target = T;
#[inline]
fn deref(&self) -> &Self::Target {
&*self.inner
}
} This struct must not implement |
Nice! Should I make a PR with the changes or do you plan on doing it? |
Sure, you can do it if you want! :) |
Benchmark for 27ebfefClick to view benchmark
|
Is there anything else missing? |
Not sure, it should work. I'll debug it when I get some time this week :) |
Benchmark for ec8fdefClick to view benchmark
|
Benchmark for cc99501Click to view benchmark
|
OK, this is pretty much ready, I think. It's feature gated, |
Benchmark for 0d9ef33Click to view benchmark
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! :)
Benchmark for 2d419b1Click to view benchmark
|
Moving it for 0.16 to give some time for deeper reviewing, as discussed in Discord. |
Moving to 0.17, because I had a slightly safer API using a |
Co-authored-by: HalidOdat <[email protected]>
04d6993
to
f6bf8f4
Compare
Blocked since we want to first abstract |
This Pull Request fixes/closes #1373
This PR implements
JsValue
NaN boxing It is a work in progress, and requires a lot more changes.