Skip to content

Commit cec7280

Browse files
committed
debug instrumentation (can remove)
1 parent 965b0bf commit cec7280

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

src/librustc_trans/trans/_match.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,9 @@ fn mk_binding_alloca<'blk, 'tcx, A, F>(bcx: Block<'blk, 'tcx>,
17601760
let lvalue = Lvalue::new_with_hint(caller_name, bcx, p_id, HintKind::DontZeroJustUse);
17611761
let datum = Datum::new(llval, var_ty, lvalue);
17621762

1763+
debug!("mk_binding_alloca cleanup_scope={:?} llval={} var_ty={:?}",
1764+
cleanup_scope, bcx.ccx().tn().val_to_string(llval), var_ty);
1765+
17631766
// Subtle: be sure that we *populate* the memory *before*
17641767
// we schedule the cleanup.
17651768
call_lifetime_start(bcx, llval);

src/librustc_trans/trans/adt.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,11 @@ pub fn trans_drop_flag_ptr<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
12811281
let scratch = unpack_datum!(bcx, datum::lvalue_scratch_datum(
12821282
bcx, tcx.dtor_type(), "drop_flag",
12831283
InitAlloca::Uninit("drop flag itself has no dtor"),
1284-
cleanup::CustomScope(custom_cleanup_scope), (), |_, bcx, _| bcx
1284+
cleanup::CustomScope(custom_cleanup_scope), (), |_, bcx, _| {
1285+
debug!("no-op populate call for trans_drop_flag_ptr on dtor_type={:?}",
1286+
tcx.dtor_type());
1287+
bcx
1288+
}
12851289
));
12861290
bcx = fold_variants(bcx, r, val, |variant_cx, st, value| {
12871291
let ptr = struct_field_ptr(variant_cx, st, MaybeSizedValue::sized(value),

src/librustc_trans/trans/base.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,6 +1689,8 @@ pub fn create_datums_for_fn_args<'a, 'tcx>(mut bcx: Block<'a, 'tcx>,
16891689
let fcx = bcx.fcx;
16901690
let arg_scope_id = cleanup::CustomScope(arg_scope);
16911691

1692+
debug!("create_datums_for_fn_args");
1693+
16921694
// Return an array wrapping the ValueRefs that we get from `get_param` for
16931695
// each argument into datums.
16941696
//
@@ -1723,6 +1725,9 @@ pub fn create_datums_for_fn_args<'a, 'tcx>(mut bcx: Block<'a, 'tcx>,
17231725
unpack_datum!(bcx, datum::lvalue_scratch_datum(bcx, arg_ty, "", uninit_reason,
17241726
arg_scope_id, (data, extra),
17251727
|(data, extra), bcx, dst| {
1728+
debug!("populate call for create_datum_for_fn_args \
1729+
early fat arg, on arg[{}] ty={:?}", i, arg_ty);
1730+
17261731
Store(bcx, data, expr::get_dataptr(bcx, dst));
17271732
Store(bcx, extra, expr::get_meta(bcx, dst));
17281733
bcx
@@ -1738,7 +1743,13 @@ pub fn create_datums_for_fn_args<'a, 'tcx>(mut bcx: Block<'a, 'tcx>,
17381743
uninit_reason,
17391744
arg_scope_id,
17401745
tmp,
1741-
|tmp, bcx, dst| tmp.store_to(bcx, dst)))
1746+
|tmp, bcx, dst| {
1747+
1748+
debug!("populate call for create_datum_for_fn_args \
1749+
early thin arg, on arg[{}] ty={:?}", i, arg_ty);
1750+
1751+
tmp.store_to(bcx, dst)
1752+
}))
17421753
}
17431754
} else {
17441755
// FIXME(pcwalton): Reduce the amount of code bloat this is responsible for.
@@ -1753,7 +1764,9 @@ pub fn create_datums_for_fn_args<'a, 'tcx>(mut bcx: Block<'a, 'tcx>,
17531764
(),
17541765
|(),
17551766
mut bcx,
1756-
llval| {
1767+
llval| {
1768+
debug!("populate call for create_datum_for_fn_args \
1769+
tupled_args, on arg[{}] ty={:?}", i, arg_ty);
17571770
for (j, &tupled_arg_ty) in
17581771
tupled_arg_tys.iter().enumerate() {
17591772
let lldest = StructGEP(bcx, llval, j);

src/librustc_trans/trans/datum.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ pub fn lvalue_scratch_datum<'blk, 'tcx, A, F>(bcx: Block<'blk, 'tcx>,
311311
// Very subtle: potentially initialize the scratch memory at point where it is alloca'ed.
312312
// (See discussion at Issue 30530.)
313313
let scratch = alloc_ty_init(bcx, ty, zero, name);
314+
debug!("lvalue_scratch_datum scope={:?} scratch={} ty={:?}",
315+
scope, bcx.ccx().tn().val_to_string(scratch), ty);
314316

315317
// Subtle. Populate the scratch memory *before* scheduling cleanup.
316318
let bcx = populate(arg, bcx, scratch);
@@ -349,6 +351,8 @@ fn add_rvalue_clean<'a, 'tcx>(mode: RvalueMode,
349351
scope: cleanup::ScopeId,
350352
val: ValueRef,
351353
ty: Ty<'tcx>) {
354+
debug!("add_rvalue_clean scope={:?} val={} ty={:?}",
355+
scope, fcx.ccx.tn().val_to_string(val), ty);
352356
match mode {
353357
ByValue => { fcx.schedule_drop_immediate(scope, val, ty); }
354358
ByRef => {
@@ -507,6 +511,8 @@ impl<'tcx> Datum<'tcx, Rvalue> {
507511
lvalue_scratch_datum(
508512
bcx, self.ty, name, InitAlloca::Dropped, scope, self,
509513
|this, bcx, llval| {
514+
debug!("populate call for Datum::to_lvalue_datum_in_scope \
515+
self.ty={:?}", this.ty);
510516
call_lifetime_start(bcx, llval);
511517
let bcx = this.store_to(bcx, llval);
512518
bcx.fcx.schedule_lifetime_end(scope, llval);

src/librustc_trans/trans/expr.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,8 @@ pub fn trans_adt<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
14871487
}
14881488
};
14891489

1490+
debug!("trans_adt");
1491+
14901492
// This scope holds intermediates that must be cleaned should
14911493
// panic occur before the ADT as a whole is ready.
14921494
let custom_cleanup_scope = fcx.push_custom_cleanup_scope();

0 commit comments

Comments
 (0)