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

stylo: Remove a bunch of unneeded ool-calls. #13440

Merged
merged 1 commit into from Oct 2, 2016
Merged

Conversation

@emilio
Copy link
Member

emilio commented Sep 26, 2016


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes do not require tests because stylo

This change is Reviewable

@KiChjang
Copy link
Member

KiChjang commented Sep 26, 2016

That's an interesting title.

@emilio emilio force-pushed the emilio:no-ool branch from 8327121 to 9789b93 Sep 26, 2016
@emilio emilio changed the title <!-- Please describe your changes on the following line: --> stylo: Remove a bunch of unneeded ool-calls. Sep 26, 2016
@emilio
Copy link
Member Author

emilio commented Sep 26, 2016

@KiChjang Yeah, hub is fun.

r? @bholley

@highfive highfive assigned bholley and unassigned asajeffrey Sep 26, 2016
@emilio emilio force-pushed the emilio:no-ool branch from 9789b93 to 6702f65 Sep 27, 2016
Copy link
Contributor

bholley left a comment

lgtm modulo those issues.

@@ -96,10 +92,36 @@ fn from_opaque_style_data(d: *mut OpaqueStyleData) -> *mut NonOpaqueStyleData {
pub struct GeckoNode<'ln>(pub &'ln RawGeckoNode);

impl<'ln> GeckoNode<'ln> {
fn from_content(content: &'ln nsIContent) -> Self {
use std::mem;
GeckoNode(unsafe { mem::transmute(content) })

This comment has been minimized.

Copy link
@bholley

bholley Sep 27, 2016

Contributor

Why do we need to do this instead of just pulling it out of content._base?

This comment has been minimized.

Copy link
@emilio

emilio Sep 27, 2016

Author Member

Whoops, nice catch.

GeckoNode(unsafe { mem::transmute(content) })
}

fn node_info(&self) -> *mut structs::NodeInfo {

This comment has been minimized.

Copy link
@bholley

bholley Sep 27, 2016

Contributor

Wouldn't it be nicer to return a &structs::NodeInfo so that callers can read it without an unsafe dereference? NodeInfo can never be null.

This comment has been minimized.

Copy link
@emilio

emilio Sep 27, 2016

Author Member

Yep, at first I thought we might want to mutate it and didn't want to discuss aliasing issues, but it didn't happen.

// FIXME: We can implement this without OOL calls, but we can't easily given
// GeckoNode is a raw reference.
//
// We can use a Cell<T>, but that's a bit of a pain.

This comment has been minimized.

Copy link
@bholley

bholley Sep 27, 2016

Contributor

I thought the idea as that we rewrite flags as an AtomicUsize (which has the same interior mutability semantics as Cell)? Seems like that would solve this problem.

This comment has been minimized.

Copy link
@bholley

bholley Sep 27, 2016

Contributor

Fine to do in a followup if you like though.

This comment has been minimized.

Copy link
@emilio

emilio Sep 27, 2016

Author Member

Hmm... I thought the idea was setting (some of) those flags atomically from Gecko (which is the equivalent to use the intrinsics::atomic_or operation in Rust, but that's unstable.

In any case, if we want to rely in atomics being raw types with atomic operations, that might not be true in all platforms, we'd need an AtomicUInt32, which is also unstable.

This comment has been minimized.

Copy link
@bholley

bholley Sep 27, 2016

Contributor

Hm, so what's our plan here? Do we really need to continue using FFI calls on the flags until AtomicU32 stablizes?

This comment has been minimized.

Copy link
@emilio

emilio Sep 27, 2016

Author Member

Pretty much, since the other alternative (implementing it ourselves with asm! for platforms we care about) is also unstable.

unsafe {
Gecko_IsTextNode(self.0)

This comment has been minimized.

Copy link
@bholley

bholley Sep 27, 2016

Contributor

We'll presumably want a corresponding gecko bug to remove the unused APIs (followup is of course fine).

This comment has been minimized.

Copy link
@emilio

emilio Sep 27, 2016

Author Member

Sure

@emilio emilio force-pushed the emilio:no-ool branch 2 times, most recently from dcf4351 to 0aa9c24 Sep 27, 2016
@bholley
Copy link
Contributor

bholley commented Sep 27, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Sep 27, 2016

📌 Commit 0aa9c24 has been approved by bholley

@bors-servo
Copy link
Contributor

bors-servo commented Sep 28, 2016

Testing commit 0aa9c24 with merge 017b326...

bors-servo added a commit that referenced this pull request Sep 28, 2016
stylo: Remove a bunch of unneeded ool-calls.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] These changes do not require tests because stylo

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/13440)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 28, 2016

💔 Test failed - mac-rel-wpt

@KiChjang
Copy link
Member

KiChjang commented Sep 28, 2016

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Sep 28, 2016

Testing commit 0aa9c24 with merge 2ab517e...

bors-servo added a commit that referenced this pull request Sep 28, 2016
stylo: Remove a bunch of unneeded ool-calls.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] These changes do not require tests because stylo

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/13440)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 28, 2016

💔 Test failed - mac-rel-wpt

@KiChjang
Copy link
Member

KiChjang commented Sep 28, 2016

@bors-servo retry

@jdm
Copy link
Member

jdm commented Oct 1, 2016

/Users/servo/buildbot/slave/mac-rel-css/build/components/style/gecko/wrapper.rs:591:27: 591:74 error: attempted access of field `mRawPtr` on type `gecko_bindings::structs::nsCOMPtr<gecko_bindings::structs::nsIAtom>`, but no field with that name was found
/Users/servo/buildbot/slave/mac-rel-css/build/components/style/gecko/wrapper.rs:591             WeakAtom::new(self.as_node().node_info().mInner.mName.mRawPtr)
                                                                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/servo/buildbot/slave/mac-rel-css/build/components/style/gecko/wrapper.rs:591:67: 591:74 help: did you mean `_base`?
/Users/servo/buildbot/slave/mac-rel-css/build/components/style/gecko/wrapper.rs:591             WeakAtom::new(self.as_node().node_info().mInner.mName.mRawPtr)
                                                                                                                                                      ^~~~~~~
error: aborting due to previous error
error: Could not compile `style`.
@emilio emilio force-pushed the emilio:no-ool branch from 0aa9c24 to 11de803 Oct 2, 2016
@emilio
Copy link
Member Author

emilio commented Oct 2, 2016

I'm pretty sure that field exists, just rebased and worked without any change. I guess some of the recent regenerations made this fail spuriously?

@bors-servo: r=bholley

@bors-servo
Copy link
Contributor

bors-servo commented Oct 2, 2016

📌 Commit 11de803 has been approved by bholley

@bors-servo
Copy link
Contributor

bors-servo commented Oct 2, 2016

Testing commit 11de803 with merge 778c39f...

bors-servo added a commit that referenced this pull request Oct 2, 2016
stylo: Remove a bunch of unneeded ool-calls.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] These changes do not require tests because stylo

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/13440)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Oct 2, 2016

💔 Test failed - mac-rel-css

@emilio
Copy link
Member Author

emilio commented Oct 2, 2016

Pfft, I'm stupid.

We inherit conditionally depending on the build type, for some reason
http://searchfox.org/mozilla-central/source/xpcom/glue/nsCOMPtr.h#350.

I'll make a proper fix for it when I find the time.

On 10/02/2016 03:39 AM, bors-servo wrote:

💔 Test failed - mac-rel-css
http://build.servo.org/builders/mac-rel-css/builds/3335


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#13440 (comment), or
mute the thread
https://github.com/notifications/unsubscribe-auth/ABQwumzv-wWwZ4vNZVI-IcEh-4K2lCApks5qvws3gaJpZM4KG7FV.

@emilio emilio force-pushed the emilio:no-ool branch from 11de803 to 0e82fe4 Oct 2, 2016
@emilio emilio force-pushed the emilio:no-ool branch from 0e82fe4 to eb0c12a Oct 2, 2016
@emilio
Copy link
Member Author

emilio commented Oct 2, 2016

I added a new sugar module for nsCOMPtr that handles this properly depending on the build type.

@bors-servo: r=bholley

@bors-servo
Copy link
Contributor

bors-servo commented Oct 2, 2016

📌 Commit eb0c12a has been approved by bholley

@bors-servo
Copy link
Contributor

bors-servo commented Oct 2, 2016

Testing commit eb0c12a with merge c4021a6...

bors-servo added a commit that referenced this pull request Oct 2, 2016
stylo: Remove a bunch of unneeded ool-calls.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] These changes do not require tests because stylo

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/13440)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Oct 2, 2016

@bors-servo bors-servo merged commit eb0c12a into servo:master Oct 2, 2016
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
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.

None yet

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