Skip to content

Commit 7c74aa3

Browse files
committed
---
yaml --- r: 22010 b: refs/heads/snap-stage3 c: 991cbfe h: refs/heads/master v: v3
1 parent af66256 commit 7c74aa3

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: bb0ad11252c493ca8de85025411c3f068f529039
4+
refs/heads/snap-stage3: 991cbfe42c8836e8b4adfcaf288d5c0b8d57397c
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/rt/rust.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ command_line_args : public kernel_owned<command_line_args>
7272
// FIXME (#2670): This belongs somewhere else
7373
int check_claims = 0;
7474

75-
void* global_crate_map = NULL;
76-
7775
/**
7876
The runtime entrypoint. The (C ABI) main function generated by rustc calls
7977
`rust_start`, providing the address of the Rust ABI main function, the
@@ -88,8 +86,6 @@ rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
8886
// line as well.
8987
rust_env *env = load_env();
9088

91-
global_crate_map = crate_map;
92-
9389
update_gc_metadata(crate_map);
9490

9591
update_log_settings(crate_map, env->logspec);

branches/snap-stage3/src/rt/rust_globals.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,4 @@ static size_t const BUF_BYTES = 2048;
101101
// (writing), a port (reading) or a task (waiting).
102102
struct rust_cond { };
103103

104-
extern void* global_crate_map;
105-
106104
#endif /* RUST_GLOBALS_H */

branches/snap-stage3/src/rt/rust_task.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#include "rust_cc.h"
1010
#include "rust_env.h"
1111
#include "rust_port.h"
12-
#include "rust_globals.h"
13-
#include "rust_crate_map.h"
1412

1513
// Tasks
1614
rust_task::rust_task(rust_sched_loop *sched_loop, rust_task_state state,
@@ -127,9 +125,18 @@ cleanup_task(cleanup_args *args) {
127125
main_task_failed_without_spawning = true;
128126
}
129127

130-
// Call the box annihilator.
131-
cratemap* map = reinterpret_cast<cratemap*>(global_crate_map);
132-
task->call_on_rust_stack(NULL, const_cast<void*>(map->annihilate_fn()));
128+
// FIXME (#2676): For performance we should do the annihilator
129+
// instead of the cycle collector even under normal termination, but
130+
// since that would hide memory management errors (like not derefing
131+
// boxes), it needs to be disableable in debug builds.
132+
if (threw_exception) {
133+
// FIXME (#2676): When the annihilator is more powerful and
134+
// successfully runs resource destructors, etc. we can get rid
135+
// of this cc
136+
cc::do_cc(task);
137+
annihilate_boxes(task);
138+
}
139+
cc::do_final_cc(task);
133140

134141
task->die();
135142

0 commit comments

Comments
 (0)