@@ -7086,40 +7086,39 @@ fn trans_obj(@local_ctxt cx, &span sp, &ast::_obj ob, ast::def_id oid,
7086
7086
// there's not much to do.
7087
7087
7088
7088
// Store null into pair, if no args or typarams.
7089
-
7090
7089
bcx. build. Store ( C_null ( llbox_ty) , pair_box) ;
7091
7090
} else {
7092
7091
// Otherwise, we have to synthesize a big structural type for the
7093
7092
// object body.
7094
-
7095
7093
let vec[ ty:: t] obj_fields = [ ] ;
7096
7094
for ( ty:: arg a in arg_tys) { vec:: push[ ty:: t] ( obj_fields, a. ty) ; }
7097
- // Tuple type for fields: [field, ...]
7098
7095
7096
+ // Tuple type for fields: [field, ...]
7099
7097
let ty:: t fields_ty = ty:: mk_imm_tup( ccx. tcx, obj_fields) ;
7100
- // Tuple type for typarams: [typaram, ...]
7101
7098
7102
7099
auto tydesc_ty = ty:: mk_type( ccx. tcx) ;
7103
7100
let vec[ ty:: t] tps = [ ] ;
7104
7101
for ( ast:: ty_param tp in ty_params) {
7105
7102
vec:: push[ ty:: t] ( tps, tydesc_ty) ;
7106
7103
}
7104
+
7105
+ // Tuple type for typarams: [typaram, ...]
7107
7106
let ty:: t typarams_ty = ty:: mk_imm_tup( ccx. tcx, tps) ;
7108
- // Tuple type for body: [tydesc_ty, [typaram, ...], [field, ...]]
7109
7107
7108
+ // Tuple type for body: [tydesc_ty, [typaram, ...], [field, ...]]
7110
7109
let ty:: t body_ty =
7111
7110
ty:: mk_imm_tup( ccx. tcx, [ tydesc_ty, typarams_ty, fields_ty] ) ;
7111
+
7112
7112
// Hand this type we've synthesized off to trans_malloc_boxed, which
7113
7113
// allocates a box, including space for a refcount.
7114
-
7115
7114
auto box = trans_malloc_boxed( bcx, body_ty) ;
7116
7115
bcx = box. bcx;
7116
+
7117
7117
// mk_imm_box throws a refcount into the type we're synthesizing, so
7118
7118
// that it looks like: [rc, [tydesc_ty, [typaram, ...], [field, ...]]]
7119
-
7120
7119
let ty:: t boxed_body_ty = ty:: mk_imm_box( ccx. tcx, body_ty) ;
7121
- // Grab onto the refcount and body parts of the box we allocated.
7122
7120
7121
+ // Grab onto the refcount and body parts of the box we allocated.
7123
7122
auto rc =
7124
7123
GEP_tup_like ( bcx, boxed_body_ty, box. val,
7125
7124
[ 0 , abi:: box_rc_field_refcnt] ) ;
@@ -7129,6 +7128,7 @@ fn trans_obj(@local_ctxt cx, &span sp, &ast::_obj ob, ast::def_id oid,
7129
7128
[ 0 , abi:: box_rc_field_body] ) ;
7130
7129
bcx = body. bcx;
7131
7130
bcx. build. Store ( C_int ( 1 ) , rc. val) ;
7131
+
7132
7132
// Put together a tydesc for the body, so that the object can later be
7133
7133
// freed by calling through its tydesc.
7134
7134
@@ -7148,6 +7148,7 @@ fn trans_obj(@local_ctxt cx, &span sp, &ast::_obj ob, ast::def_id oid,
7148
7148
lazily_emit_tydesc_glue( bcx, abi:: tydesc_field_free_glue, ti) ;
7149
7149
bcx = body_td. bcx;
7150
7150
bcx. build. Store ( body_td. val, body_tydesc. val) ;
7151
+
7151
7152
// Copy the object's type parameters and fields into the space we
7152
7153
// allocated for the object body. (This is something like saving the
7153
7154
// lexical environment of a function in its closure: the "captured
@@ -7156,7 +7157,6 @@ fn trans_obj(@local_ctxt cx, &span sp, &ast::_obj ob, ast::def_id oid,
7156
7157
// Likewise for the object's fields.)
7157
7158
7158
7159
// Copy typarams into captured typarams.
7159
-
7160
7160
auto body_typarams =
7161
7161
GEP_tup_like ( bcx, body_ty, body. val,
7162
7162
[ 0 , abi:: obj_body_elt_typarams] ) ;
@@ -7170,8 +7170,8 @@ fn trans_obj(@local_ctxt cx, &span sp, &ast::_obj ob, ast::def_id oid,
7170
7170
bcx = copy_val( bcx, INIT , capture. val, typaram, tydesc_ty) . bcx;
7171
7171
i += 1 ;
7172
7172
}
7173
- // Copy args into body fields.
7174
7173
7174
+ // Copy args into body fields.
7175
7175
auto body_fields =
7176
7176
GEP_tup_like ( bcx, body_ty, body. val,
7177
7177
[ 0 , abi:: obj_body_elt_fields] ) ;
@@ -7186,14 +7186,14 @@ fn trans_obj(@local_ctxt cx, &span sp, &ast::_obj ob, ast::def_id oid,
7186
7186
bcx = copy_val( bcx, INIT , field. val, arg, arg_tys. ( i) . ty) . bcx;
7187
7187
i += 1 ;
7188
7188
}
7189
- // Store box ptr in outer pair.
7190
7189
7190
+ // Store box ptr in outer pair.
7191
7191
auto p = bcx. build. PointerCast ( box. val, llbox_ty) ;
7192
7192
bcx. build. Store ( p, pair_box) ;
7193
7193
}
7194
7194
bcx. build. RetVoid ( ) ;
7195
- // Insert the mandatory first few basic blocks before lltop.
7196
7195
7196
+ // Insert the mandatory first few basic blocks before lltop.
7197
7197
finish_fn( fcx, lltop) ;
7198
7198
}
7199
7199
0 commit comments