Skip to content

Fix the implementation of JSTraceable for RefCell. - #8056

Merged
bors-servo merged 1 commit into
servo:masterfrom
eefriedman:trace-refcell
Nov 3, 2015
Merged

bors-servo merged 1 commit into
servo:masterfrom
eefriedman:trace-refcell

Conversation

@eefriedman

Copy link
Copy Markdown
Contributor

The existing implementation could panic; make sure that doesn't
happen by requiring that the contents of a RefCell are trivially
traceable (i.e. the value don't contain any traceable objects).

I'm not sure whether the TriviallyJSTraceable trait is actually
worthwhile; maybe we should just never use RefCell in the DOM.

Review on Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 17, 2015
@frewsxcv

Copy link
Copy Markdown
Contributor

Regression test?

@eefriedman

Copy link
Copy Markdown
Contributor Author

This was found by inspection; I'm not sure it's actually possible to trigger this panic with Servo on master. The relevant sequence would be something like "call RefCell::borrow_mut(), then trigger a GC with the borrow active".

DOMRefCell sort of has the same issue, but the documentation for that explicitly acknowledges the problem, and it has a workaround.

@jdm

jdm commented Oct 17, 2015

Copy link
Copy Markdown
Member

We've attempted to keep RefCell out of script/dom/ in the past, but never got around to actually enforcing it via a lint.

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #8041) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added S-needs-rebase There are merge conflict errors. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Oct 21, 2015
@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #8091) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added S-needs-rebase There are merge conflict errors. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Oct 23, 2015
@eefriedman

Copy link
Copy Markdown
Contributor Author

Rebased. (Should this be assigned to someone?)

@jdm jdm self-assigned this Oct 24, 2015
@frewsxcv frewsxcv removed the S-needs-rebase There are merge conflict errors. label Oct 25, 2015
@jdm

jdm commented Nov 2, 2015

Copy link
Copy Markdown
Member

I would rather remove all uses of RefCell (and the implementation of JSTraceable for RefCell) than add another layer of annotations for "this type doesn't contain any GC-owned values". That's the purpose of no_jsmanaged_fields, which I believe is clearer.

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Nov 2, 2015
The implementation wasn't really right, and we would rather just use
DOMRefCell anyway.
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Nov 2, 2015
@eefriedman

Copy link
Copy Markdown
Contributor Author

Okay; here's the version which just makes RefCell untraceable.

@jdm

jdm commented Nov 2, 2015

Copy link
Copy Markdown
Member

@bors-servo: r+
Thanks!


Reviewed 11 of 11 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from the review on Reviewable.io

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit df7fb8f has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Nov 2, 2015
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit df7fb8f with merge 4f51710...

bors-servo pushed a commit that referenced this pull request Nov 3, 2015
Fix the implementation of JSTraceable for RefCell.

The existing implementation could panic; make sure that doesn't
happen by requiring that the contents of a RefCell are trivially
traceable (i.e. the value don't contain any traceable objects).

I'm not sure whether the TriviallyJSTraceable trait is actually
worthwhile; maybe we should just never use RefCell in the DOM.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8056)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Nov 3, 2015
@eefriedman

Copy link
Copy Markdown
Contributor Author

@bors-servo retry #7787

@bors-servo

Copy link
Copy Markdown
Contributor

⚡ Previous build results for android, gonk, linux-dev, mac-dev-ref-unit, mac-rel-css, mac-rel-wpt are reusable. Rebuilding only linux-rel...

@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-ref-unit, mac-rel-css, mac-rel-wpt

@bors-servo
bors-servo merged commit df7fb8f into servo:master Nov 3, 2015
@SimonSapin SimonSapin removed the S-tests-failed The changes caused existing tests to fail. label Jan 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants