-
Notifications
You must be signed in to change notification settings - Fork 14k
Simplify jemalloc setup
#146627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify jemalloc setup
#146627
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,11 +61,6 @@ extern crate rustc_target; | |
| extern crate rustc_trait_selection; | ||
| extern crate test; | ||
|
|
||
| // See docs in https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc/src/main.rs | ||
| // about jemalloc. | ||
| #[cfg(feature = "jemalloc")] | ||
| extern crate tikv_jemalloc_sys as jemalloc_sys; | ||
|
|
||
| use std::env::{self, VarError}; | ||
| use std::io::{self, IsTerminal}; | ||
| use std::path::Path; | ||
|
|
@@ -77,6 +72,10 @@ use rustc_interface::interface; | |
| use rustc_middle::ty::TyCtxt; | ||
| use rustc_session::config::{ErrorOutputType, RustcOptGroup, make_crate_type_option}; | ||
| use rustc_session::{EarlyDiagCtxt, getopts}; | ||
| /// See docs in https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc/src/main.rs | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you also link to this PR here? It's much easier for someone to accidentally change something in rustc and this reference to go stale, while if you link to this PR the reasoning always stays clear. r=me after that @rustbot author
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or perhaps pin the reference to a commit?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went with: /// See docs in https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc/src/main.rs
/// and https://github.com/rust-lang/rust/pull/146627 for why we need this `use` statement.
(There wasn't really a commit I could pin it to while changing the contents in the same commit). |
||
| /// and https://github.com/rust-lang/rust/pull/146627 for why we need this `use` statement. | ||
| #[cfg(feature = "jemalloc")] | ||
| use tikv_jemalloc_sys as _; | ||
| use tracing::info; | ||
|
|
||
| use crate::clean::utils::DOC_RUST_LANG_ORG_VERSION; | ||
|
|
@@ -124,37 +123,6 @@ mod visit_ast; | |
| mod visit_lib; | ||
|
|
||
| pub fn main() { | ||
| // See docs in https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc/src/main.rs | ||
| // about jemalloc. | ||
| #[cfg(feature = "jemalloc")] | ||
| { | ||
| use std::os::raw::{c_int, c_void}; | ||
|
|
||
| #[used] | ||
| static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::calloc; | ||
| #[used] | ||
| static _F2: unsafe extern "C" fn(*mut *mut c_void, usize, usize) -> c_int = | ||
| jemalloc_sys::posix_memalign; | ||
| #[used] | ||
| static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::aligned_alloc; | ||
| #[used] | ||
| static _F4: unsafe extern "C" fn(usize) -> *mut c_void = jemalloc_sys::malloc; | ||
| #[used] | ||
| static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = jemalloc_sys::realloc; | ||
| #[used] | ||
| static _F6: unsafe extern "C" fn(*mut c_void) = jemalloc_sys::free; | ||
|
|
||
| #[cfg(target_os = "macos")] | ||
| { | ||
| unsafe extern "C" { | ||
| fn _rjem_je_zone_register(); | ||
| } | ||
|
|
||
| #[used] | ||
| static _F7: unsafe extern "C" fn() = _rjem_je_zone_register; | ||
| } | ||
| } | ||
|
|
||
| let mut early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default()); | ||
|
|
||
| rustc_driver::install_ice_hook( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.