diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-11-18 12:39:13 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-11-18 12:48:54 -0800 |
| commit | 3a6320f71b1e1bde9ec3b30563d9f8e0ef4bdbce (patch) | |
| tree | 1db92aea52237c973ee22d83139448f23336f40b /src/rt/rust_builtin.cpp | |
| parent | 93931311ff1d034ef92e35f36c900bbd74176179 (diff) | |
| download | rust-3a6320f71b1e1bde9ec3b30563d9f8e0ef4bdbce.tar.gz rust-3a6320f71b1e1bde9ec3b30563d9f8e0ef4bdbce.zip | |
intrinsics: Eliminate recv intrinsic
This intrinsic existed just to get ahold of the return pointer. I replaced it with a call_with_retptr intrinsic that grabs the return pointer and passes it to another Rust function, thereby eliminating the need to call C functions on the Rust stack.
Diffstat (limited to 'src/rt/rust_builtin.cpp')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 0ae191da0f6..3460d460900 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -515,10 +515,8 @@ rust_task_sleep(rust_task *task, size_t time_in_us) { task->yield(time_in_us); } -// This is called by an intrinsic on the Rust stack. -// Do not call on the C stack. extern "C" CDECL void -port_recv(uintptr_t *dptr, rust_port *port) { +port_recv(uintptr_t *dptr, rust_port *port, uintptr_t *yield) { rust_task *task = rust_scheduler::get_task(); { scoped_lock with(port->lock); @@ -528,6 +526,7 @@ port_recv(uintptr_t *dptr, rust_port *port) { (uintptr_t) port, (uintptr_t) dptr, port->unit_sz); if (port->receive(dptr)) { + *yield = false; return; } @@ -539,7 +538,8 @@ port_recv(uintptr_t *dptr, rust_port *port) { task->rendezvous_ptr = dptr; task->block(port, "waiting for rendezvous data"); } - task->yield(3); + *yield = true; + return; } // |
