diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-01-13 16:53:13 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-02-06 14:27:36 -0800 |
| commit | e43c5bdc6b47e8dd5e2ddcd6cf57fec79388523a (patch) | |
| tree | 309c89fe29131346dc5e258e2dd948c381ec256d /src/rt/rust_stack.cpp | |
| parent | e91040c704aa9ab46fb1c7a10e293fd5f6bfe079 (diff) | |
| download | rust-e43c5bdc6b47e8dd5e2ddcd6cf57fec79388523a.tar.gz rust-e43c5bdc6b47e8dd5e2ddcd6cf57fec79388523a.zip | |
Rewrite the exchange allocator to work without an active scheduler. #4457
Diffstat (limited to 'src/rt/rust_stack.cpp')
| -rw-r--r-- | src/rt/rust_stack.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/rt/rust_stack.cpp b/src/rt/rust_stack.cpp index 466399bd5b5..3bcda8adf40 100644 --- a/src/rt/rust_stack.cpp +++ b/src/rt/rust_stack.cpp @@ -53,6 +53,8 @@ check_stack_canary(stk_seg *stk) { assert(stk->canary == canary_value && "Somebody killed the canary"); } +// XXX: Duplication here between the local and exchange heap constructors + stk_seg * create_stack(memory_region *region, size_t sz) { size_t total_sz = sizeof(stk_seg) + sz; @@ -69,3 +71,20 @@ destroy_stack(memory_region *region, stk_seg *stk) { deregister_valgrind_stack(stk); region->free(stk); } + +stk_seg * +create_exchange_stack(rust_exchange_alloc *exchange, size_t sz) { + size_t total_sz = sizeof(stk_seg) + sz; + stk_seg *stk = (stk_seg *)exchange->malloc(total_sz, false); + memset(stk, 0, sizeof(stk_seg)); + stk->end = (uintptr_t) &stk->data[sz]; + add_stack_canary(stk); + register_valgrind_stack(stk); + return stk; +} + +void +destroy_exchange_stack(rust_exchange_alloc *exchange, stk_seg *stk) { + deregister_valgrind_stack(stk); + exchange->free(stk); +} |
