提交 048ed148 编写于 作者: J James Miller 提交者: James Miller

Move count-llvm-insn code into task-local storage

上级 0b0c756c
......@@ -259,7 +259,7 @@ pub enum opt_result {
range_result(Result, Result),
}
pub fn trans_opt(bcx: block, o: &Opt) -> opt_result {
let _icx = bcx.insn_ctxt("match::trans_opt");
let _icx = push_ctxt("match::trans_opt");
let ccx = bcx.ccx();
let bcx = bcx;
match *o {
......@@ -870,7 +870,7 @@ pub fn extract_variant_args(bcx: block,
disr_val: int,
val: ValueRef)
-> ExtractedBlock {
let _icx = bcx.insn_ctxt("match::extract_variant_args");
let _icx = push_ctxt("match::extract_variant_args");
let args = do vec::from_fn(adt::num_args(repr, disr_val)) |i| {
adt::trans_field_ptr(bcx, repr, val, disr_val, i)
};
......@@ -896,7 +896,7 @@ pub fn extract_vec_elems(bcx: block,
val: ValueRef,
count: ValueRef)
-> ExtractedBlock {
let _icx = bcx.insn_ctxt("match::extract_vec_elems");
let _icx = push_ctxt("match::extract_vec_elems");
let vec_datum = match_datum(bcx, val, pat_id);
let (bcx, base, len) = vec_datum.get_vec_base_and_len(bcx, pat_span,
pat_id, 0);
......@@ -1088,7 +1088,7 @@ pub fn compare_values(cx: block,
rhs: ValueRef,
rhs_t: ty::t)
-> Result {
let _icx = cx.insn_ctxt("compare_values");
let _icx = push_ctxt("compare_values");
if ty::type_is_scalar(rhs_t) {
let rs = compare_scalar_types(cx, lhs, rhs, rhs_t, ast::eq);
return rslt(rs.bcx, rs.val);
......@@ -1277,7 +1277,7 @@ pub fn compile_submatch(bcx: block,
For an empty match, a fall-through case must exist
*/
assert!((m.len() > 0u || chk.is_some()));
let _icx = bcx.insn_ctxt("match::compile_submatch");
let _icx = push_ctxt("match::compile_submatch");
let mut bcx = bcx;
let tcx = bcx.tcx();
let dm = tcx.def_map;
......@@ -1617,7 +1617,7 @@ pub fn trans_match(bcx: block,
discr_expr: @ast::expr,
arms: ~[ast::arm],
dest: Dest) -> block {
let _icx = bcx.insn_ctxt("match::trans_match");
let _icx = push_ctxt("match::trans_match");
do with_scope(bcx, match_expr.info(), "match") |bcx| {
trans_match_inner(bcx, discr_expr, arms, dest)
}
......@@ -1664,7 +1664,7 @@ pub fn trans_match_inner(scope_cx: block,
discr_expr: @ast::expr,
arms: &[ast::arm],
dest: Dest) -> block {
let _icx = scope_cx.insn_ctxt("match::trans_match_inner");
let _icx = push_ctxt("match::trans_match_inner");
let mut bcx = scope_cx;
let tcx = bcx.tcx();
......@@ -1751,7 +1751,7 @@ pub fn bind_irrefutable_pat(bcx: block,
make_copy: bool,
binding_mode: IrrefutablePatternBindingMode)
-> block {
let _icx = bcx.insn_ctxt("match::bind_irrefutable_pat");
let _icx = push_ctxt("match::bind_irrefutable_pat");
let ccx = bcx.fcx.ccx;
let mut bcx = bcx;
......
此差异已折叠。
......@@ -19,6 +19,7 @@
use middle::trans::machine::llalign_of_min;
use syntax::codemap::span;
use middle::trans::base;
use middle::trans::type_::Type;
use core::cast;
......@@ -46,10 +47,8 @@ pub fn B(cx: block) -> BuilderRef {
}
pub fn count_insn(cx: block, category: &str) {
if cx.ccx().sess.count_llvm_insns() {
do base::with_insn_ctxt |v| {
let h = &mut cx.ccx().stats.llvm_insns;
let v : &[~str] = cx.ccx().stats.llvm_insn_ctxt;
// Build version of path with cycles removed.
......
......@@ -78,7 +78,7 @@ pub struct Callee {
}
pub fn trans(bcx: block, expr: @ast::expr) -> Callee {
let _icx = bcx.insn_ctxt("trans_callee");
let _icx = push_ctxt("trans_callee");
debug!("callee::trans(expr=%s)", expr.repr(bcx.tcx()));
// pick out special kinds of expressions that can be called:
......@@ -172,7 +172,7 @@ pub fn trans_fn_ref(bcx: block,
* with id `def_id` into a function pointer. This may require
* monomorphization or inlining. */
let _icx = bcx.insn_ctxt("trans_fn_ref");
let _icx = push_ctxt("trans_fn_ref");
let type_params = node_id_type_params(bcx, ref_id);
let vtables = node_vtables(bcx, ref_id);
......@@ -216,7 +216,7 @@ pub fn trans_fn_ref_with_vtables(
// - `type_params`: values for each of the fn/method's type parameters
// - `vtables`: values for each bound on each of the type parameters
let _icx = bcx.insn_ctxt("trans_fn_ref_with_vtables");
let _icx = push_ctxt("trans_fn_ref_with_vtables");
let ccx = bcx.ccx();
let tcx = ccx.tcx;
......@@ -357,7 +357,7 @@ pub fn trans_call(in_cx: block,
id: ast::node_id,
dest: expr::Dest)
-> block {
let _icx = in_cx.insn_ctxt("trans_call");
let _icx = push_ctxt("trans_call");
trans_call_inner(in_cx,
call_ex.info(),
expr_ty(in_cx, f),
......@@ -375,7 +375,7 @@ pub fn trans_method_call(in_cx: block,
args: CallArgs,
dest: expr::Dest)
-> block {
let _icx = in_cx.insn_ctxt("trans_method_call");
let _icx = push_ctxt("trans_method_call");
debug!("trans_method_call(call_ex=%s, rcvr=%s)",
call_ex.repr(in_cx.tcx()),
rcvr.repr(in_cx.tcx()));
......@@ -671,7 +671,7 @@ pub fn trans_args(cx: block,
autoref_arg: AutorefArg,
llargs: &mut ~[ValueRef]) -> block
{
let _icx = cx.insn_ctxt("trans_args");
let _icx = push_ctxt("trans_args");
let mut temp_cleanups = ~[];
let arg_tys = ty::ty_fn_args(fn_ty);
......@@ -725,7 +725,7 @@ pub fn trans_arg_expr(bcx: block,
temp_cleanups: &mut ~[ValueRef],
ret_flag: Option<ValueRef>,
autoref_arg: AutorefArg) -> Result {
let _icx = bcx.insn_ctxt("trans_arg_expr");
let _icx = push_ctxt("trans_arg_expr");
let ccx = bcx.ccx();
debug!("trans_arg_expr(formal_arg_ty=(%s), self_mode=%?, arg_expr=%s, \
......
......@@ -162,12 +162,12 @@ pub fn mk_closure_tys(tcx: ty::ctxt,
pub fn allocate_cbox(bcx: block, sigil: ast::Sigil, cdata_ty: ty::t)
-> Result {
let _icx = bcx.insn_ctxt("closure::allocate_cbox");
let _icx = push_ctxt("closure::allocate_cbox");
let ccx = bcx.ccx();
let tcx = ccx.tcx;
fn nuke_ref_count(bcx: block, llbox: ValueRef) {
let _icx = bcx.insn_ctxt("closure::nuke_ref_count");
let _icx = push_ctxt("closure::nuke_ref_count");
// Initialize ref count to arbitrary value for debugging:
let ccx = bcx.ccx();
let llbox = PointerCast(bcx, llbox, Type::opaque_box(ccx).ptr_to());
......@@ -206,7 +206,7 @@ pub struct ClosureResult {
pub fn store_environment(bcx: block,
bound_values: ~[EnvValue],
sigil: ast::Sigil) -> ClosureResult {
let _icx = bcx.insn_ctxt("closure::store_environment");
let _icx = push_ctxt("closure::store_environment");
let ccx = bcx.ccx();
let tcx = ccx.tcx;
......@@ -260,7 +260,7 @@ pub fn build_closure(bcx0: block,
cap_vars: &[moves::CaptureVar],
sigil: ast::Sigil,
include_ret_handle: Option<ValueRef>) -> ClosureResult {
let _icx = bcx0.insn_ctxt("closure::build_closure");
let _icx = push_ctxt("closure::build_closure");
// If we need to, package up the iterator body to call
let bcx = bcx0;
......@@ -322,7 +322,7 @@ pub fn load_environment(fcx: fn_ctxt,
cap_vars: &[moves::CaptureVar],
load_ret_handle: bool,
sigil: ast::Sigil) {
let _icx = fcx.insn_ctxt("closure::load_environment");
let _icx = push_ctxt("closure::load_environment");
let llloadenv = match fcx.llloadenv {
Some(ll) => ll,
......@@ -393,7 +393,7 @@ pub fn trans_expr_fn(bcx: block,
(fn ptr, env) pair
*/
let _icx = bcx.insn_ctxt("closure::trans_expr_fn");
let _icx = push_ctxt("closure::trans_expr_fn");
let dest_addr = match dest {
expr::SaveIn(p) => p,
......@@ -470,7 +470,7 @@ pub fn make_closure_glue(
v: ValueRef,
t: ty::t,
glue_fn: @fn(block, v: ValueRef, t: ty::t) -> block) -> block {
let _icx = cx.insn_ctxt("closure::make_closure_glue");
let _icx = push_ctxt("closure::make_closure_glue");
let bcx = cx;
let tcx = cx.tcx();
......@@ -494,7 +494,7 @@ pub fn make_opaque_cbox_take_glue(
cboxptr: ValueRef) // ptr to ptr to the opaque closure
-> block {
// Easy cases:
let _icx = bcx.insn_ctxt("closure::make_opaque_cbox_take_glue");
let _icx = push_ctxt("closure::make_opaque_cbox_take_glue");
match sigil {
ast::BorrowedSigil => {
return bcx;
......@@ -553,7 +553,7 @@ pub fn make_opaque_cbox_drop_glue(
sigil: ast::Sigil,
cboxptr: ValueRef) // ptr to the opaque closure
-> block {
let _icx = bcx.insn_ctxt("closure::make_opaque_cbox_drop_glue");
let _icx = push_ctxt("closure::make_opaque_cbox_drop_glue");
match sigil {
ast::BorrowedSigil => bcx,
ast::ManagedSigil => {
......@@ -574,7 +574,7 @@ pub fn make_opaque_cbox_free_glue(
sigil: ast::Sigil,
cbox: ValueRef) // ptr to ptr to the opaque closure
-> block {
let _icx = bcx.insn_ctxt("closure::make_opaque_cbox_free_glue");
let _icx = push_ctxt("closure::make_opaque_cbox_free_glue");
match sigil {
ast::BorrowedSigil => {
return bcx;
......
......@@ -101,7 +101,6 @@ pub struct Stats {
n_monos: uint,
n_inlines: uint,
n_closures: uint,
llvm_insn_ctxt: ~[~str],
llvm_insns: HashMap<~str, uint>,
fn_times: ~[(~str, int)] // (ident, time)
}
......
......@@ -19,7 +19,7 @@
use middle::const_eval;
use middle::trans::adt;
use middle::trans::base;
use middle::trans::base::get_insn_ctxt;
use middle::trans::base::push_ctxt;
use middle::trans::common::*;
use middle::trans::consts;
use middle::trans::expr;
......@@ -37,7 +37,7 @@
pub fn const_lit(cx: @mut CrateContext, e: @ast::expr, lit: ast::lit)
-> ValueRef {
let _icx = cx.insn_ctxt("trans_lit");
let _icx = push_ctxt("trans_lit");
match lit.node {
ast::lit_int(i, t) => C_integral(Type::int_from_ty(cx, t), i as u64, true),
ast::lit_uint(u, t) => C_integral(Type::uint_from_ty(cx, t), u, false),
......@@ -249,7 +249,7 @@ pub fn const_expr(cx: @mut CrateContext, e: @ast::expr) -> ValueRef {
fn const_expr_unadjusted(cx: @mut CrateContext, e: @ast::expr) -> ValueRef {
unsafe {
let _icx = cx.insn_ctxt("const_expr");
let _icx = push_ctxt("const_expr");
return match e.node {
ast::expr_lit(lit) => consts::const_lit(cx, e, *lit),
ast::expr_binary(_, b, e1, e2) => {
......@@ -589,7 +589,7 @@ fn const_expr_unadjusted(cx: @mut CrateContext, e: @ast::expr) -> ValueRef {
pub fn trans_const(ccx: @mut CrateContext, _e: @ast::expr, id: ast::node_id) {
unsafe {
let _icx = ccx.insn_ctxt("trans_const");
let _icx = push_ctxt("trans_const");
let g = base::get_item_val(ccx, id);
// At this point, get_item_val has already translated the
// constant's initializer to determine its LLVM type.
......
......@@ -162,6 +162,10 @@ pub fn new(sess: session::Session, name: &str, tcx: ty::ctxt,
None
};
if sess.count_llvm_insns() {
base::init_insn_ctxt()
}
CrateContext {
sess: sess,
llmod: llmod,
......@@ -210,7 +214,6 @@ pub fn new(sess: session::Session, name: &str, tcx: ty::ctxt,
n_monos: 0u,
n_inlines: 0u,
n_closures: 0u,
llvm_insn_ctxt: ~[],
llvm_insns: HashMap::new(),
fn_times: ~[]
},
......@@ -234,7 +237,6 @@ pub fn log_fn_time(&mut self, name: ~str, start: time::Timespec, end: time::Time
((end.nsec as int) - (start.nsec as int)) / 1000000;
self.stats.fn_times.push((name, elapsed));
}
}
#[unsafe_destructor]
......@@ -247,7 +249,6 @@ fn finalize(&self) {
}
fn task_local_llcx_key(_v: @ContextRef) {}
pub fn task_llcx() -> ContextRef {
let opt = unsafe { local_data::local_data_get(task_local_llcx_key) };
*opt.expect("task-local LLVMContextRef wasn't ever set!")
......
......@@ -35,7 +35,7 @@
use syntax::codemap::span;
pub fn trans_block(bcx: block, b: &ast::blk, dest: expr::Dest) -> block {
let _icx = bcx.insn_ctxt("trans_block");
let _icx = push_ctxt("trans_block");
let mut bcx = bcx;
do block_locals(b) |local| {
bcx = alloc_local(bcx, local);
......@@ -67,7 +67,7 @@ pub fn trans_if(bcx: block,
dest.to_str(bcx.ccx()));
let _indenter = indenter();
let _icx = bcx.insn_ctxt("trans_if");
let _icx = push_ctxt("trans_if");
let Result {bcx, val: cond_val} =
expr::trans_to_datum(bcx, cond).to_result();
......@@ -126,7 +126,7 @@ pub fn join_blocks(parent_bcx: block, in_cxs: &[block]) -> block {
}
pub fn trans_while(bcx: block, cond: @ast::expr, body: &ast::blk) -> block {
let _icx = bcx.insn_ctxt("trans_while");
let _icx = push_ctxt("trans_while");
let next_bcx = sub_block(bcx, "while next");
// bcx
......@@ -168,7 +168,7 @@ pub fn trans_loop(bcx:block,
body: &ast::blk,
opt_label: Option<ident>)
-> block {
let _icx = bcx.insn_ctxt("trans_loop");
let _icx = push_ctxt("trans_loop");
let next_bcx = sub_block(bcx, "next");
let body_bcx_in = loop_scope_block(bcx, next_bcx, opt_label, "`loop`",
body.info());
......@@ -182,7 +182,7 @@ pub fn trans_log(log_ex: @ast::expr,
lvl: @ast::expr,
bcx: block,
e: @ast::expr) -> block {
let _icx = bcx.insn_ctxt("trans_log");
let _icx = push_ctxt("trans_log");
let ccx = bcx.ccx();
let mut bcx = bcx;
if ty::type_is_bot(expr_ty(bcx, lvl)) {
......@@ -244,7 +244,7 @@ pub fn trans_break_cont(bcx: block,
opt_label: Option<ident>,
to_end: bool)
-> block {
let _icx = bcx.insn_ctxt("trans_break_cont");
let _icx = push_ctxt("trans_break_cont");
// Locate closest loop block, outputting cleanup as we go.
let mut unwind = bcx;
let mut target;
......@@ -298,7 +298,7 @@ pub fn trans_cont(bcx: block, label_opt: Option<ident>) -> block {
}
pub fn trans_ret(bcx: block, e: Option<@ast::expr>) -> block {
let _icx = bcx.insn_ctxt("trans_ret");
let _icx = push_ctxt("trans_ret");
let mut bcx = bcx;
let dest = match copy bcx.fcx.loop_ret {
Some((flagptr, retptr)) => {
......@@ -333,7 +333,7 @@ pub fn trans_fail_expr(bcx: block,
sp_opt: Option<span>,
fail_expr: Option<@ast::expr>)
-> block {
let _icx = bcx.insn_ctxt("trans_fail_expr");
let _icx = push_ctxt("trans_fail_expr");
let mut bcx = bcx;
match fail_expr {
Some(arg_expr) => {
......@@ -361,7 +361,7 @@ pub fn trans_fail(bcx: block,
sp_opt: Option<span>,
fail_str: @str)
-> block {
let _icx = bcx.insn_ctxt("trans_fail");
let _icx = push_ctxt("trans_fail");
let V_fail_str = C_cstr(bcx.ccx(), fail_str);
return trans_fail_value(bcx, sp_opt, V_fail_str);
}
......@@ -370,7 +370,7 @@ fn trans_fail_value(bcx: block,
sp_opt: Option<span>,
V_fail_str: ValueRef)
-> block {
let _icx = bcx.insn_ctxt("trans_fail_value");
let _icx = push_ctxt("trans_fail_value");
let ccx = bcx.ccx();
let (V_filename, V_line) = match sp_opt {
Some(sp) => {
......@@ -394,7 +394,7 @@ fn trans_fail_value(bcx: block,
pub fn trans_fail_bounds_check(bcx: block, sp: span,
index: ValueRef, len: ValueRef) -> block {
let _icx = bcx.insn_ctxt("trans_fail_bounds_check");
let _icx = push_ctxt("trans_fail_bounds_check");
let (filename, line) = filename_and_line_num_from_span(bcx, sp);
let args = ~[filename, line, index, len];
let bcx = callee::trans_lang_call(
......
......@@ -273,7 +273,7 @@ pub fn copy_to(&self, bcx: block, action: CopyAction, dst: ValueRef)
* `store_to()` instead, which will move if possible but copy if
* neccessary. */
let _icx = bcx.insn_ctxt("copy_to");
let _icx = push_ctxt("copy_to");
if ty::type_is_nil(self.ty) || ty::type_is_bot(self.ty) {
return bcx;
......@@ -317,7 +317,7 @@ pub fn copy_to_no_check(&self,
* A helper for `copy_to()` which does not check to see if we
* are copying to/from the same value. */
let _icx = bcx.insn_ctxt("copy_to_no_check");
let _icx = push_ctxt("copy_to_no_check");
let mut bcx = bcx;
if action == DROP_EXISTING {
......@@ -341,7 +341,7 @@ pub fn copy_to_no_check(&self,
//
pub fn move_to(&self, bcx: block, action: CopyAction, dst: ValueRef)
-> block {
let _icx = bcx.insn_ctxt("move_to");
let _icx = push_ctxt("move_to");
let mut bcx = bcx;
debug!("move_to(self=%s, action=%?, dst=%s)",
......@@ -740,7 +740,7 @@ pub fn autoderef(&self,
expr_id: ast::node_id,
max: uint)
-> DatumBlock {
let _icx = bcx.insn_ctxt("autoderef");
let _icx = push_ctxt("autoderef");
debug!("autoderef(expr_id=%d, max=%?, self=%?)",
expr_id, max, self.to_str(bcx.ccx()));
......
......@@ -451,7 +451,7 @@ fn nil(bcx: block, ty: ty::t) -> DatumBlock {
}
fn trans_rvalue_datum_unadjusted(bcx: block, expr: @ast::expr) -> DatumBlock {
let _icx = bcx.insn_ctxt("trans_rvalue_datum_unadjusted");
let _icx = push_ctxt("trans_rvalue_datum_unadjusted");
trace_span!(bcx, expr.span, shorten(bcx.expr_to_str(expr)));
......@@ -502,7 +502,7 @@ fn trans_rvalue_datum_unadjusted(bcx: block, expr: @ast::expr) -> DatumBlock {
fn trans_rvalue_stmt_unadjusted(bcx: block, expr: @ast::expr) -> block {
let mut bcx = bcx;
let _icx = bcx.insn_ctxt("trans_rvalue_stmt");
let _icx = push_ctxt("trans_rvalue_stmt");
if bcx.unreachable {
return bcx;
......@@ -558,7 +558,7 @@ fn trans_rvalue_stmt_unadjusted(bcx: block, expr: @ast::expr) -> block {
fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
dest: Dest) -> block {
let _icx = bcx.insn_ctxt("trans_rvalue_dps_unadjusted");
let _icx = push_ctxt("trans_rvalue_dps_unadjusted");
let tcx = bcx.tcx();
trace_span!(bcx, expr.span, shorten(bcx.expr_to_str(expr)));
......@@ -707,7 +707,7 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
fn trans_def_dps_unadjusted(bcx: block, ref_expr: @ast::expr,
def: ast::def, dest: Dest) -> block {
let _icx = bcx.insn_ctxt("trans_def_dps_unadjusted");
let _icx = push_ctxt("trans_def_dps_unadjusted");
let ccx = bcx.ccx();
let lldest = match dest {
......@@ -755,7 +755,7 @@ fn trans_def_datum_unadjusted(bcx: block,
ref_expr: @ast::expr,
def: ast::def) -> DatumBlock
{
let _icx = bcx.insn_ctxt("trans_def_datum_unadjusted");
let _icx = push_ctxt("trans_def_datum_unadjusted");
match def {
ast::def_fn(did, _) | ast::def_static_method(did, None, _) => {
......@@ -816,7 +816,7 @@ fn trans_lvalue_unadjusted(bcx: block, expr: @ast::expr) -> DatumBlock {
* Translates an lvalue expression, always yielding a by-ref
* datum. Does not apply any adjustments. */
let _icx = bcx.insn_ctxt("trans_lval");
let _icx = push_ctxt("trans_lval");
let mut bcx = bcx;
debug!("trans_lvalue(expr=%s)", bcx.expr_to_str(expr));
......@@ -855,7 +855,7 @@ fn trans_rec_field(bcx: block,
//! Translates `base.field`.
let mut bcx = bcx;
let _icx = bcx.insn_ctxt("trans_rec_field");
let _icx = push_ctxt("trans_rec_field");
let base_datum = unpack_datum!(bcx, trans_to_datum(bcx, base));
let repr = adt::represent_type(bcx.ccx(), base_datum.ty);
......@@ -878,7 +878,7 @@ fn trans_index(bcx: block,
idx: @ast::expr) -> DatumBlock {
//! Translates `base[idx]`.
let _icx = bcx.insn_ctxt("trans_index");
let _icx = push_ctxt("trans_index");
let ccx = bcx.ccx();
let base_ty = expr_ty(bcx, base);
let mut bcx = bcx;
......@@ -942,7 +942,7 @@ fn trans_def_lvalue(bcx: block,
{
//! Translates a reference to a path.
let _icx = bcx.insn_ctxt("trans_def_lvalue");
let _icx = push_ctxt("trans_def_lvalue");
let ccx = bcx.ccx();
match def {
ast::def_const(did) => {
......@@ -1012,7 +1012,7 @@ fn get_val(bcx: block, did: ast::def_id, const_ty: ty::t)
}
pub fn trans_local_var(bcx: block, def: ast::def) -> Datum {
let _icx = bcx.insn_ctxt("trans_local_var");
let _icx = push_ctxt("trans_local_var");
return match def {
ast::def_upvar(nid, _, _, _) => {
......@@ -1143,7 +1143,7 @@ fn trans_rec_or_struct(bcx: block,
id: ast::node_id,
dest: Dest) -> block
{
let _icx = bcx.insn_ctxt("trans_rec");
let _icx = push_ctxt("trans_rec");
let bcx = bcx;
let ty = node_id_type(bcx, id);
......@@ -1217,7 +1217,7 @@ fn trans_adt(bcx: block, repr: &adt::Repr, discr: int,
fields: &[(uint, @ast::expr)],
optbase: Option<StructBaseInfo>,
dest: Dest) -> block {
let _icx = bcx.insn_ctxt("trans_adt");
let _icx = push_ctxt("trans_adt");
let mut bcx = bcx;
let addr = match dest {
Ignore => {
......@@ -1263,7 +1263,7 @@ fn trans_adt(bcx: block, repr: &adt::Repr, discr: int,
fn trans_immediate_lit(bcx: block, expr: @ast::expr,
lit: ast::lit) -> DatumBlock {
// must not be a string constant, that is a RvalueDpsExpr
let _icx = bcx.insn_ctxt("trans_immediate_lit");
let _icx = push_ctxt("trans_immediate_lit");
let ty = expr_ty(bcx, expr);
immediate_rvalue_bcx(bcx, consts::const_lit(bcx.ccx(), expr, lit), ty)
}
......@@ -1272,7 +1272,7 @@ fn trans_unary_datum(bcx: block,
un_expr: @ast::expr,
op: ast::unop,
sub_expr: @ast::expr) -> DatumBlock {
let _icx = bcx.insn_ctxt("trans_unary_datum");
let _icx = push_ctxt("trans_unary_datum");
// if deref, would be LvalueExpr
assert!(op != ast::deref);
......@@ -1333,7 +1333,7 @@ fn trans_boxed_expr(bcx: block,
contents: @ast::expr,
contents_ty: ty::t,
heap: heap) -> DatumBlock {
let _icx = bcx.insn_ctxt("trans_boxed_expr");
let _icx = push_ctxt("trans_boxed_expr");
let base::MallocResult { bcx, box: bx, body } =
base::malloc_general(bcx, contents_ty, heap);
add_clean_free(bcx, bx, heap);
......@@ -1345,7 +1345,7 @@ fn trans_boxed_expr(bcx: block,
fn trans_addr_of(bcx: block, expr: @ast::expr,
subexpr: @ast::expr) -> DatumBlock {
let _icx = bcx.insn_ctxt("trans_addr_of");
let _icx = push_ctxt("trans_addr_of");
let mut bcx = bcx;
let sub_datum = unpack_datum!(bcx, trans_to_datum(bcx, subexpr));
let llval = sub_datum.to_ref_llval(bcx);
......@@ -1361,7 +1361,7 @@ fn trans_eager_binop(bcx: block,
lhs_datum: &Datum,
rhs_datum: &Datum)
-> DatumBlock {
let _icx = bcx.insn_ctxt("trans_eager_binop");
let _icx = push_ctxt("trans_eager_binop");
let lhs = lhs_datum.to_appropriate_llval(bcx);
let lhs_t = lhs_datum.ty;
......@@ -1457,7 +1457,7 @@ fn trans_lazy_binop(bcx: block,
op: lazy_binop_ty,
a: @ast::expr,
b: @ast::expr) -> DatumBlock {
let _icx = bcx.insn_ctxt("trans_lazy_binop");
let _icx = push_ctxt("trans_lazy_binop");
let binop_ty = expr_ty(bcx, binop_expr);
let bcx = bcx;
......@@ -1503,7 +1503,7 @@ fn trans_binary(bcx: block,
lhs: @ast::expr,
rhs: @ast::expr) -> DatumBlock
{
let _icx = bcx.insn_ctxt("trans_binary");
let _icx = push_ctxt("trans_binary");
match op {
ast::and => {
......@@ -1550,7 +1550,7 @@ fn trans_overloaded_op(bcx: block,
fn int_cast(bcx: block, lldsttype: Type, llsrctype: Type,
llsrc: ValueRef, signed: bool) -> ValueRef {
let _icx = bcx.insn_ctxt("int_cast");
let _icx = push_ctxt("int_cast");
unsafe {
let srcsz = llvm::LLVMGetIntTypeWidth(llsrctype.to_ref());
let dstsz = llvm::LLVMGetIntTypeWidth(lldsttype.to_ref());
......@@ -1568,7 +1568,7 @@ fn int_cast(bcx: block, lldsttype: Type, llsrctype: Type,
fn float_cast(bcx: block, lldsttype: Type, llsrctype: Type,
llsrc: ValueRef) -> ValueRef {
let _icx = bcx.insn_ctxt("float_cast");
let _icx = push_ctxt("float_cast");
let srcsz = llsrctype.float_width();
let dstsz = lldsttype.float_width();
return if dstsz > srcsz {
......@@ -1602,7 +1602,7 @@ pub fn cast_type_kind(t: ty::t) -> cast_kind {
fn trans_imm_cast(bcx: block, expr: @ast::expr,
id: ast::node_id) -> DatumBlock {
let _icx = bcx.insn_ctxt("trans_cast");
let _icx = push_ctxt("trans_cast");
let ccx = bcx.ccx();
let t_out = node_id_type(bcx, id);
......@@ -1669,7 +1669,7 @@ fn trans_assign_op(bcx: block,
dst: @ast::expr,
src: @ast::expr) -> block
{
let _icx = bcx.insn_ctxt("trans_assign_op");
let _icx = push_ctxt("trans_assign_op");
let mut bcx = bcx;
debug!("trans_assign_op(expr=%s)", bcx.expr_to_str(expr));
......
......@@ -188,7 +188,7 @@ fn build_wrap_fn_(ccx: @mut CrateContext,
needs_c_return: bool,
arg_builder: wrap_arg_builder,
ret_builder: wrap_ret_builder) {
let _icx = ccx.insn_ctxt("foreign::build_wrap_fn_");
let _icx = push_ctxt("foreign::build_wrap_fn_");
let fcx = new_fn_ctxt(ccx, ~[], llwrapfn, tys.fn_sig.output, None);
// Patch up the return type if it's not immediate and we're returning via
......@@ -274,7 +274,7 @@ fn build_wrap_fn_(ccx: @mut CrateContext,
pub fn trans_foreign_mod(ccx: @mut CrateContext,
path: &ast_map::path,
foreign_mod: &ast::foreign_mod) {
let _icx = ccx.insn_ctxt("foreign::trans_foreign_mod");
let _icx = push_ctxt("foreign::trans_foreign_mod");
let arch = ccx.sess.targ_cfg.arch;
let abi = match foreign_mod.abis.for_arch(arch) {
......@@ -370,11 +370,11 @@ fn build_shim_fn(ccx: @mut CrateContext,
* }
*/
let _icx = ccx.insn_ctxt("foreign::build_shim_fn");
let _icx = push_ctxt("foreign::build_shim_fn");
fn build_args(bcx: block, tys: &ShimTypes, llargbundle: ValueRef)
-> ~[ValueRef] {
let _icx = bcx.insn_ctxt("foreign::shim::build_args");
let _icx = push_ctxt("foreign::shim::build_args");
tys.fn_ty.build_shim_args(bcx, tys.llsig.llarg_tys, llargbundle)
}
......@@ -382,7 +382,7 @@ fn build_ret(bcx: block,
tys: &ShimTypes,
llargbundle: ValueRef,
llretval: ValueRef) {
let _icx = bcx.insn_ctxt("foreign::shim::build_ret");
let _icx = push_ctxt("foreign::shim::build_ret");
tys.fn_ty.build_shim_ret(bcx,
tys.llsig.llarg_tys,
tys.ret_def,
......@@ -488,7 +488,7 @@ fn build_wrap_fn(ccx: @mut CrateContext,
* account for the Rust modes.
*/
let _icx = ccx.insn_ctxt("foreign::build_wrap_fn");
let _icx = push_ctxt("foreign::build_wrap_fn");
build_wrap_fn_(ccx,
tys,
......@@ -503,7 +503,7 @@ fn build_args(bcx: block,
tys: &ShimTypes,
llwrapfn: ValueRef,
llargbundle: ValueRef) {
let _icx = bcx.insn_ctxt("foreign::wrap::build_args");
let _icx = push_ctxt("foreign::wrap::build_args");
let ccx = bcx.ccx();
let n = tys.llsig.llarg_tys.len();
for uint::range(0, n) |i| {
......@@ -528,7 +528,7 @@ fn build_args(bcx: block,
fn build_ret(bcx: block,
shim_types: &ShimTypes,
llargbundle: ValueRef) {
let _icx = bcx.insn_ctxt("foreign::wrap::build_ret");
let _icx = push_ctxt("foreign::wrap::build_ret");
let arg_count = shim_types.fn_sig.inputs.len();
for bcx.fcx.llretptr.iter().advance |&retptr| {
let llretptr = load_inbounds(bcx, llargbundle, [0, arg_count]);
......@@ -1155,7 +1155,7 @@ pub fn trans_foreign_fn(ccx: @mut CrateContext,
body: &ast::blk,
llwrapfn: ValueRef,
id: ast::node_id) {
let _icx = ccx.insn_ctxt("foreign::build_foreign_fn");
let _icx = push_ctxt("foreign::build_foreign_fn");
fn build_rust_fn(ccx: @mut CrateContext,
path: ast_map::path,
......@@ -1163,7 +1163,7 @@ fn build_rust_fn(ccx: @mut CrateContext,
body: &ast::blk,
id: ast::node_id)
-> ValueRef {
let _icx = ccx.insn_ctxt("foreign::foreign::build_rust_fn");
let _icx = push_ctxt("foreign::foreign::build_rust_fn");
let t = ty::node_id_to_type(ccx.tcx, id);
// XXX: Bad copy.
let ps = link::mangle_internal_name_by_path(
......@@ -1205,11 +1205,11 @@ fn build_shim_fn(ccx: @mut CrateContext,
* one of those types that is passed by pointer in Rust.
*/
let _icx = ccx.insn_ctxt("foreign::foreign::build_shim_fn");
let _icx = push_ctxt("foreign::foreign::build_shim_fn");
fn build_args(bcx: block, tys: &ShimTypes, llargbundle: ValueRef)
-> ~[ValueRef] {
let _icx = bcx.insn_ctxt("foreign::extern::shim::build_args");
let _icx = push_ctxt("foreign::extern::shim::build_args");
let ccx = bcx.ccx();
let mut llargvals = ~[];
let mut i = 0u;
......@@ -1284,7 +1284,7 @@ fn build_wrap_fn(ccx: @mut CrateContext,
* }
*/
let _icx = ccx.insn_ctxt("foreign::foreign::build_wrap_fn");
let _icx = push_ctxt("foreign::foreign::build_wrap_fn");
build_wrap_fn_(ccx,
tys,
......@@ -1299,7 +1299,7 @@ fn build_args(bcx: block,
tys: &ShimTypes,
llwrapfn: ValueRef,
llargbundle: ValueRef) {
let _icx = bcx.insn_ctxt("foreign::foreign::wrap::build_args");
let _icx = push_ctxt("foreign::foreign::wrap::build_args");
tys.fn_ty.build_wrap_args(bcx,
tys.llsig.llret_ty,
llwrapfn,
......@@ -1307,7 +1307,7 @@ fn build_args(bcx: block,
}
fn build_ret(bcx: block, tys: &ShimTypes, llargbundle: ValueRef) {
let _icx = bcx.insn_ctxt("foreign::foreign::wrap::build_ret");
let _icx = push_ctxt("foreign::foreign::wrap::build_ret");
tys.fn_ty.build_wrap_ret(bcx, tys.llsig.llarg_tys, llargbundle);
build_return(bcx);
}
......@@ -1329,7 +1329,7 @@ pub fn register_foreign_fn(ccx: @mut CrateContext,
node_id: ast::node_id,
attrs: &[ast::attribute])
-> ValueRef {
let _icx = ccx.insn_ctxt("foreign::register_foreign_fn");
let _icx = push_ctxt("foreign::register_foreign_fn");
let t = ty::node_id_to_type(ccx.tcx, node_id);
......
......@@ -45,7 +45,7 @@
use syntax::ast;
pub fn trans_free(cx: block, v: ValueRef) -> block {
let _icx = cx.insn_ctxt("trans_free");
let _icx = push_ctxt("trans_free");
callee::trans_lang_call(cx,
cx.tcx().lang_items.free_fn(),
[PointerCast(cx, v, Type::i8p())],
......@@ -53,7 +53,7 @@ pub fn trans_free(cx: block, v: ValueRef) -> block {
}
pub fn trans_exchange_free(cx: block, v: ValueRef) -> block {
let _icx = cx.insn_ctxt("trans_exchange_free");
let _icx = push_ctxt("trans_exchange_free");
callee::trans_lang_call(cx,
cx.tcx().lang_items.exchange_free_fn(),
[PointerCast(cx, v, Type::i8p())],
......@@ -62,7 +62,7 @@ pub fn trans_exchange_free(cx: block, v: ValueRef) -> block {
pub fn take_ty(cx: block, v: ValueRef, t: ty::t) -> block {
// NB: v is an *alias* of type t here, not a direct value.
let _icx = cx.insn_ctxt("take_ty");
let _icx = push_ctxt("take_ty");
if ty::type_needs_drop(cx.tcx(), t) {
return call_tydesc_glue(cx, v, t, abi::tydesc_field_take_glue);
}
......@@ -71,7 +71,7 @@ pub fn take_ty(cx: block, v: ValueRef, t: ty::t) -> block {
pub fn drop_ty(cx: block, v: ValueRef, t: ty::t) -> block {
// NB: v is an *alias* of type t here, not a direct value.
let _icx = cx.insn_ctxt("drop_ty");
let _icx = push_ctxt("drop_ty");
if ty::type_needs_drop(cx.tcx(), t) {
return call_tydesc_glue(cx, v, t, abi::tydesc_field_drop_glue);
}
......@@ -79,7 +79,7 @@ pub fn drop_ty(cx: block, v: ValueRef, t: ty::t) -> block {
}
pub fn drop_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> block {
let _icx = bcx.insn_ctxt("drop_ty_immediate");
let _icx = push_ctxt("drop_ty_immediate");
match ty::get(t).sty {
ty::ty_uniq(_)
| ty::ty_evec(_, ty::vstore_uniq)
......@@ -96,7 +96,7 @@ pub fn drop_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> block {
}
pub fn take_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> Result {
let _icx = bcx.insn_ctxt("take_ty_immediate");
let _icx = push_ctxt("take_ty_immediate");
match ty::get(t).sty {
ty::ty_box(_) | ty::ty_opaque_box |
ty::ty_evec(_, ty::vstore_box) |
......@@ -117,7 +117,7 @@ pub fn take_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> Result {
pub fn free_ty(cx: block, v: ValueRef, t: ty::t) -> block {
// NB: v is an *alias* of type t here, not a direct value.
let _icx = cx.insn_ctxt("free_ty");
let _icx = push_ctxt("free_ty");
if ty::type_needs_drop(cx.tcx(), t) {
return call_tydesc_glue(cx, v, t, abi::tydesc_field_free_glue);
}
......@@ -125,7 +125,7 @@ pub fn free_ty(cx: block, v: ValueRef, t: ty::t) -> block {
}
pub fn free_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> block {
let _icx = bcx.insn_ctxt("free_ty_immediate");
let _icx = push_ctxt("free_ty_immediate");
match ty::get(t).sty {
ty::ty_uniq(_) |
ty::ty_evec(_, ty::vstore_uniq) |
......@@ -207,7 +207,7 @@ pub fn simplified_glue_type(tcx: ty::ctxt, field: uint, t: ty::t) -> ty::t {
pub fn lazily_emit_simplified_tydesc_glue(ccx: @mut CrateContext,
field: uint,
ti: @mut tydesc_info) -> bool {
let _icx = ccx.insn_ctxt("lazily_emit_simplified_tydesc_glue");
let _icx = push_ctxt("lazily_emit_simplified_tydesc_glue");
let simpl = simplified_glue_type(ccx.tcx, field, ti.ty);
if simpl != ti.ty {
let simpl_ti = get_tydesc(ccx, simpl);
......@@ -232,7 +232,7 @@ pub fn lazily_emit_simplified_tydesc_glue(ccx: @mut CrateContext,
pub fn lazily_emit_tydesc_glue(ccx: @mut CrateContext,
field: uint,
ti: @mut tydesc_info) {
let _icx = ccx.insn_ctxt("lazily_emit_tydesc_glue");
let _icx = push_ctxt("lazily_emit_tydesc_glue");
let llfnty = type_of_glue_fn(ccx);
if lazily_emit_simplified_tydesc_glue(ccx, field, ti) {
......@@ -300,7 +300,7 @@ pub fn call_tydesc_glue_full(bcx: block,
tydesc: ValueRef,
field: uint,
static_ti: Option<@mut tydesc_info>) {
let _icx = bcx.insn_ctxt("call_tydesc_glue_full");
let _icx = push_ctxt("call_tydesc_glue_full");
let ccx = bcx.ccx();
// NB: Don't short-circuit even if this block is unreachable because
// GC-based cleanup needs to the see that the roots are live.
......@@ -347,14 +347,14 @@ pub fn call_tydesc_glue_full(bcx: block,
// See [Note-arg-mode]
pub fn call_tydesc_glue(cx: block, v: ValueRef, t: ty::t, field: uint)
-> block {
let _icx = cx.insn_ctxt("call_tydesc_glue");
let _icx = push_ctxt("call_tydesc_glue");
let ti = get_tydesc(cx.ccx(), t);
call_tydesc_glue_full(cx, v, ti.tydesc, field, Some(ti));
return cx;
}
pub fn make_visit_glue(bcx: block, v: ValueRef, t: ty::t) {
let _icx = bcx.insn_ctxt("make_visit_glue");
let _icx = push_ctxt("make_visit_glue");
let bcx = do with_scope(bcx, None, "visitor cleanup") |bcx| {
let mut bcx = bcx;
let (visitor_trait, object_ty) = ty::visitor_object_ty(bcx.tcx());
......@@ -369,7 +369,7 @@ pub fn make_visit_glue(bcx: block, v: ValueRef, t: ty::t) {
pub fn make_free_glue(bcx: block, v: ValueRef, t: ty::t) {
// NB: v0 is an *alias* of type t here, not a direct value.
let _icx = bcx.insn_ctxt("make_free_glue");
let _icx = push_ctxt("make_free_glue");
let ccx = bcx.ccx();
let bcx = match ty::get(t).sty {
ty::ty_box(body_mt) => {
......@@ -461,7 +461,7 @@ pub fn trans_struct_drop(bcx: block,
pub fn make_drop_glue(bcx: block, v0: ValueRef, t: ty::t) {
// NB: v0 is an *alias* of type t here, not a direct value.
let _icx = bcx.insn_ctxt("make_drop_glue");
let _icx = push_ctxt("make_drop_glue");
let ccx = bcx.ccx();
let bcx = match ty::get(t).sty {
ty::ty_box(_) | ty::ty_opaque_box |
......@@ -532,7 +532,7 @@ pub fn decr_refcnt_maybe_free(bcx: block, box_ptr: ValueRef,
box_ptr_ptr: Option<ValueRef>,
t: ty::t)
-> block {
let _icx = bcx.insn_ctxt("decr_refcnt_maybe_free");
let _icx = push_ctxt("decr_refcnt_maybe_free");
let ccx = bcx.ccx();
do with_cond(bcx, IsNotNull(bcx, box_ptr)) |bcx| {
......@@ -551,7 +551,7 @@ pub fn decr_refcnt_maybe_free(bcx: block, box_ptr: ValueRef,
pub fn make_take_glue(bcx: block, v: ValueRef, t: ty::t) {
let _icx = bcx.insn_ctxt("make_take_glue");
let _icx = push_ctxt("make_take_glue");
// NB: v is a *pointer* to type t here, not a direct value.
let bcx = match ty::get(t).sty {
ty::ty_box(_) | ty::ty_opaque_box |
......@@ -600,7 +600,7 @@ pub fn make_take_glue(bcx: block, v: ValueRef, t: ty::t) {
}
pub fn incr_refcnt_of_boxed(cx: block, box_ptr: ValueRef) {
let _icx = cx.insn_ctxt("incr_refcnt_of_boxed");
let _icx = push_ctxt("incr_refcnt_of_boxed");
let ccx = cx.ccx();
let rc_ptr = GEPi(cx, box_ptr, [0u, abi::box_field_refcnt]);
let rc = Load(cx, rc_ptr);
......@@ -650,7 +650,7 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
pub fn declare_generic_glue(ccx: @mut CrateContext, t: ty::t, llfnty: Type,
name: ~str) -> ValueRef {
let _icx = ccx.insn_ctxt("declare_generic_glue");
let _icx = push_ctxt("declare_generic_glue");
let name = name;
let fn_nm = mangle_internal_name_by_type_and_seq(ccx, t, (~"glue_" + name)).to_managed();
debug!("%s is for type %s", fn_nm, ppaux::ty_to_str(ccx.tcx, t));
......@@ -665,7 +665,7 @@ pub fn make_generic_glue_inner(ccx: @mut CrateContext,
llfn: ValueRef,
helper: glue_helper)
-> ValueRef {
let _icx = ccx.insn_ctxt("make_generic_glue_inner");
let _icx = push_ctxt("make_generic_glue_inner");
let fcx = new_fn_ctxt(ccx, ~[], llfn, ty::mk_nil(), None);
lib::llvm::SetLinkage(llfn, lib::llvm::InternalLinkage);
ccx.stats.n_glues_created += 1u;
......@@ -695,7 +695,7 @@ pub fn make_generic_glue(ccx: @mut CrateContext,
helper: glue_helper,
name: &str)
-> ValueRef {
let _icx = ccx.insn_ctxt("make_generic_glue");
let _icx = push_ctxt("make_generic_glue");
if !ccx.sess.trans_stats() {
return make_generic_glue_inner(ccx, t, llfn, helper);
}
......@@ -708,7 +708,7 @@ pub fn make_generic_glue(ccx: @mut CrateContext,
}
pub fn emit_tydescs(ccx: &mut CrateContext) {
//let _icx = ccx.insn_ctxt("emit_tydescs");
let _icx = push_ctxt("emit_tydescs");
// As of this point, allow no more tydescs to be created.
ccx.finished_tydescs = true;
let glue_fn_ty = Type::generic_glue_fn(ccx);
......
......@@ -12,8 +12,7 @@
use metadata::csearch;
use middle::astencode;
use middle::trans::base::{get_insn_ctxt};
use middle::trans::base::{impl_owned_self, impl_self, no_self};
use middle::trans::base::{push_ctxt,impl_owned_self, impl_self, no_self};
use middle::trans::base::{trans_item, get_item_val, trans_fn};
use middle::trans::common::*;
use middle::ty;
......@@ -30,7 +29,7 @@
pub fn maybe_instantiate_inline(ccx: @mut CrateContext, fn_id: ast::def_id,
translate: bool)
-> ast::def_id {
let _icx = ccx.insn_ctxt("maybe_instantiate_inline");
let _icx = push_ctxt("maybe_instantiate_inline");
match ccx.external.find(&fn_id) {
Some(&Some(node_id)) => {
// Already inline
......
......@@ -51,7 +51,7 @@ pub fn trans_impl(ccx: @mut CrateContext,
generics: &ast::Generics,
self_ty: Option<ty::t>,
id: ast::node_id) {
let _icx = ccx.insn_ctxt("impl::trans_impl");
let _icx = push_ctxt("impl::trans_impl");
let tcx = ccx.tcx;
debug!("trans_impl(path=%s, name=%s, self_ty=%s, id=%?)",
......@@ -159,7 +159,7 @@ pub fn trans_method(ccx: @mut CrateContext,
pub fn trans_self_arg(bcx: block,
base: @ast::expr,
mentry: typeck::method_map_entry) -> Result {
let _icx = bcx.insn_ctxt("impl::trans_self_arg");
let _icx = push_ctxt("impl::trans_self_arg");
let mut temp_cleanups = ~[];
// Compute the type of self.
......@@ -187,7 +187,7 @@ pub fn trans_method_callee(bcx: block,
this: @ast::expr,
mentry: typeck::method_map_entry)
-> Callee {
let _icx = bcx.insn_ctxt("impl::trans_method_callee");
let _icx = push_ctxt("impl::trans_method_callee");
let tcx = bcx.tcx();
debug!("trans_method_callee(callee_id=%?, this=%s, mentry=%s)",
......@@ -293,7 +293,7 @@ pub fn trans_static_method_callee(bcx: block,
trait_id: ast::def_id,
callee_id: ast::node_id)
-> FnData {
let _icx = bcx.insn_ctxt("impl::trans_static_method_callee");
let _icx = push_ctxt("impl::trans_static_method_callee");
let ccx = bcx.ccx();
debug!("trans_static_method_callee(method_id=%?, trait_id=%s, \
......@@ -437,7 +437,7 @@ pub fn trans_monomorphized_callee(bcx: block,
n_method: uint,
vtbl: typeck::vtable_origin)
-> Callee {
let _icx = bcx.insn_ctxt("impl::trans_monomorphized_callee");
let _icx = push_ctxt("impl::trans_monomorphized_callee");
return match vtbl {
typeck::vtable_static(impl_did, ref rcvr_substs, rcvr_origins) => {
let ccx = bcx.ccx();
......@@ -586,7 +586,7 @@ pub fn trans_trait_callee(bcx: block,
// first evaluate the self expression (expected a by-ref result) and then
// extract the self data and vtable out of the pair.
let _icx = bcx.insn_ctxt("impl::trans_trait_callee");
let _icx = push_ctxt("impl::trans_trait_callee");
let mut bcx = bcx;
let self_datum = unpack_datum!(bcx,
expr::trans_to_datum(bcx, self_expr));
......@@ -619,7 +619,7 @@ pub fn trans_trait_callee_from_llval(bcx: block,
// Same as `trans_trait_callee()` above, except that it is given
// a by-ref pointer to the @Trait pair.
let _icx = bcx.insn_ctxt("impl::trans_trait_callee");
let _icx = push_ctxt("impl::trans_trait_callee");
let ccx = bcx.ccx();
let mut bcx = bcx;
......@@ -770,7 +770,7 @@ pub fn make_vtable(ccx: @mut CrateContext,
ptrs: &[ValueRef])
-> ValueRef {
unsafe {
let _icx = ccx.insn_ctxt("impl::make_vtable");
let _icx = push_ctxt("impl::make_vtable");
let mut components = ~[ tydesc.tydesc ];
for ptrs.each |&ptr| {
......@@ -797,7 +797,7 @@ pub fn make_impl_vtable(bcx: block,
vtables: typeck::vtable_res)
-> ValueRef {
let ccx = bcx.ccx();
let _icx = ccx.insn_ctxt("impl::make_impl_vtable");
let _icx = push_ctxt("impl::make_impl_vtable");
let tcx = ccx.tcx;
let trt_id = match ty::impl_trait_ref(tcx, impl_id) {
......@@ -841,7 +841,7 @@ pub fn trans_trait_cast(bcx: block,
_store: ty::TraitStore)
-> block {
let mut bcx = bcx;
let _icx = bcx.insn_ctxt("impl::trans_cast");
let _icx = push_ctxt("impl::trans_cast");
let lldest = match dest {
Ignore => {
......
......@@ -13,9 +13,8 @@
use back::link::mangle_exported_name;
use driver::session;
use lib::llvm::ValueRef;
use middle::trans::base::{get_insn_ctxt};
use middle::trans::base::{set_inline_hint_if_appr, set_inline_hint};
use middle::trans::base::{trans_enum_variant};
use middle::trans::base::{trans_enum_variant,push_ctxt};
use middle::trans::base::{trans_fn, decl_internal_cdecl_fn};
use middle::trans::base::{get_item_val, no_self};
use middle::trans::base;
......@@ -61,6 +60,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
ref_id);
assert!(real_substs.tps.iter().all(|t| !ty::type_needs_infer(*t)));
let _icx = push_ctxt("monomorphic_fn");
let _icx = ccx.insn_ctxt("monomorphic_fn");
let mut must_cast = false;
let substs = vec::map(real_substs.tps, |t| {
......
......@@ -53,7 +53,7 @@ pub fn expand_boxed_vec_ty(tcx: ty::ctxt, t: ty::t) -> ty::t {
}
pub fn get_fill(bcx: block, vptr: ValueRef) -> ValueRef {
let _icx = bcx.insn_ctxt("tvec::get_fill");
let _icx = push_ctxt("tvec::get_fill");
Load(bcx, GEPi(bcx, vptr, [0u, abi::vec_elt_fill]))
}
pub fn set_fill(bcx: block, vptr: ValueRef, fill: ValueRef) {
......@@ -68,12 +68,12 @@ pub fn get_bodyptr(bcx: block, vptr: ValueRef) -> ValueRef {
}
pub fn get_dataptr(bcx: block, vptr: ValueRef) -> ValueRef {
let _icx = bcx.insn_ctxt("tvec::get_dataptr");
let _icx = push_ctxt("tvec::get_dataptr");
GEPi(bcx, vptr, [0u, abi::vec_elt_elems, 0u])
}
pub fn pointer_add(bcx: block, ptr: ValueRef, bytes: ValueRef) -> ValueRef {
let _icx = bcx.insn_ctxt("tvec::pointer_add");
let _icx = push_ctxt("tvec::pointer_add");
let old_ty = val_ty(ptr);
let bptr = PointerCast(bcx, ptr, Type::i8p());
return PointerCast(bcx, InBoundsGEP(bcx, bptr, [bytes]), old_ty);
......@@ -81,7 +81,7 @@ pub fn pointer_add(bcx: block, ptr: ValueRef, bytes: ValueRef) -> ValueRef {
pub fn alloc_raw(bcx: block, unit_ty: ty::t,
fill: ValueRef, alloc: ValueRef, heap: heap) -> Result {
let _icx = bcx.insn_ctxt("tvec::alloc_uniq");
let _icx = push_ctxt("tvec::alloc_uniq");
let ccx = bcx.ccx();
let vecbodyty = ty::mk_mut_unboxed_vec(bcx.tcx(), unit_ty);
......@@ -105,7 +105,7 @@ pub fn alloc_vec(bcx: block,
elts: uint,
heap: heap)
-> Result {
let _icx = bcx.insn_ctxt("tvec::alloc_uniq");
let _icx = push_ctxt("tvec::alloc_uniq");
let ccx = bcx.ccx();
let llunitty = type_of::type_of(ccx, unit_ty);
let unit_sz = nonzero_llsize_of(ccx, llunitty);
......@@ -119,7 +119,7 @@ pub fn alloc_vec(bcx: block,
}
pub fn duplicate_uniq(bcx: block, vptr: ValueRef, vec_ty: ty::t) -> Result {
let _icx = bcx.insn_ctxt("tvec::duplicate_uniq");
let _icx = push_ctxt("tvec::duplicate_uniq");
let fill = get_fill(bcx, get_bodyptr(bcx, vptr));
let unit_ty = ty::sequence_element_type(bcx.tcx(), vec_ty);
......@@ -137,7 +137,7 @@ pub fn duplicate_uniq(bcx: block, vptr: ValueRef, vec_ty: ty::t) -> Result {
pub fn make_drop_glue_unboxed(bcx: block, vptr: ValueRef, vec_ty: ty::t) ->
block {
let _icx = bcx.insn_ctxt("tvec::make_drop_glue_unboxed");
let _icx = push_ctxt("tvec::make_drop_glue_unboxed");
let tcx = bcx.tcx();
let unit_ty = ty::sequence_element_type(tcx, vec_ty);
if ty::type_needs_drop(tcx, unit_ty) {
......@@ -349,7 +349,7 @@ pub fn write_content(bcx: block,
content_expr: @ast::expr,
dest: Dest)
-> block {
let _icx = bcx.insn_ctxt("tvec::write_content");
let _icx = push_ctxt("tvec::write_content");
let mut bcx = bcx;
debug!("write_content(vt=%s, dest=%s, vstore_expr=%?)",
......@@ -548,7 +548,7 @@ pub fn get_base_and_len(bcx: block,
pub fn iter_vec_raw(bcx: block, data_ptr: ValueRef, vec_ty: ty::t,
fill: ValueRef, f: iter_vec_block) -> block {
let _icx = bcx.insn_ctxt("tvec::iter_vec_raw");
let _icx = push_ctxt("tvec::iter_vec_raw");
let unit_ty = ty::sequence_element_type(bcx.tcx(), vec_ty);
......@@ -579,14 +579,14 @@ pub fn iter_vec_raw(bcx: block, data_ptr: ValueRef, vec_ty: ty::t,
pub fn iter_vec_uniq(bcx: block, vptr: ValueRef, vec_ty: ty::t,
fill: ValueRef, f: iter_vec_block) -> block {
let _icx = bcx.insn_ctxt("tvec::iter_vec_uniq");
let _icx = push_ctxt("tvec::iter_vec_uniq");
let data_ptr = get_dataptr(bcx, get_bodyptr(bcx, vptr));
iter_vec_raw(bcx, data_ptr, vec_ty, fill, f)
}
pub fn iter_vec_unboxed(bcx: block, body_ptr: ValueRef, vec_ty: ty::t,
f: iter_vec_block) -> block {
let _icx = bcx.insn_ctxt("tvec::iter_vec_unboxed");
let _icx = push_ctxt("tvec::iter_vec_unboxed");
let fill = get_fill(bcx, body_ptr);
let dataptr = get_dataptr(bcx, body_ptr);
return iter_vec_raw(bcx, dataptr, vec_ty, fill, f);
......
......@@ -21,7 +21,7 @@
pub fn make_free_glue(bcx: block, vptrptr: ValueRef, box_ty: ty::t)
-> block {
let _icx = bcx.insn_ctxt("uniq::make_free_glue");
let _icx = push_ctxt("uniq::make_free_glue");
let box_datum = immediate_rvalue(Load(bcx, vptrptr), box_ty);
let not_null = IsNotNull(bcx, box_datum.val);
......@@ -38,7 +38,7 @@ pub fn make_free_glue(bcx: block, vptrptr: ValueRef, box_ty: ty::t)
}
pub fn duplicate(bcx: block, src_box: ValueRef, src_ty: ty::t) -> Result {
let _icx = bcx.insn_ctxt("uniq::duplicate");
let _icx = push_ctxt("uniq::duplicate");
// Load the body of the source (*src)
let src_datum = immediate_rvalue(src_box, src_ty);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册