From e43c5bdc6b47e8dd5e2ddcd6cf57fec79388523a Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sun, 13 Jan 2013 16:53:13 -0800 Subject: Rewrite the exchange allocator to work without an active scheduler. #4457 --- src/rt/rust_upcall.cpp | 75 -------------------------------------------------- 1 file changed, 75 deletions(-) (limited to 'src/rt/rust_upcall.cpp') diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index ea396146755..008b470fede 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -140,81 +140,6 @@ struct s_trace_args { size_t line; }; -/********************************************************************** - * Allocate an object in the exchange heap - */ - -struct s_exchange_malloc_args { - rust_task *task; - uintptr_t retval; - type_desc *td; - uintptr_t size; -}; - -extern "C" CDECL void -upcall_s_exchange_malloc(s_exchange_malloc_args *args) { - rust_task *task = args->task; - LOG_UPCALL_ENTRY(task); - - size_t total_size = get_box_size(args->size, args->td->align); - void *p = task->kernel->malloc(total_size, "exchange malloc"); - - rust_opaque_box *header = static_cast(p); - header->ref_count = -1; // This is not ref counted - header->td = args->td; - header->prev = 0; - header->next = 0; - - LOG(task, mem, "exchange malloced %p of size %" PRIuPTR, - header, args->size); - - args->retval = (uintptr_t)header; -} - -extern "C" CDECL uintptr_t -upcall_exchange_malloc(type_desc *td, uintptr_t size) { - rust_task *task = rust_get_current_task(); - s_exchange_malloc_args args = {task, 0, td, size}; - UPCALL_SWITCH_STACK(task, &args, upcall_s_exchange_malloc); - return args.retval; -} - -// FIXME (#2861): Alias used by libcore/rt.rs to avoid naming conflicts with -// autogenerated wrappers for upcall_exchange_malloc. Remove this when we -// fully move away away from the C upcall path. -extern "C" CDECL uintptr_t -rust_upcall_exchange_malloc(type_desc *td, uintptr_t size) { - return upcall_exchange_malloc(td, size); -} - -struct s_exchange_free_args { - rust_task *task; - void *ptr; -}; - -extern "C" CDECL void -upcall_s_exchange_free(s_exchange_free_args *args) { - rust_task *task = args->task; - LOG_UPCALL_ENTRY(task); - LOG(task, mem, "exchange freed %p", args->ptr); - task->kernel->free(args->ptr); -} - -extern "C" CDECL void -upcall_exchange_free(void *ptr) { - rust_task *task = rust_get_current_task(); - s_exchange_free_args args = {task,ptr}; - UPCALL_SWITCH_STACK(task, &args, upcall_s_exchange_free); -} - -// FIXME (#2861): Alias used by libcore/rt.rs to avoid naming conflicts with -// autogenerated wrappers for upcall_exchange_free. Remove this when we fully -// move away away from the C upcall path. -extern "C" CDECL void -rust_upcall_exchange_free(void *ptr) { - return upcall_exchange_free(ptr); -} - /********************************************************************** * Allocate an object in the task-local heap. */ -- cgit 1.4.1-3-g733a5