@@ -90,7 +90,6 @@ upcall_trace_str(rust_task *task, char const *c) {
90
90
extern " C" CDECL rust_port*
91
91
upcall_new_port (rust_task *task, size_t unit_sz) {
92
92
LOG_UPCALL_ENTRY (task);
93
- scoped_lock with (task->kernel ->scheduler_lock );
94
93
LOG (task, comm, " upcall_new_port(task=0x%" PRIxPTR " (%s), unit_sz=%d)" ,
95
94
(uintptr_t ) task, task->name , unit_sz);
96
95
return new (task) rust_port (task, unit_sz);
@@ -99,7 +98,6 @@ upcall_new_port(rust_task *task, size_t unit_sz) {
99
98
extern " C" CDECL void
100
99
upcall_del_port (rust_task *task, rust_port *port) {
101
100
LOG_UPCALL_ENTRY (task);
102
- scoped_lock with (task->kernel ->scheduler_lock );
103
101
LOG (task, comm, " upcall del_port(0x%" PRIxPTR " )" , (uintptr_t ) port);
104
102
I (task->sched , !port->ref_count );
105
103
delete port;
@@ -139,7 +137,6 @@ upcall_flush_chan(rust_task *task, rust_chan *chan) {
139
137
extern " C" CDECL
140
138
void upcall_del_chan (rust_task *task, rust_chan *chan) {
141
139
LOG_UPCALL_ENTRY (task);
142
- scoped_lock with (task->kernel ->scheduler_lock );
143
140
144
141
LOG (task, comm, " upcall del_chan(0x%" PRIxPTR " )" , (uintptr_t ) chan);
145
142
chan->destroy ();
@@ -153,7 +150,6 @@ extern "C" CDECL rust_chan *
153
150
upcall_clone_chan (rust_task *task, maybe_proxy<rust_task> *target,
154
151
rust_chan *chan) {
155
152
LOG_UPCALL_ENTRY (task);
156
- scoped_lock with (task->kernel ->scheduler_lock );
157
153
return chan->clone (target);
158
154
}
159
155
@@ -181,34 +177,31 @@ upcall_sleep(rust_task *task, size_t time_in_us) {
181
177
extern " C" CDECL void
182
178
upcall_send (rust_task *task, rust_chan *chan, void *sptr) {
183
179
LOG_UPCALL_ENTRY (task);
184
- scoped_lock with (task->kernel ->scheduler_lock );
185
180
chan->send (sptr);
186
181
LOG (task, comm, " === sent data ===>" );
187
182
}
188
183
189
184
extern " C" CDECL void
190
185
upcall_recv (rust_task *task, uintptr_t *dptr, rust_port *port) {
191
- {
192
- LOG_UPCALL_ENTRY (task);
193
- scoped_lock with (task->kernel ->scheduler_lock );
194
-
195
- LOG (task, comm, " port: 0x%" PRIxPTR " , dptr: 0x%" PRIxPTR
196
- " , size: 0x%" PRIxPTR " , chan_no: %d" ,
197
- (uintptr_t ) port, (uintptr_t ) dptr, port->unit_sz ,
198
- port->chans .length ());
199
-
200
- if (port->receive (dptr)) {
201
- return ;
202
- }
203
-
204
- // No data was buffered on any incoming channel, so block this task
205
- // on the port. Remember the rendezvous location so that any sender
206
- // task can write to it before waking up this task.
207
-
208
- LOG (task, comm, " <=== waiting for rendezvous data ===" );
209
- task->rendezvous_ptr = dptr;
210
- task->block (port, " waiting for rendezvous data" );
186
+ LOG_UPCALL_ENTRY (task);
187
+
188
+ LOG (task, comm, " port: 0x%" PRIxPTR " , dptr: 0x%" PRIxPTR
189
+ " , size: 0x%" PRIxPTR " , chan_no: %d" ,
190
+ (uintptr_t ) port, (uintptr_t ) dptr, port->unit_sz ,
191
+ port->chans .length ());
192
+
193
+ if (port->receive (dptr)) {
194
+ return ;
211
195
}
196
+
197
+ // No data was buffered on any incoming channel, so block this task on the
198
+ // port. Remember the rendezvous location so that any sender task can
199
+ // write to it before waking up this task.
200
+
201
+ LOG (task, comm, " <=== waiting for rendezvous data ===" );
202
+ task->rendezvous_ptr = dptr;
203
+ task->block (port, " waiting for rendezvous data" );
204
+
212
205
task->yield (3 );
213
206
}
214
207
@@ -228,7 +221,7 @@ upcall_fail(rust_task *task,
228
221
extern " C" CDECL void
229
222
upcall_kill (rust_task *task, maybe_proxy<rust_task> *target) {
230
223
LOG_UPCALL_ENTRY (task);
231
- scoped_lock with (task-> kernel -> scheduler_lock );
224
+
232
225
if (target->is_proxy ()) {
233
226
notify_message::
234
227
send (notify_message::KILL, " kill" , task->get_handle (),
@@ -245,33 +238,31 @@ upcall_kill(rust_task *task, maybe_proxy<rust_task> *target) {
245
238
*/
246
239
extern " C" CDECL void
247
240
upcall_exit (rust_task *task) {
248
- {
249
- LOG_UPCALL_ENTRY (task);
250
- scoped_lock with (task->kernel ->scheduler_lock );
251
- LOG (task, task, " task ref_count: %d" , task->ref_count );
252
- A (task->sched , task->ref_count >= 0 ,
253
- " Task ref_count should not be negative on exit!" );
254
- task->die ();
255
- task->notify_tasks_waiting_to_join ();
256
- }
241
+ LOG_UPCALL_ENTRY (task);
242
+ LOG (task, task, " task ref_count: %d" , task->ref_count );
243
+ A (task->sched , task->ref_count >= 0 ,
244
+ " Task ref_count should not be negative on exit!" );
245
+ task->die ();
246
+ task->notify_tasks_waiting_to_join ();
257
247
task->yield (1 );
258
248
}
259
249
260
250
extern " C" CDECL uintptr_t
261
251
upcall_malloc (rust_task *task, size_t nbytes, type_desc *td) {
262
252
LOG_UPCALL_ENTRY (task);
263
- scoped_lock with (task->kernel ->scheduler_lock );
264
253
265
254
LOG (task, mem,
266
- " upcall malloc(%" PRIdPTR " , 0x%" PRIxPTR " )"
267
- " with gc-chain head = 0x%" PRIxPTR,
268
- nbytes, td, task->gc_alloc_chain );
255
+ " upcall malloc(%" PRIdPTR " , 0x%" PRIxPTR " )"
256
+ " with gc-chain head = 0x%" PRIxPTR,
257
+ nbytes, td, task->gc_alloc_chain );
258
+
269
259
void *p = task->malloc (nbytes, td);
260
+
270
261
LOG (task, mem,
271
- " upcall malloc(%" PRIdPTR " , 0x%" PRIxPTR
272
- " ) = 0x%" PRIxPTR
273
- " with gc-chain head = 0x%" PRIxPTR,
274
- nbytes, td, (uintptr_t )p, task->gc_alloc_chain );
262
+ " upcall malloc(%" PRIdPTR " , 0x%" PRIxPTR
263
+ " ) = 0x%" PRIxPTR
264
+ " with gc-chain head = 0x%" PRIxPTR,
265
+ nbytes, td, (uintptr_t )p, task->gc_alloc_chain );
275
266
return (uintptr_t ) p;
276
267
}
277
268
@@ -281,7 +272,7 @@ upcall_malloc(rust_task *task, size_t nbytes, type_desc *td) {
281
272
extern " C" CDECL void
282
273
upcall_free (rust_task *task, void * ptr, uintptr_t is_gc) {
283
274
LOG_UPCALL_ENTRY (task);
284
- scoped_lock with (task-> kernel -> scheduler_lock );
275
+
285
276
rust_scheduler *sched = task->sched ;
286
277
DLOG (sched, mem,
287
278
" upcall free(0x%" PRIxPTR " , is_gc=%" PRIdPTR " )" ,
@@ -322,7 +313,6 @@ upcall_shared_free(rust_task *task, void* ptr) {
322
313
extern " C" CDECL uintptr_t
323
314
upcall_mark (rust_task *task, void * ptr) {
324
315
LOG_UPCALL_ENTRY (task);
325
- scoped_lock with (task->kernel ->scheduler_lock );
326
316
327
317
rust_scheduler *sched = task->sched ;
328
318
if (ptr) {
@@ -354,23 +344,21 @@ rust_str *make_str(rust_task *task, char const *s, size_t fill) {
354
344
extern " C" CDECL rust_str *
355
345
upcall_new_str (rust_task *task, char const *s, size_t fill) {
356
346
LOG_UPCALL_ENTRY (task);
357
- scoped_lock with (task->kernel ->scheduler_lock );
358
347
359
348
return make_str (task, s, fill);
360
349
}
361
350
362
351
extern " C" CDECL rust_str *
363
352
upcall_dup_str (rust_task *task, rust_task *target, rust_str *str) {
364
353
LOG_UPCALL_ENTRY (task);
365
- scoped_lock with (task->kernel ->scheduler_lock );
366
354
367
355
return make_str (target, (char const *)str->data , str->fill );
368
356
}
369
357
370
358
extern " C" CDECL rust_vec *
371
359
upcall_new_vec (rust_task *task, size_t fill, type_desc *td) {
372
360
LOG_UPCALL_ENTRY (task);
373
- scoped_lock with (task-> kernel -> scheduler_lock );
361
+
374
362
rust_scheduler *sched = task->sched ;
375
363
DLOG (sched, mem, " upcall new_vec(%" PRIdPTR " )" , fill);
376
364
size_t alloc = next_power_of_two (sizeof (rust_vec) + fill);
@@ -511,7 +499,7 @@ upcall_get_type_desc(rust_task *task,
511
499
type_desc const **descs) {
512
500
check_stack (task);
513
501
LOG_UPCALL_ENTRY (task);
514
- scoped_lock with (task-> kernel -> scheduler_lock );
502
+
515
503
LOG (task, cache, " upcall get_type_desc with size=%" PRIdPTR
516
504
" , align=%" PRIdPTR " , %" PRIdPTR " descs" , size, align,
517
505
n_descs);
@@ -568,7 +556,7 @@ upcall_ivec_resize(rust_task *task,
568
556
rust_ivec *v,
569
557
size_t newsz) {
570
558
LOG_UPCALL_ENTRY (task);
571
- scoped_lock with (task-> kernel -> scheduler_lock );
559
+
572
560
I (task->sched , !v->fill );
573
561
574
562
size_t new_alloc = next_power_of_two (newsz);
@@ -588,7 +576,6 @@ upcall_ivec_spill(rust_task *task,
588
576
rust_ivec *v,
589
577
size_t newsz) {
590
578
LOG_UPCALL_ENTRY (task);
591
- scoped_lock with (task->kernel ->scheduler_lock );
592
579
size_t new_alloc = next_power_of_two (newsz);
593
580
594
581
rust_ivec_heap *heap_part = (rust_ivec_heap *)
0 commit comments