Skip to content

Commit f4b1f76

Browse files
committed
LLVM crash
1 parent 0b49e30 commit f4b1f76

File tree

5 files changed

+23
-32
lines changed

5 files changed

+23
-32
lines changed

src/Cargo.lock

Lines changed: 0 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/librustc/Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,6 @@ lazy_static = "1.0.0"
5757
# compiles, then please feel free to do so!
5858
flate2 = "0.2"
5959

60-
[target.'cfg(target_arch = "x86")'.dependencies]
61-
x86 = { git = "https://github.com/gz/rust-x86.git" }
62-
63-
[target.'cfg(target_arch = "x86_64")'.dependencies]
64-
x86 = { git = "https://github.com/gz/rust-x86.git" }
65-
6660
[target.'cfg(windows)'.dependencies]
6761
kernel32-sys = "0.2.2"
6862
winapi = "0.2.8"

src/librustc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
html_root_url = "https://doc.rust-lang.org/nightly/")]
4141
#![deny(warnings)]
4242

43+
#![feature(asm)]
4344
#![feature(box_patterns)]
4445
#![feature(box_syntax)]
4546
#![feature(conservative_impl_trait)]
@@ -82,7 +83,6 @@ extern crate libc;
8283
extern crate kernel32;
8384
#[cfg(windows)]
8485
extern crate winapi;
85-
extern crate x86;
8686
extern crate owning_ref;
8787
extern crate rustc_back;
8888
#[macro_use] extern crate rustc_data_structures;

src/librustc/util/common.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,22 @@ fn time_threads_impl<T, F>(what: &str, f: F) -> T where
160160
{
161161
use rayon_core::registry;
162162
use std::iter;
163-
use x86;
164163
use winapi;
165164
use kernel32;
166165

166+
#[allow(unused_mut)]
167+
fn read_counter() -> u64 {
168+
let mut low: u32;
169+
let mut high: u32;
170+
171+
unsafe {
172+
asm!("xor %%rax, %%rax; cpuid; rdtsc"
173+
: "={eax}" (low), "={edx}" (high) :: "memory,rbx,rcx");
174+
}
175+
176+
((high as u64) << 32) | (low as u64)
177+
}
178+
167179
let registry = registry::get_current_registry();
168180
if let Some(registry) = registry {
169181
let freq = unsafe {
@@ -186,9 +198,10 @@ fn time_threads_impl<T, F>(what: &str, f: F) -> T where
186198
assert!(kernel32::QueryThreadCycleTime(handle, &mut begin[i]) == winapi::TRUE);
187199
}
188200
}
189-
let time_start = unsafe { x86::shared::time::rdtsc() };
201+
202+
let time_start = read_counter();
190203
let result = f();
191-
let time_end = unsafe { x86::shared::time::rdtsc() };
204+
let time_end = read_counter();
192205
for (i, &handle) in threads.iter().enumerate() {
193206
unsafe {
194207
assert!(kernel32::QueryThreadCycleTime(handle, &mut end[i]) == winapi::TRUE);

src/librustc_driver/driver.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,9 +787,13 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
787787
let mut ecx = ExtCtxt::new(&sess.parse_sess, cfg, &mut resolver);
788788
let err_count = ecx.parse_sess.span_diagnostic.err_count();
789789

790-
let krate = ecx.monotonic_expander().expand_crate(krate);
790+
let krate = time(time_passes, "expand crate", || {
791+
ecx.monotonic_expander().expand_crate(krate);
792+
});
791793

792-
ecx.check_unused_macros();
794+
time(time_passes, "check unused macros", || {
795+
ecx.check_unused_macros();
796+
});
793797

794798
let mut missing_fragment_specifiers: Vec<_> =
795799
ecx.parse_sess.missing_fragment_specifiers.borrow().iter().cloned().collect();

0 commit comments

Comments
 (0)