Skip to content

Commit 8429d4f

Browse files
committed
---
yaml --- r: 13892 b: refs/heads/try c: 6548cdd h: refs/heads/master v: v3
1 parent 4282d9d commit 8429d4f

File tree

8 files changed

+25
-11
lines changed

8 files changed

+25
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 361f90e618c081afe2fa8b0a67370610781e413e
5+
refs/heads/try: 6548cdd59beca24a90f41d6507cb615e67828b07
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rt/rust.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ command_line_args : public kernel_owned<command_line_args>
7575

7676
int check_claims = 0;
7777

78+
const size_t MAIN_STACK_SIZE = 1024*1024;
79+
7880
extern "C" CDECL int
7981
rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
8082

@@ -85,7 +87,7 @@ rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
8587

8688
rust_srv *srv = new rust_srv(env);
8789
rust_kernel *kernel = new rust_kernel(srv, env->num_sched_threads);
88-
rust_task_id root_id = kernel->create_task(NULL, "main");
90+
rust_task_id root_id = kernel->create_task(NULL, "main", MAIN_STACK_SIZE);
8991
rust_task *root_task = kernel->get_task_by_id(root_id);
9092
I(kernel, root_task != NULL);
9193
rust_scheduler *sched = root_task->sched;

branches/try/src/rt/rust_kernel.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,21 @@ rust_kernel::fail() {
151151
}
152152

153153
rust_task_id
154-
rust_kernel::create_task(rust_task *spawner, const char *name) {
154+
rust_kernel::create_task(rust_task *spawner, const char *name,
155+
size_t init_stack_sz) {
155156
scoped_lock with(_kernel_lock);
156157
rust_scheduler *thread = threads[isaac_rand(&rctx) % num_threads];
157-
rust_task *t = thread->create_task(spawner, name);
158+
rust_task *t = thread->create_task(spawner, name, init_stack_sz);
158159
t->user.id = max_id++;
159160
task_table.put(t->user.id, t);
160161
return t->user.id;
161162
}
162163

164+
rust_task_id
165+
rust_kernel::create_task(rust_task *spawner, const char *name) {
166+
return create_task(spawner, name, env->min_stack_size);
167+
}
168+
163169
rust_task *
164170
rust_kernel::get_task_by_id(rust_task_id id) {
165171
scoped_lock with(_kernel_lock);

branches/try/src/rt/rust_kernel.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ class rust_kernel {
6666
void win32_require(LPCTSTR fn, BOOL ok);
6767
#endif
6868

69-
rust_task_id create_task(rust_task *spawner, const char *name);
69+
rust_task_id create_task(rust_task *spawner, const char *name,
70+
size_t init_stack_size);
71+
rust_task_id create_task(rust_task * spawner, const char *name);
7072
rust_task *get_task_by_id(rust_task_id id);
7173
void release_task_id(rust_task_id tid);
7274
void set_exit_status(int code);

branches/try/src/rt/rust_scheduler.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,11 @@ rust_scheduler::get_cache() {
333333
}
334334

335335
rust_task *
336-
rust_scheduler::create_task(rust_task *spawner, const char *name) {
336+
rust_scheduler::create_task(rust_task *spawner, const char *name,
337+
size_t init_stack_sz) {
337338
rust_task *task =
338339
new (this->kernel, "rust_task")
339-
rust_task (this, &newborn_tasks, spawner, name);
340+
rust_task (this, &newborn_tasks, spawner, name, init_stack_sz);
340341
DLOG(this, task, "created task: " PTR ", spawner: %s, name: %s",
341342
task, spawner ? spawner->name : "null", name);
342343
if(spawner) {

branches/try/src/rt/rust_scheduler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ struct rust_scheduler : public kernel_owned<rust_scheduler>,
112112

113113
void kill_all_tasks();
114114

115-
rust_task *create_task(rust_task *spawner, const char *name);
115+
rust_task *create_task(rust_task *spawner, const char *name,
116+
size_t init_stack_sz);
116117

117118
virtual void run();
118119

branches/try/src/rt/rust_task.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ del_stk(rust_task *task, stk_seg *stk)
239239

240240
// Tasks
241241
rust_task::rust_task(rust_scheduler *sched, rust_task_list *state,
242-
rust_task *spawner, const char *name) :
242+
rust_task *spawner, const char *name,
243+
size_t init_stack_sz) :
243244
ref_count(1),
244245
stk(NULL),
245246
runtime_sp(0),
@@ -271,7 +272,7 @@ rust_task::rust_task(rust_scheduler *sched, rust_task_list *state,
271272

272273
user.notify_enabled = 0;
273274

274-
stk = new_stk(sched, this, 0);
275+
stk = new_stk(sched, this, init_stack_sz);
275276
user.rust_sp = stk->end;
276277
if (supervisor) {
277278
supervisor->ref();

branches/try/src/rt/rust_task.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ rust_task : public kernel_owned<rust_task>, rust_cond
133133
rust_task(rust_scheduler *sched,
134134
rust_task_list *state,
135135
rust_task *spawner,
136-
const char *name);
136+
const char *name,
137+
size_t init_stack_sz);
137138

138139
~rust_task();
139140

0 commit comments

Comments
 (0)