Skip to content

Commit 3670812

Browse files
committed
Merge commit '1eded3619d0e55d57521a259bf27a03906fdfad0' into sync_cg_clif-2023-07-22
2 parents 42f5419 + 1eded36 commit 3670812

30 files changed

+668
-170
lines changed

compiler/rustc_codegen_cranelift/.github/workflows/main.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v3
1414

15-
- name: Install rustfmt
15+
- name: Avoid installing rustc-dev
1616
run: |
17-
rustup component add rustfmt
17+
sed -i 's/components.*/components = ["rustfmt"]/' rust-toolchain
18+
echo 'profile = "minimal"' >> rust-toolchain
19+
rustfmt -v
1820
1921
- name: Rustfmt
2022
run: |
@@ -127,7 +129,7 @@ jobs:
127129
- uses: actions/checkout@v3
128130

129131
- name: Prepare dependencies
130-
run: ./y.rs prepare
132+
run: ./y.sh prepare
131133

132134
- name: Disable JIT tests
133135
run: |
@@ -136,7 +138,7 @@ jobs:
136138
- name: Test
137139
env:
138140
TARGET_TRIPLE: x86_64-unknown-linux-gnu
139-
run: ./y.rs test --use-backend llvm
141+
run: ./y.sh test --use-backend llvm
140142

141143
bench:
142144
runs-on: ubuntu-latest

compiler/rustc_codegen_cranelift/Cargo.lock

+53-31
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
5151

5252
[[package]]
5353
name = "cranelift-bforest"
54-
version = "0.96.1"
54+
version = "0.98.0"
5555
source = "registry+https://github.com/rust-lang/crates.io-index"
56-
checksum = "9b6160c0a96253993b79fb7e0983534a4515ecf666120ddf8f92068114997ebc"
56+
checksum = "ec27af72e56235eb326b5bf2de4e70ab7c5ac1fb683a1829595badaf821607fd"
5757
dependencies = [
5858
"cranelift-entity",
5959
]
6060

6161
[[package]]
6262
name = "cranelift-codegen"
63-
version = "0.96.1"
63+
version = "0.98.0"
6464
source = "registry+https://github.com/rust-lang/crates.io-index"
65-
checksum = "7b38da5f63562e42f3c929d7c76871098e5ad12c8ab44b0659ffc529f22a5b3a"
65+
checksum = "2231e12925e6c5f4bc9c95b62a798eea6ed669a95bc3e00f8b2adb3b7b9b7a80"
6666
dependencies = [
6767
"bumpalo",
6868
"cranelift-bforest",
@@ -81,39 +81,39 @@ dependencies = [
8181

8282
[[package]]
8383
name = "cranelift-codegen-meta"
84-
version = "0.96.1"
84+
version = "0.98.0"
8585
source = "registry+https://github.com/rust-lang/crates.io-index"
86-
checksum = "011371e213e163b55dd9e8404b3f2d9fa52cd14dc2f3dc5b83e61ffceff126db"
86+
checksum = "413b00b8dfb3aab85674a534677e7ca08854b503f164a70ec0634fce80996e2c"
8787
dependencies = [
8888
"cranelift-codegen-shared",
8989
]
9090

9191
[[package]]
9292
name = "cranelift-codegen-shared"
93-
version = "0.96.1"
93+
version = "0.98.0"
9494
source = "registry+https://github.com/rust-lang/crates.io-index"
95-
checksum = "1bf97dde7f5ad571161cdd203a2c9c88682ef669830aea3c14ea5d164ef8bb43"
95+
checksum = "cd0feb9ecc8193ef5cb04f494c5bd835e5bfec4bde726e7ac0444fc9dd76229e"
9696

9797
[[package]]
9898
name = "cranelift-control"
99-
version = "0.96.1"
99+
version = "0.98.0"
100100
source = "registry+https://github.com/rust-lang/crates.io-index"
101-
checksum = "fd9a9254aee733b0f2b68e5eaaf0337ad53cb23252a056c10a35370551be8d40"
101+
checksum = "72eedd2afcf5fee1e042eaaf18d3750e48ad0eca364a9f5971ecfdd5ef85bf71"
102102
dependencies = [
103103
"arbitrary",
104104
]
105105

106106
[[package]]
107107
name = "cranelift-entity"
108-
version = "0.96.1"
108+
version = "0.98.0"
109109
source = "registry+https://github.com/rust-lang/crates.io-index"
110-
checksum = "baf39a33ee39479d1337cd9333f3c09786c5a0ca1ec509edcaf9d1346d5de0e5"
110+
checksum = "7af19157be42671073cf8c2a52d6a4ae1e7b11f1dcb4131fede356d9f91c29dd"
111111

112112
[[package]]
113113
name = "cranelift-frontend"
114-
version = "0.96.1"
114+
version = "0.98.0"
115115
source = "registry+https://github.com/rust-lang/crates.io-index"
116-
checksum = "65e260b92a193a0a2dccc3938f133d9532e7dcfe8d03e36bf8b7d3518c1c1793"
116+
checksum = "c2dc7636c5fad156be7d9ae691cd1aaecd97326caf2ab534ba168056d56aa76c"
117117
dependencies = [
118118
"cranelift-codegen",
119119
"log",
@@ -123,15 +123,15 @@ dependencies = [
123123

124124
[[package]]
125125
name = "cranelift-isle"
126-
version = "0.96.1"
126+
version = "0.98.0"
127127
source = "registry+https://github.com/rust-lang/crates.io-index"
128-
checksum = "9446c8e1aadfcdacee1a49592bc2c25d1d9bf5484782c163e7f5485c92cd3c1c"
128+
checksum = "c1111aea4fb6fade5779903f184249a3fc685a799fe4ec59126f9af59c7c2a74"
129129

130130
[[package]]
131131
name = "cranelift-jit"
132-
version = "0.96.1"
132+
version = "0.98.0"
133133
source = "registry+https://github.com/rust-lang/crates.io-index"
134-
checksum = "689a6df165d0f860c1e1a3d53c28944e2743c3e9ee4c678cf190fe60ad7a6ef5"
134+
checksum = "dadf88076317f6286ec77ebbe65978734fb43b6befdc96f52ff4c4c511841644"
135135
dependencies = [
136136
"anyhow",
137137
"cranelift-codegen",
@@ -149,9 +149,9 @@ dependencies = [
149149

150150
[[package]]
151151
name = "cranelift-module"
152-
version = "0.96.1"
152+
version = "0.98.0"
153153
source = "registry+https://github.com/rust-lang/crates.io-index"
154-
checksum = "0b1402d6ff1695b429536b2eaa126db560fc94c375ed0e9cfb15051fc07427f7"
154+
checksum = "c6bae8a82dbf82241b1083e57e06870d2c2bdc9852727be99d58477513816953"
155155
dependencies = [
156156
"anyhow",
157157
"cranelift-codegen",
@@ -160,9 +160,9 @@ dependencies = [
160160

161161
[[package]]
162162
name = "cranelift-native"
163-
version = "0.96.1"
163+
version = "0.98.0"
164164
source = "registry+https://github.com/rust-lang/crates.io-index"
165-
checksum = "eac916f3c5aff4b817e42fc2e682292b931495b3fe2603d5e3c3cf602d74e344"
165+
checksum = "1ecfc01a634448468a698beac433d98040033046678a0eed3ca39a3a9f63ae86"
166166
dependencies = [
167167
"cranelift-codegen",
168168
"libc",
@@ -171,9 +171,9 @@ dependencies = [
171171

172172
[[package]]
173173
name = "cranelift-object"
174-
version = "0.96.1"
174+
version = "0.98.0"
175175
source = "registry+https://github.com/rust-lang/crates.io-index"
176-
checksum = "23860f4cd064017f2108e6bc5d25660a77cd6eea77f1ac0756870a00abb12e93"
176+
checksum = "0ee14a7276999f0dcaae2de84043e2c2de50820fb89b3db56fab586a4ad26734"
177177
dependencies = [
178178
"anyhow",
179179
"cranelift-codegen",
@@ -193,6 +193,12 @@ dependencies = [
193193
"cfg-if",
194194
]
195195

196+
[[package]]
197+
name = "equivalent"
198+
version = "1.0.0"
199+
source = "registry+https://github.com/rust-lang/crates.io-index"
200+
checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1"
201+
196202
[[package]]
197203
name = "fallible-iterator"
198204
version = "0.2.0"
@@ -206,7 +212,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
206212
checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4"
207213
dependencies = [
208214
"fallible-iterator",
209-
"indexmap",
215+
"indexmap 1.9.3",
210216
"stable_deref_trait",
211217
]
212218

@@ -225,6 +231,12 @@ dependencies = [
225231
"ahash",
226232
]
227233

234+
[[package]]
235+
name = "hashbrown"
236+
version = "0.14.0"
237+
source = "registry+https://github.com/rust-lang/crates.io-index"
238+
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
239+
228240
[[package]]
229241
name = "indexmap"
230242
version = "1.9.3"
@@ -235,6 +247,16 @@ dependencies = [
235247
"hashbrown 0.12.3",
236248
]
237249

250+
[[package]]
251+
name = "indexmap"
252+
version = "2.0.0"
253+
source = "registry+https://github.com/rust-lang/crates.io-index"
254+
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
255+
dependencies = [
256+
"equivalent",
257+
"hashbrown 0.14.0",
258+
]
259+
238260
[[package]]
239261
name = "libc"
240262
version = "0.2.138"
@@ -283,7 +305,7 @@ checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385"
283305
dependencies = [
284306
"crc32fast",
285307
"hashbrown 0.13.2",
286-
"indexmap",
308+
"indexmap 1.9.3",
287309
"memchr",
288310
]
289311

@@ -295,9 +317,9 @@ checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
295317

296318
[[package]]
297319
name = "regalloc2"
298-
version = "0.8.1"
320+
version = "0.9.2"
299321
source = "registry+https://github.com/rust-lang/crates.io-index"
300-
checksum = "d4a52e724646c6c0800fc456ec43b4165d2f91fba88ceaca06d9e0b400023478"
322+
checksum = "5b4dcbd3a2ae7fb94b5813fa0e957c6ab51bf5d0a8ee1b69e0c2d0f1e6eb8485"
301323
dependencies = [
302324
"hashbrown 0.13.2",
303325
"log",
@@ -335,7 +357,7 @@ dependencies = [
335357
"cranelift-native",
336358
"cranelift-object",
337359
"gimli",
338-
"indexmap",
360+
"indexmap 2.0.0",
339361
"libloading",
340362
"object",
341363
"smallvec",
@@ -374,9 +396,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
374396

375397
[[package]]
376398
name = "wasmtime-jit-icache-coherence"
377-
version = "9.0.1"
399+
version = "11.0.0"
378400
source = "registry+https://github.com/rust-lang/crates.io-index"
379-
checksum = "7d90933b781e1cef7656baed671c7a90bdba0c1c694e04fdd4124419308f5cbb"
401+
checksum = "e34eb67f0829a5614ec54716c8e0c9fe68fab7b9df3686c85f719c9d247f7169"
380402
dependencies = [
381403
"cfg-if",
382404
"libc",

compiler/rustc_codegen_cranelift/Cargo.toml

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ crate-type = ["dylib"]
88

99
[dependencies]
1010
# These have to be in sync with each other
11-
cranelift-codegen = { version = "0.96.1", features = ["unwind", "all-arch"] }
12-
cranelift-frontend = { version = "0.96.1" }
13-
cranelift-module = { version = "0.96.1" }
14-
cranelift-native = { version = "0.96.1" }
15-
cranelift-jit = { version = "0.96.1", optional = true }
16-
cranelift-object = { version = "0.96.1" }
11+
cranelift-codegen = { version = "0.98", features = ["unwind", "all-arch"] }
12+
cranelift-frontend = { version = "0.98" }
13+
cranelift-module = { version = "0.98" }
14+
cranelift-native = { version = "0.98" }
15+
cranelift-jit = { version = "0.98", optional = true }
16+
cranelift-object = { version = "0.98" }
1717
target-lexicon = "0.12.0"
1818
gimli = { version = "0.27.2", default-features = false, features = ["write"]}
1919
object = { version = "0.30.3", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
2020

21-
indexmap = "1.9.3"
21+
indexmap = "2.0.0"
2222
libloading = { version = "0.7.3", optional = true }
2323
smallvec = "1.8.1"
2424

compiler/rustc_codegen_cranelift/Readme.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ to `./build/host/stage2/bin/`. Note that you would need to do this every time yo
6565
5. Copy cargo from another toolchain: `cp $(rustup which cargo) .build/<your hostname triple>/stage2/bin/cargo`
6666
* Another option is to build it at step 3 and copy with other executables at step 4.
6767
6. Link your new `rustc` to toolchain: `rustup toolchain link stage2 ./build/host/stage2/`.
68-
7. (Windows only) compile y.rs: `rustc +stage2 -O y.rs`.
69-
8. You need to prefix every `./y.rs` (or `y` if you built `y.rs`) command by `rustup run stage2` to make cg_clif use your local changes in rustc.
68+
7. (Windows only) compile the build system: `rustc +stage2 -O build_system/main.rs -o y.exe`.
69+
8. You need to prefix every `./y.sh` (or `y` if you built `build_system/main.rs` as `y`) command by `rustup run stage2` to make cg_clif use your local changes in rustc.
7070

71-
* `rustup run stage2 ./y.rs prepare`
72-
* `rustup run stage2 ./y.rs build`
73-
* (Optional) run tests: `rustup run stage2 ./y.rs test`
71+
* `rustup run stage2 ./y.sh prepare`
72+
* `rustup run stage2 ./y.sh build`
73+
* (Optional) run tests: `rustup run stage2 ./y.sh test`
7474
9. Now you can use your cg_clif build to compile other Rust programs, e.g. you can open any Rust crate and run commands like `$RustCheckoutDir/compiler/rustc_codegen_cranelift/dist/cargo-clif build --release`.
7575

7676
## Configuration

compiler/rustc_codegen_cranelift/build_system/bench.rs

+48-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::env;
2+
use std::io::Write;
23
use std::path::Path;
34

45
use super::path::{Dirs, RelPath};
@@ -30,6 +31,12 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
3031

3132
let bench_runs = env::var("BENCH_RUNS").unwrap_or_else(|_| "10".to_string()).parse().unwrap();
3233

34+
let mut gha_step_summary = if let Ok(file) = std::env::var("GITHUB_STEP_SUMMARY") {
35+
Some(std::fs::OpenOptions::new().append(true).open(file).unwrap())
36+
} else {
37+
None
38+
};
39+
3340
eprintln!("[BENCH COMPILE] ebobby/simple-raytracer");
3441
let cargo_clif = RelPath::DIST
3542
.to_path(dirs)
@@ -60,36 +67,64 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
6067
target_dir = target_dir.display(),
6168
);
6269

70+
let bench_compile_markdown = RelPath::DIST.to_path(dirs).join("bench_compile.md");
71+
6372
let bench_compile = hyperfine_command(
6473
1,
6574
bench_runs,
6675
Some(&clean_cmd),
67-
&[&llvm_build_cmd, &clif_build_cmd, &clif_build_opt_cmd],
76+
&[
77+
("cargo build", &llvm_build_cmd),
78+
("cargo-clif build", &clif_build_cmd),
79+
("cargo-clif build --release", &clif_build_opt_cmd),
80+
],
81+
&bench_compile_markdown,
6882
);
6983

7084
spawn_and_wait(bench_compile);
7185

86+
if let Some(gha_step_summary) = gha_step_summary.as_mut() {
87+
gha_step_summary.write_all(b"## Compile ebobby/simple-raytracer\n\n").unwrap();
88+
gha_step_summary.write_all(&std::fs::read(bench_compile_markdown).unwrap()).unwrap();
89+
gha_step_summary.write_all(b"\n").unwrap();
90+
}
91+
7292
eprintln!("[BENCH RUN] ebobby/simple-raytracer");
7393

94+
let bench_run_markdown = RelPath::DIST.to_path(dirs).join("bench_run.md");
95+
96+
let raytracer_cg_llvm = Path::new(".").join(get_file_name(
97+
&bootstrap_host_compiler.rustc,
98+
"raytracer_cg_llvm",
99+
"bin",
100+
));
101+
let raytracer_cg_clif = Path::new(".").join(get_file_name(
102+
&bootstrap_host_compiler.rustc,
103+
"raytracer_cg_clif",
104+
"bin",
105+
));
106+
let raytracer_cg_clif_opt = Path::new(".").join(get_file_name(
107+
&bootstrap_host_compiler.rustc,
108+
"raytracer_cg_clif_opt",
109+
"bin",
110+
));
74111
let mut bench_run = hyperfine_command(
75112
0,
76113
bench_runs,
77114
None,
78115
&[
79-
Path::new(".")
80-
.join(get_file_name(&bootstrap_host_compiler.rustc, "raytracer_cg_llvm", "bin"))
81-
.to_str()
82-
.unwrap(),
83-
Path::new(".")
84-
.join(get_file_name(&bootstrap_host_compiler.rustc, "raytracer_cg_clif", "bin"))
85-
.to_str()
86-
.unwrap(),
87-
Path::new(".")
88-
.join(get_file_name(&bootstrap_host_compiler.rustc, "raytracer_cg_clif_opt", "bin"))
89-
.to_str()
90-
.unwrap(),
116+
("", raytracer_cg_llvm.to_str().unwrap()),
117+
("", raytracer_cg_clif.to_str().unwrap()),
118+
("", raytracer_cg_clif_opt.to_str().unwrap()),
91119
],
120+
&bench_run_markdown,
92121
);
93122
bench_run.current_dir(RelPath::BUILD.to_path(dirs));
94123
spawn_and_wait(bench_run);
124+
125+
if let Some(gha_step_summary) = gha_step_summary.as_mut() {
126+
gha_step_summary.write_all(b"## Run ebobby/simple-raytracer\n\n").unwrap();
127+
gha_step_summary.write_all(&std::fs::read(bench_run_markdown).unwrap()).unwrap();
128+
gha_step_summary.write_all(b"\n").unwrap();
129+
}
95130
}

0 commit comments

Comments
 (0)