Skip to content

Commit 6f63d39

Browse files
committed
---
yaml --- r: 3888 b: refs/heads/master c: 2e29513 h: refs/heads/master v: v3
1 parent 3e36109 commit 6f63d39

File tree

5 files changed

+34
-37
lines changed

5 files changed

+34
-37
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 1ba53c008a7f6f447f94f07570baab26d39d7df4
2+
refs/heads/master: 2e2951305d66feea833ec2b05af8102b1b5affa9

trunk/src/rt/rust_builtin.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ last_os_error(rust_task *task) {
2929
char cbuf[BUF_BYTES];
3030
char *buf = strerror_r(errno, cbuf, sizeof(cbuf));
3131
if (!buf) {
32-
task->fail(1);
32+
task->fail();
3333
return NULL;
3434
}
3535
#else
@@ -44,7 +44,7 @@ last_os_error(rust_task *task) {
4444
size_t alloc = next_power_of_two(sizeof(rust_str) + fill);
4545
void *mem = task->malloc(alloc);
4646
if (!mem) {
47-
task->fail(1);
47+
task->fail();
4848
return NULL;
4949
}
5050
rust_str *st = new (mem) rust_str(sched, alloc, fill,
@@ -68,15 +68,15 @@ rust_getcwd(rust_task *task) {
6868
#else
6969
if (!getcwd(cbuf, sizeof(cbuf))) {
7070
#endif
71-
task->fail(1);
71+
task->fail();
7272
return NULL;
7373
}
7474

7575
size_t fill = strlen(cbuf) + 1;
7676
size_t alloc = next_power_of_two(sizeof(rust_str) + fill);
7777
void *mem = task->malloc(alloc);
7878
if (!mem) {
79-
task->fail(1);
79+
task->fail();
8080
return NULL;
8181
}
8282

@@ -114,7 +114,7 @@ refcount(rust_task *task, type_desc *t, intptr_t *v) {
114114

115115
extern "C" CDECL void
116116
do_gc(rust_task *task) {
117-
task->gc(1);
117+
task->gc();
118118
}
119119

120120
extern "C" CDECL void
@@ -132,7 +132,7 @@ vec_alloc(rust_task *task, type_desc *t, type_desc *elem_t, size_t n_elts)
132132
size_t alloc = next_power_of_two(sizeof(rust_vec) + fill);
133133
void *mem = task->malloc(alloc, t->is_stateful ? t : NULL);
134134
if (!mem) {
135-
task->fail(4);
135+
task->fail();
136136
return NULL;
137137
}
138138
rust_vec *vec = new (mem) rust_vec(sched, alloc, 0, NULL);
@@ -230,7 +230,7 @@ str_alloc(rust_task *task, size_t n_bytes)
230230
1, 1,
231231
(void*)"");
232232
if (!st) {
233-
task->fail(2);
233+
task->fail();
234234
return NULL;
235235
}
236236
return st;
@@ -244,7 +244,7 @@ str_push_byte(rust_task* task, rust_str* v, size_t byte)
244244
if (v->ref_count > 1 || v->alloc < alloc) {
245245
v = vec_alloc_with_data(task, fill + 1, fill, 1, (void*)&v->data[0]);
246246
if (!v) {
247-
task->fail(2);
247+
task->fail();
248248
return NULL;
249249
}
250250
}
@@ -268,7 +268,7 @@ str_slice(rust_task* task, rust_str* v, size_t begin, size_t end)
268268
1,
269269
len ? v->data + begin : NULL);
270270
if (!st) {
271-
task->fail(2);
271+
task->fail();
272272
return NULL;
273273
}
274274
st->data[st->fill++] = '\0';
@@ -301,7 +301,7 @@ str_vec(rust_task *task, rust_str *s)
301301
1,
302302
(s->fill - 1) ? (void*)s->data : NULL);
303303
if (!v) {
304-
task->fail(2);
304+
task->fail();
305305
return NULL;
306306
}
307307
return v;
@@ -326,7 +326,7 @@ str_from_ivec(rust_task *task, rust_ivec *v)
326326
1,
327327
fill ? data : NULL);
328328
if (!st) {
329-
task->fail(2);
329+
task->fail();
330330
return NULL;
331331
}
332332
st->data[st->fill++] = '\0';
@@ -343,7 +343,7 @@ str_from_vec(rust_task *task, rust_vec *v)
343343
1,
344344
v->fill ? (void*)v->data : NULL);
345345
if (!st) {
346-
task->fail(2);
346+
task->fail();
347347
return NULL;
348348
}
349349
st->data[st->fill++] = '\0';
@@ -356,7 +356,7 @@ str_from_cstr(rust_task *task, char *sbuf)
356356
size_t len = strlen(sbuf) + 1;
357357
rust_str *st = vec_alloc_with_data(task, len, len, 1, sbuf);
358358
if (!st) {
359-
task->fail(2);
359+
task->fail();
360360
return NULL;
361361
}
362362
return st;
@@ -366,7 +366,7 @@ extern "C" CDECL rust_str *
366366
str_from_buf(rust_task *task, char *buf, unsigned int len) {
367367
rust_str *st = vec_alloc_with_data(task, len + 1, len, 1, buf);
368368
if (!st) {
369-
task->fail(2);
369+
task->fail();
370370
return NULL;
371371
}
372372
st->data[st->fill++] = '\0';
@@ -379,7 +379,7 @@ rand_new(rust_task *task)
379379
rust_scheduler *sched = task->sched;
380380
randctx *rctx = (randctx *) task->malloc(sizeof(randctx));
381381
if (!rctx) {
382-
task->fail(1);
382+
task->fail();
383383
return NULL;
384384
}
385385
isaac_init(sched, rctx);
@@ -777,7 +777,7 @@ ivec_copy_from_buf(rust_task *task, type_desc *ty, rust_ivec *v, void *ptr,
777777
{
778778
size_t old_size = get_ivec_size(v);
779779
if (old_size) {
780-
task->fail(1);
780+
task->fail();
781781
return;
782782
}
783783

@@ -806,7 +806,7 @@ ivec_copy_from_buf_shared(rust_task *task, type_desc *ty, rust_ivec *v,
806806
{
807807
size_t old_size = get_ivec_size(v);
808808
if (old_size) {
809-
task->fail(1);
809+
task->fail();
810810
return;
811811
}
812812

trunk/src/rt/rust_task.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,17 +177,15 @@ rust_task::grow(size_t n_frame_bytes)
177177
}
178178

179179
void
180-
rust_task::yield(size_t nargs) {
181-
yield(nargs, 0);
180+
rust_task::yield() {
181+
yield(0);
182182
}
183183

184184
void
185-
rust_task::yield(size_t nargs, size_t time_in_us) {
185+
rust_task::yield(size_t time_in_us) {
186186
LOG(this, task, "task %s @0x%" PRIxPTR " yielding for %d us",
187187
name, this, time_in_us);
188188

189-
// FIXME: what is nargs for, and is it safe to ignore?
190-
191189
yield_timer.reset_us(time_in_us);
192190

193191
// Return to the scheduler.
@@ -203,7 +201,7 @@ rust_task::kill() {
203201

204202
// Note the distinction here: kill() is when you're in an upcall
205203
// from task A and want to force-fail task B, you do B->kill().
206-
// If you want to fail yourself you do self->fail(upcall_nargs).
204+
// If you want to fail yourself you do self->fail().
207205
LOG(this, task, "killing task %s @0x%" PRIxPTR, name, this);
208206
// Unblock the task so it can unwind.
209207
unblock();
@@ -216,15 +214,14 @@ rust_task::kill() {
216214
}
217215

218216
void
219-
rust_task::fail(size_t nargs) {
217+
rust_task::fail() {
220218
// See note in ::kill() regarding who should call this.
221219
DLOG(sched, task, "task %s @0x%" PRIxPTR " failing", name, this);
222220
backtrace();
223221
// Unblock the task so it can unwind.
224222
unblock();
225223
if (this == sched->root_task)
226224
sched->fail();
227-
// run_after_return(nargs, rust_unwind_glue);
228225
if (supervisor) {
229226
DLOG(sched, task,
230227
"task %s @0x%" PRIxPTR
@@ -237,7 +234,7 @@ rust_task::fail(size_t nargs) {
237234
}
238235

239236
void
240-
rust_task::gc(size_t nargs)
237+
rust_task::gc()
241238
{
242239
// FIXME: not presently implemented; was broken by rustc.
243240
DLOG(sched, task,

trunk/src/rt/rust_task.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,19 @@ rust_task : public maybe_proxy<rust_task>,
127127
void backtrace();
128128

129129
// Save callee-saved registers and return to the main loop.
130-
void yield(size_t nargs);
130+
void yield();
131131

132132
// Yields for a specified duration of time.
133-
void yield(size_t nargs, size_t time_in_ms);
133+
void yield(size_t time_in_ms);
134134

135135
// Fail this task (assuming caller-on-stack is different task).
136136
void kill();
137137

138138
// Fail self, assuming caller-on-stack is this task.
139-
void fail(size_t nargs);
139+
void fail();
140140

141141
// Run the gc glue on the task stack.
142-
void gc(size_t nargs);
142+
void gc();
143143

144144
// Disconnect from our supervisor.
145145
void unsupervise();

trunk/src/rt/rust_upcall.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ upcall_sleep(rust_task *task, size_t time_in_us) {
173173
LOG(task, task, "elapsed %" PRIu64 " us",
174174
task->yield_timer.elapsed_us());
175175
LOG(task, task, "sleep %d us", time_in_us);
176-
task->yield(2, time_in_us);
176+
task->yield(time_in_us);
177177
}
178178

179179
/**
@@ -221,7 +221,7 @@ upcall_fail(rust_task *task,
221221
size_t line) {
222222
LOG_UPCALL_ENTRY(task);
223223
LOG_ERR(task, upcall, "upcall fail '%s', %s:%" PRIdPTR, expr, file, line);
224-
task->fail(4);
224+
task->fail();
225225
}
226226

227227
/**
@@ -338,7 +338,7 @@ rust_str *make_str(rust_task *task, char const *s, size_t fill) {
338338
size_t alloc = next_power_of_two(sizeof(rust_str) + fill);
339339
void *mem = task->malloc(alloc);
340340
if (!mem) {
341-
task->fail(3);
341+
task->fail();
342342
return NULL;
343343
}
344344
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) {
372372
size_t alloc = next_power_of_two(sizeof(rust_vec) + fill);
373373
void *mem = task->malloc(alloc, td);
374374
if (!mem) {
375-
task->fail(3);
375+
task->fail();
376376
return NULL;
377377
}
378378
rust_vec *v = new (mem) rust_vec(sched, alloc, 0, NULL);
@@ -410,7 +410,7 @@ vec_grow(rust_task *task,
410410
LOG(task, mem, "realloc path");
411411
v = (rust_vec*) task->realloc(v, alloc, td->is_stateful);
412412
if (!v) {
413-
task->fail(4);
413+
task->fail();
414414
return NULL;
415415
}
416416
v->alloc = alloc;
@@ -432,7 +432,7 @@ vec_grow(rust_task *task,
432432
LOG(task, mem, "new vec path");
433433
void *mem = task->malloc(alloc, td);
434434
if (!mem) {
435-
task->fail(4);
435+
task->fail();
436436
return NULL;
437437
}
438438

0 commit comments

Comments
 (0)