Skip to content

Instantly share code, notes, and snippets.

diff --git a/js/src/builtin/ParallelArray.cpp b/js/src/builtin/ParallelArray.cpp
--- a/js/src/builtin/ParallelArray.cpp
+++ b/js/src/builtin/ParallelArray.cpp
@@ -18,16 +18,18 @@
*
* The Initial Developer of the Original Code is
* Intel Corporation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*

Freezable, sendable hashtable

If we make the changes I suggested in issue 2941, I think we can implement a freezable/sendable hashtable.

Here is the basic idea. You define a closed hashtable like so:

type hash<T> = {hashf: ~fn(T) -> uint, eqf: ~fn(T, T) -> bool, data: ~[T]};
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- automatically generated by aafigure -->
<text x="98.0" y="25.9" font-family="monospace" font-size="14.0" fill="#000000" >
A
</text>
<body>
<div style="width:100%">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- automatically generated by aafigure -->
<text x="98.0" y="25.9" font-family="monospace" font-size="14.0" fill="#000000" >
A
</text>
<text x="434.0" y="25.9" font-family="monospace" font-size="14.0" fill="#000000" >
B
diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs
index 2c48507..4eec333 100644
--- a/src/libcore/send_map.rs
+++ b/src/libcore/send_map.rs
@@ -252,6 +252,22 @@ mod linear {
}
}
+ impl public_methods<K: copy, V: copy> for &const linear_map<K,V> {
+ fn each(f: fn(+k: K, +v: V) -> bool) {
fn each_mut<V>(v: &[mut V], op: fn(v: &mut V) -> bool) {
for uint::range(0, v.len()) |i| {
if !op(&mut v[i]) { return; }
}
}
#!/bin/bash
#
# Script which finds an appropriate rustc to execute based on the current
# directory. We begin by walking up the set of directories until we find
# one that contains "src/comp/rustc.rc".
# Walk up directories looking for the main rust directory. Don't walk
# past the home directory of the current user, just seems unsanitary.
if [ -z "$1" ]; then
fn main() {
let mut v = some(22);
match v {
none => {}
some(ref mut p) => { *p += 1; }
}
assert v == some(23);
}
diff --git a/js/src/ion/Bailouts.h b/js/src/ion/Bailouts.h
--- a/js/src/ion/Bailouts.h
+++ b/js/src/ion/Bailouts.h
@@ -102,16 +102,17 @@ static const uint32 BAILOUT_TABLE_SIZE =
static const uint32 BAILOUT_RETURN_OK = 0;
static const uint32 BAILOUT_RETURN_FATAL_ERROR = 1;
static const uint32 BAILOUT_RETURN_ARGUMENT_CHECK = 2;
static const uint32 BAILOUT_RETURN_TYPE_BARRIER = 3;
static const uint32 BAILOUT_RETURN_MONITOR = 4;
static const uint32 BAILOUT_RETURN_RECOMPILE_CHECK = 5;
Replace the fn `remove_copy()` in ty.rs with:
fn remove_copyable(k: kind) -> kind {
k - kind_(KIND_MASK_COPY | KIND_MASK_DEFAULT_MODE)
}