Skip to content

Commit c0d689f

Browse files
committed
---
yaml --- r: 12242 b: refs/heads/master c: 2437908 h: refs/heads/master v: v3
1 parent 83f274e commit c0d689f

18 files changed

+191
-191
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 6bf8d19712e2310ab6a7da2e82b2287278a772e4
2+
refs/heads/master: 243790836a40fd3f23d8bd16d8f45430d19aae61
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/mk/rt.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ RUNTIME_CS_$(1) := \
5050
rt/rust_builtin.cpp \
5151
rt/rust_run_program.cpp \
5252
rt/rust_env.cpp \
53-
rt/rust_task_thread.cpp \
53+
rt/rust_sched_loop.cpp \
5454
rt/rust_sched_launcher.cpp \
5555
rt/rust_scheduler.cpp \
5656
rt/rust_task.cpp \

trunk/src/rt/rust.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,14 @@ rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
8080
rust_sched_id sched_id = kernel->create_scheduler(env->num_sched_threads);
8181
rust_scheduler *sched = kernel->get_scheduler_by_id(sched_id);
8282
rust_task *root_task = sched->create_task(NULL, "main");
83-
rust_task_thread *thread = root_task->thread;
8483
command_line_args *args
8584
= new (kernel, "main command line args")
8685
command_line_args(root_task, argc, argv);
8786

88-
DLOG(thread, dom, "startup: %d args in 0x%" PRIxPTR,
87+
LOG(root_task, dom, "startup: %d args in 0x%" PRIxPTR,
8988
args->argc, (uintptr_t)args->args);
9089
for (int i = 0; i < args->argc; i++) {
91-
DLOG(thread, dom, "startup: arg[%d] = '%s'", i, args->argv[i]);
90+
LOG(root_task, dom, "startup: arg[%d] = '%s'", i, args->argv[i]);
9291
}
9392

9493
root_task->start((spawn_fn)main_fn, NULL, args->args);

trunk/src/rt/rust_builtin.cpp

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Native builtins. */
22

33
#include "rust_internal.h"
4-
#include "rust_task_thread.h"
4+
#include "rust_sched_loop.h"
55
#include "rust_task.h"
66
#include "rust_util.h"
77
#include "rust_scheduler.h"
@@ -22,7 +22,7 @@ extern char **environ;
2222

2323
extern "C" CDECL rust_str*
2424
last_os_error() {
25-
rust_task *task = rust_task_thread::get_task();
25+
rust_task *task = rust_sched_loop::get_task();
2626

2727
LOG(task, task, "last_os_error()");
2828

@@ -65,7 +65,7 @@ last_os_error() {
6565

6666
extern "C" CDECL rust_str *
6767
rust_getcwd() {
68-
rust_task *task = rust_task_thread::get_task();
68+
rust_task *task = rust_sched_loop::get_task();
6969
LOG(task, task, "rust_getcwd()");
7070

7171
char cbuf[BUF_BYTES];
@@ -85,7 +85,7 @@ rust_getcwd() {
8585
#if defined(__WIN32__)
8686
extern "C" CDECL rust_vec *
8787
rust_env_pairs() {
88-
rust_task *task = rust_task_thread::get_task();
88+
rust_task *task = rust_sched_loop::get_task();
8989
size_t envc = 0;
9090
LPTCH ch = GetEnvironmentStringsA();
9191
LPTCH c;
@@ -111,7 +111,7 @@ rust_env_pairs() {
111111
#else
112112
extern "C" CDECL rust_vec *
113113
rust_env_pairs() {
114-
rust_task *task = rust_task_thread::get_task();
114+
rust_task *task = rust_sched_loop::get_task();
115115
#ifdef __APPLE__
116116
char **environ = *_NSGetEnviron();
117117
#endif
@@ -133,21 +133,21 @@ refcount(intptr_t *v) {
133133

134134
extern "C" CDECL void
135135
unsupervise() {
136-
rust_task *task = rust_task_thread::get_task();
136+
rust_task *task = rust_sched_loop::get_task();
137137
task->unsupervise();
138138
}
139139

140140
extern "C" CDECL void
141141
vec_reserve_shared(type_desc* ty, rust_vec** vp,
142142
size_t n_elts) {
143-
rust_task *task = rust_task_thread::get_task();
143+
rust_task *task = rust_sched_loop::get_task();
144144
reserve_vec_exact(task, vp, n_elts * ty->size);
145145
}
146146

147147
extern "C" CDECL void
148148
str_reserve_shared(rust_vec** sp,
149149
size_t n_elts) {
150-
rust_task *task = rust_task_thread::get_task();
150+
rust_task *task = rust_sched_loop::get_task();
151151
reserve_vec_exact(task, sp, n_elts + 1);
152152
}
153153

@@ -157,7 +157,7 @@ str_reserve_shared(rust_vec** sp,
157157
*/
158158
extern "C" CDECL rust_vec*
159159
vec_from_buf_shared(type_desc *ty, void *ptr, size_t count) {
160-
rust_task *task = rust_task_thread::get_task();
160+
rust_task *task = rust_sched_loop::get_task();
161161
size_t fill = ty->size * count;
162162
rust_vec* v = (rust_vec*)task->kernel->malloc(fill + sizeof(rust_vec),
163163
"vec_from_buf");
@@ -168,7 +168,7 @@ vec_from_buf_shared(type_desc *ty, void *ptr, size_t count) {
168168

169169
extern "C" CDECL void
170170
rust_str_push(rust_vec** sp, uint8_t byte) {
171-
rust_task *task = rust_task_thread::get_task();
171+
rust_task *task = rust_sched_loop::get_task();
172172
size_t fill = (*sp)->fill;
173173
reserve_vec(task, sp, fill + 1);
174174
(*sp)->data[fill-1] = byte;
@@ -178,8 +178,8 @@ rust_str_push(rust_vec** sp, uint8_t byte) {
178178

179179
extern "C" CDECL void *
180180
rand_new() {
181-
rust_task *task = rust_task_thread::get_task();
182-
rust_task_thread *thread = task->thread;
181+
rust_task *task = rust_sched_loop::get_task();
182+
rust_sched_loop *thread = task->sched_loop;
183183
randctx *rctx = (randctx *) task->malloc(sizeof(randctx), "randctx");
184184
if (!rctx) {
185185
task->fail();
@@ -196,7 +196,7 @@ rand_next(randctx *rctx) {
196196

197197
extern "C" CDECL void
198198
rand_free(randctx *rctx) {
199-
rust_task *task = rust_task_thread::get_task();
199+
rust_task *task = rust_sched_loop::get_task();
200200
task->free(rctx);
201201
}
202202

@@ -242,22 +242,22 @@ debug_abi_2(floats f) {
242242
static void
243243
debug_tydesc_helper(type_desc *t)
244244
{
245-
rust_task *task = rust_task_thread::get_task();
245+
rust_task *task = rust_sched_loop::get_task();
246246
LOG(task, stdlib, " size %" PRIdPTR ", align %" PRIdPTR
247247
", first_param 0x%" PRIxPTR,
248248
t->size, t->align, t->first_param);
249249
}
250250

251251
extern "C" CDECL void
252252
debug_tydesc(type_desc *t) {
253-
rust_task *task = rust_task_thread::get_task();
253+
rust_task *task = rust_sched_loop::get_task();
254254
LOG(task, stdlib, "debug_tydesc");
255255
debug_tydesc_helper(t);
256256
}
257257

258258
extern "C" CDECL void
259259
debug_opaque(type_desc *t, uint8_t *front) {
260-
rust_task *task = rust_task_thread::get_task();
260+
rust_task *task = rust_sched_loop::get_task();
261261
LOG(task, stdlib, "debug_opaque");
262262
debug_tydesc_helper(t);
263263
// FIXME may want to actually account for alignment. `front` may not
@@ -277,7 +277,7 @@ struct rust_box {
277277

278278
extern "C" CDECL void
279279
debug_box(type_desc *t, rust_box *box) {
280-
rust_task *task = rust_task_thread::get_task();
280+
rust_task *task = rust_sched_loop::get_task();
281281
LOG(task, stdlib, "debug_box(0x%" PRIxPTR ")", box);
282282
debug_tydesc_helper(t);
283283
LOG(task, stdlib, " refcount %" PRIdPTR,
@@ -294,7 +294,7 @@ struct rust_tag {
294294

295295
extern "C" CDECL void
296296
debug_tag(type_desc *t, rust_tag *tag) {
297-
rust_task *task = rust_task_thread::get_task();
297+
rust_task *task = rust_sched_loop::get_task();
298298

299299
LOG(task, stdlib, "debug_tag");
300300
debug_tydesc_helper(t);
@@ -312,7 +312,7 @@ struct rust_fn {
312312

313313
extern "C" CDECL void
314314
debug_fn(type_desc *t, rust_fn *fn) {
315-
rust_task *task = rust_task_thread::get_task();
315+
rust_task *task = rust_sched_loop::get_task();
316316
LOG(task, stdlib, "debug_fn");
317317
debug_tydesc_helper(t);
318318
LOG(task, stdlib, " thunk at 0x%" PRIxPTR, fn->thunk);
@@ -326,7 +326,7 @@ extern "C" CDECL void *
326326
debug_ptrcast(type_desc *from_ty,
327327
type_desc *to_ty,
328328
void *ptr) {
329-
rust_task *task = rust_task_thread::get_task();
329+
rust_task *task = rust_sched_loop::get_task();
330330
LOG(task, stdlib, "debug_ptrcast from");
331331
debug_tydesc_helper(from_ty);
332332
LOG(task, stdlib, "to");
@@ -336,13 +336,13 @@ debug_ptrcast(type_desc *from_ty,
336336

337337
extern "C" CDECL void *
338338
debug_get_stk_seg() {
339-
rust_task *task = rust_task_thread::get_task();
339+
rust_task *task = rust_sched_loop::get_task();
340340
return task->stk;
341341
}
342342

343343
extern "C" CDECL rust_vec*
344344
rust_list_files(rust_str *path) {
345-
rust_task *task = rust_task_thread::get_task();
345+
rust_task *task = rust_sched_loop::get_task();
346346
array_list<rust_str*> strings;
347347
#if defined(__WIN32__)
348348
WIN32_FIND_DATA FindFileData;
@@ -443,21 +443,21 @@ precise_time_ns(uint64_t *ns) {
443443

444444
extern "C" CDECL rust_sched_id
445445
rust_get_sched_id() {
446-
rust_task *task = rust_task_thread::get_task();
446+
rust_task *task = rust_sched_loop::get_task();
447447
return task->sched->get_id();
448448
}
449449

450450
extern "C" CDECL rust_sched_id
451451
rust_new_sched(uintptr_t threads) {
452-
rust_task *task = rust_task_thread::get_task();
453-
A(task->thread, threads > 0,
452+
rust_task *task = rust_sched_loop::get_task();
453+
A(task->sched_loop, threads > 0,
454454
"Can't create a scheduler with no threads, silly!");
455455
return task->kernel->create_scheduler(threads);
456456
}
457457

458458
extern "C" CDECL rust_task_id
459459
get_task_id() {
460-
rust_task *task = rust_task_thread::get_task();
460+
rust_task *task = rust_sched_loop::get_task();
461461
return task->id;
462462
}
463463

@@ -468,13 +468,13 @@ new_task_common(rust_scheduler *sched, rust_task *parent) {
468468

469469
extern "C" CDECL rust_task*
470470
new_task() {
471-
rust_task *task = rust_task_thread::get_task();
471+
rust_task *task = rust_sched_loop::get_task();
472472
return new_task_common(task->sched, task);
473473
}
474474

475475
extern "C" CDECL rust_task*
476476
rust_new_task_in_sched(rust_sched_id id) {
477-
rust_task *task = rust_task_thread::get_task();
477+
rust_task *task = rust_sched_loop::get_task();
478478
rust_scheduler *sched = task->kernel->get_scheduler_by_id(id);
479479
// FIXME: What if we didn't get the scheduler?
480480
return new_task_common(sched, task);
@@ -487,7 +487,7 @@ rust_task_config_notify(rust_task *target, rust_port_id *port) {
487487

488488
extern "C" rust_task *
489489
rust_get_task() {
490-
return rust_task_thread::get_task();
490+
return rust_sched_loop::get_task();
491491
}
492492

493493
extern "C" CDECL void
@@ -497,13 +497,13 @@ start_task(rust_task *target, fn_env_pair *f) {
497497

498498
extern "C" CDECL int
499499
sched_threads() {
500-
rust_task *task = rust_task_thread::get_task();
500+
rust_task *task = rust_sched_loop::get_task();
501501
return task->sched->number_of_threads();
502502
}
503503

504504
extern "C" CDECL rust_port*
505505
new_port(size_t unit_sz) {
506-
rust_task *task = rust_task_thread::get_task();
506+
rust_task *task = rust_sched_loop::get_task();
507507
LOG(task, comm, "new_port(task=0x%" PRIxPTR " (%s), unit_sz=%d)",
508508
(uintptr_t) task, task->name, unit_sz);
509509
// port starts with refcount == 1
@@ -512,7 +512,7 @@ new_port(size_t unit_sz) {
512512

513513
extern "C" CDECL void
514514
rust_port_begin_detach(rust_port *port, uintptr_t *yield) {
515-
rust_task *task = rust_task_thread::get_task();
515+
rust_task *task = rust_sched_loop::get_task();
516516
LOG(task, comm, "rust_port_detach(0x%" PRIxPTR ")", (uintptr_t) port);
517517
port->begin_detach(yield);
518518
}
@@ -524,7 +524,7 @@ rust_port_end_detach(rust_port *port) {
524524

525525
extern "C" CDECL void
526526
del_port(rust_port *port) {
527-
rust_task *task = rust_task_thread::get_task();
527+
rust_task *task = rust_sched_loop::get_task();
528528
LOG(task, comm, "del_port(0x%" PRIxPTR ")", (uintptr_t) port);
529529
delete port;
530530
}
@@ -542,7 +542,7 @@ get_port_id(rust_port *port) {
542542
extern "C" CDECL uintptr_t
543543
rust_port_id_send(type_desc *t, rust_port_id target_port_id, void *sptr) {
544544
bool sent = false;
545-
rust_task *task = rust_task_thread::get_task();
545+
rust_task *task = rust_sched_loop::get_task();
546546

547547
LOG(task, comm, "rust_port_id*_send port: 0x%" PRIxPTR,
548548
(uintptr_t) target_port_id);
@@ -573,14 +573,14 @@ port_recv(uintptr_t *dptr, rust_port *port, uintptr_t *yield) {
573573
extern "C" CDECL void
574574
rust_port_select(rust_port **dptr, rust_port **ports,
575575
size_t n_ports, uintptr_t *yield) {
576-
rust_task *task = rust_task_thread::get_task();
576+
rust_task *task = rust_sched_loop::get_task();
577577
rust_port_selector *selector = task->get_port_selector();
578578
selector->select(task, dptr, ports, n_ports, yield);
579579
}
580580

581581
extern "C" CDECL void
582582
rust_set_exit_status(intptr_t code) {
583-
rust_task *task = rust_task_thread::get_task();
583+
rust_task *task = rust_sched_loop::get_task();
584584
task->kernel->set_exit_status((int)code);
585585
}
586586

@@ -595,7 +595,7 @@ extern void log_console_off(rust_env *env);
595595

596596
extern "C" CDECL void
597597
rust_log_console_off() {
598-
rust_task *task = rust_task_thread::get_task();
598+
rust_task *task = rust_sched_loop::get_task();
599599
log_console_off(task->kernel->env);
600600
}
601601

@@ -606,36 +606,36 @@ rust_dbg_lock_create() {
606606

607607
extern "C" CDECL void
608608
rust_dbg_lock_destroy(lock_and_signal *lock) {
609-
rust_task *task = rust_task_thread::get_task();
610-
I(task->thread, lock);
609+
rust_task *task = rust_sched_loop::get_task();
610+
I(task->sched_loop, lock);
611611
delete lock;
612612
}
613613

614614
extern "C" CDECL void
615615
rust_dbg_lock_lock(lock_and_signal *lock) {
616-
rust_task *task = rust_task_thread::get_task();
617-
I(task->thread, lock);
616+
rust_task *task = rust_sched_loop::get_task();
617+
I(task->sched_loop, lock);
618618
lock->lock();
619619
}
620620

621621
extern "C" CDECL void
622622
rust_dbg_lock_unlock(lock_and_signal *lock) {
623-
rust_task *task = rust_task_thread::get_task();
624-
I(task->thread, lock);
623+
rust_task *task = rust_sched_loop::get_task();
624+
I(task->sched_loop, lock);
625625
lock->unlock();
626626
}
627627

628628
extern "C" CDECL void
629629
rust_dbg_lock_wait(lock_and_signal *lock) {
630-
rust_task *task = rust_task_thread::get_task();
631-
I(task->thread, lock);
630+
rust_task *task = rust_sched_loop::get_task();
631+
I(task->sched_loop, lock);
632632
lock->wait();
633633
}
634634

635635
extern "C" CDECL void
636636
rust_dbg_lock_signal(lock_and_signal *lock) {
637-
rust_task *task = rust_task_thread::get_task();
638-
I(task->thread, lock);
637+
rust_task *task = rust_sched_loop::get_task();
638+
I(task->sched_loop, lock);
639639
lock->signal();
640640
}
641641

0 commit comments

Comments
 (0)