move smallintmap to oldsmallintmap

This commit is contained in:
Daniel Micay 2013-01-31 18:18:07 -05:00
parent 9ba7114515
commit 70855f5a07
9 changed files with 23 additions and 22 deletions

View File

@ -34,8 +34,8 @@ use core::uint;
use core::vec;
use std::map::{Map, HashMap};
use std::map;
use std::smallintmap::{Map, SmallIntMap};
use std::smallintmap;
use std::oldsmallintmap::{Map, SmallIntMap};
use std::oldsmallintmap;
use syntax::ast_util::{path_to_ident};
use syntax::attr;
use syntax::codemap::span;
@ -248,7 +248,7 @@ pub type lint_settings = {
};
pub fn mk_lint_settings() -> lint_settings {
{default_settings: smallintmap::mk(),
{default_settings: oldsmallintmap::mk(),
settings_map: HashMap()}
}
@ -273,7 +273,8 @@ pub fn get_lint_settings_level(settings: lint_settings,
// This is kind of unfortunate. It should be somewhere else, or we should use
// a persistent data structure...
fn clone_lint_modes(modes: lint_modes) -> lint_modes {
smallintmap::SmallIntMap_(@smallintmap::SmallIntMap_ { v: copy modes.v })
oldsmallintmap::SmallIntMap_(@oldsmallintmap::SmallIntMap_
{v: copy modes.v})
}
type ctxt_ = {dict: lint_dict,
@ -393,7 +394,7 @@ fn build_settings_item(i: @ast::item, &&cx: ctxt, v: visit::vt<ctxt>) {
pub fn build_settings_crate(sess: session::Session, crate: @ast::crate) {
let cx = ctxt_({dict: get_lint_dict(),
curr: smallintmap::mk(),
curr: oldsmallintmap::mk(),
is_default: true,
sess: sess});

View File

@ -76,7 +76,7 @@ use core::option::{is_none, is_some};
use core::option;
use core::uint;
use std::map::HashMap;
use std::smallintmap;
use std::oldsmallintmap;
use std::{map, time, list};
use syntax::ast_map::{path, path_elt_to_str, path_mod, path_name};
use syntax::ast_util::{def_id_of_def, local_def, path_to_ident};

View File

@ -42,7 +42,7 @@ use core::to_bytes;
use core::uint;
use core::vec;
use std::map::HashMap;
use std::{map, smallintmap};
use std::{map, oldsmallintmap};
use syntax::ast::*;
use syntax::ast_util::{is_local, local_def};
use syntax::ast_util;
@ -785,7 +785,7 @@ type type_cache = HashMap<ast::def_id, ty_param_bounds_and_ty>;
type constness_cache = HashMap<ast::def_id, const_eval::constness>;
pub type node_type_table = @smallintmap::SmallIntMap<t>;
pub type node_type_table = @oldsmallintmap::SmallIntMap<t>;
fn mk_rcache() -> creader_cache {
type val = {cnum: int, pos: uint, len: uint};
@ -837,7 +837,7 @@ pub fn mk_ctxt(s: session::Session,
def_map: dm,
region_map: region_map,
region_paramd_items: region_paramd_items,
node_types: @smallintmap::mk(),
node_types: @oldsmallintmap::mk(),
node_type_substs: map::HashMap(),
items: amap,
intrinsic_defs: map::HashMap(),
@ -2799,7 +2799,7 @@ pub fn br_hashmap<V:Copy>() -> HashMap<bound_region, V> {
pub fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t {
//io::println(fmt!("%?/%?", id, cx.node_types.size()));
match smallintmap::find(*cx.node_types, id as uint) {
match oldsmallintmap::find(*cx.node_types, id as uint) {
Some(t) => t,
None => cx.sess.bug(
fmt!("node_id_to_type: no type for node `%s`",
@ -3175,7 +3175,7 @@ pub fn expr_kind(tcx: ctxt,
}
ast::expr_cast(*) => {
match smallintmap::find(*tcx.node_types, expr.id as uint) {
match oldsmallintmap::find(*tcx.node_types, expr.id as uint) {
Some(t) => {
if ty::type_is_immediate(t) {
RvalueDatumExpr

View File

@ -281,7 +281,7 @@ use core::result;
use core::vec;
use std::list::Nil;
use std::map::HashMap;
use std::smallintmap;
use std::oldsmallintmap;
use syntax::ast::{ret_style, purity};
use syntax::ast::{m_const, m_imm, m_mutbl};
use syntax::ast::{unsafe_fn, impure_fn, pure_fn, extern_fn};
@ -353,7 +353,7 @@ pub fn fixup_err_to_str(f: fixup_err) -> ~str {
fn new_ValsAndBindings<V:Copy, T:Copy>() -> ValsAndBindings<V, T> {
ValsAndBindings {
vals: smallintmap::mk(),
vals: oldsmallintmap::mk(),
mut bindings: ~[]
}
}

View File

@ -10,7 +10,7 @@
use core::prelude::*;
use core::result;
use std::smallintmap::SmallIntMap;
use std::oldsmallintmap::SmallIntMap;
use middle::ty::{Vid, expected_found, IntVarValue};
use middle::ty;

View File

@ -69,7 +69,7 @@ use std::list::{List, Nil, Cons};
use std::list;
use std::map::HashMap;
use std::map;
use std::smallintmap;
use std::oldsmallintmap;
use syntax::ast::{provided, required, spanned};
use syntax::ast_map::node_id_to_str;
use syntax::ast_util::{local_def, respan, split_trait_methods};
@ -212,7 +212,7 @@ pub enum crate_ctxt {
// Functions that write types into the node type table
pub fn write_ty_to_tcx(tcx: ty::ctxt, node_id: ast::node_id, ty: ty::t) {
debug!("write_ty_to_tcx(%d, %s)", node_id, ppaux::ty_to_str(tcx, ty));
smallintmap::insert(*tcx.node_types, node_id as uint, ty);
oldsmallintmap::insert(*tcx.node_types, node_id as uint, ty);
}
pub fn write_substs_to_tcx(tcx: ty::ctxt,
node_id: ast::node_id,

View File

@ -172,7 +172,7 @@ impl<V: Copy> SmallIntMap<V>: ops::Index<uint, V> {
#[cfg(test)]
mod tests {
use smallintmap::{mk, SmallIntMap};
use super::{mk, SmallIntMap};
use core::option::None;

View File

@ -82,7 +82,7 @@ pub mod list;
pub mod map;
pub mod priority_queue;
pub mod rope;
pub mod smallintmap;
pub mod oldsmallintmap;
pub mod sort;
pub mod treemap;

View File

@ -8,11 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Microbenchmark for the smallintmap library
// Microbenchmark for the oldsmallintmap library
extern mod std;
use std::smallintmap;
use std::smallintmap::SmallIntMap;
use std::oldsmallintmap;
use std::oldsmallintmap::SmallIntMap;
use io::WriterUtil;
fn append_sequential(min: uint, max: uint, map: SmallIntMap<uint>) {
@ -43,7 +43,7 @@ fn main() {
let mut appendf = 0.0;
for uint::range(0u, rep) |_r| {
let map = smallintmap::mk();
let map = oldsmallintmap::mk();
let start = std::time::precise_time_s();
append_sequential(0u, max, map);
let mid = std::time::precise_time_s();