diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2012-03-15 17:42:33 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-03-16 15:38:42 +0100 |
| commit | 22bef74b550b2b08338ebb43363f3d09df6413b9 (patch) | |
| tree | 1a96fdf8b865c54e4d0a64391451bb913d97ea50 /src/rt | |
| parent | 140d194007bbb427ab694807782b3a41bb43b27d (diff) | |
Remove shared tydescs
All tydescs are static now, there's no need to worry about marshalling them between threads anymore.
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/rust_cc.cpp | 9 | ||||
| -rw-r--r-- | src/rt/rust_task.cpp | 1 | ||||
| -rw-r--r-- | src/rt/rust_upcall.cpp | 73 | ||||
| -rw-r--r-- | src/rt/rust_upcall.h | 1 | ||||
| -rw-r--r-- | src/rt/rustrt.def.in | 2 |
5 files changed, 0 insertions, 86 deletions
diff --git a/src/rt/rust_cc.cpp b/src/rt/rust_cc.cpp index 95208b311ee..de454fc2f84 100644 --- a/src/rt/rust_cc.cpp +++ b/src/rt/rust_cc.cpp @@ -18,9 +18,6 @@ // collection. #define RUST_CC_FREQUENCY 5000 -// defined in rust_upcall.cpp: -void upcall_s_free_shared_type_desc(type_desc *td); - using namespace std; namespace cc { @@ -534,9 +531,6 @@ class sweep : public shape::data<sweep,shape::ptr> { // free closed over data: shape::data<sweep,shape::ptr>::walk_fn_contents1(); - // now free the embedded type descr: - upcall_s_free_shared_type_desc((type_desc*)pair.env->td); - // now free the ptr: task->kernel->free(pair.env); } @@ -563,12 +557,9 @@ class sweep : public shape::data<sweep,shape::ptr> { } void walk_tydesc2(char kind) { - type_desc *td = *(type_desc **)dp; switch(kind) { case shape::SHAPE_TYDESC: - break; case shape::SHAPE_SEND_TYDESC: - upcall_s_free_shared_type_desc(td); break; default: abort(); } diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 32f1e0eb887..039989cbf31 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -192,7 +192,6 @@ 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_free_shared_type_desc(env->td); upcall_shared_free(env); } diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index 28a8e0a4716..dfeeda34994 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -288,79 +288,6 @@ upcall_shared_realloc(void *ptr, size_t size) { return args.retval; } -/********************************************************************** - * Called to deep copy a type descriptor onto the exchange heap. - * Used when sending closures. It's possible that we should have - * a central hashtable to avoid copying and re-copying the same - * type descriptors. - */ - -struct s_create_shared_type_desc_args { - const type_desc *td; - type_desc *res; -}; - -void upcall_s_create_shared_type_desc(s_create_shared_type_desc_args *args) -{ - rust_task *task = rust_task_thread::get_task(); - LOG_UPCALL_ENTRY(task); - - // Copy the main part of the type descriptor: - const type_desc *td = args->td; - int n_params = td->n_params; - size_t sz = sizeof(type_desc) + sizeof(type_desc*) * (n_params+1); - args->res = (type_desc*) task->kernel->malloc(sz, "create_shared_type_desc"); - memcpy(args->res, td, sizeof(type_desc)); - - // Recursively copy any referenced descriptors: - if (n_params == 0) { - args->res->first_param = NULL; - } else { - args->res->first_param = &args->res->descs[1]; - args->res->descs[0] = args->res; - for (int i = 0; i < n_params; i++) { - s_create_shared_type_desc_args rec_args = { - td->first_param[i], 0 - }; - upcall_s_create_shared_type_desc(&rec_args); - args->res->first_param[i] = rec_args.res; - } - } -} - -extern "C" CDECL type_desc * -upcall_create_shared_type_desc(type_desc *td) { - s_create_shared_type_desc_args args = { td, 0 }; - UPCALL_SWITCH_STACK(&args, upcall_s_create_shared_type_desc); - return args.res; -} - -/********************************************************************** - * Called to deep free a type descriptor from the exchange heap. - */ - -void upcall_s_free_shared_type_desc(type_desc *td) -{ // n.b.: invoked from rust_cc.cpp as well as generated code - rust_task *task = rust_task_thread::get_task(); - LOG_UPCALL_ENTRY(task); - - if (td) { - // Recursively free any referenced descriptors: - for (unsigned i = 0; i < td->n_params; i++) { - upcall_s_free_shared_type_desc((type_desc*) td->first_param[i]); - } - - task->kernel->free(td); - } -} - -extern "C" CDECL void -upcall_free_shared_type_desc(type_desc *td) { - if (td) { - UPCALL_SWITCH_STACK(td, upcall_s_free_shared_type_desc); - } -} - /**********************************************************************/ struct s_vec_grow_args { diff --git a/src/rt/rust_upcall.h b/src/rt/rust_upcall.h index 46676497d63..344730e2171 100644 --- a/src/rt/rust_upcall.h +++ b/src/rt/rust_upcall.h @@ -3,5 +3,4 @@ // Upcalls used from C code on occasion: extern "C" CDECL void upcall_shared_free(void* ptr); -extern "C" CDECL void upcall_free_shared_type_desc(type_desc *td); diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index 67542eb93dd..4d2f7b99f72 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -59,8 +59,6 @@ upcall_cmp_type upcall_fail upcall_free upcall_validate_box -upcall_create_shared_type_desc -upcall_free_shared_type_desc upcall_log_type upcall_malloc upcall_rust_personality |
