Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upstylo: Remove a bunch of unneeded ool-calls. #13440
Conversation
|
That's an interesting title. |
|
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.
This comment has been minimized.
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.
This comment has been minimized.
| GeckoNode(unsafe { mem::transmute(content) }) | ||
| } | ||
|
|
||
| fn node_info(&self) -> *mut structs::NodeInfo { |
This comment has been minimized.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
dcf4351
to
0aa9c24
|
@bors-servo r+ |
|
|
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 retry |
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 retry |
|
|
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 |
|
|
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 -->
|
|
|
Pfft, I'm stupid. We inherit conditionally depending on the build type, for some reason I'll make a proper fix for it when I find the time. On 10/02/2016 03:39 AM, bors-servo wrote:
|
|
I added a new @bors-servo: r=bholley |
|
|
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 -->
|
|
emilio commentedSep 26, 2016
•
edited by larsbergstrom
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is