Skip to content

Commit 558e6e9

Browse files
committed
---
yaml --- r: 5549 b: refs/heads/master c: ad19ab4 h: refs/heads/master i: 5547: 02551be v: v3
1 parent 0e5afd7 commit 558e6e9

File tree

5 files changed

+49
-7
lines changed

5 files changed

+49
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 47e5ab093a89fbe240e67be6a59c901f32d5ce4f
2+
refs/heads/master: ad19ab4c6fdf3ea74ac0ff3688d040a852f30760

trunk/src/rt/rust_builtin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@ migrate_alloc(rust_task *task, void *alloc, rust_task_id tid) {
456456
if(!alloc) return;
457457
rust_task *target = task->kernel->get_task_by_id(tid);
458458
if(target) {
459-
task->local_region.release_alloc(alloc);
460-
target->local_region.claim_alloc(alloc);
459+
const type_desc *tydesc = task->release_alloc(alloc);
460+
target->claim_alloc(alloc, tydesc);
461461
target->deref();
462462
}
463463
else {

trunk/src/rt/rust_cc.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,22 @@ irc::compute_ircs(rust_task *task, irc_map &ircs) {
178178
shape::arena arena;
179179
shape::type_param *params =
180180
shape::type_param::from_tydesc_and_data(tydesc, p, arena);
181-
irc irc(task, true, tydesc->shape, params, tydesc->shape_tables,
182-
p + sizeof(uintptr_t), ircs);
183-
irc.walk();
184181

185182
#if 0
183+
shape::print print(task, true, tydesc->shape, params,
184+
tydesc->shape_tables);
185+
print.walk();
186+
186187
shape::log log(task, true, tydesc->shape, params,
187-
tydesc->shape_tables, p, std::cerr);
188+
tydesc->shape_tables, p + sizeof(uintptr_t),
189+
std::cerr);
188190
log.walk();
189191
#endif
190192

193+
irc irc(task, true, tydesc->shape, params, tydesc->shape_tables,
194+
p + sizeof(uintptr_t), ircs);
195+
irc.walk();
196+
191197
++begin;
192198
}
193199
}

trunk/src/rt/rust_task.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ void task_start_wrapper(spawn_args *a)
152152
failed = true;
153153
}
154154

155+
cc::do_cc(task);
156+
155157
rust_closure_env* env = (rust_closure_env*)a->a3;
156158
if(env) {
157159
// free the environment.
@@ -551,6 +553,35 @@ rust_chan *rust_task::get_chan_by_handle(chan_handle *handle) {
551553
return NULL;
552554
}
553555

556+
// Temporary routine to allow boxes on one task's shared heap to be reparented
557+
// to another.
558+
const type_desc *
559+
rust_task::release_alloc(void *alloc) {
560+
lock.lock();
561+
562+
assert(local_allocs.find(alloc) != local_allocs.end());
563+
const type_desc *tydesc = local_allocs[alloc];
564+
local_allocs.erase(alloc);
565+
566+
local_region.release_alloc(alloc);
567+
568+
lock.unlock();
569+
return tydesc;
570+
}
571+
572+
// Temporary routine to allow boxes from one task's shared heap to be
573+
// reparented to this one.
574+
void
575+
rust_task::claim_alloc(void *alloc, const type_desc *tydesc) {
576+
lock.lock();
577+
578+
assert(local_allocs.find(alloc) == local_allocs.end());
579+
local_allocs[alloc] = tydesc;
580+
local_region.claim_alloc(alloc);
581+
582+
lock.unlock();
583+
}
584+
554585
//
555586
// Local Variables:
556587
// mode: C++

trunk/src/rt/rust_task.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ rust_task : public kernel_owned<rust_task>, rust_cond
204204
intptr_t get_ref_count() const { return ref_count; }
205205

206206
rust_chan *get_chan_by_handle(chan_handle *handle);
207+
208+
// FIXME: These functions only exist to get the tasking system off the
209+
// ground. We should never be migrating shared boxes between tasks.
210+
const type_desc *release_alloc(void *alloc);
211+
void claim_alloc(void *alloc, const type_desc *tydesc);
207212
};
208213

209214
//

0 commit comments

Comments
 (0)