about summary refs log tree commit diff
path: root/src/rt/rust_upcall.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-02-16 22:35:52 -0800
committerBrian Anderson <banderson@mozilla.com>2012-02-17 11:37:17 -0800
commitd23cd8f52fbfb41844b27c5e65cb620c34c7af59 (patch)
treea32c76e919f0d3f3897ebaee2f05ae5925698f73 /src/rt/rust_upcall.cpp
parenta3fdd8c93f9aab540fc4edc0984e79c7dee467a5 (diff)
downloadrust-d23cd8f52fbfb41844b27c5e65cb620c34c7af59.tar.gz
rust-d23cd8f52fbfb41844b27c5e65cb620c34c7af59.zip
rt: Don't hit TLS on upcall_vec_push unless necessary
Diffstat (limited to 'src/rt/rust_upcall.cpp')
-rw-r--r--src/rt/rust_upcall.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index 15b149404c1..905b546b0b7 100644
--- a/src/rt/rust_upcall.cpp
+++ b/src/rt/rust_upcall.cpp
@@ -434,7 +434,7 @@ upcall_vec_grow(rust_vec** vp, size_t new_sz) {
 // Copy elements from one vector to another,
 // dealing with reference counts
 static inline void
-copy_elements(rust_task *task, type_desc *elem_t,
+copy_elements(type_desc *elem_t,
               void *pdst, void *psrc, size_t n) {
     char *dst = (char *)pdst, *src = (char *)psrc;
     memmove(dst, src, n);
@@ -454,12 +454,10 @@ extern "C" CDECL void
 upcall_vec_push(rust_vec** vp, type_desc* elt_ty, void* elt) {
     // NB: This runs entirely on the Rust stack because it invokes take glue
 
-    rust_task *task = rust_task_thread::get_task();
-
     size_t new_sz = (*vp)->fill + elt_ty->size;
-    reserve_vec(task, vp, new_sz);
+    reserve_vec_fast(vp, new_sz);
     rust_vec* v = *vp;
-    copy_elements(task, elt_ty, &v->data[0] + v->fill,
+    copy_elements(elt_ty, &v->data[0] + v->fill,
                   elt, elt_ty->size);
     v->fill += elt_ty->size;
 }