rt: Call the Rust box annihilator; stop calling the cycle collector

This reverts commit 991cbfe42c.
This commit is contained in:
Patrick Walton 2012-09-24 14:14:31 -07:00
parent 530540025c
commit 00e3492511
3 changed files with 11 additions and 12 deletions

View File

@ -72,6 +72,8 @@ command_line_args : public kernel_owned<command_line_args>
// FIXME (#2670): This belongs somewhere else
int check_claims = 0;
void* global_crate_map = NULL;
/**
The runtime entrypoint. The (C ABI) main function generated by rustc calls
`rust_start`, providing the address of the Rust ABI main function, the
@ -86,6 +88,8 @@ rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
// line as well.
rust_env *env = load_env();
global_crate_map = crate_map;
update_gc_metadata(crate_map);
update_log_settings(crate_map, env->logspec);

View File

@ -101,4 +101,6 @@ static size_t const BUF_BYTES = 2048;
// (writing), a port (reading) or a task (waiting).
struct rust_cond { };
extern void* global_crate_map;
#endif /* RUST_GLOBALS_H */

View File

@ -9,6 +9,8 @@
#include "rust_cc.h"
#include "rust_env.h"
#include "rust_port.h"
#include "rust_globals.h"
#include "rust_crate_map.h"
// Tasks
rust_task::rust_task(rust_sched_loop *sched_loop, rust_task_state state,
@ -125,18 +127,9 @@ cleanup_task(cleanup_args *args) {
main_task_failed_without_spawning = true;
}
// FIXME (#2676): For performance we should do the annihilator
// instead of the cycle collector even under normal termination, but
// since that would hide memory management errors (like not derefing
// boxes), it needs to be disableable in debug builds.
if (threw_exception) {
// FIXME (#2676): When the annihilator is more powerful and
// successfully runs resource destructors, etc. we can get rid
// of this cc
cc::do_cc(task);
annihilate_boxes(task);
}
cc::do_final_cc(task);
// Call the box annihilator.
cratemap* map = reinterpret_cast<cratemap*>(global_crate_map);
task->call_on_rust_stack(NULL, const_cast<void*>(map->annihilate_fn()));
task->die();