Skip to content

Commit 2ec57b0

Browse files
committed
Various changes
1 parent b7036ab commit 2ec57b0

5 files changed

Lines changed: 174 additions & 11 deletions

File tree

build_system/tests.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[
7474
),
7575
TestCase::jit_bin("jit.std_example", "example/std_example.rs", "arg"),
7676
TestCase::build_bin_and_run("aot.std_example", "example/std_example.rs", &["arg"]),
77+
TestCase::custom("aot.exception_bench", &|runner| {
78+
runner.run_rustc(["example/exception_bench.rs", "--crate-name", "exception_bench_unwind"]);
79+
runner.run_out_command("exception_bench_unwind", &[]);
80+
}),
7781
TestCase::build_bin_and_run("aot.dst_field_align", "example/dst-field-align.rs", &[]),
7882
TestCase::build_bin_and_run(
7983
"aot.subslice-patterns-const-eval",
@@ -402,6 +406,7 @@ impl<'a> TestRunner<'a> {
402406
cmd.arg("--out-dir");
403407
cmd.arg(BUILD_EXAMPLE_OUT_DIR.to_path(&self.dirs));
404408
cmd.arg("-Cdebuginfo=2");
409+
cmd.arg("-Copt-level=3");
405410
cmd.arg("--target");
406411
cmd.arg(&self.target_compiler.triple);
407412
cmd.arg("--check-cfg=cfg(jit)");

config.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ testsuite.base_sysroot
2222
#aot.arbitrary_self_types_pointers_and_wrappers
2323
#aot.issue_91827_extern_types
2424
#jit.std_example
25-
aot.std_example
26-
aot.dst_field_align
27-
aot.subslice-patterns-const-eval
28-
aot.track-caller-attribute
29-
aot.float-minmax-pass
30-
aot.issue-72793
31-
aot.issue-59326
32-
aot.neon
33-
aot.gen_block_iterate
34-
aot.raw-dylib
35-
test.sysroot
25+
#aot.std_example
26+
#aot.dst_field_align
27+
#aot.subslice-patterns-const-eval
28+
#aot.track-caller-attribute
29+
#aot.float-minmax-pass
30+
#aot.issue-72793
31+
#aot.issue-59326
32+
#aot.neon
33+
#aot.gen_block_iterate
34+
#aot.raw-dylib
35+
aot.exception_bench
3636

3737
#testsuite.extended_sysroot
3838
test.rust-random/rand

example/exception_bench.rs

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
fn main() {
2+
#[cfg(panic = "abort")]
3+
println!("With panic=abort");
4+
5+
#[cfg(panic = "unwind")]
6+
println!("With panic=unwind");
7+
8+
timed("100_000_000 nops", many_nops);
9+
timed("100_000_000 calls", many_calls);
10+
timed(" 100_000 calls recursing 1000 frames", many_calls_recursive);
11+
timed(
12+
" 100_000 calls recursing 1000 frames with landingpad",
13+
many_calls_recursive_with_landingpad,
14+
);
15+
#[cfg(panic = "unwind")]
16+
timed(" 10_000 throws catch unwinding few frame", many_throw_catch_few);
17+
#[cfg(panic = "unwind")]
18+
timed(
19+
" 10_000 throws catch unwinding few frame with landingpad",
20+
many_throw_catch_few_with_landingpad,
21+
);
22+
#[cfg(panic = "unwind")]
23+
timed(" 1_000 throws catch unwinding 100 frames", many_throw_catch_many);
24+
}
25+
26+
fn timed(name: &str, f: fn()) {
27+
let before = std::time::Instant::now();
28+
f();
29+
println!("{name} took {:?}", before.elapsed());
30+
}
31+
32+
struct DropMe;
33+
34+
impl Drop for DropMe {
35+
#[inline(never)]
36+
fn drop(&mut self) {}
37+
}
38+
39+
fn many_nops() {
40+
let mut i = 0;
41+
while i < 100_000_000 {
42+
// nop
43+
i += 1;
44+
}
45+
}
46+
47+
fn many_calls() {
48+
#[inline(never)]
49+
fn callee() {}
50+
51+
let mut i = 0;
52+
while i < 100_000_000 {
53+
callee();
54+
i += 1;
55+
}
56+
}
57+
58+
fn many_calls_recursive() {
59+
#[inline(never)]
60+
fn callee(i: u32) {
61+
if i > 0 {
62+
{
63+
let _a = DropMe;
64+
// Drop the DropMe outside of a landingpad
65+
}
66+
callee(i - 1);
67+
}
68+
}
69+
70+
let mut i = 0;
71+
while i < 100_000 {
72+
callee(1000);
73+
i += 1;
74+
}
75+
}
76+
77+
fn many_calls_recursive_with_landingpad() {
78+
#[inline(never)]
79+
fn callee(i: u32) {
80+
if i > 0 {
81+
let _a = DropMe;
82+
callee(i - 1);
83+
}
84+
}
85+
86+
let mut i = 0;
87+
while i < 100_000 {
88+
callee(1000);
89+
i += 1;
90+
}
91+
}
92+
93+
fn many_throw_catch_few() {
94+
#[inline(never)]
95+
fn callee() {
96+
std::panic::resume_unwind(Box::new(()));
97+
}
98+
99+
let mut i = 0;
100+
while i < 10_000 {
101+
std::panic::catch_unwind(|| {
102+
{
103+
let _a = DropMe;
104+
// Drop the DropMe outside of a landingpad
105+
}
106+
callee();
107+
});
108+
i += 1;
109+
}
110+
}
111+
112+
fn many_throw_catch_few_with_landingpad() {
113+
#[inline(never)]
114+
fn callee() {
115+
std::panic::resume_unwind(Box::new(()));
116+
}
117+
118+
let mut i = 0;
119+
while i < 10_000 {
120+
std::panic::catch_unwind(|| {
121+
let _a = DropMe;
122+
callee();
123+
});
124+
i += 1;
125+
}
126+
}
127+
128+
fn many_throw_catch_many() {
129+
#[inline(never)]
130+
fn callee(n: u32) {
131+
if n == 0 {
132+
std::panic::resume_unwind(Box::new(()));
133+
} else {
134+
callee(n - 1);
135+
}
136+
}
137+
138+
let mut i = 0;
139+
while i < 1000 {
140+
std::panic::catch_unwind(|| {
141+
callee(100);
142+
});
143+
i += 1;
144+
}
145+
}

example/mini_core_hello_world.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ pub trait LegacyReceiver {}
256256
impl<T: ?Sized> LegacyReceiver for &T {}
257257
impl<T: ?Sized> LegacyReceiver for &mut T {}
258258

259+
#[lang = "unpin"]
260+
pub auto trait Unpin {}
261+
259262
#[lang = "panic"]
260263
#[track_caller]
261264
pub fn panic(_msg: &'static str) -> ! {

scripts/test_rustc_tests.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ git checkout -- tests/ui/entry-point/auxiliary/bad_main_functions.rs
3131
# missing features
3232
# ================
3333

34+
rm -r tests/run-make/bin-emit-no-symbols # wrong personality definition
35+
rm -r tests/run-make/foreign-double-unwind
36+
rm -r tests/run-make/rustdoc-target-spec-json-path
37+
rm -r tests/run-make/std-core-cycle
38+
rm -r tests/run-make/c-unwind-abi-catch-lib-panic
39+
rm -r tests/run-make/no-alloc-shim
40+
rm -r tests/run-make/crate-circular-deps-link
41+
rm tests/ui/extern-flag/auxiliary/panic_handler.rs
42+
rm tests/ui/panic-runtime/incompatible-type.rs
43+
3444
# vendor intrinsics
3545
rm tests/ui/asm/x86_64/evex512-implicit-feature.rs # unimplemented AVX512 x86 vendor intrinsic
3646
rm tests/ui/simd/dont-invalid-bitcast-x86_64.rs # unimplemented llvm.x86.sse41.round.ps

0 commit comments

Comments
 (0)