summary refs log tree commit diff
path: root/src/rt/rust_task.h
diff options
context:
space:
mode:
authorJon Morton <jonanin@gmail.com>2012-04-02 16:13:40 -0500
committerBrian Anderson <banderson@mozilla.com>2012-04-02 14:21:09 -0700
commitfa88d15d636d84b7e6928323386f86d3fec8f51b (patch)
tree5ef2894ef4bb7fc0eb4bd96049acb30b21a697e3 /src/rt/rust_task.h
parent33a949eed6e6a5f2cba72663d92a0012e5439d80 (diff)
downloadrust-fa88d15d636d84b7e6928323386f86d3fec8f51b.tar.gz
rust-fa88d15d636d84b7e6928323386f86d3fec8f51b.zip
remove unneeded assert, move get_task_tls to sched_loop
Diffstat (limited to 'src/rt/rust_task.h')
-rw-r--r--src/rt/rust_task.h22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h
index 25266242485..87aeca511e9 100644
--- a/src/rt/rust_task.h
+++ b/src/rt/rust_task.h
@@ -444,22 +444,6 @@ rust_task::record_stack_limit() {
     record_sp_limit(stk->data + LIMIT_OFFSET + RED_ZONE_SIZE);
 }
 
-inline rust_task* __rust_get_task_tls()
-{
-    if (!rust_sched_loop::tls_initialized)
-        return NULL;
-#ifdef __WIN32__
-    rust_task *task = reinterpret_cast<rust_task *>
-        (TlsGetValue(rust_sched_loop::task_key));
-#else
-    rust_task *task = reinterpret_cast<rust_task *>
-        (pthread_getspecific(rust_sched_loop::task_key));
-#endif
-    assert(task && "Couldn't get the task from TLS!");
-    return task;
-
-}
-
 inline rust_task* rust_get_current_task() {
     uintptr_t sp_limit = get_sp_limit();
 
@@ -467,7 +451,7 @@ inline rust_task* rust_get_current_task() {
     // value is sometimes inconveniently set to 0, so we can't use this
     // method of retreiving the task pointer and need to fall back to TLS.
     if (sp_limit == 0)
-        return __rust_get_task_tls();
+        return rust_sched_loop::get_task_tls();
 
     // The stack pointer boundary is stored in a quickly-accessible location
     // in the TCB. From that we can calculate the address of the stack segment
@@ -476,11 +460,9 @@ inline rust_task* rust_get_current_task() {
     uintptr_t seg_addr =
         sp_limit - RED_ZONE_SIZE - LIMIT_OFFSET - sizeof(stk_seg);
     stk_seg *stk = (stk_seg*) seg_addr;
+
     // Make sure we've calculated the right address
     ::check_stack_canary(stk);
-
-    if (stk->task == NULL)
-        return __rust_get_task_tls();
     return stk->task;
 }