Skip to content

Commit c80faa9

Browse files
committed
---
yaml --- r: 30717 b: refs/heads/incoming c: bb0ad11 h: refs/heads/master i: 30715: 76ad6e0 v: v3
1 parent 9baf127 commit c80faa9

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: afd91f8a5698e7767ddfbf90c665c08dcd4f0de0
9+
refs/heads/incoming: bb0ad11252c493ca8de85025411c3f068f529039
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/rt/rust.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ 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+
7577
/**
7678
The runtime entrypoint. The (C ABI) main function generated by rustc calls
7779
`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) {
8688
// line as well.
8789
rust_env *env = load_env();
8890

91+
global_crate_map = crate_map;
92+
8993
update_gc_metadata(crate_map);
9094

9195
update_log_settings(crate_map, env->logspec);

branches/incoming/src/rt/rust_globals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,6 @@ 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+
104106
#endif /* RUST_GLOBALS_H */

branches/incoming/src/rt/rust_task.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
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"
1214

1315
// Tasks
1416
rust_task::rust_task(rust_sched_loop *sched_loop, rust_task_state state,
@@ -125,18 +127,9 @@ cleanup_task(cleanup_args *args) {
125127
main_task_failed_without_spawning = true;
126128
}
127129

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);
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()));
140133

141134
task->die();
142135

0 commit comments

Comments
 (0)