Skip to content
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

remove type_use #9538

Merged
merged 1 commit into from
Sep 27, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 0 additions & 79 deletions src/etc/monodebug.pl

This file was deleted.

1 change: 0 additions & 1 deletion src/etc/zsh/_rust
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ _rustc_opts_debug=(
'count-type-sizes:count the sizes of aggregate types'
'meta-stats:gather metadata statistics'
'no-opt:do not optimize, even if -O is passed'
'no-monomorphic-collapse:do not collapse template instantiations'
'print-link-args:Print the arguments passed to the linker'
'gc:Garbage collect shared data (experimental)'
'jit:Execute using JIT (experimental)'
Expand Down
7 changes: 0 additions & 7 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,13 +748,6 @@ pub fn build_session_options(binary: @str,
let debuginfo = debugging_opts & session::debug_info != 0 ||
extra_debuginfo;

// If debugging info is generated, do not collapse monomorphized function instances.
// Functions with equivalent llvm code still need separate debugging descriptions because names
// might differ.
if debuginfo {
debugging_opts |= session::no_monomorphic_collapse;
}

let statik = debugging_opts & session::statik != 0;

let addl_lib_search_paths = matches.opt_strs("L").map(|s| Path(*s));
Expand Down
32 changes: 13 additions & 19 deletions src/librustc/driver/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,19 @@ pub static debug_llvm: uint = 1 << 13;
pub static count_type_sizes: uint = 1 << 14;
pub static meta_stats: uint = 1 << 15;
pub static no_opt: uint = 1 << 16;
pub static no_monomorphic_collapse: uint = 1 << 17;
pub static gc: uint = 1 << 18;
pub static jit: uint = 1 << 19;
pub static debug_info: uint = 1 << 20;
pub static extra_debug_info: uint = 1 << 21;
pub static statik: uint = 1 << 22;
pub static print_link_args: uint = 1 << 23;
pub static no_debug_borrows: uint = 1 << 24;
pub static lint_llvm: uint = 1 << 25;
pub static once_fns: uint = 1 << 26;
pub static print_llvm_passes: uint = 1 << 27;
pub static no_vectorize_loops: uint = 1 << 28;
pub static no_vectorize_slp: uint = 1 << 29;
pub static no_prepopulate_passes: uint = 1 << 30;
pub static gc: uint = 1 << 17;
pub static jit: uint = 1 << 18;
pub static debug_info: uint = 1 << 19;
pub static extra_debug_info: uint = 1 << 20;
pub static statik: uint = 1 << 21;
pub static print_link_args: uint = 1 << 22;
pub static no_debug_borrows: uint = 1 << 23;
pub static lint_llvm: uint = 1 << 24;
pub static once_fns: uint = 1 << 25;
pub static print_llvm_passes: uint = 1 << 26;
pub static no_vectorize_loops: uint = 1 << 27;
pub static no_vectorize_slp: uint = 1 << 28;
pub static no_prepopulate_passes: uint = 1 << 29;

pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
~[(~"verbose", ~"in general, enable more debug printouts", verbose),
Expand All @@ -106,8 +105,6 @@ pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
count_type_sizes),
(~"meta-stats", ~"gather metadata statistics", meta_stats),
(~"no-opt", ~"do not optimize, even if -O is passed", no_opt),
(~"no-monomorphic-collapse", ~"do not collapse template instantiations",
no_monomorphic_collapse),
(~"print-link-args", ~"Print the arguments passed to the linker", print_link_args),
(~"gc", ~"Garbage collect shared data (experimental)", gc),
(~"jit", ~"Execute using JIT (experimental)", jit),
Expand Down Expand Up @@ -326,9 +323,6 @@ impl Session_ {
pub fn borrowck_note_loan(&self) -> bool {
self.debugging_opt(borrowck_note_loan)
}
pub fn no_monomorphic_collapse(&self) -> bool {
self.debugging_opt(no_monomorphic_collapse)
}
pub fn debug_borrows(&self) -> bool {
self.opts.optimize == No && !self.debugging_opt(no_debug_borrows)
}
Expand Down
4 changes: 0 additions & 4 deletions src/librustc/middle/trans/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use middle::trans::adt;
use middle::trans::base;
use middle::trans::builder::Builder;
use middle::trans::debuginfo;
use middle::trans::type_use;
use middle::trans::common::{C_i32, C_null};
use middle::ty;

Expand Down Expand Up @@ -73,8 +72,6 @@ pub struct CrateContext {
// Cache instances of monomorphized functions
monomorphized: HashMap<mono_id, ValueRef>,
monomorphizing: HashMap<ast::DefId, uint>,
// Cache computed type parameter uses (see type_use.rs)
type_use_cache: HashMap<ast::DefId, @~[type_use::type_uses]>,
// Cache generated vtables
vtables: HashMap<(ty::t, mono_id), ValueRef>,
// Cache of constant strings,
Expand Down Expand Up @@ -204,7 +201,6 @@ impl CrateContext {
non_inlineable_statics: HashSet::new(),
monomorphized: HashMap::new(),
monomorphizing: HashMap::new(),
type_use_cache: HashMap::new(),
vtables: HashMap::new(),
const_cstr_cache: HashMap::new(),
const_globals: HashMap::new(),
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/middle/trans/meth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,7 @@ pub fn vtable_id(ccx: @mut CrateContext,
monomorphize::make_mono_id(
ccx,
impl_id,
&psubsts,
None)
&psubsts)
}

// can't this be checked at the callee?
Expand Down
1 change: 0 additions & 1 deletion src/librustc/middle/trans/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ pub mod foreign;
pub mod intrinsic;
pub mod reflect;
pub mod debuginfo;
pub mod type_use;
pub mod machine;
pub mod adt;
pub mod asm;
Expand Down
71 changes: 7 additions & 64 deletions src/librustc/middle/trans/monomorphize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ use middle::trans::base::{trans_fn, decl_internal_rust_fn};
use middle::trans::base::{get_item_val, no_self};
use middle::trans::base;
use middle::trans::common::*;
use middle::trans::datum;
use middle::trans::machine;
use middle::trans::meth;
use middle::trans::type_of;
use middle::trans::type_use;
use middle::trans::intrinsic;
use middle::ty;
use middle::typeck;
use util::ppaux::{Repr,ty_to_str};
use util::ppaux::Repr;

use syntax::ast;
use syntax::ast_map;
Expand Down Expand Up @@ -65,10 +61,8 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,

for s in real_substs.tps.iter() { assert!(!ty::type_has_params(*s)); }
for s in psubsts.tys.iter() { assert!(!ty::type_has_params(*s)); }
let param_uses = type_use::type_uses_for(ccx, fn_id, psubsts.tys.len());


let hash_id = make_mono_id(ccx, fn_id, &*psubsts, Some(param_uses));
let hash_id = make_mono_id(ccx, fn_id, &*psubsts);
if hash_id.params.iter().any(
|p| match *p { mono_precise(_, _) => false, _ => true }) {
must_cast = true;
Expand Down Expand Up @@ -302,8 +296,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,

pub fn make_mono_id(ccx: @mut CrateContext,
item: ast::DefId,
substs: &param_substs,
param_uses: Option<@~[type_use::type_uses]>) -> mono_id {
substs: &param_substs) -> mono_id {
// FIXME (possibly #5801): Need a lot of type hints to get
// .collect() to work.
let substs_iter = substs.self_ty.iter().chain(substs.tys.iter());
Expand All @@ -321,59 +314,9 @@ pub fn make_mono_id(ccx: @mut CrateContext,
};


let param_ids = match param_uses {
Some(ref uses) => {
// param_uses doesn't include a use for the self type.
// We just say it is fully used.
let self_use =
substs.self_ty.map(|_| type_use::use_repr|type_use::use_tydesc);
let uses_iter = self_use.iter().chain(uses.iter());

precise_param_ids.iter().zip(uses_iter).map(|(id, uses)| {
if ccx.sess.no_monomorphic_collapse() {
match *id {
(a, b) => mono_precise(a, b)
}
} else {
match *id {
(a, b@Some(_)) => mono_precise(a, b),
(subst, None) => {
if *uses == 0 {
mono_any
} else if *uses == type_use::use_repr &&
!ty::type_needs_drop(ccx.tcx, subst)
{
let llty = type_of::type_of(ccx, subst);
let size = machine::llbitsize_of_real(ccx, llty);
let align = machine::llalign_of_min(ccx, llty);
let mode = datum::appropriate_mode(ccx.tcx, subst);
let data_class = mono_data_classify(subst);

debug!("make_mono_id: type %s -> size %u align %u mode %? class %?",
ty_to_str(ccx.tcx, subst),
size, align, mode, data_class);

// Special value for nil to prevent problems
// with undef return pointers.
if size <= 8u && ty::type_is_nil(subst) {
mono_repr(0u, 0u, data_class, mode)
} else {
mono_repr(size, align, data_class, mode)
}
} else {
mono_precise(subst, None)
}
}
}
}
}).collect()
}
None => {
precise_param_ids.iter().map(|x| {
let (a, b) = *x;
mono_precise(a, b)
}).collect()
}
};
let param_ids = precise_param_ids.iter().map(|x| {
let (a, b) = *x;
mono_precise(a, b)
}).collect();
@mono_id_ {def: item, params: param_ids}
}
Loading