Skip to content

Commit 52c5d3c

Browse files
committed
---
yaml --- r: 14699 b: refs/heads/try c: c9375fe h: refs/heads/master i: 14697: f6d5f6b 14695: 739ea9f v: v3
1 parent 26b43e6 commit 52c5d3c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+97
-48
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: c245d9e980946d4472e9c830a109db77e1bcb038
5+
refs/heads/try: c9375fed8d55197a528edb3c3182aaf3b71abe76
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/cargo/cargo.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import io::writer_util;
1616
import std::json;
1717
import result;
1818
import std::map;
19+
import std::map::hashmap;
1920
import std::os;
2021
import std::run;
2122
import str;

branches/try/src/libstd/json.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import result::{ok, err};
55
import io;
66
import io::{reader_util, writer_util};
77
import map;
8+
import map::hashmap;
89

910
export json;
1011
export error;
@@ -36,7 +37,7 @@ enum json {
3637
/* Variant: list */
3738
list([json]),
3839
/* Variant: dict */
39-
dict(map::map<str,json>),
40+
dict(map::hashmap<str,json>),
4041
/* Variant: null */
4142
null,
4243
}

branches/try/src/libstd/map.rs

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Module: map
44
A map type
55
*/
66

7+
import chained::hashmap;
8+
export hashmap, hashfn, eqfn, set, map, chained, mk_hashmap, new_str_hash;
9+
export new_bytes_hash, new_int_hash, new_uint_hash, set_add;
10+
711
/* Section: Types */
812

913
/*
@@ -23,14 +27,13 @@ Equality
2327
type eqfn<K> = fn@(K, K) -> bool;
2428

2529
/*
26-
Type: hashset
30+
Type: set
2731
28-
A convenience type to treat a map as a set
32+
A convenience type to treat a hashmap as a set
2933
*/
30-
type set<K> = map<K, ()>;
34+
type set<K> = hashmap<K, ()>;
3135

32-
// Temporary alias to make migration easier
33-
type hashmap<K, V> = map<K, V>;
36+
type hashmap<K, V> = chained::t<K, V>;
3437

3538
/*
3639
IFace: map
@@ -103,8 +106,7 @@ iface map<K: copy, V: copy> {
103106
}
104107

105108
// FIXME: package this up and export it as a datatype usable for
106-
// external code that doesn't want to pay the cost of a box and vtable
107-
// lookups.
109+
// external code that doesn't want to pay the cost of a box.
108110
mod chained {
109111
type entry<K, V> = {
110112
hash: uint,
@@ -118,8 +120,8 @@ mod chained {
118120
absent
119121
}
120122

121-
type t<K, V> = {
122-
mutable size: uint,
123+
type t<K, V> = @{
124+
mutable count: uint,
123125
mutable chains: [mutable chain<K,V>],
124126
hasher: hashfn<K>,
125127
eqer: eqfn<K>
@@ -185,7 +187,7 @@ mod chained {
185187
let hash = tbl.hasher(k);
186188
alt search_tbl(tbl, k, hash) {
187189
not_found {
188-
tbl.size += 1u;
190+
tbl.count += 1u;
189191
let idx = hash % vec::len(tbl.chains);
190192
let old_chain = tbl.chains[idx];
191193
tbl.chains[idx] = present(@{
@@ -229,13 +231,13 @@ mod chained {
229231
}
230232

231233
found_first(idx, entry) {
232-
tbl.size -= 1u;
234+
tbl.count -= 1u;
233235
tbl.chains[idx] = entry.next;
234236
ret core::option::some(entry.value);
235237
}
236238

237239
found_after(eprev, entry) {
238-
tbl.size -= 1u;
240+
tbl.count -= 1u;
239241
eprev.next = entry.next;
240242
ret core::option::some(entry.value);
241243
}
@@ -291,12 +293,12 @@ mod chained {
291293
}
292294
}
293295

294-
impl <K: copy, V: copy> of map<K, V> for t<K, V> {
295-
fn size() -> uint { self.size }
296+
impl hashmap<K: copy, V: copy> of map<K, V> for t<K, V> {
297+
fn size() -> uint { self.count }
296298

297299
fn insert(k: K, v: V) -> bool {
298300
let nchains = vec::len(self.chains);
299-
let load = {num: (self.size + 1u) as int, den: nchains as int};
301+
let load = {num: (self.count + 1u) as int, den: nchains as int};
300302
// Structural consts would be nice. This is a const 3/4
301303
// load factor that we compare against.
302304
if !util::rational_leq(load, {num:3, den:4}) { rehash(self); }
@@ -318,13 +320,13 @@ mod chained {
318320
fn values(blk: fn(V)) { items(self) { |_k, v| blk(v) } }
319321
}
320322

321-
fn mk<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>) -> map<K,V> {
323+
fn mk<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>) -> t<K,V> {
322324
let initial_capacity: uint = 32u; // 2^5
323-
let slf: t<K, V> = {mutable size: 0u,
324-
mutable chains: chains(initial_capacity),
325-
hasher: hasher,
326-
eqer: eqer};
327-
slf as map::<K, V>
325+
let slf: t<K, V> = @{mutable count: 0u,
326+
mutable chains: chains(initial_capacity),
327+
hasher: hasher,
328+
eqer: eqer};
329+
slf
328330
}
329331
}
330332

@@ -339,7 +341,7 @@ hasher - The hash function for key type K
339341
eqer - The equality function for key type K
340342
*/
341343
fn mk_hashmap<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>)
342-
-> map<K, V> {
344+
-> hashmap<K, V> {
343345
chained::mk(hasher, eqer)
344346
}
345347

@@ -348,7 +350,7 @@ Function: new_str_hash
348350
349351
Construct a hashmap for string keys
350352
*/
351-
fn new_str_hash<V: copy>() -> map<str, V> {
353+
fn new_str_hash<V: copy>() -> hashmap<str, V> {
352354
ret mk_hashmap(str::hash, str::eq);
353355
}
354356

@@ -357,7 +359,7 @@ Function: new_bytes_hash
357359
358360
Construct a hashmap for byte string keys
359361
*/
360-
fn new_bytes_hash<V: copy>() -> map<[u8], V> {
362+
fn new_bytes_hash<V: copy>() -> hashmap<[u8], V> {
361363
ret mk_hashmap(vec::u8::hash, vec::u8::eq);
362364
}
363365

@@ -366,7 +368,7 @@ Function: new_int_hash
366368
367369
Construct a hashmap for int keys
368370
*/
369-
fn new_int_hash<V: copy>() -> map<int, V> {
371+
fn new_int_hash<V: copy>() -> hashmap<int, V> {
370372
fn hash_int(&&x: int) -> uint { int::hash(x) }
371373
fn eq_int(&&a: int, &&b: int) -> bool { ret a == b; }
372374
ret mk_hashmap(hash_int, eq_int);
@@ -377,7 +379,7 @@ Function: new_uint_hash
377379
378380
Construct a hashmap for uint keys
379381
*/
380-
fn new_uint_hash<V: copy>() -> map<uint, V> {
382+
fn new_uint_hash<V: copy>() -> hashmap<uint, V> {
381383
fn hash_uint(&&x: uint) -> uint { uint::hash(x) }
382384
fn eq_uint(&&a: uint, &&b: uint) -> bool { ret a == b; }
383385
ret mk_hashmap(hash_uint, eq_uint);

branches/try/src/libstd/uv.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import map::hashmap;
12
export loop_new, loop_delete, run, close, run_in_bg;
23
export async_init, async_send;
34
export timer_init, timer_start, timer_stop;
@@ -129,17 +130,17 @@ fn loop_new() -> uv_loop unsafe {
129130
process_operation);
130131

131132
// all state goes here
132-
let handles: map::map<[u8], *ctypes::void> =
133+
let handles: map::hashmap<[u8], *ctypes::void> =
133134
map::new_bytes_hash();
134-
let id_to_handle: map::map<[u8], uv_handle> =
135+
let id_to_handle: map::hashmap<[u8], uv_handle> =
135136
map::new_bytes_hash();
136-
let after_cbs: map::map<[u8], fn~(uv_handle)> =
137+
let after_cbs: map::hashmap<[u8], fn~(uv_handle)> =
137138
map::new_bytes_hash();
138-
let close_callbacks: map::map<[u8], fn~()> =
139+
let close_callbacks: map::hashmap<[u8], fn~()> =
139140
map::new_bytes_hash();
140-
let async_cbs: map::map<[u8], fn~(uv_handle)> =
141+
let async_cbs: map::hashmap<[u8], fn~(uv_handle)> =
141142
map::new_bytes_hash();
142-
let timer_cbs: map::map<[u8], fn~(uv_handle)> =
143+
let timer_cbs: map::hashmap<[u8], fn~(uv_handle)> =
143144
map::new_bytes_hash();
144145

145146
// the main loop that this task blocks on.

branches/try/src/rustc/back/link.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import middle::ty;
77
import metadata::{encoder, cstore};
88
import middle::trans::common::crate_ctxt;
99
import std::fs;
10+
import std::map::hashmap;
1011
import std::run;
1112
import std::sha1::sha1;
1213
import syntax::ast;

branches/try/src/rustc/back/rpath.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import std::{os, fs, os_fs, map};
2+
import std::map::hashmap;
23
import metadata::cstore;
34
import driver::session;
45
import util::filesearch;

branches/try/src/rustc/front/attr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Functions dealing with attributes and meta_items
22

33
import std::map;
4+
import std::map::hashmap;
45
import syntax::{ast, ast_util};
56
import driver::session::session;
67

branches/try/src/rustc/lib/llvm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import str::sbuf;
2+
import std::map::hashmap;
23

34
import ctypes::{c_int, c_uint, unsigned, longlong, ulonglong};
45

branches/try/src/rustc/metadata/astencode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import syntax::visit;
44
import syntax::ast_util;
55
import syntax::ast_util::inlined_item_methods;
66
import syntax::codemap::span;
7-
import std::map::map;
8-
import std::smallintmap::map;
97
import std::ebml;
108
import std::ebml::writer;
9+
import std::map::hashmap;
1110
import std::serialization;
1211
import std::serialization::serializer;
1312
import std::serialization::deserializer;
1413
import std::serialization::serializer_helpers;
1514
import std::serialization::deserializer_helpers;
15+
import std::smallintmap::map;
1616
import middle::trans::common::maps;
1717
import middle::{ty, typeck, last_use, ast_map};
1818
import middle::typeck::method_origin;
@@ -922,4 +922,4 @@ fn test_more() {
922922
ret z;
923923
}
924924
});
925-
}
925+
}

branches/try/src/rustc/metadata/csearch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import middle::{ty, ast_map};
66
import option::{some, none};
77
import driver::session;
88
import middle::trans::common::maps;
9+
import std::map::hashmap;
910

1011
export get_symbol;
1112
export get_type_param_count;

branches/try/src/rustc/metadata/cstore.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// crates and libraries
33

44
import std::map;
5+
import std::map::hashmap;
56
import syntax::ast;
67
import util::common::*;
78

branches/try/src/rustc/metadata/decoder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Decoding metadata from a single crate's metadata
22

33
import std::{ebml, map, io};
4+
import std::map::hashmap;
45
import io::writer_util;
56
import syntax::{ast, ast_util};
67
import driver::session::session;

branches/try/src/rustc/metadata/encoder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Metadata encoding
22

33
import std::{io, ebml, map, list};
4+
import std::map::hashmap;
45
import io::writer_util;
56
import ebml::writer;
67
import syntax::ast::*;

branches/try/src/rustc/metadata/reachable.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import syntax::ast::*;
1010
import syntax::visit;
1111
import syntax::ast_util::def_id_of_def;
1212
import front::attr;
13+
import std::map::hashmap;
1314

1415
export map, find_reachable;
1516

16-
type map = std::map::map<node_id, ()>;
17+
type map = std::map::hashmap<node_id, ()>;
1718

1819
type ctx = {ccx: middle::trans::common::crate_ctxt,
1920
rmap: map};

branches/try/src/rustc/metadata/tydecode.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import syntax::ast::*;
55
import syntax::ast_util;
66
import syntax::ast_util::respan;
77
import middle::ty;
8+
import std::map::hashmap;
89

910
export parse_ty_data, parse_def_id;
1011
export parse_bounds_data;

branches/try/src/rustc/middle/alias.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import syntax::codemap::span;
55
import syntax::visit;
66
import visit::vt;
77
import std::list;
8+
import std::map::hashmap;
89
import std::util::unreachable;
910
import option::is_none;
1011
import list::list;

branches/try/src/rustc/middle/ast_map.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import std::map;
2+
import std::map::hashmap;
23
import syntax::ast::*;
34
import syntax::ast_util;
45
import syntax::ast_util::inlined_item_methods;
@@ -35,7 +36,7 @@ enum ast_node {
3536
node_res_ctor(@item),
3637
}
3738

38-
type map = std::map::map<node_id, ast_node>;
39+
type map = std::map::hashmap<node_id, ast_node>;
3940
type ctx = {map: map, mutable path: path, mutable local_id: uint};
4041
type vt = visit::vt<ctx>;
4142

branches/try/src/rustc/middle/capture.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import syntax::{ast, ast_util};
22
import driver::session::session;
33
import std::map;
4+
import std::map::hashmap;
45

56
export capture_mode;
67
export capture_var;

branches/try/src/rustc/middle/check_alt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import syntax::visit;
88
import driver::session::session;
99
import middle::ty;
1010
import middle::ty::*;
11+
import std::map::hashmap;
1112

1213
fn check_crate(tcx: ty::ctxt, crate: @crate) {
1314
visit::visit_crate(*crate, (), visit::mk_vt(@{

branches/try/src/rustc/middle/check_const.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import syntax::ast::*;
22
import syntax::{visit, ast_util};
33
import driver::session::session;
4+
import std::map::hashmap;
45

56
fn check_crate(sess: session, crate: @crate, method_map: typeck::method_map) {
67
visit::visit_crate(*crate, false, visit::mk_vt(@{

branches/try/src/rustc/middle/fn_usage.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import std::map::hashmap;
12
import syntax::ast;
23
import syntax::visit;
34
import syntax::print::pprust::expr_to_str;

branches/try/src/rustc/middle/kind.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import syntax::ast::*;
33
import syntax::codemap::span;
44
import ty::{kind, kind_copyable, kind_sendable, kind_noncopyable};
55
import driver::session::session;
6+
import std::map::hashmap;
67

78
// Kind analysis pass. There are three kinds:
89
//

branches/try/src/rustc/middle/last_use.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import syntax::codemap::span;
44
import std::list::{is_not_empty, list, nil, cons, tail};
55
import std::util::unreachable;
66
import std::list;
7+
import std::map::hashmap;
78

89
// Last use analysis pass.
910
//

branches/try/src/rustc/middle/lint.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import middle::ty::ctxt;
33
import syntax::{ast, visit};
44
import front::attr;
55
import std::io;
6+
import std::map::hashmap;
67
import io::writer_util;
78

89
enum option {

0 commit comments

Comments
 (0)