about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-02-26 07:10:23 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-02-26 08:50:06 -0800
commit4a9d4aa52e70eba52dad0719ed6e1eca95f1a2cc (patch)
treee2b1ff2d05e1ab8e90ad17bcec048a245c6fad86
parent9b08cd4903f7b3b5bb193dec85b055f24ff09cb7 (diff)
bench: Fix botched option dances. rs=demuting
-rw-r--r--src/test/bench/msgsend-ring-mutex-arcs.rs9
-rw-r--r--src/test/bench/msgsend-ring-pipes.rs8
-rw-r--r--src/test/bench/msgsend-ring-rw-arcs.rs10
-rw-r--r--src/test/bench/shootout-chameneos-redux.rs2
4 files changed, 16 insertions, 13 deletions
diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs
index 22045007134..12060a87850 100644
--- a/src/test/bench/msgsend-ring-mutex-arcs.rs
+++ b/src/test/bench/msgsend-ring-mutex-arcs.rs
@@ -19,6 +19,7 @@ extern mod std;
 use std::time;
 use std::arc;
 use std::future;
+use core::cell::Cell;
 
 // A poor man's pipe.
 type pipe = arc::MutexARC<~[uint]>;
@@ -77,7 +78,7 @@ fn main() {
     let msg_per_task = uint::from_str(args[2]).get();
 
     let (num_chan, num_port) = init();
-    let mut num_chan = Some(num_chan);
+    let mut num_chan = Cell(num_chan);
 
     let start = time::precise_time_s();
 
@@ -87,7 +88,7 @@ fn main() {
     for uint::range(1u, num_tasks) |i| {
         //error!("spawning %?", i);
         let (new_chan, num_port) = init();
-        let num_chan2 = Cell(num_chan);
+        let num_chan2 = Cell(num_chan.take());
         let num_port = Cell(num_port);
         let new_future = do future::spawn() {
             let num_chan = num_chan2.take();
@@ -95,11 +96,11 @@ fn main() {
             thread_ring(i, msg_per_task, num_chan, num_port1)
         };
         futures.push(new_future);
-        num_chan = Some(new_chan);
+        num_chan.put_back(new_chan);
     };
 
     // do our iteration
-    thread_ring(0, msg_per_task, option::unwrap(num_chan), num_port);
+    thread_ring(0, msg_per_task, num_chan.take(), num_port);
 
     // synchronize
     for futures.each |f| { f.get() };
diff --git a/src/test/bench/msgsend-ring-pipes.rs b/src/test/bench/msgsend-ring-pipes.rs
index dfe5c6de832..56a46d3e006 100644
--- a/src/test/bench/msgsend-ring-pipes.rs
+++ b/src/test/bench/msgsend-ring-pipes.rs
@@ -71,7 +71,7 @@ fn main() {
     let msg_per_task = uint::from_str(args[2]).get();
 
     let (num_chan, num_port) = ring::init();
-    let mut num_chan = Some(num_chan);
+    let mut num_chan = Cell(num_chan);
 
     let start = time::precise_time_s();
 
@@ -81,7 +81,7 @@ fn main() {
     for uint::range(1u, num_tasks) |i| {
         //error!("spawning %?", i);
         let (new_chan, num_port) = ring::init();
-        let num_chan2 = Cell(num_chan);
+        let num_chan2 = Cell(num_chan.take());
         let num_port = Cell(num_port);
         let new_future = do future::spawn || {
             let num_chan = num_chan2.take();
@@ -89,11 +89,11 @@ fn main() {
             thread_ring(i, msg_per_task, num_chan, num_port1)
         };
         futures.push(new_future);
-        num_chan = Some(new_chan);
+        num_chan.put_back(new_chan);
     };
 
     // do our iteration
-    thread_ring(0, msg_per_task, option::unwrap(num_chan), num_port);
+    thread_ring(0, msg_per_task, num_chan.take(), num_port);
 
     // synchronize
     for futures.each |f| { f.get() };
diff --git a/src/test/bench/msgsend-ring-rw-arcs.rs b/src/test/bench/msgsend-ring-rw-arcs.rs
index 98c0129918a..57d04abb414 100644
--- a/src/test/bench/msgsend-ring-rw-arcs.rs
+++ b/src/test/bench/msgsend-ring-rw-arcs.rs
@@ -16,6 +16,8 @@
 // This also serves as a pipes test, because ARCs are implemented with pipes.
 
 extern mod std;
+
+use core::cell::Cell;
 use std::time;
 use std::arc;
 use std::future;
@@ -77,7 +79,7 @@ fn main() {
     let msg_per_task = uint::from_str(args[2]).get();
 
     let (num_chan, num_port) = init();
-    let mut num_chan = Some(num_chan);
+    let mut num_chan = Cell(num_chan);
 
     let start = time::precise_time_s();
 
@@ -87,7 +89,7 @@ fn main() {
     for uint::range(1u, num_tasks) |i| {
         //error!("spawning %?", i);
         let (new_chan, num_port) = init();
-        let num_chan2 = Cell(num_chan);
+        let num_chan2 = Cell(num_chan.take());
         let num_port = Cell(num_port);
         let new_future = do future::spawn {
             let num_chan = num_chan2.take();
@@ -95,11 +97,11 @@ fn main() {
             thread_ring(i, msg_per_task, num_chan, num_port1)
         };
         futures.push(new_future);
-        num_chan = Some(new_chan);
+        num_chan.put_back(new_chan);
     };
 
     // do our iteration
-    thread_ring(0, msg_per_task, option::unwrap(num_chan), num_port);
+    thread_ring(0, msg_per_task, num_chan.take(), num_port);
 
     // synchronize
     for futures.each |f| { f.get() };
diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs
index 42a1e4b5046..111219974d0 100644
--- a/src/test/bench/shootout-chameneos-redux.rs
+++ b/src/test/bench/shootout-chameneos-redux.rs
@@ -14,7 +14,7 @@ extern mod std;
 use std::oldmap;
 use std::oldmap::HashMap;
 use std::sort;
-use std::cell::Cell;
+use core::cell::Cell;
 use core::comm::*;
 
 fn print_complements() {