@@ -22,7 +22,7 @@ extern char **environ;
22
22
23
23
extern " C" CDECL rust_str*
24
24
last_os_error () {
25
- rust_task *task = rust_sched_loop::get_task ();
25
+ rust_task *task = rust_get_current_task ();
26
26
27
27
LOG (task, task, " last_os_error()" );
28
28
@@ -65,7 +65,7 @@ last_os_error() {
65
65
66
66
extern " C" CDECL rust_str *
67
67
rust_getcwd () {
68
- rust_task *task = rust_sched_loop::get_task ();
68
+ rust_task *task = rust_get_current_task ();
69
69
LOG (task, task, " rust_getcwd()" );
70
70
71
71
char cbuf[BUF_BYTES];
@@ -85,7 +85,7 @@ rust_getcwd() {
85
85
#if defined(__WIN32__)
86
86
extern " C" CDECL rust_vec *
87
87
rust_env_pairs () {
88
- rust_task *task = rust_sched_loop::get_task ();
88
+ rust_task *task = rust_get_current_task ();
89
89
size_t envc = 0 ;
90
90
LPTCH ch = GetEnvironmentStringsA ();
91
91
LPTCH c;
@@ -111,7 +111,7 @@ rust_env_pairs() {
111
111
#else
112
112
extern " C" CDECL rust_vec *
113
113
rust_env_pairs () {
114
- rust_task *task = rust_sched_loop::get_task ();
114
+ rust_task *task = rust_get_current_task ();
115
115
#ifdef __APPLE__
116
116
char **environ = *_NSGetEnviron ();
117
117
#endif
@@ -133,21 +133,21 @@ refcount(intptr_t *v) {
133
133
134
134
extern " C" CDECL void
135
135
unsupervise () {
136
- rust_task *task = rust_sched_loop::get_task ();
136
+ rust_task *task = rust_get_current_task ();
137
137
task->unsupervise ();
138
138
}
139
139
140
140
extern " C" CDECL void
141
141
vec_reserve_shared (type_desc* ty, rust_vec** vp,
142
142
size_t n_elts) {
143
- rust_task *task = rust_sched_loop::get_task ();
143
+ rust_task *task = rust_get_current_task ();
144
144
reserve_vec_exact (task, vp, n_elts * ty->size );
145
145
}
146
146
147
147
extern " C" CDECL void
148
148
str_reserve_shared (rust_vec** sp,
149
149
size_t n_elts) {
150
- rust_task *task = rust_sched_loop::get_task ();
150
+ rust_task *task = rust_get_current_task ();
151
151
reserve_vec_exact (task, sp, n_elts + 1 );
152
152
}
153
153
@@ -157,7 +157,7 @@ str_reserve_shared(rust_vec** sp,
157
157
*/
158
158
extern " C" CDECL rust_vec*
159
159
vec_from_buf_shared (type_desc *ty, void *ptr, size_t count) {
160
- rust_task *task = rust_sched_loop::get_task ();
160
+ rust_task *task = rust_get_current_task ();
161
161
size_t fill = ty->size * count;
162
162
rust_vec* v = (rust_vec*)task->kernel ->malloc (fill + sizeof (rust_vec),
163
163
" vec_from_buf" );
@@ -168,7 +168,7 @@ vec_from_buf_shared(type_desc *ty, void *ptr, size_t count) {
168
168
169
169
extern " C" CDECL void
170
170
rust_str_push (rust_vec** sp, uint8_t byte) {
171
- rust_task *task = rust_sched_loop::get_task ();
171
+ rust_task *task = rust_get_current_task ();
172
172
size_t fill = (*sp)->fill ;
173
173
reserve_vec (task, sp, fill + 1 );
174
174
(*sp)->data [fill-1 ] = byte;
@@ -178,7 +178,7 @@ rust_str_push(rust_vec** sp, uint8_t byte) {
178
178
179
179
extern " C" CDECL void *
180
180
rand_new () {
181
- rust_task *task = rust_sched_loop::get_task ();
181
+ rust_task *task = rust_get_current_task ();
182
182
rust_sched_loop *thread = task->sched_loop ;
183
183
randctx *rctx = (randctx *) task->malloc (sizeof (randctx), " randctx" );
184
184
if (!rctx) {
@@ -196,7 +196,7 @@ rand_next(randctx *rctx) {
196
196
197
197
extern " C" CDECL void
198
198
rand_free (randctx *rctx) {
199
- rust_task *task = rust_sched_loop::get_task ();
199
+ rust_task *task = rust_get_current_task ();
200
200
task->free (rctx);
201
201
}
202
202
@@ -242,22 +242,22 @@ debug_abi_2(floats f) {
242
242
static void
243
243
debug_tydesc_helper (type_desc *t)
244
244
{
245
- rust_task *task = rust_sched_loop::get_task ();
245
+ rust_task *task = rust_get_current_task ();
246
246
LOG (task, stdlib, " size %" PRIdPTR " , align %" PRIdPTR
247
247
" , first_param 0x%" PRIxPTR,
248
248
t->size , t->align , t->first_param );
249
249
}
250
250
251
251
extern " C" CDECL void
252
252
debug_tydesc (type_desc *t) {
253
- rust_task *task = rust_sched_loop::get_task ();
253
+ rust_task *task = rust_get_current_task ();
254
254
LOG (task, stdlib, " debug_tydesc" );
255
255
debug_tydesc_helper (t);
256
256
}
257
257
258
258
extern " C" CDECL void
259
259
debug_opaque (type_desc *t, uint8_t *front) {
260
- rust_task *task = rust_sched_loop::get_task ();
260
+ rust_task *task = rust_get_current_task ();
261
261
LOG (task, stdlib, " debug_opaque" );
262
262
debug_tydesc_helper (t);
263
263
// FIXME may want to actually account for alignment. `front` may not
@@ -277,7 +277,7 @@ struct rust_box {
277
277
278
278
extern " C" CDECL void
279
279
debug_box (type_desc *t, rust_box *box) {
280
- rust_task *task = rust_sched_loop::get_task ();
280
+ rust_task *task = rust_get_current_task ();
281
281
LOG (task, stdlib, " debug_box(0x%" PRIxPTR " )" , box);
282
282
debug_tydesc_helper (t);
283
283
LOG (task, stdlib, " refcount %" PRIdPTR,
@@ -294,7 +294,7 @@ struct rust_tag {
294
294
295
295
extern " C" CDECL void
296
296
debug_tag (type_desc *t, rust_tag *tag) {
297
- rust_task *task = rust_sched_loop::get_task ();
297
+ rust_task *task = rust_get_current_task ();
298
298
299
299
LOG (task, stdlib, " debug_tag" );
300
300
debug_tydesc_helper (t);
@@ -312,7 +312,7 @@ struct rust_fn {
312
312
313
313
extern " C" CDECL void
314
314
debug_fn (type_desc *t, rust_fn *fn) {
315
- rust_task *task = rust_sched_loop::get_task ();
315
+ rust_task *task = rust_get_current_task ();
316
316
LOG (task, stdlib, " debug_fn" );
317
317
debug_tydesc_helper (t);
318
318
LOG (task, stdlib, " thunk at 0x%" PRIxPTR, fn->thunk );
@@ -326,7 +326,7 @@ extern "C" CDECL void *
326
326
debug_ptrcast (type_desc *from_ty,
327
327
type_desc *to_ty,
328
328
void *ptr) {
329
- rust_task *task = rust_sched_loop::get_task ();
329
+ rust_task *task = rust_get_current_task ();
330
330
LOG (task, stdlib, " debug_ptrcast from" );
331
331
debug_tydesc_helper (from_ty);
332
332
LOG (task, stdlib, " to" );
@@ -336,13 +336,13 @@ debug_ptrcast(type_desc *from_ty,
336
336
337
337
extern " C" CDECL void *
338
338
debug_get_stk_seg () {
339
- rust_task *task = rust_sched_loop::get_task ();
339
+ rust_task *task = rust_get_current_task ();
340
340
return task->stk ;
341
341
}
342
342
343
343
extern " C" CDECL rust_vec*
344
344
rust_list_files (rust_str *path) {
345
- rust_task *task = rust_sched_loop::get_task ();
345
+ rust_task *task = rust_get_current_task ();
346
346
array_list<rust_str*> strings;
347
347
#if defined(__WIN32__)
348
348
WIN32_FIND_DATA FindFileData;
@@ -443,20 +443,20 @@ precise_time_ns(uint64_t *ns) {
443
443
444
444
extern " C" CDECL rust_sched_id
445
445
rust_get_sched_id () {
446
- rust_task *task = rust_sched_loop::get_task ();
446
+ rust_task *task = rust_get_current_task ();
447
447
return task->sched ->get_id ();
448
448
}
449
449
450
450
extern " C" CDECL rust_sched_id
451
451
rust_new_sched (uintptr_t threads) {
452
- rust_task *task = rust_sched_loop::get_task ();
452
+ rust_task *task = rust_get_current_task ();
453
453
assert (threads > 0 && " Can't create a scheduler with no threads, silly!" );
454
454
return task->kernel ->create_scheduler (threads);
455
455
}
456
456
457
457
extern " C" CDECL rust_task_id
458
458
get_task_id () {
459
- rust_task *task = rust_sched_loop::get_task ();
459
+ rust_task *task = rust_get_current_task ();
460
460
return task->id ;
461
461
}
462
462
@@ -467,13 +467,13 @@ new_task_common(rust_scheduler *sched, rust_task *parent) {
467
467
468
468
extern " C" CDECL rust_task*
469
469
new_task () {
470
- rust_task *task = rust_sched_loop::get_task ();
470
+ rust_task *task = rust_get_current_task ();
471
471
return new_task_common (task->sched , task);
472
472
}
473
473
474
474
extern " C" CDECL rust_task*
475
475
rust_new_task_in_sched (rust_sched_id id) {
476
- rust_task *task = rust_sched_loop::get_task ();
476
+ rust_task *task = rust_get_current_task ();
477
477
rust_scheduler *sched = task->kernel ->get_scheduler_by_id (id);
478
478
// FIXME: What if we didn't get the scheduler?
479
479
return new_task_common (sched, task);
@@ -486,7 +486,7 @@ rust_task_config_notify(rust_task *target, rust_port_id *port) {
486
486
487
487
extern " C" rust_task *
488
488
rust_get_task () {
489
- return rust_sched_loop::get_task ();
489
+ return rust_get_current_task ();
490
490
}
491
491
492
492
extern " C" CDECL void
@@ -496,13 +496,13 @@ start_task(rust_task *target, fn_env_pair *f) {
496
496
497
497
extern " C" CDECL int
498
498
sched_threads () {
499
- rust_task *task = rust_sched_loop::get_task ();
499
+ rust_task *task = rust_get_current_task ();
500
500
return task->sched ->number_of_threads ();
501
501
}
502
502
503
503
extern " C" CDECL rust_port*
504
504
new_port (size_t unit_sz) {
505
- rust_task *task = rust_sched_loop::get_task ();
505
+ rust_task *task = rust_get_current_task ();
506
506
LOG (task, comm, " new_port(task=0x%" PRIxPTR " (%s), unit_sz=%d)" ,
507
507
(uintptr_t ) task, task->name , unit_sz);
508
508
// port starts with refcount == 1
@@ -511,7 +511,7 @@ new_port(size_t unit_sz) {
511
511
512
512
extern " C" CDECL void
513
513
rust_port_begin_detach (rust_port *port, uintptr_t *yield) {
514
- rust_task *task = rust_sched_loop::get_task ();
514
+ rust_task *task = rust_get_current_task ();
515
515
LOG (task, comm, " rust_port_detach(0x%" PRIxPTR " )" , (uintptr_t ) port);
516
516
port->begin_detach (yield);
517
517
}
@@ -523,7 +523,7 @@ rust_port_end_detach(rust_port *port) {
523
523
524
524
extern " C" CDECL void
525
525
del_port (rust_port *port) {
526
- rust_task *task = rust_sched_loop::get_task ();
526
+ rust_task *task = rust_get_current_task ();
527
527
LOG (task, comm, " del_port(0x%" PRIxPTR " )" , (uintptr_t ) port);
528
528
delete port;
529
529
}
@@ -541,7 +541,7 @@ get_port_id(rust_port *port) {
541
541
extern " C" CDECL uintptr_t
542
542
rust_port_id_send (type_desc *t, rust_port_id target_port_id, void *sptr) {
543
543
bool sent = false ;
544
- rust_task *task = rust_sched_loop::get_task ();
544
+ rust_task *task = rust_get_current_task ();
545
545
546
546
LOG (task, comm, " rust_port_id*_send port: 0x%" PRIxPTR,
547
547
(uintptr_t ) target_port_id);
@@ -572,14 +572,14 @@ port_recv(uintptr_t *dptr, rust_port *port, uintptr_t *yield) {
572
572
extern " C" CDECL void
573
573
rust_port_select (rust_port **dptr, rust_port **ports,
574
574
size_t n_ports, uintptr_t *yield) {
575
- rust_task *task = rust_sched_loop::get_task ();
575
+ rust_task *task = rust_get_current_task ();
576
576
rust_port_selector *selector = task->get_port_selector ();
577
577
selector->select (task, dptr, ports, n_ports, yield);
578
578
}
579
579
580
580
extern " C" CDECL void
581
581
rust_set_exit_status (intptr_t code) {
582
- rust_task *task = rust_sched_loop::get_task ();
582
+ rust_task *task = rust_get_current_task ();
583
583
task->kernel ->set_exit_status ((int )code);
584
584
}
585
585
@@ -594,7 +594,7 @@ extern void log_console_off(rust_env *env);
594
594
595
595
extern " C" CDECL void
596
596
rust_log_console_off () {
597
- rust_task *task = rust_sched_loop::get_task ();
597
+ rust_task *task = rust_get_current_task ();
598
598
log_console_off (task->kernel ->env );
599
599
}
600
600
0 commit comments