From 408d4ec0ef40a2ce650fab8d730a79f08d35054a Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 30 Nov 2011 14:33:58 -0800 Subject: [PATCH] rt: Remove upcall_alloc_c_stack/call_c_stack, et. al. We are using upcall_call_shim_on_c_stack now --- src/rt/arch/i386/ccall.S | 46 -------------------------- src/rt/arch/x86_64/ccall.S | 68 -------------------------------------- src/rt/rust_upcall.cpp | 10 ------ src/rt/rustrt.def.in | 5 --- 4 files changed, 129 deletions(-) diff --git a/src/rt/arch/i386/ccall.S b/src/rt/arch/i386/ccall.S index 370c0e7c990..3d7063d201a 100644 --- a/src/rt/arch/i386/ccall.S +++ b/src/rt/arch/i386/ccall.S @@ -1,51 +1,5 @@ .text -// upcall_call_c_stack(void (*fn)(), void *arg_struct) -// -// Note that we could use |enter| and |leave| but the manuals tell me they're -// slower. -#if defined(__APPLE__) || defined(_WIN32) -.globl _upcall_call_c_stack -.globl _upcall_call_c_stack_i64 -.globl _upcall_call_c_stack_float -_upcall_call_c_stack: -_upcall_call_c_stack_i64: -_upcall_call_c_stack_float: -#else -.globl upcall_call_c_stack -.globl upcall_call_c_stack_i64 -.globl upcall_call_c_stack_float -upcall_call_c_stack: -upcall_call_c_stack_i64: -upcall_call_c_stack_float: -#endif - pushl %ebp - movl %esp,%ebp // save esp - movl 8(%esp),%eax // eax = callee - movl 12(%esp),%esp // switch stack - calll *%eax - movl %ebp,%esp // would like to use "leave" but it's slower - popl %ebp - ret - -#if defined(__APPLE__) || defined(_WIN32) -.globl _upcall_call_c_stack_shim -_upcall_call_c_stack_shim: -#else -.globl upcall_call_c_stack_shim -upcall_call_c_stack_shim: -#endif - pushl %ebp - movl %esp,%ebp // save esp - movl 8(%ebp),%eax // eax = callee - movl 12(%ebp),%esp // switch stack - subl $12,%esp // maintain 16-byte alignment - pushl 12(%ebp) // push ptr to argument block - calll *%eax - movl %ebp,%esp // would like to use "leave" but it's slower - popl %ebp - ret - #if defined(__APPLE__) || defined(_WIN32) .globl _asm_call_on_stack _asm_call_on_stack: diff --git a/src/rt/arch/x86_64/ccall.S b/src/rt/arch/x86_64/ccall.S index 943a2027907..bfec8fc9795 100644 --- a/src/rt/arch/x86_64/ccall.S +++ b/src/rt/arch/x86_64/ccall.S @@ -6,74 +6,6 @@ .text -// upcall_call_c_stack(void (*fn)(), void *new_esp) -// -// Note that we could use |enter| and |leave| but the manuals tell me they're -// slower. -#if defined(__APPLE__) || defined(_WIN32) -.globl _upcall_call_c_stack -.globl _upcall_call_c_stack_i64 -.globl _upcall_call_c_stack_float -_upcall_call_c_stack: -_upcall_call_c_stack_i64: -_upcall_call_c_stack_float: -#else -.globl upcall_call_c_stack -.globl upcall_call_c_stack_i64 -.globl upcall_call_c_stack_float -upcall_call_c_stack: -upcall_call_c_stack_i64: -upcall_call_c_stack_float: -#endif - push %rbp - mov %rsp,%rbp // save rsp - mov ARG1,%rsp // switch stack - - // Hack: the arguments to the function are sitting - // on the stack right now, as in i386 calling - // convention. We need them in registers. - // For now, we just load them into registers. - // - // This is a total hack because it does not consider - // the actual arguments of the target function. - // It fails if there are non-INTEGER class arguments, - // which would get pushed on the stack, or if there are - // additional arguments beyond those that will get - // passed in registers. - mov ARG0,%r11 // Remember target address - mov 0(%rsp),RUSTRT_ARG0_S - mov 8(%rsp),RUSTRT_ARG1_S - mov 16(%rsp),RUSTRT_ARG2_S - mov 24(%rsp),RUSTRT_ARG3_S -# ifdef RUSTRT_ARG4_S - mov 32(%rsp),RUSTRT_ARG4_S -# endif -# ifdef RUSTRT_ARG5_S - mov 40(%rsp),RUSTRT_ARG5_S -# endif - - call *%r11 - mov %rbp,%rsp // would like to use "leave" but it's slower - pop %rbp - ret - -#if defined(__APPLE__) || defined(_WIN32) -.globl _upcall_call_c_stack_shim -_upcall_call_c_stack_shim: -#else -.globl upcall_call_c_stack_shim -upcall_call_c_stack_shim: -#endif - push %rbp - mov %rsp,%rbp // save rsp - mov ARG1,%rsp // switch stack - mov ARG0,%r11 // Remember target address - mov ARG1,ARG0 // setup the parameter shim expects - call *%r11 - mov %rbp,%rsp - pop %rbp - ret - #if defined(__APPLE__) || defined(_WIN32) .globl _asm_call_on_stack _asm_call_on_stack: diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index aac4212cac7..839a9231f45 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -209,16 +209,6 @@ upcall_dynastack_free(void *ptr) { return rust_scheduler::get_task()->dynastack.free(ptr); } -/** - * Allocates |nbytes| bytes in the C stack and returns a pointer to the start - * of the allocated space. - */ -extern "C" CDECL void * -upcall_alloc_c_stack(size_t nbytes) { - rust_scheduler *sched = rust_scheduler::get_task()->sched; - return sched->c_context.alloc_stack(nbytes); -} - /** * Allocates |nbytes| bytes in the C stack and returns a pointer to the start * of the allocated space. diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index 8d78ba16e9c..a62c7ab06f5 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -53,11 +53,6 @@ start_task vec_reserve_shared vec_from_buf_shared unsupervise -upcall_alloc_c_stack -upcall_call_c_stack -upcall_call_c_stack_i64 -upcall_call_c_stack_float -upcall_call_c_stack_shim upcall_cmp_type upcall_dynastack_alloc upcall_dynastack_alloc_2