There is only one yield glue.
This commit is contained in:
parent
b1292580b9
commit
ac836dd79c
7 changed files with 52 additions and 57 deletions
|
|
@ -86,43 +86,6 @@ fn store_esp_to_runtime_sp_second_arg() -> vec[str] {
|
|||
ret ["movl %esp, " + wstr(abi::task_field_runtime_sp) + "(%edx)"];
|
||||
}
|
||||
|
||||
|
||||
/* More glue code, this time the 'bottom half' of yielding.
|
||||
*
|
||||
* We arrived here because an native call decided to deschedule the
|
||||
* running task. So the native call's return address got patched to the
|
||||
* first instruction of this glue code.
|
||||
*
|
||||
* When the native call does 'ret' it will come here, and its esp will be
|
||||
* pointing to the last argument pushed on the C stack before making
|
||||
* the native call: the 0th argument to the native call, which is always
|
||||
* the task ptr performing the native call. That's where we take over.
|
||||
*
|
||||
* Our goal is to complete the descheduling
|
||||
*
|
||||
* - Switch over to the task stack temporarily.
|
||||
*
|
||||
* - Save the task's callee-saves onto the task stack.
|
||||
* (the task is now 'descheduled', safe to set aside)
|
||||
*
|
||||
* - Switch *back* to the C stack.
|
||||
*
|
||||
* - Restore the C-stack callee-saves.
|
||||
*
|
||||
* - Return to the caller on the C stack that activated the task.
|
||||
*
|
||||
*/
|
||||
|
||||
fn rust_yield_glue() -> vec[str] {
|
||||
ret ["movl 0(%esp), %ecx # ecx = rust_task"]
|
||||
+ load_esp_from_rust_sp_first_arg()
|
||||
+ save_callee_saves()
|
||||
+ store_esp_to_rust_sp_first_arg()
|
||||
+ load_esp_from_runtime_sp_first_arg()
|
||||
+ restore_callee_saves()
|
||||
+ ["ret"];
|
||||
}
|
||||
|
||||
fn native_glue(int n_args, abi::native_glue_type ngt) -> vec[str] {
|
||||
|
||||
let bool pass_task;
|
||||
|
|
@ -218,11 +181,8 @@ fn get_module_asm() -> str {
|
|||
|
||||
auto prefix = get_symbol_prefix();
|
||||
|
||||
auto glues =
|
||||
[decl_glue(align, prefix,
|
||||
abi::yield_glue_name(),
|
||||
rust_yield_glue())]
|
||||
|
||||
let vec[str] glues =
|
||||
[]
|
||||
+ vec::init_fn[str](bind decl_native_glue(align, prefix,
|
||||
abi::ngt_rust, _), (abi::n_native_glues + 1) as uint)
|
||||
+ vec::init_fn[str](bind decl_native_glue(align, prefix,
|
||||
|
|
|
|||
|
|
@ -7660,9 +7660,6 @@ fn create_crate_constant(ValueRef crate_ptr, @glue_fns glues) {
|
|||
|
||||
let ValueRef crate_addr = p2i(crate_ptr);
|
||||
|
||||
let ValueRef yield_glue_off =
|
||||
llvm::LLVMConstSub(p2i(glues.yield_glue), crate_addr);
|
||||
|
||||
let ValueRef crate_val =
|
||||
C_struct([C_null(T_int()), // ptrdiff_t image_base_off
|
||||
p2i(crate_ptr), // uintptr_t self_addr
|
||||
|
|
@ -7671,10 +7668,10 @@ fn create_crate_constant(ValueRef crate_ptr, @glue_fns glues) {
|
|||
C_null(T_int()), // ptrdiff_t debug_info_off
|
||||
C_null(T_int()), // size_t debug_info_sz
|
||||
C_null(T_int()), // size_t pad
|
||||
yield_glue_off, // size_t yield_glue_off
|
||||
C_null(T_int()), // size_t pad
|
||||
C_null(T_int()), // size_t gc_glue_off
|
||||
C_null(T_int()), // size_t pad2
|
||||
C_null(T_int()), // size_t gc_glue_off
|
||||
C_null(T_int()), // size_t pad3
|
||||
C_null(T_int()), // int n_rust_syms
|
||||
C_null(T_int()), // int n_c_syms
|
||||
C_null(T_int()) // int n_libs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue