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

[WIP] Generic script crate #21371

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@retep007

retep007 commented Aug 9, 2018

Separation is based on adding types to TypeHolderTrait which contains
associated types with traits that script crate actually needs. This allows
using static methods and Sized types.

Affects servo in two ways:

  • generic structs do not compile in script crate but are left for later monomorphization
  • dom_structs itself are moved to separate crate

TODO:

  • tests
  • performance
  • polyshing

Fixes #1799

r? @jdm


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #1799 (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive

This comment has been minimized.

highfive commented Aug 9, 2018

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @jdm (or someone else) soon.

@highfive

This comment has been minimized.

highfive commented Aug 9, 2018

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/test.rs, components/script/dom/textencoder.rs, components/script/dom/htmlbrelement.rs, components/script/dom/audiodestinationnode.rs, components/script/dom/abstractworkerglobalscope.rs and 345 more
  • @wafflespeanut: python/tidy/servo_tidy_tests/ban-domrefcell.rs
  • @edunham: python/tidy/servo_tidy_tests/ban-domrefcell.rs
  • @paulrouget: components/servo/lib.rs, components/servo/Cargo.toml
  • @KiChjang: components/script/test.rs, components/script/dom/textencoder.rs, components/script/dom/htmlbrelement.rs, components/script/dom/audiodestinationnode.rs, components/script/dom/abstractworkerglobalscope.rs and 345 more
@highfive

This comment has been minimized.

highfive commented Aug 9, 2018

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
@jdm

This comment has been minimized.

Member

jdm commented Aug 9, 2018

@bors-servo

This comment has been minimized.

Contributor

bors-servo commented Aug 9, 2018

⌛️ Trying commit e668042 with merge 32f598e...

bors-servo added a commit that referenced this pull request Aug 9, 2018

Auto merge of #21371 - retep007:generic-servo, r=<try>
[WIP] Generic script crate

Separation is based on adding types to TypeHolderTrait which contains
associated types with traits that script crate actually needs. This allows
using static methods and Sized types.

Affects servo in two ways:
- generic structs do not compile in script crate but are left for later monomorphization
- dom_structs itself are moved to separate crate

TODO:
- [ ] tests
- [ ] performance
- [ ] polyshing

Fixes #1799

r? @jdm

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #1799 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/21371)
<!-- Reviewable:end -->
@bors-servo

This comment has been minimized.

Contributor

bors-servo commented Aug 9, 2018

💔 Test failed - linux-rel-css

@jdm

This comment has been minimized.

Member

jdm commented Aug 9, 2018

Results from local measurements using non-incremental builds:

master:
./mach build -d; touch components/script/dom/servoparser/html.rs && ./mach build -d: 3:49m

PR:
./mach build -d; touch components/script/fetch.rs && ./mach build -d: 4:18m
./mach build -d; touch components/script_servoparser/html.rs && ./mach build -d: 1:59m

@jdm

This comment has been minimized.

Member

jdm commented Aug 9, 2018

Results from local measurements using incremental builds:

master:
./mach build -d; touch components/script/dom/servoparser/html.rs && ./mach build -d: 3:19m

PR:
./mach build -d; touch components/script/fetch.rs && ./mach build -d: 2:56m
./mach build -d; touch components/script_servoparser/html.rs && ./mach build -d: 1:48m

@bors-servo

This comment has been minimized.

Contributor

bors-servo commented Aug 11, 2018

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

@retep007 retep007 force-pushed the retep007:generic-servo branch from e668042 to 0723a3c Aug 20, 2018

@retep007 retep007 force-pushed the retep007:generic-servo branch 3 times, most recently from 540bef5 to 57d5567 Aug 25, 2018

@jdm

This comment has been minimized.

Member

jdm commented Oct 1, 2018

@retep007 Does this PR contain the most recent changes you have been making? I might try to keep investigating this week.

@retep007

This comment has been minimized.

retep007 commented Oct 1, 2018

@jdm It contains all latest changes, however I can rebase it for you. Also I don't really know how to solve the ICE problem, no response from rust-lang so far. Those const functions are used to generate const variables and one of them can't be replaced so easily.

@jdm

This comment has been minimized.

Member

jdm commented Oct 1, 2018

Ah, that's good to know. Have you tried making duplicating the function and making a non-const version?

@retep007

This comment has been minimized.

retep007 commented Oct 2, 2018

Last static fn which I wasn't able to remove is Guard::newwhich I think is beyond manual replacement. But maybe we could try lazy_static?

@jdm

This comment has been minimized.

Member

jdm commented Oct 3, 2018

I'm not sure I understand - what's the problem with Guard::new, exactly?

[WIP] Generic script crate
Separation is based on adding types to TypeHolderTrait which contains
associated types with traits that script crate actually needs. This allows
using static methods and Sized types.

Affects servo in two ways:
- generic structs does not compile in script crate, but are left for later monomorphization
- dom_structs itself are moved to separate crate

TODO:
- [] tests
- [] performance
- [] polyshing

@retep007 retep007 force-pushed the retep007:generic-servo branch from 57d5567 to ee0b2e0 Oct 8, 2018

@retep007

This comment has been minimized.

retep007 commented Oct 8, 2018

@jdm I solved the const fn issue and rebased I get window is undefined. I guess that it origniates from mozjs which is checking for null pointer provided by servo. Maybe something wrong with initialization?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment