diff options
Diffstat (limited to 'src/rt/rust_cc.cpp')
| -rw-r--r-- | src/rt/rust_cc.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/rt/rust_cc.cpp b/src/rt/rust_cc.cpp index ec54b1ef181..eb99e28b2d0 100644 --- a/src/rt/rust_cc.cpp +++ b/src/rt/rust_cc.cpp @@ -12,6 +12,7 @@ #include <set> #include <vector> #include <stdint.h> +#include <ios> // The number of allocations Rust code performs before performing cycle // collection. @@ -20,6 +21,8 @@ // defined in rust_upcall.cpp: void upcall_s_free_shared_type_desc(type_desc *td); +using namespace std; + namespace cc { // Internal reference count computation @@ -660,6 +663,25 @@ do_cc(rust_task *task) { } void +do_final_cc(rust_task *task) { + do_cc(task); + + boxed_region *boxed = &task->boxed; + for (rust_opaque_box *box = boxed->first_live_alloc(); + box != NULL; + box = box->next) { + cerr << "Unreclaimed object found at " << (void*) box << ": "; + const type_desc *td = box->td; + shape::arena arena; + shape::type_param *params = shape::type_param::from_tydesc(td, arena); + shape::log log(task, true, td->shape, params, td->shape_tables, + (uint8_t*)box_body(box), cerr); + log.walk(); + cerr << "\n"; + } +} + +void maybe_cc(rust_task *task) { static debug::flag zeal("RUST_CC_ZEAL"); if (*zeal) { |
