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

Use Heap instead of UnsafeCell in DOM reflectors #15118

Merged
merged 1 commit into from Jan 25, 2017

Conversation

@jdm
Copy link
Member

jdm commented Jan 19, 2017

The previous Reflector implementation did not use post barriers, so we could crash when storing nursery objects in a Reflector structure that were later moved out of the nursery.

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #15085
  • There are tests for these changes

This change is Reviewable

@highfive
Copy link

highfive commented Jan 19, 2017

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/promise.rs, components/script/dom/bindings/reflector.rs
  • @KiChjang: components/script/dom/promise.rs, components/script/dom/bindings/reflector.rs
@jdm
Copy link
Member Author

jdm commented Jan 19, 2017

r? @Ms2ger

@highfive highfive assigned Ms2ger and unassigned wafflespeanut Jan 19, 2017
@jdm jdm mentioned this pull request Jan 19, 2017
4 of 4 tasks complete
@Ms2ger
Copy link
Contributor

Ms2ger commented Jan 20, 2017

I noticed that trace_reflector calls CallUnbarrieredObjectTracer; would that need to be changed as well?

@jdm jdm force-pushed the jdm:reflector-barrier-crash branch from 842eff5 to 3fe9521 Jan 20, 2017
@jdm
Copy link
Member Author

jdm commented Jan 20, 2017

You are correct. I have updated the code to account for that.

@jdm jdm force-pushed the jdm:reflector-barrier-crash branch from 3fe9521 to e5eaab3 Jan 20, 2017
@jdm
Copy link
Member Author

jdm commented Jan 20, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Jan 20, 2017

Trying commit e5eaab3 with merge 469a3f4...

bors-servo added a commit that referenced this pull request Jan 20, 2017
Use Heap instead of UnsafeCell in DOM reflectors

The previous `Reflector` implementation did not use post barriers, so we could crash when storing nursery objects in a `Reflector` structure that were later moved out of the nursery.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #15085
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15118)
<!-- Reviewable:end -->
@Ms2ger
Copy link
Contributor

Ms2ger commented Jan 23, 2017

I don't see anything wrong with this, but would feel more comfortable if you had someone from the SM GC side have a look too. (Feel free to take this as r+ either way.)

@jdm
Copy link
Member Author

jdm commented Jan 23, 2017

10:31 <jonco> jdm: this means you're using the equivalent of JS::Heap<> to store the reflector object right?
10:31 <jdm> jonco: yes
10:31 <jonco> jdm: that sounds good

@bors-servo: r=Ms2ger

@bors-servo
Copy link
Contributor

bors-servo commented Jan 23, 2017

📌 Commit e5eaab3 has been approved by Ms2ger

@jonco3
Copy link

jonco3 commented Jan 23, 2017

Using Heap is the right thing to do here. I have minimal knowledge of rust, but this looks good to me.

}

/// Return a pointer to the memory location at which the JS reflector
/// object is stored. Used to root the reflector, as
/// required by the JSAPI rooting APIs.
pub fn rootable(&self) -> *mut *mut JSObject {
self.object.get()
pub fn rootable(&self) -> &Heap<*mut JSObject> {

This comment has been minimized.

@KiChjang

KiChjang Jan 23, 2017

Member

Should this be &mut instead?

This comment has been minimized.

@jdm

jdm Jan 23, 2017

Author Member

I argue that we can discuss that separately, since the changes here achieve the same effect as previously existed.

@jdm
Copy link
Member Author

jdm commented Jan 23, 2017

@bors-servo: r=Ms2ger

@bors-servo
Copy link
Contributor

bors-servo commented Jan 23, 2017

💡 This pull request was already approved, no need to approve it again.

  • There's another pull request that is currently being tested, blocking this pull request: #15142
@bors-servo
Copy link
Contributor

bors-servo commented Jan 23, 2017

📌 Commit e5eaab3 has been approved by Ms2ger

@Ms2ger
Copy link
Contributor

Ms2ger commented Jan 24, 2017

@Ms2ger
Copy link
Contributor

Ms2ger commented Jan 24, 2017

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Jan 24, 2017

Testing commit e5eaab3 with merge 2b91bb3...

bors-servo added a commit that referenced this pull request Jan 24, 2017
Use Heap instead of UnsafeCell in DOM reflectors

The previous `Reflector` implementation did not use post barriers, so we could crash when storing nursery objects in a `Reflector` structure that were later moved out of the nursery.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #15085
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15118)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 24, 2017

💔 Test failed - windows-gnu-dev

@Ms2ger
Copy link
Contributor

Ms2ger commented Jan 24, 2017

@jdm
Copy link
Member Author

jdm commented Jan 24, 2017

@mbrubeck
Copy link
Contributor

mbrubeck commented Jan 24, 2017

@bors-servo r=Ms2ger

@bors-servo
Copy link
Contributor

bors-servo commented Jan 24, 2017

📌 Commit e5eaab3 has been approved by Ms2ger

@bors-servo
Copy link
Contributor

bors-servo commented Jan 24, 2017

Testing commit e5eaab3 with merge 023a9c5...

bors-servo added a commit that referenced this pull request Jan 24, 2017
Use Heap instead of UnsafeCell in DOM reflectors

The previous `Reflector` implementation did not use post barriers, so we could crash when storing nursery objects in a `Reflector` structure that were later moved out of the nursery.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #15085
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15118)
<!-- Reviewable:end -->
@bors-servo bors-servo merged commit e5eaab3 into servo:master Jan 25, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@Ms2ger Ms2ger deleted the jdm:reflector-barrier-crash branch Feb 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

8 participants
You can’t perform that action at this time.