diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-05-07 18:13:15 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-05-15 12:19:14 -0700 |
| commit | bfd9aa9755149725e39d8024d693ed76f92a30df (patch) | |
| tree | 45dff5217306f2f3c10ed1add0756f286acaf921 /src/rt | |
| parent | 6a6076ae810d470dfb511712c303a4ee7ffedf00 (diff) | |
| download | rust-bfd9aa9755149725e39d8024d693ed76f92a30df.tar.gz rust-bfd9aa9755149725e39d8024d693ed76f92a30df.zip | |
core:rt: A few micro-opts
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/rust_exchange_alloc.cpp | 16 | ||||
| -rw-r--r-- | src/rt/rustrt.def.in | 2 |
2 files changed, 7 insertions, 11 deletions
diff --git a/src/rt/rust_exchange_alloc.cpp b/src/rt/rust_exchange_alloc.cpp index 5958c68f3e7..89257dc9f6e 100644 --- a/src/rt/rust_exchange_alloc.cpp +++ b/src/rt/rust_exchange_alloc.cpp @@ -15,14 +15,15 @@ #include <string.h> #include <stdio.h> -uintptr_t exchange_count = 0; +extern uintptr_t rust_exchange_count; +uintptr_t rust_exchange_count = 0; void * rust_exchange_alloc::malloc(size_t size) { void *value = ::malloc(size); assert(value); - sync::increment(exchange_count); + sync::increment(rust_exchange_count); return value; } @@ -36,20 +37,15 @@ rust_exchange_alloc::realloc(void *ptr, size_t size) { void rust_exchange_alloc::free(void *ptr) { - sync::decrement(exchange_count); + sync::decrement(rust_exchange_count); ::free(ptr); } -extern "C" uintptr_t * -rust_get_exchange_count_ptr() { - return &exchange_count; -} - void rust_check_exchange_count_on_exit() { - if (exchange_count != 0) { + if (rust_exchange_count != 0) { printf("exchange heap not empty on exit\n"); - printf("%d dangling allocations\n", (int)exchange_count); + printf("%d dangling allocations\n", (int)rust_exchange_count); abort(); } } diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index 75a5a069605..a62d7991d49 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -195,7 +195,7 @@ rust_register_exit_function rust_get_global_data_ptr rust_inc_kernel_live_count rust_dec_kernel_live_count -rust_get_exchange_count_ptr +rust_exchange_count rust_get_sched_tls_key swap_registers rust_readdir |
