@@ -36,6 +36,8 @@ use core::cast;
36
36
use core:: hashmap:: { HashMap } ;
37
37
use core:: libc:: { c_uint, c_longlong, c_ulonglong} ;
38
38
use core:: to_bytes;
39
+ use core:: str;
40
+ use core:: vec:: raw:: to_ptr;
39
41
use core:: vec;
40
42
use syntax:: ast:: ident;
41
43
use syntax:: ast_map:: { path, path_elt} ;
@@ -860,7 +862,7 @@ pub fn is_null(val: ValueRef) -> bool {
860
862
}
861
863
862
864
// Used to identify cached monomorphized functions and vtables
863
- #[ deriving( Eq ) ]
865
+ #[ deriving( Eq , IterBytes ) ]
864
866
pub enum mono_param_id {
865
867
mono_precise( ty:: t , Option < @~[ mono_id ] > ) ,
866
868
mono_any,
@@ -870,7 +872,7 @@ pub enum mono_param_id {
870
872
datum:: DatumMode ) ,
871
873
}
872
874
873
- #[ deriving( Eq ) ]
875
+ #[ deriving( Eq , IterBytes ) ]
874
876
pub enum MonoDataClass {
875
877
MonoBits , // Anything not treated differently from arbitrary integer data
876
878
MonoNonNull , // Non-null pointers (used for optional-pointer optimization)
@@ -895,7 +897,7 @@ pub fn mono_data_classify(t: ty::t) -> MonoDataClass {
895
897
}
896
898
897
899
898
- #[ deriving( Eq ) ]
900
+ #[ deriving( Eq , IterBytes ) ]
899
901
pub struct mono_id_ {
900
902
def : ast:: def_id ,
901
903
params : ~[ mono_param_id ] ,
@@ -904,40 +906,6 @@ pub struct mono_id_ {
904
906
905
907
pub type mono_id = @mono_id_ ;
906
908
907
- impl to_bytes:: IterBytes for mono_param_id {
908
- fn iter_bytes ( & self , lsb0 : bool , f : to_bytes:: Cb ) -> bool {
909
- match * self {
910
- mono_precise( t, ref mids) => {
911
- 0u8 . iter_bytes ( lsb0, f) &&
912
- ty:: type_id ( t) . iter_bytes ( lsb0, f) &&
913
- mids. iter_bytes ( lsb0, f)
914
- }
915
-
916
- mono_any => 1u8 . iter_bytes ( lsb0, f) ,
917
-
918
- mono_repr( ref a, ref b, ref c, ref d) => {
919
- 2u8 . iter_bytes ( lsb0, f) &&
920
- a. iter_bytes ( lsb0, f) &&
921
- b. iter_bytes ( lsb0, f) &&
922
- c. iter_bytes ( lsb0, f) &&
923
- d. iter_bytes ( lsb0, f)
924
- }
925
- }
926
- }
927
- }
928
-
929
- impl to_bytes:: IterBytes for MonoDataClass {
930
- fn iter_bytes ( & self , lsb0 : bool , f : to_bytes:: Cb ) -> bool {
931
- ( * self as u8 ) . iter_bytes ( lsb0, f)
932
- }
933
- }
934
-
935
- impl to_bytes:: IterBytes for mono_id_ {
936
- fn iter_bytes ( & self , lsb0 : bool , f : to_bytes:: Cb ) -> bool {
937
- self . def . iter_bytes ( lsb0, f) && self . params . iter_bytes ( lsb0, f)
938
- }
939
- }
940
-
941
909
pub fn umax ( cx : block , a : ValueRef , b : ValueRef ) -> ValueRef {
942
910
let cond = build:: ICmp ( cx, lib:: llvm:: IntULT , a, b) ;
943
911
return build:: Select ( cx, cond, b, a) ;
0 commit comments