Skip to content

Commit 59d91b8

Browse files
Merge pull request #694 from Mark-Simulacrum/reduce-further
Reduce runtime further
2 parents 5397734 + dd6bebf commit 59d91b8

40 files changed

+39124
-58
lines changed

collector/benchmarks/ripgrep/build.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use app::{RGArg, RGArgKind};
1818
mod app;
1919

2020
fn main() {
21+
println!("cargo:rerun-if-changed=build.rs");
2122
// OUT_DIR is set by Cargo and it's where any additional build artifacts
2223
// are written.
2324
let outdir = match env::var_os("OUT_DIR") {
@@ -26,7 +27,8 @@ fn main() {
2627
eprintln!(
2728
"OUT_DIR environment variable not defined. \
2829
Please file a bug: \
29-
https://github.com/BurntSushi/ripgrep/issues/new");
30+
https://github.com/BurntSushi/ripgrep/issues/new"
31+
);
3032
process::exit(1);
3133
}
3234
};
@@ -95,8 +97,10 @@ fn generate_man_page<P: AsRef<Path>>(outdir: P) -> io::Result<()> {
9597
File::create(&txt_path)?.write_all(tpl.as_bytes())?;
9698
let result = process::Command::new("a2x")
9799
.arg("--no-xmllint")
98-
.arg("--doctype").arg("manpage")
99-
.arg("--format").arg("manpage")
100+
.arg("--doctype")
101+
.arg("manpage")
102+
.arg("--format")
103+
.arg("manpage")
100104
.arg(&txt_path)
101105
.spawn()?
102106
.wait()?;
@@ -119,7 +123,7 @@ fn formatted_options() -> io::Result<String> {
119123
// ripgrep only has two positional arguments, and probably will only
120124
// ever have two positional arguments, so we just hardcode them into
121125
// the template.
122-
if let app::RGArgKind::Positional{..} = arg.kind {
126+
if let app::RGArgKind::Positional { .. } = arg.kind {
123127
continue;
124128
}
125129
formatted.push(formatted_arg(&arg)?);
@@ -129,8 +133,12 @@ fn formatted_options() -> io::Result<String> {
129133

130134
fn formatted_arg(arg: &RGArg) -> io::Result<String> {
131135
match arg.kind {
132-
RGArgKind::Positional{..} => panic!("unexpected positional argument"),
133-
RGArgKind::Switch { long, short, multiple } => {
136+
RGArgKind::Positional { .. } => panic!("unexpected positional argument"),
137+
RGArgKind::Switch {
138+
long,
139+
short,
140+
multiple,
141+
} => {
134142
let mut out = vec![];
135143

136144
let mut header = format!("--{}", long);
@@ -147,7 +155,13 @@ fn formatted_arg(arg: &RGArg) -> io::Result<String> {
147155

148156
Ok(String::from_utf8(out).unwrap())
149157
}
150-
RGArgKind::Flag { long, short, value_name, multiple, .. } => {
158+
RGArgKind::Flag {
159+
long,
160+
short,
161+
value_name,
162+
multiple,
163+
..
164+
} => {
151165
let mut out = vec![];
152166

153167
let mut header = format!("--{}", long);

collector/benchmarks/script-servo-2/Cargo.lock

Lines changed: 7 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

collector/benchmarks/script-servo-2/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ surfman = { git = "https://github.com/servo/surfman" }
3131
surfman-chains = { git = "https://github.com/asajeffrey/surfman-chains" }
3232
# https://github.com/retep998/winapi-rs/pull/816
3333
winapi = { git = "https://github.com/servo/winapi-rs", branch = "patch-1" }
34+
35+
[patch."https://github.com/servo/rust-mozjs"]
36+
mozjs = { path = "./rust-mozjs" }

collector/benchmarks/script-servo-2/components/atoms/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ fn main() {
2828
.atoms(static_atoms.lines().map(Result::unwrap))
2929
.write_to_file(&Path::new(&env::var_os("OUT_DIR").unwrap()).join("atom.rs"))
3030
.unwrap();
31+
println!("cargo:rerun-if-changed=build.rs");
3132
}

collector/benchmarks/script-servo-2/components/compositing/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::io::{Read, Write};
88
use std::path::Path;
99

1010
fn main() {
11+
println!("cargo:rerun-if-changed=build.rs");
1112
let lockfile_path = Path::new(&env::var("CARGO_MANIFEST_DIR").unwrap())
1213
.join("..")
1314
.join("..")

collector/benchmarks/script-servo-2/components/net/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
44

55
fn main() {
6+
println!("cargo:rerun-if-changed=build.rs");
67
let version =
78
std::env::var("DEP_OPENSSL_VERSION_NUMBER").expect("missing DEP_OPENSSL_VERSION_NUMBER");
89
let actual = u64::from_str_radix(&version, 16).unwrap();

collector/benchmarks/script-servo-2/components/script/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ fn main() {
4444
map.build(),
4545
)
4646
.unwrap();
47+
println!("cargo:rerun-if-changed=build.rs");
4748
}
4849

4950
#[derive(Eq, Hash, PartialEq)]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/doc
2+
/target
3+
/Cargo.lock
4+
5+
# Keep this in sync with ignore() in build.rs
6+
7+
*.pyc
8+
*.o
9+
*.so
10+
*.dll
11+
*.dylib
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[package]
2+
name = "mozjs_sys"
3+
description = "System crate for the Mozilla SpiderMonkey JavaScript engine."
4+
repository = "https://github.com/servo/mozjs/"
5+
version = "0.68.1"
6+
authors = ["Mozilla"]
7+
license = "MPL-2.0"
8+
exclude = [
9+
"mozjs/js/src/tests/**",
10+
"mozjs/js/src/octane/**",
11+
"mozjs/js/src/jit-test/**",
12+
"mozjs/js/src/jsapi-tests/**",
13+
"mozjs/js/src/doc/**",
14+
]
15+
16+
[features]
17+
debugmozjs = []
18+
profilemozjs = []
19+
uwp = []
20+
jitspew = []
21+
22+
[lib]
23+
name = "mozjs_sys"
24+
# The generated jsapi.rs contains #[doc] strings which look like
25+
# doctests but are definitely not.
26+
doctest = false
27+
28+
[dependencies]
29+
encoding_c = "0.9.6"
30+
encoding_c_mem = "0.2.5"
31+
libc = "0.2"
32+
libz-sys = "1.0"
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
This repository contains Rust bindings for [SpiderMonkey][sm] for use with
2+
[Servo][s].
3+
4+
[sm]: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey
5+
[s]: https://servo.org/
6+
7+
The bindings are to the raw SpiderMonkey API, higher-level bindings
8+
are in the [rust-mozjs repository][r-m].
9+
10+
[r-m]: https://github.com/servo/rust-mozjs/
11+
12+
Building
13+
========
14+
15+
Under Linux:
16+
17+
Install Clang (at least version 3.9) and autoconf v 2.13, for example in a Debian-based Linux:
18+
```
19+
sudo apt-get install clang-6.0 autoconf2.13
20+
21+
```
22+
23+
If you have more than one version of Clang installed, you can set the `LIBCLANG_PATH`
24+
environment variable, for example:
25+
```
26+
export LIBCLANG_PATH=/usr/lib/clang/4.0/lib
27+
```
28+
29+
Under Windows:
30+
31+
1. Follow the directions at
32+
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Windows_Prerequisites
33+
34+
2. Open up a shell configured to use Visual Studio. This could be the
35+
one included with Visual Studio (e.g. Visual Studio 2017 / X64 Native
36+
Tools Command Prompt for VS 2017) or a shell in which you have run
37+
```
38+
"c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
39+
```
40+
41+
3. Set the `MOZTOOLS_PATH` environment variable to point to the tools from the Mozilla Build Package:
42+
```
43+
set MOZTOOLS_PATH=C:\mozilla-build\msys\bin;C:\mozilla-build\bin
44+
```
45+
46+
4. Download and install Clang for Windows (64 bit) from https://releases.llvm.org/download.html
47+
and set the `LIBCLANG_PATH` environment variable to its `lib` directory:
48+
```
49+
set LIBCLANG_PATH=C:\Program Files\LLVM\lib
50+
```
51+
52+
5. Set environment variables so the build script can find Python 2.7 and Autoconf 2.13:
53+
```
54+
set AUTOCONF=C:\mozilla-build\msys\local\bin\autoconf-2.13
55+
set NATIVE_WIN32_PYTHON=C:\mozilla-build\python\python2.7.exe
56+
```
57+
58+
You can now build and test the crate using cargo:
59+
```
60+
cargo build
61+
cargo test
62+
cargo build --features debugmozjs
63+
cargo test --features debugmozjs
64+
```
65+
66+
Upgrading
67+
=========
68+
69+
In order to upgrade to a new version of SpiderMonkey:
70+
71+
1. Find the mozilla-release commit for the desired version of SpiderMonkey, at
72+
https://treeherder.mozilla.org/#/jobs?repo=mozilla-release&filter-searchStr=spidermonkey%20pkg.
73+
You are looking for an SM(pkg) tagged with FIREFOX_RELEASE.
74+
Take a note of the commit number to the left (a hex number such as ac4fbb7aaca0).
75+
76+
2. Click on the SM(pkg) link, which will open a panel with details of the
77+
commit, including an artefact uploaded link, with a name of the form
78+
mozjs-*version*.tar.bz2. Download it and save it locally.
79+
80+
3. Look at the patches in `etc/patches/*.patch`, and remove any that no longer apply
81+
(with a bit of luck this will be all of them).
82+
83+
4. Run `python3 ./etc/update.py path/to/tarball`.
84+
85+
5. Update `etc/COMMIT` with the commit number.
86+
87+
6. Build and test the bindings as above, then submit a PR!
88+
89+
[bindgen]: https://github.com/servo/rust-bindgen

0 commit comments

Comments
 (0)