@@ -3581,7 +3581,12 @@ fn trans_expr(bcx: @block_ctxt, e: @ast::expr, dest: dest) -> @block_ctxt {
3581
3581
}
3582
3582
else { ret lval_to_dps ( bcx, a, dest) ; }
3583
3583
}
3584
- ast:: expr_cast ( val, _) { ret trans_cast ( bcx, val, e. id , dest) ; }
3584
+ ast:: expr_cast ( val, _) {
3585
+ alt tcx. cast_map . find ( e. id ) {
3586
+ some ( ty:: triv_cast. ) { ret trans_expr ( bcx, val, dest) ; }
3587
+ _ { ret trans_cast( bcx, val, e. id , dest) ; }
3588
+ }
3589
+ }
3585
3590
ast:: expr_anon_obj ( anon_obj) {
3586
3591
ret trans_anon_obj ( bcx, e. span , anon_obj, e. id , dest) ;
3587
3592
}
@@ -3610,7 +3615,7 @@ fn trans_expr(bcx: @block_ctxt, e: @ast::expr, dest: dest) -> @block_ctxt {
3610
3615
// that is_call_expr(ex) -- but we don't support that
3611
3616
// yet
3612
3617
// FIXME
3613
- check ( ast_util:: is_call_expr ( ex) ) ;
3618
+ check ( ast_util:: is_tail_call_expr ( ex) ) ;
3614
3619
ret trans_be( bcx, ex) ;
3615
3620
}
3616
3621
ast:: expr_fail ( expr) {
@@ -3947,7 +3952,8 @@ fn trans_ret(bcx: @block_ctxt, e: option::t<@ast::expr>) -> @block_ctxt {
3947
3952
fn build_return ( bcx : @block_ctxt ) { Br ( bcx, bcx_fcx ( bcx) . llreturn ) ; }
3948
3953
3949
3954
// fn trans_be(cx: &@block_ctxt, e: &@ast::expr) -> result {
3950
- fn trans_be( cx : @block_ctxt , e : @ast:: expr ) : ast_util:: is_call_expr ( e ) ->
3955
+ fn trans_be( cx : @block_ctxt , e : @ast:: expr ) :
3956
+ ast_util:: is_tail_call_expr ( e ) ->
3951
3957
@block_ctxt {
3952
3958
// FIXME: Turn this into a real tail call once
3953
3959
// calling convention issues are settled
@@ -4348,7 +4354,7 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, sp: span, llfndecl: ValueRef,
4348
4354
lllocals : new_int_hash :: < local_val > ( ) ,
4349
4355
llupvars : new_int_hash :: < ValueRef > ( ) ,
4350
4356
mutable lltydescs : [ ] ,
4351
- derived_tydescs : ty :: new_ty_hash ( ) ,
4357
+ derived_tydescs : map :: mk_hashmap ( ty :: hash_ty , ty :: eq_ty ) ,
4352
4358
id : id,
4353
4359
ret_style : rstyle,
4354
4360
sp : sp,
@@ -4722,6 +4728,16 @@ fn trans_impl(cx: @local_ctxt, name: ast::ident, methods: [@ast::method],
4722
4728
// that does so later on?
4723
4729
fn trans_const_expr ( cx : @crate_ctxt , e : @ast:: expr ) -> ValueRef {
4724
4730
alt e. node {
4731
+ ast:: expr_cast ( e1, _) {
4732
+ alt ccx_tcx ( cx) . cast_map . find ( e. id ) {
4733
+ some ( ty:: triv_cast. ) { trans_const_expr ( cx, e1) }
4734
+ _ {
4735
+ cx. sess . span_err ( e. span ,
4736
+ "non-trivial cast in constant expression" ) ;
4737
+ fail;
4738
+ }
4739
+ }
4740
+ }
4725
4741
ast:: expr_lit ( lit) { ret trans_crate_lit ( cx, * lit) ; }
4726
4742
ast:: expr_binary ( b, e1, e2) {
4727
4743
let te1 = trans_const_expr ( cx, e1) ;
@@ -5642,6 +5658,13 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
5642
5658
tn. associate ( "taskptr" , taskptr_type) ;
5643
5659
let tydesc_type = T_tydesc ( targ_cfg) ;
5644
5660
tn. associate ( "tydesc" , tydesc_type) ;
5661
+ let hasher = ty:: hash_ty;
5662
+ let eqer = ty:: eq_ty;
5663
+ let tag_sizes = map:: mk_hashmap :: < ty:: t , uint > ( hasher, eqer) ;
5664
+ let tydescs = map:: mk_hashmap :: < ty:: t , @tydesc_info > ( hasher, eqer) ;
5665
+ let lltypes = map:: mk_hashmap :: < ty:: t , TypeRef > ( hasher, eqer) ;
5666
+ let sha1s = map:: mk_hashmap :: < ty:: t , str > ( hasher, eqer) ;
5667
+ let short_names = map:: mk_hashmap :: < ty:: t , str > ( hasher, eqer) ;
5645
5668
let crate_map = decl_crate_map ( sess, link_meta. name , llmod) ;
5646
5669
let dbg_cx = if sess. get_opts ( ) . debuginfo {
5647
5670
option:: some ( @{ llmetadata: map:: new_int_hash ( ) ,
@@ -5662,18 +5685,18 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
5662
5685
item_symbols: new_int_hash :: < str > ( ) ,
5663
5686
mutable main_fn: none :: < ValueRef > ,
5664
5687
link_meta: link_meta,
5665
- tag_sizes: ty :: new_ty_hash ( ) ,
5688
+ tag_sizes: tag_sizes ,
5666
5689
discrims: ast_util:: new_def_id_hash :: < ValueRef > ( ) ,
5667
5690
discrim_symbols: new_int_hash :: < str > ( ) ,
5668
5691
consts: new_int_hash :: < ValueRef > ( ) ,
5669
5692
obj_methods: new_int_hash :: < ( ) > ( ) ,
5670
- tydescs: ty :: new_ty_hash ( ) ,
5693
+ tydescs: tydescs ,
5671
5694
module_data: new_str_hash :: < ValueRef > ( ) ,
5672
- lltypes: ty :: new_ty_hash ( ) ,
5695
+ lltypes: lltypes ,
5673
5696
names: namegen ( 0 ) ,
5674
5697
sha: sha,
5675
- type_sha1s: ty :: new_ty_hash ( ) ,
5676
- type_short_names: ty :: new_ty_hash ( ) ,
5698
+ type_sha1s: sha1s ,
5699
+ type_short_names: short_names ,
5677
5700
tcx: tcx,
5678
5701
mut_map: mut_map,
5679
5702
copy_map: copy_map,
0 commit comments