From 263f4c58a0c9409f257d45ae03d4b19700ef232b Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 12 Jan 2012 09:28:29 -0800 Subject: add tydescs into shape, rewrite walk_fn_contents() --- src/rt/rust_cc.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/rt/rust_cc.cpp') diff --git a/src/rt/rust_cc.cpp b/src/rt/rust_cc.cpp index 1f99fe98f71..78138434d73 100644 --- a/src/rt/rust_cc.cpp +++ b/src/rt/rust_cc.cpp @@ -357,7 +357,7 @@ class mark : public shape::data { case shape::SHAPE_BOX_FN: { // Record an irc for the environment box, but don't descend // into it since it will be walked via the box's allocation - shape::data::walk_fn_contents1(dp); + shape::data::walk_fn_contents1(dp, false); break; } case shape::SHAPE_BARE_FN: // Does not close over data. @@ -552,15 +552,14 @@ class sweep : public shape::data { fn_env_pair pair = *(fn_env_pair*)dp; // free closed over data: - // - // FIXME--this is a bit sketchy, since there is an - // embedded tydesc that we will be using to walk the - // data, but it will be freed as we walk. In the - // generated code we pull this desc out and free it - // later. We may well want to do the same. However, - // since all we use from the descr. is the "shape", I - // think we're ok. - shape::data::walk_fn_contents1(dp); + shape::data::walk_fn_contents1(dp, true); + + // now free the embedded type descr: + // + // see comment in walk_fn_contents1() concerning null_td + // to understand why this does not occur during the normal + // walk. + upcall_s_free_shared_type_desc((type_desc*)pair.env->td); // now free the ptr: task->kernel->free(pair.env); -- cgit 1.4.1-3-g733a5