add an option to the final cc so that it prints out/logs unreclaimed ptrs
This commit is contained in:
parent
acb129c541
commit
5ee89f3f2a
|
@ -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
|
||||
|
@ -659,6 +662,25 @@ do_cc(rust_task *task) {
|
|||
sweep::do_sweep(task, marked);
|
||||
}
|
||||
|
||||
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");
|
||||
|
|
|
@ -9,6 +9,10 @@ struct rust_task;
|
|||
namespace cc {
|
||||
|
||||
void do_cc(rust_task *task);
|
||||
|
||||
// performs a cycle coll then asserts that there is nothing left
|
||||
void do_final_cc(rust_task *task);
|
||||
|
||||
void maybe_cc(rust_task *task);
|
||||
|
||||
} // end namespace cc
|
||||
|
|
|
@ -149,7 +149,7 @@ cleanup_task(cleanup_args *args) {
|
|||
bool threw_exception = args->threw_exception;
|
||||
rust_task *task = a->task;
|
||||
|
||||
cc::do_cc(task);
|
||||
cc::do_final_cc(task);
|
||||
|
||||
task->die();
|
||||
|
||||
|
|
Loading…
Reference in New Issue