From 4c7abd504ce2c534e3f2eedfeecf466f83c693da Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Tue, 31 Dec 2019 15:59:49 +0100 Subject: [PATCH] Revert some changes --- example/mini_core.rs | 4 ---- src/base.rs | 2 +- src/value_and_place.rs | 13 +++++++++++++ test.sh | 15 ++++++--------- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/example/mini_core.rs b/example/mini_core.rs index f649c945c05..1912cc50a21 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -394,10 +394,6 @@ pub trait FnMut: FnOnce { #[lang = "panic"] pub fn panic(&(_msg, _file, _line, _col): &(&'static str, &'static str, u32, u32)) -> ! { - panic_inner(&_msg); -} - -pub fn panic_inner(_msg: &&str) -> ! { unsafe { libc::puts("Panicking\0" as *const str as *const u8); intrinsics::abort(); diff --git a/src/base.rs b/src/base.rs index 0adca5bee8b..81ca47fe645 100644 --- a/src/base.rs +++ b/src/base.rs @@ -269,7 +269,7 @@ fn trans_stmt<'tcx>( fx.set_debug_loc(stmt.source_info); - #[cfg(false_debug_assertions)] + #[cfg(debug_assertions)] match &stmt.kind { StatementKind::StorageLive(..) | StatementKind::StorageDead(..) => {} // Those are not very useful _ => { diff --git a/src/value_and_place.rs b/src/value_and_place.rs index 6f0c615c950..39eb7d24707 100644 --- a/src/value_and_place.rs +++ b/src/value_and_place.rs @@ -362,6 +362,19 @@ pub fn to_ptr_maybe_unsized( } pub fn write_cvalue(self, fx: &mut FunctionCx<'_, 'tcx, impl Backend>, from: CValue<'tcx>) { + #[cfg(debug_assertions)] + { + use cranelift_codegen::cursor::{Cursor, CursorPosition}; + let cur_ebb = match fx.bcx.cursor().position() { + CursorPosition::After(ebb) => ebb, + _ => unreachable!(), + }; + fx.add_comment( + fx.bcx.func.layout.last_inst(cur_ebb).unwrap(), + format!("write_cvalue: {:?} <- {:?}",self, from), + ); + } + let from_ty = from.layout().ty; let to_ty = self.layout().ty; diff --git a/test.sh b/test.sh index 98171bc0f6a..e502a20db5b 100755 --- a/test.sh +++ b/test.sh @@ -4,10 +4,10 @@ set -e if [[ "$1" == "--release" ]]; then export CHANNEL='release' - cargo rustc --release $CG_CLIF_COMPILE_FLAGS -- -Clink-args=-fuse-ld=lld + cargo build --release $CG_CLIF_COMPILE_FLAGS else export CHANNEL='debug' - cargo rustc $CG_CLIF_COMPILE_FLAGS -- -Clink-args=-fuse-ld=lld + cargo build $CG_CLIF_COMPILE_FLAGS fi source config.sh @@ -28,8 +28,6 @@ mkdir -p target/out/clif echo "[BUILD] mini_core" $RUSTC example/mini_core.rs --crate-name mini_core --crate-type lib,dylib -#exit 1 - echo "[BUILD] example" $RUSTC example/example.rs --crate-type lib @@ -71,16 +69,15 @@ $RUSTC example/mod_bench.rs --crate-type bin pushd simple-raytracer echo "[BENCH COMPILE] ebobby/simple-raytracer" -rm -r target/x86_64*/ -../cargo.sh build +hyperfine --runs ${RUN_RUNS:-10} --warmup 1 --prepare "rm -r target/*/debug || true" \ + "RUSTFLAGS='' cargo build --target $TARGET_TRIPLE" \ + "../cargo.sh build" echo "[BENCH RUN] ebobby/simple-raytracer" cp ./target/*/debug/main ./raytracer_cg_clif -hyperfine --runs ${RUN_RUNS:-10} ./raytracer_* +hyperfine --runs ${RUN_RUNS:-10} ./raytracer_cg_llvm ./raytracer_cg_clif popd -exit 1 - pushd build_sysroot/sysroot_src/src/libcore/tests rm -r ./target || true ../../../../../cargo.sh test