-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Rust values getting GC'd while still borrowed and not getting GC'…
…d if created via. constructor (#3940) * Add a failing test * Force tests to run sequentially At first I tried fixing them so that they didn't need to (giving each of them their own `dropCount`), but running multiple GCs in parallel seems to be flaky. * Add objects created via. constructors to the FinalizationRegistry * Add a failing test * Fix exported Rust types being GC'd while still borrowed I also discovered and fixed an extra bug while working on this, which was that `LongRefFromWasmAbi` wasn't getting used for `self`: this bug didn't cause any problems before, because the only type that had a different `LongRefFromWasmAbi` impl than its `RefFromWasmAbi` impl was `JsValue` which can't be the type of `self`. It became a problem here because I made the new `LongRefFromWasmAbi` impl for exported Rust types clone the `Rc`, whereas the `RefFromWasmAbi` impl doesn't because garbage collection can't occur during the synchronous call that the value has to live for. I might actually change it so that both of the impls behave like the current `LongRefFromWasmAbi` impl, though: cloning an `Rc` isn't expensive and so having the second different impl just makes things more complicated for no good reason. I just left it in this commit as explanation for how I discovered the `LongRefFromWasmAbi` issue. * Unify RefFromWasmAbi and LongRefFromWasmAbi impls * Get rid of needless looping * Get rid of outdated `borrow_mut` Now that borrowing a Rust value always clones its `Rc`, `Rc::into_inner` is a sufficient check that the value isn't borrowed. * Get rid of needless `mut` For some reason I was getting errors before without it, but that seems to be fixed now. (It's probably something to do with having removed the `borrow_mut`, but that only takes `&self`, so I still don't get it.) * Update reference tests * Add changelog entry * Update schema hash * Use Rc::try_unwrap instead of Rc::into_inner * Skip GC tests They seem to be far flakier in CI than locally for some reason, and I don't see any way to solve it; so just turn them off. :( I also got rid of the weird GC warmup hack because it doesn't do anything anymore; I could've sworn it was a reproducible effect before, but it seems to make no difference now.
- Loading branch information
1 parent
5767be9
commit 88f8917
Showing
16 changed files
with
332 additions
and
81 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.