Skip to content

Commit d2fea94

Browse files
committed
---
yaml --- r: 15662 b: refs/heads/try c: 43751e4 h: refs/heads/master v: v3
1 parent a823300 commit d2fea94

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 3c166937608789d3a1ad3d89a8577b9a178c9595
5+
refs/heads/try: 43751e45d90ed3a2f5a9d0208d50125d88af6dfc
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1896,7 +1896,7 @@ fn make_mono_id(ccx: @crate_ctxt, item: ast::def_id, substs: [ty::t],
18961896
!ty::type_needs_drop(ccx.tcx, subst) {
18971897
let llty = type_of(ccx, subst);
18981898
let size = shape::llsize_of_real(ccx, llty);
1899-
let align = shape::llalign_of_real(ccx, llty);
1899+
let align = shape::llalign_of_pref(ccx, llty);
19001900
// Special value for nil to prevent problems with undef
19011901
// return pointers.
19021902
if size == 1u && ty::type_is_nil(subst) {

branches/try/src/rustc/middle/trans/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ fn create_block(cx: block) -> @metadata<block_md> {
282282
fn size_and_align_of(cx: @crate_ctxt, t: ty::t) -> (int, int) {
283283
let llty = type_of::type_of(cx, t);
284284
(shape::llsize_of_real(cx, llty) as int,
285-
shape::llalign_of_real(cx, llty) as int)
285+
shape::llalign_of_pref(cx, llty) as int)
286286
}
287287

288288
fn create_basic_type(cx: @crate_ctxt, t: ty::t, ty: ast::prim_ty, span: span)

branches/try/src/rustc/middle/trans/native.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::native_item,
765765
fcx.llretptr);
766766
}
767767
"align_of" {
768-
Store(bcx, C_uint(ccx, shape::llalign_of_real(ccx, lltp_ty)),
768+
Store(bcx, C_uint(ccx, shape::llalign_of_pref(ccx, lltp_ty)),
769769
fcx.llretptr);
770770
}
771771
"get_tydesc" {

branches/try/src/rustc/middle/trans/shape.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fn largest_variants(ccx: @crate_ctxt, tag_id: ast::def_id) -> [uint] {
117117
} else {
118118
let llty = type_of::type_of(ccx, elem_t);
119119
min_size += llsize_of_real(ccx, llty);
120-
min_align += llalign_of_real(ccx, llty);
120+
min_align += llalign_of_pref(ccx, llty);
121121
}
122122
}
123123

@@ -190,7 +190,7 @@ fn compute_static_enum_size(ccx: @crate_ctxt, largest_variants: [uint],
190190

191191
let llty = trans::common::T_struct(lltys);
192192
let dp = llsize_of_real(ccx, llty) as u16;
193-
let variant_align = llalign_of_real(ccx, llty) as u8;
193+
let variant_align = llalign_of_pref(ccx, llty) as u8;
194194

195195
if max_size < dp { max_size = dp; }
196196
if max_align < variant_align { max_align = variant_align; }
@@ -202,7 +202,7 @@ fn compute_static_enum_size(ccx: @crate_ctxt, largest_variants: [uint],
202202
if vec::len(*variants) > 1u {
203203
let variant_t = T_enum_variant(ccx);
204204
max_size += llsize_of_real(ccx, variant_t) as u16;
205-
let align = llalign_of_real(ccx, variant_t) as u8;
205+
let align = llalign_of_pref(ccx, variant_t) as u8;
206206
if max_align < align { max_align = align; }
207207
}
208208

@@ -630,8 +630,10 @@ fn llsize_of_real(cx: @crate_ctxt, t: TypeRef) -> uint {
630630
ret llvm::LLVMStoreSizeOfType(cx.td.lltd, t) as uint;
631631
}
632632

633-
// Returns the real alignment of the given type for the current target.
634-
fn llalign_of_real(cx: @crate_ctxt, t: TypeRef) -> uint {
633+
// Returns the preferred alignment of the given type for the current target.
634+
// The preffered alignment may be larger than the alignment used when
635+
// packing the type into structs
636+
fn llalign_of_pref(cx: @crate_ctxt, t: TypeRef) -> uint {
635637
ret llvm::LLVMPreferredAlignmentOfType(cx.td.lltd, t) as uint;
636638
}
637639

0 commit comments

Comments
 (0)