51
51
//! enclosing function. On the way down the tree, it identifies those AST
52
52
//! nodes and variable IDs that will be needed for the liveness analysis
53
53
//! and assigns them contiguous IDs. The liveness id for an AST node is
54
- //! called a `live_node` (it's a newtype'd uint ) and the id for a variable
55
- //! is called a `variable` (another newtype'd uint ).
54
+ //! called a `live_node` (it's a newtype'd usize ) and the id for a variable
55
+ //! is called a `variable` (another newtype'd usize ).
56
56
//!
57
57
//! On the way back up the tree, as we are about to exit from a function
58
58
//! declaration we allocate a `liveness` instance. Now that we know
@@ -118,7 +118,7 @@ use middle::ty::ClosureTyper;
118
118
use lint;
119
119
use util:: nodemap:: NodeMap ;
120
120
121
- use std:: { fmt, old_io, uint } ;
121
+ use std:: { fmt, old_io, usize } ;
122
122
use std:: rc:: Rc ;
123
123
use std:: iter:: repeat;
124
124
use syntax:: ast:: { self , NodeId , Expr } ;
@@ -138,17 +138,17 @@ enum LoopKind<'a> {
138
138
}
139
139
140
140
#[ derive( Copy , PartialEq ) ]
141
- struct Variable ( uint ) ;
141
+ struct Variable ( usize ) ;
142
142
143
143
#[ derive( Copy , PartialEq ) ]
144
- struct LiveNode ( uint ) ;
144
+ struct LiveNode ( usize ) ;
145
145
146
146
impl Variable {
147
- fn get ( & self ) -> uint { let Variable ( v) = * self ; v }
147
+ fn get ( & self ) -> usize { let Variable ( v) = * self ; v }
148
148
}
149
149
150
150
impl LiveNode {
151
- fn get ( & self ) -> uint { let LiveNode ( v) = * self ; v }
151
+ fn get ( & self ) -> usize { let LiveNode ( v) = * self ; v }
152
152
}
153
153
154
154
impl Clone for LiveNode {
@@ -232,11 +232,11 @@ impl fmt::Debug for Variable {
232
232
233
233
impl LiveNode {
234
234
fn is_valid ( & self ) -> bool {
235
- self . get ( ) != uint :: MAX
235
+ self . get ( ) != usize :: MAX
236
236
}
237
237
}
238
238
239
- fn invalid_node ( ) -> LiveNode { LiveNode ( uint :: MAX ) }
239
+ fn invalid_node ( ) -> LiveNode { LiveNode ( usize :: MAX ) }
240
240
241
241
struct CaptureInfo {
242
242
ln : LiveNode ,
@@ -260,8 +260,8 @@ enum VarKind {
260
260
struct IrMaps < ' a , ' tcx : ' a > {
261
261
tcx : & ' a ty:: ctxt < ' tcx > ,
262
262
263
- num_live_nodes : uint ,
264
- num_vars : uint ,
263
+ num_live_nodes : usize ,
264
+ num_vars : usize ,
265
265
live_node_map : NodeMap < LiveNode > ,
266
266
variable_map : NodeMap < Variable > ,
267
267
capture_info_map : NodeMap < Rc < Vec < CaptureInfo > > > ,
@@ -540,9 +540,9 @@ struct Specials {
540
540
clean_exit_var : Variable
541
541
}
542
542
543
- static ACC_READ : uint = 1 ;
544
- static ACC_WRITE : uint = 2 ;
545
- static ACC_USE : uint = 4 ;
543
+ static ACC_READ : u32 = 1 ;
544
+ static ACC_WRITE : u32 = 2 ;
545
+ static ACC_USE : u32 = 4 ;
546
546
547
547
struct Liveness < ' a , ' tcx : ' a > {
548
548
ir : & ' a mut IrMaps < ' a , ' tcx > ,
@@ -631,7 +631,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
631
631
succ
632
632
}
633
633
634
- fn idx ( & self , ln : LiveNode , var : Variable ) -> uint {
634
+ fn idx ( & self , ln : LiveNode , var : Variable ) -> usize {
635
635
ln. get ( ) * self . ir . num_vars + var. get ( )
636
636
}
637
637
@@ -670,7 +670,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
670
670
}
671
671
672
672
fn indices2 < F > ( & mut self , ln : LiveNode , succ_ln : LiveNode , mut op : F ) where
673
- F : FnMut ( & mut Liveness < ' a , ' tcx > , uint , uint ) ,
673
+ F : FnMut ( & mut Liveness < ' a , ' tcx > , usize , usize ) ,
674
674
{
675
675
let node_base_idx = self . idx ( ln, Variable ( 0 ) ) ;
676
676
let succ_base_idx = self . idx ( succ_ln, Variable ( 0 ) ) ;
@@ -684,7 +684,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
684
684
ln : LiveNode ,
685
685
mut test : F )
686
686
-> old_io:: IoResult < ( ) > where
687
- F : FnMut ( uint ) -> LiveNode ,
687
+ F : FnMut ( usize ) -> LiveNode ,
688
688
{
689
689
let node_base_idx = self . idx ( ln, Variable ( 0 ) ) ;
690
690
for var_idx in 0 ..self . ir . num_vars {
@@ -807,7 +807,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
807
807
}
808
808
809
809
// Either read, write, or both depending on the acc bitset
810
- fn acc ( & mut self , ln : LiveNode , var : Variable , acc : uint ) {
810
+ fn acc ( & mut self , ln : LiveNode , var : Variable , acc : u32 ) {
811
811
debug ! ( "{:?} accesses[{:x}] {:?}: {}" ,
812
812
ln, acc, var, self . ln_str( ln) ) ;
813
813
@@ -1283,7 +1283,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
1283
1283
}
1284
1284
1285
1285
// see comment on propagate_through_lvalue()
1286
- fn write_lvalue ( & mut self , expr : & Expr , succ : LiveNode , acc : uint )
1286
+ fn write_lvalue ( & mut self , expr : & Expr , succ : LiveNode , acc : u32 )
1287
1287
-> LiveNode {
1288
1288
match expr. node {
1289
1289
ast:: ExprPath ( ..) => {
@@ -1298,7 +1298,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
1298
1298
}
1299
1299
}
1300
1300
1301
- fn access_path ( & mut self , expr : & Expr , succ : LiveNode , acc : uint )
1301
+ fn access_path ( & mut self , expr : & Expr , succ : LiveNode , acc : u32 )
1302
1302
-> LiveNode {
1303
1303
match self . ir . tcx . def_map . borrow ( ) [ expr. id ] . full_def ( ) {
1304
1304
DefLocal ( nid) => {
0 commit comments