migrate gc.rs to LinearSet

This commit is contained in:
Daniel Micay 2013-01-22 21:13:06 -05:00
parent 499f00de1d
commit 7de5e6c487
2 changed files with 5 additions and 11 deletions

View file

@ -44,7 +44,7 @@ use io;
use libc::{size_t, uintptr_t};
use option::{None, Option, Some};
use ptr;
use send_map::linear::LinearMap;
use send_map::linear::LinearSet;
use stackwalk;
use sys;
@ -294,12 +294,6 @@ pub fn gc() {
}
}
type RootSet = LinearMap<*Word,()>;
fn RootSet() -> RootSet {
LinearMap()
}
#[cfg(gc)]
fn expect_sentinel() -> bool { true }
@ -337,13 +331,13 @@ pub fn cleanup_stack_for_failure() {
ptr::null()
};
let mut roots = ~RootSet();
let mut roots = LinearSet::new();
for walk_gc_roots(need_cleanup, sentinel) |root, tydesc| {
// Track roots to avoid double frees.
if roots.find(&*root).is_some() {
if roots.contains(&*root) {
loop;
}
roots.insert(*root, ());
roots.insert(*root);
if ptr::is_null(tydesc) {
// FIXME #4420: Destroy this box

View file

@ -485,7 +485,7 @@ pub mod linear {
fn remove(&mut self, value: &T) -> bool { self.map.remove(value) }
}
impl <T: Hash IterBytes Eq> LinearSet<T> {
pub impl <T: Hash IterBytes Eq> LinearSet<T> {
/// Create an empty LinearSet
static fn new() -> LinearSet<T> { LinearSet{map: LinearMap()} }
}