Add various debug statements to trans that I used to help track down the
problem and which seem like they could be useful in the future.
This commit is contained in:
parent
e11d13f3de
commit
6f2783d515
5 changed files with 25 additions and 5 deletions
|
@ -1579,7 +1579,15 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
|
||||||
id: ast::node_id,
|
id: ast::node_id,
|
||||||
impl_id: Option<ast::def_id>,
|
impl_id: Option<ast::def_id>,
|
||||||
param_substs: Option<@param_substs>,
|
param_substs: Option<@param_substs>,
|
||||||
sp: Option<span>) -> fn_ctxt {
|
sp: Option<span>) -> fn_ctxt
|
||||||
|
{
|
||||||
|
debug!("new_fn_ctxt_w_id(path=%s, id=%?, impl_id=%?, \
|
||||||
|
param_substs=%s",
|
||||||
|
path_str(ccx.sess, path),
|
||||||
|
id,
|
||||||
|
impl_id,
|
||||||
|
opt_param_substs_to_str(ccx.tcx, ¶m_substs));
|
||||||
|
|
||||||
let llbbs = mk_standard_basic_blocks(llfndecl);
|
let llbbs = mk_standard_basic_blocks(llfndecl);
|
||||||
return @mut fn_ctxt_ {
|
return @mut fn_ctxt_ {
|
||||||
llfn: llfndecl,
|
llfn: llfndecl,
|
||||||
|
|
|
@ -217,7 +217,7 @@ pub fn trans_fn_ref_with_vtables(
|
||||||
// - `type_params`: values for each of the fn/method's type parameters
|
// - `type_params`: values for each of the fn/method's type parameters
|
||||||
// - `vtables`: values for each bound on each of the type parameters
|
// - `vtables`: values for each bound on each of the type parameters
|
||||||
|
|
||||||
let _icx = bcx.insn_ctxt("trans_fn_with_vtables");
|
let _icx = bcx.insn_ctxt("trans_fn_ref_with_vtables");
|
||||||
let ccx = bcx.ccx();
|
let ccx = bcx.ccx();
|
||||||
let tcx = ccx.tcx;
|
let tcx = ccx.tcx;
|
||||||
|
|
||||||
|
|
|
@ -257,6 +257,11 @@ pub fn param_substs_to_str(tcx: ty::ctxt, substs: ¶m_substs) -> ~str {
|
||||||
substs.bounds.map(|b| ty::param_bounds_to_str(tcx, *b)))
|
substs.bounds.map(|b| ty::param_bounds_to_str(tcx, *b)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn opt_param_substs_to_str(tcx: ty::ctxt,
|
||||||
|
substs: &Option<@param_substs>) -> ~str {
|
||||||
|
substs.map_default(~"None", |&ps| param_substs_to_str(tcx, ps))
|
||||||
|
}
|
||||||
|
|
||||||
// Function context. Every LLVM function we create will have one of
|
// Function context. Every LLVM function we create will have one of
|
||||||
// these.
|
// these.
|
||||||
pub struct fn_ctxt_ {
|
pub struct fn_ctxt_ {
|
||||||
|
@ -1423,7 +1428,7 @@ pub fn resolve_vtable_in_fn_ctxt(fcx: fn_ctxt, +vt: typeck::vtable_origin)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn find_vtable(tcx: ty::ctxt, ps: ¶m_substs,
|
pub fn find_vtable(tcx: ty::ctxt, ps: ¶m_substs,
|
||||||
n_param: uint, n_bound: uint)
|
n_param: uint, n_bound: uint)
|
||||||
-> typeck::vtable_origin {
|
-> typeck::vtable_origin {
|
||||||
debug!("find_vtable_in_fn_ctxt(n_param=%u, n_bound=%u, ps=%?)",
|
debug!("find_vtable_in_fn_ctxt(n_param=%u, n_bound=%u, ps=%?)",
|
||||||
n_param, n_bound, param_substs_to_str(tcx, ps));
|
n_param, n_bound, param_substs_to_str(tcx, ps));
|
||||||
|
|
|
@ -175,6 +175,9 @@ pub fn trans_method_callee(bcx: block,
|
||||||
-> Callee {
|
-> Callee {
|
||||||
let _icx = bcx.insn_ctxt("impl::trans_method_callee");
|
let _icx = bcx.insn_ctxt("impl::trans_method_callee");
|
||||||
|
|
||||||
|
debug!("trans_method_callee(callee_id=%?, self=%s, mentry=%?)",
|
||||||
|
callee_id, bcx.expr_to_str(self), mentry);
|
||||||
|
|
||||||
// Replace method_self with method_static here.
|
// Replace method_self with method_static here.
|
||||||
let mut origin = mentry.origin;
|
let mut origin = mentry.origin;
|
||||||
match origin {
|
match origin {
|
||||||
|
@ -218,6 +221,8 @@ pub fn trans_method_callee(bcx: block,
|
||||||
typeck::method_trait(*) => {}
|
typeck::method_trait(*) => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug!("origin=%?", origin);
|
||||||
|
|
||||||
match origin {
|
match origin {
|
||||||
typeck::method_static(did) => {
|
typeck::method_static(did) => {
|
||||||
let callee_fn = callee::trans_fn_ref(bcx, did, callee_id);
|
let callee_fn = callee::trans_fn_ref(bcx, did, callee_id);
|
||||||
|
|
|
@ -67,9 +67,11 @@ pub fn monomorphic_fn(ccx: @CrateContext,
|
||||||
must_cast = true;
|
must_cast = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("monomorphic_fn(fn_id=%? (%s), real_substs=%?, substs=%?, \
|
debug!("monomorphic_fn(fn_id=%? (%s), vtables=%?, \
|
||||||
hash_id = %?",
|
real_substs=%?, substs=%?, \
|
||||||
|
hash_id = %?",
|
||||||
fn_id, ty::item_path_str(ccx.tcx, fn_id),
|
fn_id, ty::item_path_str(ccx.tcx, fn_id),
|
||||||
|
vtables,
|
||||||
real_substs.map(|s| ty_to_str(ccx.tcx, *s)),
|
real_substs.map(|s| ty_to_str(ccx.tcx, *s)),
|
||||||
substs.map(|s| ty_to_str(ccx.tcx, *s)), hash_id);
|
substs.map(|s| ty_to_str(ccx.tcx, *s)), hash_id);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue