mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
intrinsics: Remove the call to get_task from task_sleep
This commit is contained in:
parent
eecbc815ac
commit
21865ddce6
@ -53,7 +53,7 @@ export spawn_joinable;
|
||||
#[abi = "rust-intrinsic"]
|
||||
native mod rusti {
|
||||
// these must run on the Rust stack so that they can swap stacks etc:
|
||||
fn task_sleep(time_in_us: uint);
|
||||
fn task_sleep(task: *rust_task, time_in_us: uint);
|
||||
}
|
||||
|
||||
#[link_name = "rustrt"]
|
||||
@ -63,6 +63,7 @@ native mod rustrt {
|
||||
fn pin_task();
|
||||
fn unpin_task();
|
||||
fn get_task_id() -> task_id;
|
||||
fn rust_get_task() -> *rust_task;
|
||||
|
||||
fn set_min_stack(stack_size: uint);
|
||||
|
||||
@ -142,7 +143,10 @@ Parameters:
|
||||
|
||||
time_in_us - maximum number of microseconds to yield control for
|
||||
*/
|
||||
fn sleep(time_in_us: uint) { ret rusti::task_sleep(time_in_us); }
|
||||
fn sleep(time_in_us: uint) {
|
||||
let task = rustrt::rust_get_task();
|
||||
ret rusti::task_sleep(task, time_in_us);
|
||||
}
|
||||
|
||||
/*
|
||||
Function: yield
|
||||
|
@ -12,7 +12,7 @@ extern "C" CDECL void
|
||||
port_recv(uintptr_t *dptr, rust_port *port);
|
||||
|
||||
extern "C" CDECL void
|
||||
rust_task_sleep(size_t time_in_us);
|
||||
rust_task_sleep(rust_task *task, size_t time_in_us);
|
||||
|
||||
extern "C" void
|
||||
rust_intrinsic_vec_len(size_t *retptr,
|
||||
@ -71,7 +71,8 @@ rust_intrinsic_get_type_desc(void **retptr,
|
||||
extern "C" void
|
||||
rust_intrinsic_task_sleep(void **retptr,
|
||||
void *env,
|
||||
rust_task *task,
|
||||
size_t time_in_us) {
|
||||
rust_task_sleep(time_in_us);
|
||||
rust_task_sleep(task, time_in_us);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ target triple = "@CFG_TARGET_TRIPLE@"
|
||||
%class.rust_task_list = type { %class.indexed_list, %struct.rust_scheduler*, i8* }
|
||||
%class.indexed_list = type { i32 (...)**, %class.array_list.2 }
|
||||
%class.array_list.2 = type { i32, %struct.rust_task**, i32 }
|
||||
%struct.rust_task = type { %struct.rust_task_user, i32, %class.context, %struct.stk_seg*, i32, %struct.rust_scheduler*, %class.rust_crate_cache*, %class.rust_kernel*, i8*, %class.rust_task_list*, %struct.rust_cond*, i8*, %struct.rust_task*, i32, i32, %class.timer, i32*, i32, i32, %class.memory_region, %"class.rust_task::wakeup_callback"*, i8, i8, i8, %class.lock_and_signal, %class.hash_map.4, %class.rust_obstack, %"class.std::map", i32, %"class.debug::task_debug_info" }
|
||||
%struct.rust_task = type { %struct.rust_task_user, i32, %class.context, %struct.stk_seg*, i32, %struct.rust_scheduler*, %class.rust_crate_cache*, %class.rust_kernel*, i8*, %class.rust_task_list*, %struct.rust_cond*, i8*, %struct.rust_task*, i32, i32, %class.timer, i32*, i32, i32, %class.memory_region, i8, i8, i8, %class.lock_and_signal, %class.hash_map.4, %class.rust_obstack, %"class.std::map", i32, %"class.debug::task_debug_info" }
|
||||
%struct.rust_task_user = type { i32, i32, %struct.chan_handle, i32 }
|
||||
%struct.chan_handle = type { i32, i32 }
|
||||
%class.context = type { %struct.registers_t, %class.context* }
|
||||
@ -36,7 +36,6 @@ target triple = "@CFG_TARGET_TRIPLE@"
|
||||
%class.rust_crate_cache = type { %struct.type_desc*, %struct.rust_scheduler*, i32 }
|
||||
%struct.rust_cond = type { i8 }
|
||||
%class.timer = type { i32 (...)**, i64, i64 }
|
||||
%"class.rust_task::wakeup_callback" = type { i32 (...)** }
|
||||
%class.hash_map.4 = type { %"struct.hash_map<int, rust_port *>::map_entry"* }
|
||||
%"struct.hash_map<int, rust_port *>::map_entry" = type opaque
|
||||
%class.rust_obstack = type { %struct.rust_obstack_chunk*, %struct.rust_task* }
|
||||
@ -105,12 +104,12 @@ define void @rust_intrinsic_get_type_desc(i8** nocapture %retptr, i8* nocapture
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_task_sleep(i8** nocapture %retptr, i8* nocapture %env, i32 %time_in_us) {
|
||||
tail call void @rust_task_sleep(i32 %time_in_us)
|
||||
define void @rust_intrinsic_task_sleep(i8** nocapture %retptr, i8* nocapture %env, %struct.rust_task* %task, i32 %time_in_us) {
|
||||
tail call void @rust_task_sleep(%struct.rust_task* %task, i32 %time_in_us)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @rust_task_sleep(i32)
|
||||
declare void @rust_task_sleep(%struct.rust_task*, i32)
|
||||
|
||||
!0 = metadata !{metadata !"any pointer", metadata !1}
|
||||
!1 = metadata !{metadata !"omnipotent char", metadata !2}
|
||||
|
@ -27,7 +27,7 @@ target triple = "@CFG_TARGET_TRIPLE@"
|
||||
%class.rust_task_list = type { %class.indexed_list, %struct.rust_scheduler*, i8* }
|
||||
%class.indexed_list = type { i32 (...)**, %class.array_list.2 }
|
||||
%class.array_list.2 = type { i64, %struct.rust_task**, i64 }
|
||||
%struct.rust_task = type { %struct.rust_task_user, i64, %class.context, %struct.stk_seg*, i64, %struct.rust_scheduler*, %class.rust_crate_cache*, %class.rust_kernel*, i8*, %class.rust_task_list*, %struct.rust_cond*, i8*, %struct.rust_task*, i32, i64, %class.timer, i64*, i32, i32, %class.memory_region, %"class.rust_task::wakeup_callback"*, i8, i8, i8, %class.lock_and_signal, %class.hash_map.4, %class.rust_obstack, %"class.std::map", i32, %"class.debug::task_debug_info" }
|
||||
%struct.rust_task = type { %struct.rust_task_user, i64, %class.context, %struct.stk_seg*, i64, %struct.rust_scheduler*, %class.rust_crate_cache*, %class.rust_kernel*, i8*, %class.rust_task_list*, %struct.rust_cond*, i8*, %struct.rust_task*, i32, i64, %class.timer, i64*, i32, i32, %class.memory_region, i8, i8, i8, %class.lock_and_signal, %class.hash_map.4, %class.rust_obstack, %"class.std::map", i32, %"class.debug::task_debug_info" }
|
||||
%struct.rust_task_user = type { i64, i64, %struct.chan_handle, i64 }
|
||||
%struct.chan_handle = type { i64, i64 }
|
||||
%class.context = type { %struct.registers_t, %class.context* }
|
||||
@ -36,7 +36,6 @@ target triple = "@CFG_TARGET_TRIPLE@"
|
||||
%class.rust_crate_cache = type { %struct.type_desc*, %struct.rust_scheduler*, i64 }
|
||||
%struct.rust_cond = type { i8 }
|
||||
%class.timer = type { i32 (...)**, i64, i64 }
|
||||
%"class.rust_task::wakeup_callback" = type { i32 (...)** }
|
||||
%class.hash_map.4 = type { %"struct.hash_map<long, rust_port *>::map_entry"* }
|
||||
%"struct.hash_map<long, rust_port *>::map_entry" = type opaque
|
||||
%class.rust_obstack = type { %struct.rust_obstack_chunk*, %struct.rust_task* }
|
||||
@ -105,12 +104,12 @@ define void @rust_intrinsic_get_type_desc(i8** nocapture %retptr, i8* nocapture
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_task_sleep(i8** nocapture %retptr, i8* nocapture %env, i64 %time_in_us) uwtable {
|
||||
tail call void @rust_task_sleep(i64 %time_in_us)
|
||||
define void @rust_intrinsic_task_sleep(i8** nocapture %retptr, i8* nocapture %env, %struct.rust_task* %task, i64 %time_in_us) uwtable {
|
||||
tail call void @rust_task_sleep(%struct.rust_task* %task, i64 %time_in_us)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @rust_task_sleep(i64)
|
||||
declare void @rust_task_sleep(%struct.rust_task*, i64)
|
||||
|
||||
!0 = metadata !{metadata !"any pointer", metadata !1}
|
||||
!1 = metadata !{metadata !"omnipotent char", metadata !2}
|
||||
|
@ -511,8 +511,7 @@ chan_id_send(type_desc *t, rust_task_id target_task_id,
|
||||
// This is called by an intrinsic on the Rust stack.
|
||||
// Do not call on the C stack.
|
||||
extern "C" CDECL void
|
||||
rust_task_sleep(size_t time_in_us) {
|
||||
rust_task *task = rust_scheduler::get_task();
|
||||
rust_task_sleep(rust_task *task, size_t time_in_us) {
|
||||
task->yield(time_in_us);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user