Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove oldsmallintmap #5095

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc/middle/astencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ fn encode_side_tables_for_id(ecx: @e::EncodeContext,
}
}
}
do option::iter(&(*tcx.node_types).find(id as uint)) |ty| {
do option::iter(&tcx.node_types.find(&(id as uint))) |&ty| {
do ebml_w.tag(c::tag_table_node_type) {
ebml_w.id(id);
do ebml_w.tag(c::tag_table_val) {
Expand Down Expand Up @@ -1135,7 +1135,7 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
let ty = val_dsr.read_ty(xcx);
debug!("inserting ty for node %?: %s",
id, ty_to_str(dcx.tcx, ty));
(*dcx.tcx.node_types).insert(id as uint, ty);
dcx.tcx.node_types.insert(id as uint, ty);
} else if tag == (c::tag_table_node_type_subst as uint) {
let tys = val_dsr.read_tys(xcx);
dcx.tcx.node_type_substs.insert(id, tys);
Expand Down
20 changes: 9 additions & 11 deletions src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ use core::uint;
use core::vec;
use std::oldmap::{Map, HashMap};
use std::oldmap;
use std::oldsmallintmap::{Map, SmallIntMap};
use std::oldsmallintmap;
use std::smallintmap::SmallIntMap;
use syntax::ast_util::{path_to_ident};
use syntax::attr;
use syntax::codemap::span;
Expand Down Expand Up @@ -275,7 +274,7 @@ pub fn get_lint_dict() -> LintDict {
}

// This is a highly not-optimal set of data structure decisions.
type LintModes = SmallIntMap<level>;
type LintModes = @mut SmallIntMap<level>;
type LintModeMap = HashMap<ast::node_id, LintModes>;

// settings_map maps node ids of items with non-default lint settings
Expand All @@ -288,14 +287,14 @@ pub struct LintSettings {

pub fn mk_lint_settings() -> LintSettings {
LintSettings {
default_settings: oldsmallintmap::mk(),
default_settings: @mut SmallIntMap::new(),
settings_map: HashMap()
}
}

pub fn get_lint_level(modes: LintModes, lint: lint) -> level {
match modes.find(lint as uint) {
Some(c) => c,
match modes.find(&(lint as uint)) {
Some(&c) => c,
None => allow
}
}
Expand All @@ -314,8 +313,7 @@ pub fn get_lint_settings_level(settings: LintSettings,
// This is kind of unfortunate. It should be somewhere else, or we should use
// a persistent data structure...
fn clone_lint_modes(modes: LintModes) -> LintModes {
oldsmallintmap::SmallIntMap_(@oldsmallintmap::SmallIntMap_
{v: copy modes.v})
@mut (copy *modes)
}

struct Context {
Expand All @@ -332,7 +330,7 @@ impl Context {

fn set_level(&self, lint: lint, level: level) {
if level == allow {
self.curr.remove(lint as uint);
self.curr.remove(&(lint as uint));
} else {
self.curr.insert(lint as uint, level);
}
Expand Down Expand Up @@ -440,7 +438,7 @@ fn build_settings_item(i: @ast::item, &&cx: Context, v: visit::vt<Context>) {
pub fn build_settings_crate(sess: session::Session, crate: @ast::crate) {
let cx = Context {
dict: get_lint_dict(),
curr: oldsmallintmap::mk(),
curr: @mut SmallIntMap::new(),
is_default: true,
sess: sess
};
Expand All @@ -458,7 +456,7 @@ pub fn build_settings_crate(sess: session::Session, crate: @ast::crate) {

do cx.with_lint_attrs(/*bad*/copy crate.node.attrs) |cx| {
// Copy out the default settings
for cx.curr.each |k, v| {
for cx.curr.each |&(k, &v)| {
sess.lint_settings.default_settings.insert(k, v);
}

Expand Down
1 change: 0 additions & 1 deletion src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ use core::option::{is_none, is_some};
use core::option;
use core::uint;
use std::oldmap::HashMap;
use std::oldsmallintmap;
use std::{oldmap, 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};
Expand Down
15 changes: 8 additions & 7 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ use core::uint;
use core::vec;
use core::hashmap::linear::LinearMap;
use std::oldmap::HashMap;
use std::{oldmap, oldsmallintmap};
use std::oldmap;
use std::smallintmap::SmallIntMap;
use syntax::ast::*;
use syntax::ast_util::{is_local, local_def};
use syntax::ast_util;
Expand Down Expand Up @@ -767,7 +768,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 = @oldsmallintmap::SmallIntMap<t>;
pub type node_type_table = @mut SmallIntMap<t>;

fn mk_rcache() -> creader_cache {
type val = {cnum: int, pos: uint, len: uint};
Expand Down Expand Up @@ -812,7 +813,7 @@ pub fn mk_ctxt(s: session::Session,
def_map: dm,
region_map: region_map,
region_paramd_items: region_paramd_items,
node_types: @oldsmallintmap::mk(),
node_types: @mut SmallIntMap::new(),
node_type_substs: oldmap::HashMap(),
items: amap,
intrinsic_defs: oldmap::HashMap(),
Expand Down Expand Up @@ -2787,8 +2788,8 @@ 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.len()));
match oldsmallintmap::find(*cx.node_types, id as uint) {
Some(t) => t,
match cx.node_types.find(&(id as uint)) {
Some(&t) => t,
None => cx.sess.bug(
fmt!("node_id_to_type: no type for node `%s`",
ast_map::node_id_to_str(cx.items, id,
Expand Down Expand Up @@ -3179,8 +3180,8 @@ pub fn expr_kind(tcx: ctxt,
}

ast::expr_cast(*) => {
match oldsmallintmap::find(*tcx.node_types, expr.id as uint) {
Some(t) => {
match tcx.node_types.find(&(expr.id as uint)) {
Some(&t) => {
if ty::type_is_immediate(t) {
RvalueDatumExpr
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/typeck/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ use core::result;
use core::vec;
use std::list::Nil;
use std::oldmap::HashMap;
use std::oldsmallintmap;
use std::smallintmap::SmallIntMap;
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};
Expand Down Expand Up @@ -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: oldsmallintmap::mk(),
vals: @mut SmallIntMap::new(),
bindings: ~[]
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/librustc/middle/typeck/infer/unify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use core::prelude::*;
use core::result;
use std::oldsmallintmap::SmallIntMap;
use std::smallintmap::SmallIntMap;

use middle::ty::{Vid, expected_found, IntVarValue};
use middle::ty;
Expand All @@ -27,7 +27,7 @@ pub enum VarValue<V, T> {
}

pub struct ValsAndBindings<V, T> {
vals: SmallIntMap<VarValue<V, T>>,
vals: @mut SmallIntMap<VarValue<V, T>>,
bindings: ~[(V, VarValue<V, T>)],
}

Expand Down Expand Up @@ -64,12 +64,12 @@ pub impl InferCtxt {
vid: V) -> Node<V, T>
{
let vid_u = vid.to_uint();
match vb.vals.find(vid_u) {
match vb.vals.find(&vid_u) {
None => {
tcx.sess.bug(fmt!(
"failed lookup of vid `%u`", vid_u));
}
Some(ref var_val) => {
Some(var_val) => {
match *var_val {
Redirect(vid) => {
let node: Node<V,T> = helper(tcx, vb, vid);
Expand Down Expand Up @@ -103,8 +103,8 @@ pub impl InferCtxt {

{ // FIXME(#4903)---borrow checker is not flow sensitive
let vb = UnifyVid::appropriate_vals_and_bindings(self);
let old_v = vb.vals.get(vid.to_uint());
vb.bindings.push((vid, old_v));
let old_v = vb.vals.get(&vid.to_uint());
vb.bindings.push((vid, *old_v));
vb.vals.insert(vid.to_uint(), new_v);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/librustc/middle/typeck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ use std::list::{List, Nil, Cons};
use std::list;
use std::oldmap::HashMap;
use std::oldmap;
use std::oldsmallintmap;
use syntax::ast::{provided, required};
use syntax::ast_map::node_id_to_str;
use syntax::ast_util::{local_def, split_trait_methods};
Expand Down
Loading