mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Remove obsolete nargs counts from runtime.
This commit is contained in:
parent
1ba53c008a
commit
2e2951305d
@ -29,7 +29,7 @@ last_os_error(rust_task *task) {
|
|||||||
char cbuf[BUF_BYTES];
|
char cbuf[BUF_BYTES];
|
||||||
char *buf = strerror_r(errno, cbuf, sizeof(cbuf));
|
char *buf = strerror_r(errno, cbuf, sizeof(cbuf));
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
task->fail(1);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -44,7 +44,7 @@ last_os_error(rust_task *task) {
|
|||||||
size_t alloc = next_power_of_two(sizeof(rust_str) + fill);
|
size_t alloc = next_power_of_two(sizeof(rust_str) + fill);
|
||||||
void *mem = task->malloc(alloc);
|
void *mem = task->malloc(alloc);
|
||||||
if (!mem) {
|
if (!mem) {
|
||||||
task->fail(1);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
rust_str *st = new (mem) rust_str(sched, alloc, fill,
|
rust_str *st = new (mem) rust_str(sched, alloc, fill,
|
||||||
@ -68,7 +68,7 @@ rust_getcwd(rust_task *task) {
|
|||||||
#else
|
#else
|
||||||
if (!getcwd(cbuf, sizeof(cbuf))) {
|
if (!getcwd(cbuf, sizeof(cbuf))) {
|
||||||
#endif
|
#endif
|
||||||
task->fail(1);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ rust_getcwd(rust_task *task) {
|
|||||||
size_t alloc = next_power_of_two(sizeof(rust_str) + fill);
|
size_t alloc = next_power_of_two(sizeof(rust_str) + fill);
|
||||||
void *mem = task->malloc(alloc);
|
void *mem = task->malloc(alloc);
|
||||||
if (!mem) {
|
if (!mem) {
|
||||||
task->fail(1);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ refcount(rust_task *task, type_desc *t, intptr_t *v) {
|
|||||||
|
|
||||||
extern "C" CDECL void
|
extern "C" CDECL void
|
||||||
do_gc(rust_task *task) {
|
do_gc(rust_task *task) {
|
||||||
task->gc(1);
|
task->gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" CDECL void
|
extern "C" CDECL void
|
||||||
@ -132,7 +132,7 @@ vec_alloc(rust_task *task, type_desc *t, type_desc *elem_t, size_t n_elts)
|
|||||||
size_t alloc = next_power_of_two(sizeof(rust_vec) + fill);
|
size_t alloc = next_power_of_two(sizeof(rust_vec) + fill);
|
||||||
void *mem = task->malloc(alloc, t->is_stateful ? t : NULL);
|
void *mem = task->malloc(alloc, t->is_stateful ? t : NULL);
|
||||||
if (!mem) {
|
if (!mem) {
|
||||||
task->fail(4);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
rust_vec *vec = new (mem) rust_vec(sched, alloc, 0, NULL);
|
rust_vec *vec = new (mem) rust_vec(sched, alloc, 0, NULL);
|
||||||
@ -230,7 +230,7 @@ str_alloc(rust_task *task, size_t n_bytes)
|
|||||||
1, 1,
|
1, 1,
|
||||||
(void*)"");
|
(void*)"");
|
||||||
if (!st) {
|
if (!st) {
|
||||||
task->fail(2);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return st;
|
return st;
|
||||||
@ -244,7 +244,7 @@ str_push_byte(rust_task* task, rust_str* v, size_t byte)
|
|||||||
if (v->ref_count > 1 || v->alloc < alloc) {
|
if (v->ref_count > 1 || v->alloc < alloc) {
|
||||||
v = vec_alloc_with_data(task, fill + 1, fill, 1, (void*)&v->data[0]);
|
v = vec_alloc_with_data(task, fill + 1, fill, 1, (void*)&v->data[0]);
|
||||||
if (!v) {
|
if (!v) {
|
||||||
task->fail(2);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ str_slice(rust_task* task, rust_str* v, size_t begin, size_t end)
|
|||||||
1,
|
1,
|
||||||
len ? v->data + begin : NULL);
|
len ? v->data + begin : NULL);
|
||||||
if (!st) {
|
if (!st) {
|
||||||
task->fail(2);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
st->data[st->fill++] = '\0';
|
st->data[st->fill++] = '\0';
|
||||||
@ -301,7 +301,7 @@ str_vec(rust_task *task, rust_str *s)
|
|||||||
1,
|
1,
|
||||||
(s->fill - 1) ? (void*)s->data : NULL);
|
(s->fill - 1) ? (void*)s->data : NULL);
|
||||||
if (!v) {
|
if (!v) {
|
||||||
task->fail(2);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
@ -326,7 +326,7 @@ str_from_ivec(rust_task *task, rust_ivec *v)
|
|||||||
1,
|
1,
|
||||||
fill ? data : NULL);
|
fill ? data : NULL);
|
||||||
if (!st) {
|
if (!st) {
|
||||||
task->fail(2);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
st->data[st->fill++] = '\0';
|
st->data[st->fill++] = '\0';
|
||||||
@ -343,7 +343,7 @@ str_from_vec(rust_task *task, rust_vec *v)
|
|||||||
1,
|
1,
|
||||||
v->fill ? (void*)v->data : NULL);
|
v->fill ? (void*)v->data : NULL);
|
||||||
if (!st) {
|
if (!st) {
|
||||||
task->fail(2);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
st->data[st->fill++] = '\0';
|
st->data[st->fill++] = '\0';
|
||||||
@ -356,7 +356,7 @@ str_from_cstr(rust_task *task, char *sbuf)
|
|||||||
size_t len = strlen(sbuf) + 1;
|
size_t len = strlen(sbuf) + 1;
|
||||||
rust_str *st = vec_alloc_with_data(task, len, len, 1, sbuf);
|
rust_str *st = vec_alloc_with_data(task, len, len, 1, sbuf);
|
||||||
if (!st) {
|
if (!st) {
|
||||||
task->fail(2);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return st;
|
return st;
|
||||||
@ -366,7 +366,7 @@ extern "C" CDECL rust_str *
|
|||||||
str_from_buf(rust_task *task, char *buf, unsigned int len) {
|
str_from_buf(rust_task *task, char *buf, unsigned int len) {
|
||||||
rust_str *st = vec_alloc_with_data(task, len + 1, len, 1, buf);
|
rust_str *st = vec_alloc_with_data(task, len + 1, len, 1, buf);
|
||||||
if (!st) {
|
if (!st) {
|
||||||
task->fail(2);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
st->data[st->fill++] = '\0';
|
st->data[st->fill++] = '\0';
|
||||||
@ -379,7 +379,7 @@ rand_new(rust_task *task)
|
|||||||
rust_scheduler *sched = task->sched;
|
rust_scheduler *sched = task->sched;
|
||||||
randctx *rctx = (randctx *) task->malloc(sizeof(randctx));
|
randctx *rctx = (randctx *) task->malloc(sizeof(randctx));
|
||||||
if (!rctx) {
|
if (!rctx) {
|
||||||
task->fail(1);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
isaac_init(sched, rctx);
|
isaac_init(sched, rctx);
|
||||||
@ -777,7 +777,7 @@ ivec_copy_from_buf(rust_task *task, type_desc *ty, rust_ivec *v, void *ptr,
|
|||||||
{
|
{
|
||||||
size_t old_size = get_ivec_size(v);
|
size_t old_size = get_ivec_size(v);
|
||||||
if (old_size) {
|
if (old_size) {
|
||||||
task->fail(1);
|
task->fail();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -806,7 +806,7 @@ ivec_copy_from_buf_shared(rust_task *task, type_desc *ty, rust_ivec *v,
|
|||||||
{
|
{
|
||||||
size_t old_size = get_ivec_size(v);
|
size_t old_size = get_ivec_size(v);
|
||||||
if (old_size) {
|
if (old_size) {
|
||||||
task->fail(1);
|
task->fail();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,17 +177,15 @@ rust_task::grow(size_t n_frame_bytes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rust_task::yield(size_t nargs) {
|
rust_task::yield() {
|
||||||
yield(nargs, 0);
|
yield(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rust_task::yield(size_t nargs, size_t time_in_us) {
|
rust_task::yield(size_t time_in_us) {
|
||||||
LOG(this, task, "task %s @0x%" PRIxPTR " yielding for %d us",
|
LOG(this, task, "task %s @0x%" PRIxPTR " yielding for %d us",
|
||||||
name, this, time_in_us);
|
name, this, time_in_us);
|
||||||
|
|
||||||
// FIXME: what is nargs for, and is it safe to ignore?
|
|
||||||
|
|
||||||
yield_timer.reset_us(time_in_us);
|
yield_timer.reset_us(time_in_us);
|
||||||
|
|
||||||
// Return to the scheduler.
|
// Return to the scheduler.
|
||||||
@ -203,7 +201,7 @@ rust_task::kill() {
|
|||||||
|
|
||||||
// Note the distinction here: kill() is when you're in an upcall
|
// Note the distinction here: kill() is when you're in an upcall
|
||||||
// from task A and want to force-fail task B, you do B->kill().
|
// from task A and want to force-fail task B, you do B->kill().
|
||||||
// If you want to fail yourself you do self->fail(upcall_nargs).
|
// If you want to fail yourself you do self->fail().
|
||||||
LOG(this, task, "killing task %s @0x%" PRIxPTR, name, this);
|
LOG(this, task, "killing task %s @0x%" PRIxPTR, name, this);
|
||||||
// Unblock the task so it can unwind.
|
// Unblock the task so it can unwind.
|
||||||
unblock();
|
unblock();
|
||||||
@ -216,7 +214,7 @@ rust_task::kill() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rust_task::fail(size_t nargs) {
|
rust_task::fail() {
|
||||||
// See note in ::kill() regarding who should call this.
|
// See note in ::kill() regarding who should call this.
|
||||||
DLOG(sched, task, "task %s @0x%" PRIxPTR " failing", name, this);
|
DLOG(sched, task, "task %s @0x%" PRIxPTR " failing", name, this);
|
||||||
backtrace();
|
backtrace();
|
||||||
@ -224,7 +222,6 @@ rust_task::fail(size_t nargs) {
|
|||||||
unblock();
|
unblock();
|
||||||
if (this == sched->root_task)
|
if (this == sched->root_task)
|
||||||
sched->fail();
|
sched->fail();
|
||||||
// run_after_return(nargs, rust_unwind_glue);
|
|
||||||
if (supervisor) {
|
if (supervisor) {
|
||||||
DLOG(sched, task,
|
DLOG(sched, task,
|
||||||
"task %s @0x%" PRIxPTR
|
"task %s @0x%" PRIxPTR
|
||||||
@ -237,7 +234,7 @@ rust_task::fail(size_t nargs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rust_task::gc(size_t nargs)
|
rust_task::gc()
|
||||||
{
|
{
|
||||||
// FIXME: not presently implemented; was broken by rustc.
|
// FIXME: not presently implemented; was broken by rustc.
|
||||||
DLOG(sched, task,
|
DLOG(sched, task,
|
||||||
|
@ -127,19 +127,19 @@ rust_task : public maybe_proxy<rust_task>,
|
|||||||
void backtrace();
|
void backtrace();
|
||||||
|
|
||||||
// Save callee-saved registers and return to the main loop.
|
// Save callee-saved registers and return to the main loop.
|
||||||
void yield(size_t nargs);
|
void yield();
|
||||||
|
|
||||||
// Yields for a specified duration of time.
|
// Yields for a specified duration of time.
|
||||||
void yield(size_t nargs, size_t time_in_ms);
|
void yield(size_t time_in_ms);
|
||||||
|
|
||||||
// Fail this task (assuming caller-on-stack is different task).
|
// Fail this task (assuming caller-on-stack is different task).
|
||||||
void kill();
|
void kill();
|
||||||
|
|
||||||
// Fail self, assuming caller-on-stack is this task.
|
// Fail self, assuming caller-on-stack is this task.
|
||||||
void fail(size_t nargs);
|
void fail();
|
||||||
|
|
||||||
// Run the gc glue on the task stack.
|
// Run the gc glue on the task stack.
|
||||||
void gc(size_t nargs);
|
void gc();
|
||||||
|
|
||||||
// Disconnect from our supervisor.
|
// Disconnect from our supervisor.
|
||||||
void unsupervise();
|
void unsupervise();
|
||||||
|
@ -173,7 +173,7 @@ upcall_sleep(rust_task *task, size_t time_in_us) {
|
|||||||
LOG(task, task, "elapsed %" PRIu64 " us",
|
LOG(task, task, "elapsed %" PRIu64 " us",
|
||||||
task->yield_timer.elapsed_us());
|
task->yield_timer.elapsed_us());
|
||||||
LOG(task, task, "sleep %d us", time_in_us);
|
LOG(task, task, "sleep %d us", time_in_us);
|
||||||
task->yield(2, time_in_us);
|
task->yield(time_in_us);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -221,7 +221,7 @@ upcall_fail(rust_task *task,
|
|||||||
size_t line) {
|
size_t line) {
|
||||||
LOG_UPCALL_ENTRY(task);
|
LOG_UPCALL_ENTRY(task);
|
||||||
LOG_ERR(task, upcall, "upcall fail '%s', %s:%" PRIdPTR, expr, file, line);
|
LOG_ERR(task, upcall, "upcall fail '%s', %s:%" PRIdPTR, expr, file, line);
|
||||||
task->fail(4);
|
task->fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -338,7 +338,7 @@ rust_str *make_str(rust_task *task, char const *s, size_t fill) {
|
|||||||
size_t alloc = next_power_of_two(sizeof(rust_str) + fill);
|
size_t alloc = next_power_of_two(sizeof(rust_str) + fill);
|
||||||
void *mem = task->malloc(alloc);
|
void *mem = task->malloc(alloc);
|
||||||
if (!mem) {
|
if (!mem) {
|
||||||
task->fail(3);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
rust_str *st = new (mem) rust_str(sched, alloc, fill,
|
rust_str *st = new (mem) rust_str(sched, alloc, fill,
|
||||||
@ -372,7 +372,7 @@ upcall_new_vec(rust_task *task, size_t fill, type_desc *td) {
|
|||||||
size_t alloc = next_power_of_two(sizeof(rust_vec) + fill);
|
size_t alloc = next_power_of_two(sizeof(rust_vec) + fill);
|
||||||
void *mem = task->malloc(alloc, td);
|
void *mem = task->malloc(alloc, td);
|
||||||
if (!mem) {
|
if (!mem) {
|
||||||
task->fail(3);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
rust_vec *v = new (mem) rust_vec(sched, alloc, 0, NULL);
|
rust_vec *v = new (mem) rust_vec(sched, alloc, 0, NULL);
|
||||||
@ -410,7 +410,7 @@ vec_grow(rust_task *task,
|
|||||||
LOG(task, mem, "realloc path");
|
LOG(task, mem, "realloc path");
|
||||||
v = (rust_vec*) task->realloc(v, alloc, td->is_stateful);
|
v = (rust_vec*) task->realloc(v, alloc, td->is_stateful);
|
||||||
if (!v) {
|
if (!v) {
|
||||||
task->fail(4);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
v->alloc = alloc;
|
v->alloc = alloc;
|
||||||
@ -432,7 +432,7 @@ vec_grow(rust_task *task,
|
|||||||
LOG(task, mem, "new vec path");
|
LOG(task, mem, "new vec path");
|
||||||
void *mem = task->malloc(alloc, td);
|
void *mem = task->malloc(alloc, td);
|
||||||
if (!mem) {
|
if (!mem) {
|
||||||
task->fail(4);
|
task->fail();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user