rustc: Call the box annihilator in main

This commit is contained in:
Patrick Walton
2012-09-14 18:05:15 -07:00
parent 24c89693f0
commit 1c5db46f8e
2 changed files with 8 additions and 4 deletions

View File

@@ -71,13 +71,13 @@ struct Task {
#[lang="annihilate"]
pub unsafe fn annihilate() {
use rt::rt_free;
use io::WriterUtil;
let task: *Task = transmute(rustrt::rust_get_task());
// Pass 1: Make all boxes immortal.
let box = (*task).boxed_region.live_allocs;
let mut box: *mut BoxRepr = transmute(copy box);
assert (*box).prev == null();
while box != mut_null() {
debug!("making box immortal: %x", box as uint);
(*box).ref_count = 0x77777777;
@@ -87,7 +87,6 @@ pub unsafe fn annihilate() {
// Pass 2: Drop all boxes.
let box = (*task).boxed_region.live_allocs;
let mut box: *mut BoxRepr = transmute(copy box);
assert (*box).prev == null();
while box != mut_null() {
debug!("calling drop glue for box: %x", box as uint);
let tydesc: *TypeDesc = transmute(copy (*box).type_desc);