Skip to content

Commit 713ed8f

Browse files
author
Eric Holk
committed
---
yaml --- r: 4724 b: refs/heads/master c: 89df915 h: refs/heads/master v: v3
1 parent 0f865f3 commit 713ed8f

File tree

4 files changed

+1
-232
lines changed

4 files changed

+1
-232
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: 862bc521a16ac764bee4446f60858459c6e04860
2+
refs/heads/master: 89df915a13454fbc9f51832394c7032716f70935

trunk/src/comp/back/upcall.rs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,8 @@ import lib::llvm::llvm::TypeRef;
2626

2727
type upcalls =
2828
{grow_task: ValueRef,
29-
new_port: ValueRef,
30-
del_port: ValueRef,
31-
new_chan: ValueRef,
32-
flush_chan: ValueRef,
33-
drop_chan: ValueRef,
34-
take_chan: ValueRef,
35-
del_chan: ValueRef,
36-
clone_chan: ValueRef,
37-
chan_target_task: ValueRef,
3829
_yield: ValueRef,
3930
sleep: ValueRef,
40-
send: ValueRef,
41-
recv: ValueRef,
4231
_fail: ValueRef,
4332
kill: ValueRef,
4433
exit: ValueRef,
@@ -48,14 +37,9 @@ type upcalls =
4837
shared_free: ValueRef,
4938
mark: ValueRef,
5039
new_str: ValueRef,
51-
dup_str: ValueRef,
5240
new_vec: ValueRef,
5341
vec_append: ValueRef,
5442
get_type_desc: ValueRef,
55-
new_task: ValueRef,
56-
take_task: ValueRef,
57-
drop_task: ValueRef,
58-
start_task: ValueRef,
5943
ivec_resize: ValueRef,
6044
ivec_spill: ValueRef,
6145
ivec_resize_shared: ValueRef,
@@ -83,23 +67,8 @@ fn declare_upcalls(tn: type_names, tydesc_type: TypeRef,
8367

8468
let empty_vec: [TypeRef] = ~[];
8569
ret @{grow_task: dv("grow_task", ~[T_size_t()]),
86-
new_port: d("new_port", ~[T_size_t()], T_opaque_port_ptr()),
87-
del_port: dv("del_port", ~[T_opaque_port_ptr()]),
88-
new_chan:
89-
d("new_chan", ~[T_opaque_port_ptr()], T_opaque_chan_ptr()),
90-
flush_chan: dv("flush_chan", ~[T_opaque_chan_ptr()]),
91-
drop_chan: dv("drop_chan", ~[T_opaque_chan_ptr()]),
92-
take_chan: dv("take_chan", ~[T_opaque_chan_ptr()]),
93-
del_chan: dv("del_chan", ~[T_opaque_chan_ptr()]),
94-
clone_chan:
95-
d("clone_chan", ~[taskptr_type, T_opaque_chan_ptr()],
96-
T_opaque_chan_ptr()),
97-
chan_target_task:
98-
d("chan_target_task", ~[T_opaque_chan_ptr()], taskptr_type),
9970
_yield: dv("yield", empty_vec),
10071
sleep: dv("sleep", ~[T_size_t()]),
101-
send: dv("send", ~[T_opaque_chan_ptr(), T_ptr(T_i8())]),
102-
recv: dv("recv", ~[T_ptr(T_ptr(T_i8())), T_opaque_port_ptr()]),
10372
_fail: dv("fail", ~[T_ptr(T_i8()), T_ptr(T_i8()), T_size_t()]),
10473
kill: dv("kill", ~[taskptr_type]),
10574
exit: dv("exit", empty_vec),
@@ -112,8 +81,6 @@ fn declare_upcalls(tn: type_names, tydesc_type: TypeRef,
11281
shared_free: dv("shared_free", ~[T_ptr(T_i8())]),
11382
mark: d("mark", ~[T_ptr(T_i8())], T_int()),
11483
new_str: d("new_str", ~[T_ptr(T_i8()), T_size_t()], T_ptr(T_str())),
115-
dup_str:
116-
d("dup_str", ~[taskptr_type, T_ptr(T_str())], T_ptr(T_str())),
11784
new_vec:
11885
d("new_vec", ~[T_size_t(), T_ptr(tydesc_type)],
11986
T_opaque_vec_ptr()),
@@ -126,12 +93,6 @@ fn declare_upcalls(tn: type_names, tydesc_type: TypeRef,
12693
d("get_type_desc",
12794
~[T_ptr(T_nil()), T_size_t(), T_size_t(), T_size_t(),
12895
T_ptr(T_ptr(tydesc_type))], T_ptr(tydesc_type)),
129-
new_task: d("new_task", ~[T_ptr(T_str())], taskptr_type),
130-
take_task: dv("take_task", ~[taskptr_type]),
131-
drop_task: dv("drop_task", ~[taskptr_type]),
132-
start_task:
133-
d("start_task", ~[taskptr_type, T_int(), T_int(), T_size_t()],
134-
taskptr_type),
13596
ivec_resize:
13697
d("ivec_resize", ~[T_ptr(T_opaque_ivec()), T_int()], T_void()),
13798
ivec_spill:

trunk/src/rt/rust_upcall.cpp

Lines changed: 0 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -70,80 +70,6 @@ upcall_log_istr(rust_task *task, uint32_t level, rust_ivec *str) {
7070
task->sched->log(task, level, "rust: %s", buf);
7171
}
7272

73-
extern "C" CDECL rust_port*
74-
new_port(rust_task *task, size_t unit_sz);
75-
extern "C" CDECL rust_port*
76-
upcall_new_port(rust_task *task, size_t unit_sz) {
77-
LOG_UPCALL_ENTRY(task);
78-
LOG(task, comm, "upcall_new_port(task=0x%" PRIxPTR " (%s), unit_sz=%d)",
79-
(uintptr_t) task, task->name, unit_sz);
80-
return new_port(task, unit_sz);
81-
}
82-
83-
extern "C" CDECL void
84-
del_port(rust_task *task, rust_port *port);
85-
extern "C" CDECL void
86-
upcall_del_port(rust_task *task, rust_port *port) {
87-
LOG_UPCALL_ENTRY(task);
88-
return del_port(task, port);
89-
}
90-
91-
/**
92-
* Creates a new channel pointing to a given port.
93-
*/
94-
extern "C" CDECL rust_chan*
95-
new_chan(rust_task *task, rust_port *port);
96-
extern "C" CDECL rust_chan*
97-
upcall_new_chan(rust_task *task, rust_port *port) {
98-
LOG_UPCALL_ENTRY(task);
99-
return new_chan(task, port);
100-
}
101-
102-
/**
103-
* Called whenever this channel needs to be flushed. This can happen due to a
104-
* flush statement, or automatically whenever a channel's ref count is
105-
* about to drop to zero.
106-
*/
107-
extern "C" CDECL void
108-
upcall_flush_chan(rust_task *task, rust_chan *chan) {
109-
LOG_UPCALL_ENTRY(task);
110-
}
111-
112-
/**
113-
* Called whenever the channel's ref count drops to zero.
114-
*
115-
* Cannot Yield: If the task were to unwind, the dropped ref would still
116-
* appear to be live, causing modify-after-free errors.
117-
*/
118-
extern "C" CDECL
119-
void del_chan(rust_task *task, rust_chan *chan);
120-
extern "C" CDECL
121-
void upcall_del_chan(rust_task *task, rust_chan *chan) {
122-
LOG_UPCALL_ENTRY(task);
123-
del_chan(task, chan);
124-
}
125-
126-
/**
127-
* Clones a channel and stores it in the spawnee's domain. Each spawned task
128-
* has its own copy of the channel.
129-
*/
130-
extern "C" CDECL rust_chan *
131-
upcall_clone_chan(rust_task *task, rust_task_id tid,
132-
rust_chan *chan) {
133-
// FIXME: This should be removed.
134-
LOG_UPCALL_ENTRY(task);
135-
rust_task *target = task->kernel->get_task_by_id(tid);
136-
rust_chan *c = chan->clone(target);
137-
target->deref();
138-
return c;
139-
}
140-
141-
extern "C" CDECL rust_task *
142-
upcall_chan_target_task(rust_task *task, rust_chan *chan) {
143-
LOG_UPCALL_ENTRY(task);
144-
return chan->port->task;
145-
}
146-
14773
extern "C" CDECL void
14874
upcall_yield(rust_task *task) {
14975
LOG_UPCALL_ENTRY(task);
@@ -160,24 +86,6 @@ upcall_sleep(rust_task *task, size_t time_in_us) {
16086
task->yield(time_in_us);
16187
}
16288

163-
/**
164-
* Buffers a chunk of data in the specified channel.
165-
*
166-
* sptr: pointer to a chunk of data to buffer
167-
*/
168-
extern "C" CDECL void
169-
upcall_send(rust_task *task, rust_chan *chan, void *sptr) {
170-
LOG_UPCALL_ENTRY(task);
171-
chan->send(sptr);
172-
LOG(task, comm, "=== sent data ===>");
173-
}
174-
175-
extern "C" CDECL void
176-
upcall_recv(rust_task *task, uintptr_t *dptr, rust_port *port) {
177-
LOG_UPCALL_ENTRY(task);
178-
port_recv(task, dptr, port);
179-
}
180-
18189
extern "C" CDECL void
18290
upcall_fail(rust_task *task,
18391
char const *expr,
@@ -314,15 +222,6 @@ upcall_new_str(rust_task *task, char const *s, size_t fill) {
314222
return make_str(task, s, fill);
315223
}
316224

317-
extern "C" CDECL rust_str *
318-
upcall_dup_str(rust_task *task, rust_task_id tid, rust_str *str) {
319-
LOG_UPCALL_ENTRY(task);
320-
rust_task *target = task->kernel->get_task_by_id(tid);
321-
rust_str *s = make_str(target, (char const *)str->data, str->fill);
322-
target->deref();
323-
return s;
324-
}
325-
326225
extern "C" CDECL rust_vec *
327226
upcall_new_vec(rust_task *task, size_t fill, type_desc *td) {
328227
LOG_UPCALL_ENTRY(task);
@@ -477,80 +376,6 @@ upcall_get_type_desc(rust_task *task,
477376
return td;
478377
}
479378

480-
extern "C" CDECL rust_task_id
481-
upcall_new_task(rust_task *spawner, rust_vec *name) {
482-
// name is a rust string structure.
483-
LOG_UPCALL_ENTRY(spawner);
484-
rust_task_id tid =
485-
spawner->kernel->create_task(spawner, (const char *)name->data);
486-
// let the kernel bump the ref count.
487-
spawner->kernel->get_task_by_id(tid);
488-
// no deref because we're letting the caller take ownership.
489-
return tid;
490-
}
491-
492-
extern "C" CDECL void
493-
upcall_take_task(rust_task *task, rust_task_id tid) {
494-
LOG_UPCALL_ENTRY(task);
495-
// get_task_by_id increments the refcount.
496-
task->kernel->get_task_by_id(tid);
497-
}
498-
499-
extern "C" CDECL void
500-
drop_task(rust_task *task, rust_task_id tid);
501-
extern "C" CDECL void
502-
upcall_drop_task(rust_task *task, rust_task_id tid) {
503-
LOG_UPCALL_ENTRY(task);
504-
drop_task(task, tid);
505-
}
506-
507-
extern "C" CDECL void
508-
upcall_take_chan(rust_task *task, rust_chan *target) {
509-
LOG_UPCALL_ENTRY(task);
510-
if(target) {
511-
target->ref();
512-
}
513-
}
514-
515-
extern "C" CDECL void
516-
upcall_drop_chan(rust_task *task, rust_chan *target) {
517-
LOG_UPCALL_ENTRY(task);
518-
if(target) {
519-
target->deref();
520-
}
521-
}
522-
523-
extern "C" CDECL rust_task *
524-
upcall_start_task(rust_task *spawner,
525-
rust_task_id tid,
526-
uintptr_t spawnee_fn,
527-
uintptr_t args,
528-
size_t args_sz) {
529-
LOG_UPCALL_ENTRY(spawner);
530-
531-
rust_scheduler *sched = spawner->sched;
532-
rust_task *task = spawner->kernel->get_task_by_id(tid);
533-
DLOG(sched, task,
534-
"upcall start_task(task %s @0x%" PRIxPTR
535-
", spawnee 0x%" PRIxPTR ")",
536-
task->name, task,
537-
spawnee_fn);
538-
539-
// we used to be generating this tuple in rustc, but it's easier to do it
540-
// here.
541-
//
542-
// The args tuple is stack-allocated. We need to move it over to the new
543-
// stack.
544-
task->rust_sp -= args_sz;
545-
uintptr_t child_arg = (uintptr_t)task->rust_sp;
546-
547-
memcpy((void*)task->rust_sp, (void*)args, args_sz);
548-
549-
task->start(spawnee_fn, child_arg);
550-
task->deref();
551-
return task;
552-
}
553-
554379
/**
555380
* Resizes an interior vector that has been spilled to the heap.
556381
*/

trunk/src/rt/rustrt.def.in

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,9 @@ task_sleep
8282
task_yield
8383
task_join
8484
unsupervise
85-
upcall_chan_target_task
86-
upcall_clone_chan
8785
upcall_cmp_type
88-
upcall_del_chan
89-
upcall_del_port
90-
upcall_drop_chan
91-
upcall_drop_task
92-
upcall_dup_str
9386
upcall_exit
9487
upcall_fail
95-
upcall_flush_chan
9688
upcall_free
9789
upcall_get_type_desc
9890
upcall_grow_task
@@ -107,19 +99,10 @@ upcall_log_str
10799
upcall_log_type
108100
upcall_malloc
109101
upcall_mark
110-
upcall_new_chan
111-
upcall_new_port
112102
upcall_new_str
113-
upcall_new_task
114103
upcall_new_vec
115-
upcall_recv
116-
upcall_send
117104
upcall_shared_malloc
118105
upcall_shared_free
119106
upcall_sleep
120-
upcall_start_task
121-
upcall_take_task
122-
upcall_take_chan
123107
upcall_vec_append
124108
upcall_yield
125-

0 commit comments

Comments
 (0)