Skip to content

Commit b27a571

Browse files
committed
---
yaml --- r: 147639 b: refs/heads/try2 c: e9b9c82 h: refs/heads/master i: 147637: 2ba7dcb 147635: 37a6d16 147631: 9257fa9 v: v3
1 parent 24c4983 commit b27a571

File tree

3 files changed

+30
-29
lines changed

3 files changed

+30
-29
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: abbee6decdfd0cf69428c5964738bb7526e18dd1
8+
refs/heads/try2: e9b9c828b18647b233f3b20eecb30eb6926a5d96
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/trans/common.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ pub struct tydesc_info {
9393
align: ValueRef,
9494
borrow_offset: ValueRef,
9595
name: ValueRef,
96-
take_glue: Option<ValueRef>,
97-
drop_glue: Option<ValueRef>,
98-
free_glue: Option<ValueRef>,
99-
visit_glue: Option<ValueRef>
96+
take_glue: Cell<Option<ValueRef>>,
97+
drop_glue: Cell<Option<ValueRef>>,
98+
free_glue: Cell<Option<ValueRef>>,
99+
visit_glue: Cell<Option<ValueRef>>,
100100
}
101101

102102
/*

branches/try2/src/librustc/middle/trans/glue.rs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ use util::ppaux::ty_to_short_str;
3737
use middle::trans::type_::Type;
3838

3939
use std::c_str::ToCStr;
40+
use std::cell::Cell;
4041
use std::libc::c_uint;
4142
use syntax::ast;
4243

@@ -183,13 +184,13 @@ pub fn lazily_emit_simplified_tydesc_glue(ccx: @CrateContext,
183184
lazily_emit_tydesc_glue(ccx, field, simpl_ti);
184185
{
185186
if field == abi::tydesc_field_take_glue {
186-
ti.take_glue = simpl_ti.take_glue;
187+
ti.take_glue.set(simpl_ti.take_glue.get());
187188
} else if field == abi::tydesc_field_drop_glue {
188-
ti.drop_glue = simpl_ti.drop_glue;
189+
ti.drop_glue.set(simpl_ti.drop_glue.get());
189190
} else if field == abi::tydesc_field_free_glue {
190-
ti.free_glue = simpl_ti.free_glue;
191+
ti.free_glue.set(simpl_ti.free_glue.get());
191192
} else if field == abi::tydesc_field_visit_glue {
192-
ti.visit_glue = simpl_ti.visit_glue;
193+
ti.visit_glue.set(simpl_ti.visit_glue.get());
193194
}
194195
}
195196
return true;
@@ -209,52 +210,52 @@ pub fn lazily_emit_tydesc_glue(ccx: @CrateContext,
209210
}
210211

211212
if field == abi::tydesc_field_take_glue {
212-
match ti.take_glue {
213+
match ti.take_glue.get() {
213214
Some(_) => (),
214215
None => {
215216
debug!("+++ lazily_emit_tydesc_glue TAKE {}",
216217
ppaux::ty_to_str(ccx.tcx, ti.ty));
217218
let glue_fn = declare_generic_glue(ccx, ti.ty, llfnty, "take");
218-
ti.take_glue = Some(glue_fn);
219+
ti.take_glue.set(Some(glue_fn));
219220
make_generic_glue(ccx, ti.ty, glue_fn, make_take_glue, "take");
220221
debug!("--- lazily_emit_tydesc_glue TAKE {}",
221222
ppaux::ty_to_str(ccx.tcx, ti.ty));
222223
}
223224
}
224225
} else if field == abi::tydesc_field_drop_glue {
225-
match ti.drop_glue {
226+
match ti.drop_glue.get() {
226227
Some(_) => (),
227228
None => {
228229
debug!("+++ lazily_emit_tydesc_glue DROP {}",
229230
ppaux::ty_to_str(ccx.tcx, ti.ty));
230231
let glue_fn = declare_generic_glue(ccx, ti.ty, llfnty, "drop");
231-
ti.drop_glue = Some(glue_fn);
232+
ti.drop_glue.set(Some(glue_fn));
232233
make_generic_glue(ccx, ti.ty, glue_fn, make_drop_glue, "drop");
233234
debug!("--- lazily_emit_tydesc_glue DROP {}",
234235
ppaux::ty_to_str(ccx.tcx, ti.ty));
235236
}
236237
}
237238
} else if field == abi::tydesc_field_free_glue {
238-
match ti.free_glue {
239+
match ti.free_glue.get() {
239240
Some(_) => (),
240241
None => {
241242
debug!("+++ lazily_emit_tydesc_glue FREE {}",
242243
ppaux::ty_to_str(ccx.tcx, ti.ty));
243244
let glue_fn = declare_generic_glue(ccx, ti.ty, llfnty, "free");
244-
ti.free_glue = Some(glue_fn);
245+
ti.free_glue.set(Some(glue_fn));
245246
make_generic_glue(ccx, ti.ty, glue_fn, make_free_glue, "free");
246247
debug!("--- lazily_emit_tydesc_glue FREE {}",
247248
ppaux::ty_to_str(ccx.tcx, ti.ty));
248249
}
249250
}
250251
} else if field == abi::tydesc_field_visit_glue {
251-
match ti.visit_glue {
252+
match ti.visit_glue.get() {
252253
Some(_) => (),
253254
None => {
254255
debug!("+++ lazily_emit_tydesc_glue VISIT {}",
255256
ppaux::ty_to_str(ccx.tcx, ti.ty));
256257
let glue_fn = declare_generic_glue(ccx, ti.ty, llfnty, "visit");
257-
ti.visit_glue = Some(glue_fn);
258+
ti.visit_glue.set(Some(glue_fn));
258259
make_generic_glue(ccx, ti.ty, glue_fn, make_visit_glue, "visit");
259260
debug!("--- lazily_emit_tydesc_glue VISIT {}",
260261
ppaux::ty_to_str(ccx.tcx, ti.ty));
@@ -280,13 +281,13 @@ pub fn call_tydesc_glue_full(bcx: @Block,
280281
Some(sti) => {
281282
lazily_emit_tydesc_glue(ccx, field, sti);
282283
if field == abi::tydesc_field_take_glue {
283-
sti.take_glue
284+
sti.take_glue.get()
284285
} else if field == abi::tydesc_field_drop_glue {
285-
sti.drop_glue
286+
sti.drop_glue.get()
286287
} else if field == abi::tydesc_field_free_glue {
287-
sti.free_glue
288+
sti.free_glue.get()
288289
} else if field == abi::tydesc_field_visit_glue {
289-
sti.visit_glue
290+
sti.visit_glue.get()
290291
} else {
291292
None
292293
}
@@ -630,10 +631,10 @@ pub fn declare_tydesc(ccx: &CrateContext, t: ty::t) -> @mut tydesc_info {
630631
align: llalign,
631632
borrow_offset: borrow_offset,
632633
name: ty_name,
633-
take_glue: None,
634-
drop_glue: None,
635-
free_glue: None,
636-
visit_glue: None
634+
take_glue: Cell::new(None),
635+
drop_glue: Cell::new(None),
636+
free_glue: Cell::new(None),
637+
visit_glue: Cell::new(None),
637638
};
638639
debug!("--- declare_tydesc {}", ppaux::ty_to_str(ccx.tcx, t));
639640
return inf;
@@ -705,7 +706,7 @@ pub fn emit_tydescs(ccx: &CrateContext) {
705706
// tydesc type. Then we'll recast each function to its real type when
706707
// calling it.
707708
let take_glue =
708-
match ti.take_glue {
709+
match ti.take_glue.get() {
709710
None => { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
710711
Some(v) => {
711712
unsafe {
@@ -715,7 +716,7 @@ pub fn emit_tydescs(ccx: &CrateContext) {
715716
}
716717
};
717718
let drop_glue =
718-
match ti.drop_glue {
719+
match ti.drop_glue.get() {
719720
None => { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
720721
Some(v) => {
721722
unsafe {
@@ -725,7 +726,7 @@ pub fn emit_tydescs(ccx: &CrateContext) {
725726
}
726727
};
727728
let free_glue =
728-
match ti.free_glue {
729+
match ti.free_glue.get() {
729730
None => { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
730731
Some(v) => {
731732
unsafe {
@@ -735,7 +736,7 @@ pub fn emit_tydescs(ccx: &CrateContext) {
735736
}
736737
};
737738
let visit_glue =
738-
match ti.visit_glue {
739+
match ti.visit_glue.get() {
739740
None => { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
740741
Some(v) => {
741742
unsafe {

0 commit comments

Comments
 (0)