Skip to content

Commit 627c5e8

Browse files
HeroicKatoraMark-Simulacrum
authored andcommitted
Merge ctfe tests into renamed ctfe-stress-3
1 parent 01977b0 commit 627c5e8

File tree

6 files changed

+32
-39
lines changed

6 files changed

+32
-39
lines changed

collector/benchmarks/ctfe-stress-2/Cargo.lock

-4
This file was deleted.

collector/benchmarks/ctfe-stress-uninit/Cargo.lock renamed to collector/benchmarks/ctfe-stress-3/Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[package]
2-
name = "ctfe-stress-2"
2+
name = "ctfe-stress-3"
33
version = "0.1.0"
44
authors = ["Ralf Jung <[email protected]>"]

collector/benchmarks/ctfe-stress-2/src/lib.rs renamed to collector/benchmarks/ctfe-stress-3/src/lib.rs

+30
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(const_fn, const_let)]
2+
use std::mem::MaybeUninit;
23

34
// Try to make CTFE actually do a lot of computation, without producing a big result.
45
// And without support for loops.
@@ -65,3 +66,32 @@ expensive_static!(UNSIZE_TRAIT: &'static Trait = &42u32; [4 16 16 16 16 16]);
6566
// prone to regressions.
6667
// 24 is an exponent that makes the repeat expression take less than two seconds to compute
6768
const FOO: [i32; 1 << 24] = [0; 1 << 24];
69+
70+
// Try CTFE that operate on values that contain largely uninitialized memory, not requiring any
71+
// particular representation in MIR.
72+
type LargeUninit = MaybeUninit<[u8; 1 << 23]>;
73+
74+
// copying uninitialized bytes could also be expensive and could be optimized independently, so
75+
// track regressions here separately. It should also be less costly to compose new values
76+
// containing largly undef bytes.
77+
const BAR: LargeUninit = MaybeUninit::uninit();
78+
79+
// Check the evaluation time of passing through a function.
80+
const fn id<T>(val: T) -> T { val }
81+
const ID: LargeUninit = id(MaybeUninit::uninit());
82+
83+
const fn build() -> LargeUninit { MaybeUninit::uninit() }
84+
const BUILD: LargeUninit = build();
85+
86+
// Largely uninitialized memory but initialized with tag at the start, in both cases.
87+
const NONE: Option<LargeUninit> = None;
88+
const SOME: Option<LargeUninit> = Some(MaybeUninit::uninit());
89+
90+
// A large uninit surrounded by initialized bytes whose representation is surely computed.
91+
const SURROUND: (u8, LargeUninit, u8) = (0, MaybeUninit::uninit(), 0);
92+
const SURROUND_ID: (u8, LargeUninit, u8) = id((0, MaybeUninit::uninit(), 0));
93+
94+
// Check actual codegen for these values.
95+
pub static STATIC_BAR: LargeUninit = MaybeUninit::uninit();
96+
pub static STATIC_NONE: Option<LargeUninit> = None;
97+
pub static STATIC_SOME: Option<LargeUninit> = Some(MaybeUninit::uninit());

collector/benchmarks/ctfe-stress-uninit/Cargo.toml

-4
This file was deleted.

collector/benchmarks/ctfe-stress-uninit/src/lib.rs

-29
This file was deleted.

0 commit comments

Comments
 (0)