diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-05-25 17:22:14 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-05-30 21:23:34 -0700 |
| commit | a2bbdd3f52a71beabc1beb964772d30045cbe949 (patch) | |
| tree | ca1f96956b6e304ba31456b9c5ac085dafe3b06b /src/rt | |
| parent | 80dc2e11a12c0a77447b74ef3fea3eb3ba44faaa (diff) | |
| download | rust-a2bbdd3f52a71beabc1beb964772d30045cbe949.tar.gz rust-a2bbdd3f52a71beabc1beb964772d30045cbe949.zip | |
rt: Remove upcall_shared_malloc/free/realloc
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/rust_task.cpp | 5 | ||||
| -rw-r--r-- | src/rt/rust_upcall.cpp | 75 | ||||
| -rw-r--r-- | src/rt/rust_upcall.h | 5 | ||||
| -rw-r--r-- | src/rt/rustrt.def.in | 4 |
4 files changed, 3 insertions, 86 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 2331cccd590..5299de0ed34 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -7,7 +7,6 @@ #include "rust_task.h" #include "rust_cc.h" -#include "rust_upcall.h" #include "rust_env.h" #include "rust_port.h" @@ -130,6 +129,8 @@ cleanup_task(cleanup_args *args) { } } +extern "C" CDECL void upcall_exchange_free(void *ptr); + // This runs on the Rust stack void task_start_wrapper(spawn_args *a) { @@ -161,7 +162,7 @@ void task_start_wrapper(spawn_args *a) // free the environment (which should be a unique closure). const type_desc *td = env->td; td->drop_glue(NULL, NULL, td->first_param, box_body(env)); - upcall_shared_free(env); + upcall_exchange_free(env); } // The cleanup work needs lots of stack diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index 667a511debf..01606b37903 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -318,81 +318,6 @@ upcall_validate_box(rust_opaque_box* ptr) { } } -/********************************************************************** - * Allocate an object in the exchange heap. - */ - -struct s_shared_malloc_args { - uintptr_t retval; - size_t nbytes; -}; - -extern "C" CDECL void -upcall_s_shared_malloc(s_shared_malloc_args *args) { - rust_task *task = rust_get_current_task(); - LOG_UPCALL_ENTRY(task); - - LOG(task, mem, "upcall shared_malloc(%" PRIdPTR ")", args->nbytes); - void *p = task->kernel->malloc(args->nbytes, "shared malloc"); - memset(p, '\0', args->nbytes); - LOG(task, mem, "upcall shared_malloc(%" PRIdPTR ") = 0x%" PRIxPTR, - args->nbytes, (uintptr_t)p); - args->retval = (uintptr_t) p; -} - -extern "C" CDECL uintptr_t -upcall_shared_malloc(size_t nbytes) { - s_shared_malloc_args args = {0, nbytes}; - UPCALL_SWITCH_STACK(&args, upcall_s_shared_malloc); - return args.retval; -} - -/********************************************************************** - * Called whenever an object in the exchange heap is freed. - */ - -struct s_shared_free_args { - void *ptr; -}; - -extern "C" CDECL void -upcall_s_shared_free(s_shared_free_args *args) { - rust_task *task = rust_get_current_task(); - LOG_UPCALL_ENTRY(task); - - rust_sched_loop *sched_loop = task->sched_loop; - DLOG(sched_loop, mem, - "upcall shared_free(0x%" PRIxPTR")", - (uintptr_t)args->ptr); - task->kernel->free(args->ptr); -} - -extern "C" CDECL void -upcall_shared_free(void* ptr) { - s_shared_free_args args = {ptr}; - UPCALL_SWITCH_STACK(&args, upcall_s_shared_free); -} - -struct s_shared_realloc_args { - void *retval; - void *ptr; - size_t size; -}; - -extern "C" CDECL void -upcall_s_shared_realloc(s_shared_realloc_args *args) { - rust_task *task = rust_get_current_task(); - LOG_UPCALL_ENTRY(task); - args->retval = task->kernel->realloc(args->ptr, args->size); -} - -extern "C" CDECL void * -upcall_shared_realloc(void *ptr, size_t size) { - s_shared_realloc_args args = {NULL, ptr, size}; - UPCALL_SWITCH_STACK(&args, upcall_s_shared_realloc); - return args.retval; -} - /**********************************************************************/ struct s_str_new_uniq_args { diff --git a/src/rt/rust_upcall.h b/src/rt/rust_upcall.h index 0030ef19b36..b2b2db20674 100644 --- a/src/rt/rust_upcall.h +++ b/src/rt/rust_upcall.h @@ -1,9 +1,4 @@ - #ifndef RUST_UPCALL_H #define RUST_UPCALL_H -// Upcalls used from C code on occasion: - -extern "C" CDECL void upcall_shared_free(void* ptr); - #endif diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index 7c04902de57..8a627795850 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -74,10 +74,6 @@ upcall_validate_box upcall_log_type upcall_malloc upcall_rust_personality -upcall_s_shared_malloc -upcall_shared_malloc -upcall_shared_free -upcall_shared_realloc upcall_vec_grow upcall_str_new upcall_str_new_uniq |
