about summary refs log tree commit diff
path: root/src/rt/rust.cpp
diff options
context:
space:
mode:
authorElliott Slaughter <eslaughter@mozilla.com>2012-07-16 12:28:15 -0700
committerElliott Slaughter <eslaughter@mozilla.com>2012-09-07 09:21:21 -0700
commit3f0d207b3251e598488588765b942bf6b7a4f9bb (patch)
tree98fad8b4761bb95d63615e7e2217ca559bd4962a /src/rt/rust.cpp
parentfb8786fe522ed96172cf1ae8e205e3f2722e834c (diff)
downloadrust-3f0d207b3251e598488588765b942bf6b7a4f9bb.tar.gz
rust-3f0d207b3251e598488588765b942bf6b7a4f9bb.zip
gc: Add stack walker for new garbage collector.
Safe points are exported in a per-module list via the crate map. A C
runtime call walks the crate map at startup and aggregates the list of
safe points for the program.

Currently the GC doesn't actually deallocate memory on malloc and
free. Adding the GC at this stage is primarily of testing value.

The GC does attempt to clean up exchange heap and stack-allocated
resource on failure.

A result of this patch is that the user now needs to be careful about
what code they write in destructors, because the GC and/or failure
cleanup may need to call destructors. Specifically, calls to malloc
are considered unsafe and may result in infinite loops or segfaults.
Diffstat (limited to 'src/rt/rust.cpp')
-rw-r--r--src/rt/rust.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rt/rust.cpp b/src/rt/rust.cpp
index 150156ddae9..705a96303d4 100644
--- a/src/rt/rust.cpp
+++ b/src/rt/rust.cpp
@@ -7,6 +7,7 @@
 #include "rust_kernel.h"
 #include "rust_util.h"
 #include "rust_scheduler.h"
+#include "rust_gc_metadata.h"
 
 // Creates a rust argument vector from the platform argument vector
 struct
@@ -85,6 +86,8 @@ rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
     // line as well.
     rust_env *env = load_env();
 
+    update_gc_metadata(crate_map);
+
     update_log_settings(crate_map, env->logspec);
 
     // Maybe turn on typestate claim checking