Skip to content

Commit

Permalink
Auto merge of #84786 - JohnTitor:rollup-j5omx6f, r=JohnTitor
Browse files Browse the repository at this point in the history
Rollup of 8 pull requests

Successful merges:

 - #84601 (rustdoc: Only store locations in Cache::extern_locations and calculate the other info on-demand)
 - #84704 (platform-support.md: Update for consistency with Target Tier Policy)
 - #84724 (Replace llvm::sys::fs::F_None with llvm::sys::fs::OF_None)
 - #84740 (Reset the docs' copy path button after 1 second)
 - #84749 (Sync `rustc_codegen_cranelift`)
 - #84756 (Add a ToC to the Target Tier Policy documentation)
 - #84765 (Update cargo)
 - #84774 (Fix misspelling)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed May 1, 2021
2 parents 1c2c6b6 + 6af045f commit fed59d6
Show file tree
Hide file tree
Showing 55 changed files with 1,105 additions and 1,534 deletions.
7 changes: 7 additions & 0 deletions compiler/rustc_codegen_cranelift/.github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,10 @@ jobs:
with:
name: cg_clif-${{ runner.os }}
path: cg_clif.tar.xz

- name: Upload prebuilt cg_clif (cross compile)
if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
uses: actions/upload-artifact@v2
with:
name: cg_clif-${{ runner.os }}-cross-x86_64-mingw
path: cg_clif.tar.xz
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
// source for rustc_* is not included in the rust-src component; disable the errors about this
"rust-analyzer.diagnostics.disabled": ["unresolved-extern-crate", "macro-error"],
"rust-analyzer.diagnostics.disabled": ["unresolved-extern-crate", "unresolved-macro-call"],
"rust-analyzer.assist.importMergeBehavior": "last",
"rust-analyzer.cargo.runBuildScripts": true,
"rust-analyzer.linkedProjects": [
Expand Down
45 changes: 23 additions & 22 deletions compiler/rustc_codegen_cranelift/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "cranelift-bforest"
version = "0.72.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
version = "0.73.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
dependencies = [
"cranelift-entity",
]

[[package]]
name = "cranelift-codegen"
version = "0.72.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
version = "0.73.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
dependencies = [
"byteorder",
"cranelift-bforest",
Expand All @@ -65,27 +65,27 @@ dependencies = [

[[package]]
name = "cranelift-codegen-meta"
version = "0.72.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
version = "0.73.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
dependencies = [
"cranelift-codegen-shared",
"cranelift-entity",
]

[[package]]
name = "cranelift-codegen-shared"
version = "0.72.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
version = "0.73.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"

[[package]]
name = "cranelift-entity"
version = "0.72.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
version = "0.73.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"

[[package]]
name = "cranelift-frontend"
version = "0.72.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
version = "0.73.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
dependencies = [
"cranelift-codegen",
"log",
Expand All @@ -95,8 +95,8 @@ dependencies = [

[[package]]
name = "cranelift-jit"
version = "0.72.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
version = "0.73.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand All @@ -113,8 +113,8 @@ dependencies = [

[[package]]
name = "cranelift-module"
version = "0.72.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
version = "0.73.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand All @@ -125,17 +125,17 @@ dependencies = [

[[package]]
name = "cranelift-native"
version = "0.72.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
version = "0.73.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
dependencies = [
"cranelift-codegen",
"target-lexicon",
]

[[package]]
name = "cranelift-object"
version = "0.72.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
version = "0.73.0"
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand Down Expand Up @@ -306,6 +306,7 @@ dependencies = [
"cranelift-frontend",
"cranelift-jit",
"cranelift-module",
"cranelift-native",
"cranelift-object",
"gimli",
"indexmap",
Expand Down Expand Up @@ -334,9 +335,9 @@ dependencies = [

[[package]]
name = "target-lexicon"
version = "0.11.2"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "422045212ea98508ae3d28025bc5aaa2bd4a9cdaecd442a08da2ee620ee9ea95"
checksum = "64ae3b39281e4b14b8123bdbaddd472b7dfe215e444181f2f9d2443c2444f834"

[[package]]
name = "thiserror"
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_codegen_cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ crate-type = ["dylib"]

[dependencies]
# These have to be in sync with each other
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", features = ["unwind", "x64"] }
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", features = ["unwind"] }
cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", optional = true }
cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
target-lexicon = "0.11.0"
target-lexicon = "0.12.0"
gimli = { version = "0.23.0", default-features = false, features = ["write"]}
object = { version = "0.23.0", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }

Expand All @@ -28,6 +29,7 @@ smallvec = "1.6.1"
#cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
#cranelift-frontend = { path = "../wasmtime/cranelift/frontend" }
#cranelift-module = { path = "../wasmtime/cranelift/module" }
#cranelift-native = { path = ../wasmtime/cranelift/native" }
#cranelift-jit = { path = "../wasmtime/cranelift/jit" }
#cranelift-object = { path = "../wasmtime/cranelift/object" }

Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_codegen_cranelift/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ This will build your project with rustc_codegen_cranelift instead of the usual L

For additional ways to use rustc_codegen_cranelift like the JIT mode see [usage.md](docs/usage.md).

## Env vars
## Configuration

See [env_vars.md](docs/env_vars.md) for all env vars used by rustc_codegen_cranelift.
See the documentation on the `BackendConfig` struct in [config.rs](src/config.rs) for all
configuration options.

## Not yet supported

Expand Down
19 changes: 16 additions & 3 deletions compiler/rustc_codegen_cranelift/build_sysroot/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ dependencies = [

[[package]]
name = "compiler_builtins"
version = "0.1.39"
version = "0.1.40"
dependencies = [
"rustc-std-workspace-core",
]
Expand Down Expand Up @@ -132,9 +132,9 @@ dependencies = [

[[package]]
name = "libc"
version = "0.2.91"
version = "0.2.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7"
checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e"
dependencies = [
"rustc-std-workspace-core",
]
Expand Down Expand Up @@ -167,6 +167,7 @@ dependencies = [
name = "panic_abort"
version = "0.0.0"
dependencies = [
"alloc",
"cfg-if",
"compiler_builtins",
"core",
Expand Down Expand Up @@ -242,10 +243,22 @@ dependencies = [
"panic_abort",
"panic_unwind",
"rustc-demangle",
"std_detect",
"unwind",
"wasi",
]

[[package]]
name = "std_detect"
version = "0.1.5"
dependencies = [
"cfg-if",
"compiler_builtins",
"libc",
"rustc-std-workspace-alloc",
"rustc-std-workspace-core",
]

[[package]]
name = "sysroot"
version = "0.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ popd
git clone https://github.com/rust-lang/compiler-builtins.git || echo "rust-lang/compiler-builtins has already been cloned"
pushd compiler-builtins
git checkout -- .
git checkout 0.1.39
git checkout 0.1.40
git apply ../../crate_patches/000*-compiler-builtins-*.patch
popd

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ index 06054c8..3bea17b 100644
fn wrapping_shr(self, other: u32) -> Self;
- fn rotate_left(self, other: u32) -> Self;
fn overflowing_add(self, other: Self) -> (Self, bool);
fn aborting_div(self, other: Self) -> Self;
fn aborting_rem(self, other: Self) -> Self;
fn leading_zeros(self) -> u32;
}
@@ -209,10 +208,6 @@ macro_rules! int_impl_common {
<Self>::wrapping_shr(self, other)
}
Expand Down
15 changes: 0 additions & 15 deletions compiler/rustc_codegen_cranelift/docs/env_vars.md

This file was deleted.

43 changes: 24 additions & 19 deletions compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ unsafe extern "C" fn my_puts(s: *const i8) {
puts(s);
}

macro_rules! assert {
($e:expr) => {
if !$e {
panic(stringify!(! $e));
}
};
}

macro_rules! assert_eq {
($l:expr, $r: expr) => {
if $l != $r {
panic(stringify!($l != $r));
}
}
}

#[lang = "termination"]
trait Termination {
fn report(self) -> i32;
Expand All @@ -20,8 +36,9 @@ impl Termination for () {
fn report(self) -> i32 {
unsafe {
NUM = 6 * 7 + 1 + (1u8 == 1u8) as u8; // 44
*NUM_REF as i32
assert_eq!(*NUM_REF as i32, 44);
}
0
}
}

Expand Down Expand Up @@ -82,29 +99,12 @@ fn start<T: Termination + 'static>(
unsafe { puts(*((argv as usize + 2 * intrinsics::size_of::<*const u8>()) as *const *const i8)); }
}

main().report();
0
main().report() as isize
}

static mut NUM: u8 = 6 * 7;
static NUM_REF: &'static u8 = unsafe { &NUM };

macro_rules! assert {
($e:expr) => {
if !$e {
panic(stringify!(! $e));
}
};
}

macro_rules! assert_eq {
($l:expr, $r: expr) => {
if $l != $r {
panic(stringify!($l != $r));
}
}
}

struct Unique<T: ?Sized> {
pointer: *const T,
_marker: PhantomData<T>,
Expand Down Expand Up @@ -296,6 +296,11 @@ fn main() {
unsafe {
global_asm_test();
}

// Both statics have a reference that points to the same anonymous allocation.
static REF1: &u8 = &42;
static REF2: &u8 = REF1;
assert_eq!(*REF1, *REF2);
}

#[cfg(all(not(jit), target_os = "linux"))]
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_cranelift/example/std_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ fn main() {
assert_eq!(2.3f32.copysign(-1.0), -2.3f32);
println!("{}", 2.3f32.powf(2.0));

assert_eq!(i64::MAX.checked_mul(2), None);

assert_eq!(-128i8, (-128i8).saturating_sub(1));
assert_eq!(127i8, 127i8.saturating_sub(-128));
assert_eq!(-128i8, (-128i8).saturating_add(-128));
Expand Down Expand Up @@ -84,6 +86,7 @@ fn main() {
assert_eq!(houndred_i128 as f64, 100.0);
assert_eq!(houndred_f32 as i128, 100);
assert_eq!(houndred_f64 as i128, 100);
assert_eq!(1u128.rotate_left(2), 4);

// Test signed 128bit comparing
let max = usize::MAX as i128;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2021-03-29"
channel = "nightly-2021-04-28"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/scripts/ext_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
set -e

export CG_CLIF_DISPLAY_CG_TIME=1
export CG_CLIF_INCR_CACHE_DISABLED=1
export CG_CLIF_DISABLE_INCR_CACHE=1

export HOST_TRIPLE=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")
export TARGET_TRIPLE=${TARGET_TRIPLE:-$HOST_TRIPLE}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ index d95b5b7f17f..00b6f0e3635 100644
[dependencies]
core = { path = "../core" }
-compiler_builtins = { version = "0.1.39", features = ['rustc-dep-of-std'] }
+compiler_builtins = { version = "0.1.39", features = ['rustc-dep-of-std', 'no-asm'] }
+compiler_builtins = { version = "0.1.40", features = ['rustc-dep-of-std', 'no-asm'] }
[dev-dependencies]
rand = "0.7"
Expand Down
Loading

0 comments on commit fed59d6

Please sign in to comment.