@@ -70,80 +70,6 @@ upcall_log_istr(rust_task *task, uint32_t level, rust_ivec *str) {
70
70
task->sched ->log (task, level, " rust: %s" , buf);
71
71
}
72
72
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
-
147
73
extern " C" CDECL void
148
74
upcall_yield (rust_task *task) {
149
75
LOG_UPCALL_ENTRY (task);
@@ -160,24 +86,6 @@ upcall_sleep(rust_task *task, size_t time_in_us) {
160
86
task->yield (time_in_us);
161
87
}
162
88
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
-
181
89
extern " C" CDECL void
182
90
upcall_fail (rust_task *task,
183
91
char const *expr,
@@ -314,15 +222,6 @@ upcall_new_str(rust_task *task, char const *s, size_t fill) {
314
222
return make_str (task, s, fill);
315
223
}
316
224
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
-
326
225
extern " C" CDECL rust_vec *
327
226
upcall_new_vec (rust_task *task, size_t fill, type_desc *td) {
328
227
LOG_UPCALL_ENTRY (task);
@@ -477,80 +376,6 @@ upcall_get_type_desc(rust_task *task,
477
376
return td;
478
377
}
479
378
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
-
554
379
/* *
555
380
* Resizes an interior vector that has been spilled to the heap.
556
381
*/
0 commit comments