Skip to content

Commit fd9c989

Browse files
committed
---
yaml --- r: 3319 b: refs/heads/master c: f3798fd h: refs/heads/master i: 3317: da348bb 3315: 2602c21 3311: bc6e8d2 v: v3
1 parent 6b2e310 commit fd9c989

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 3cf00c15770a8e140c5612d42b943f6919f7909b
2+
refs/heads/master: f3798fd2134ce3b47d69e452dfe9aa926b66e859

trunk/src/comp/middle/trans.rs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,11 +2488,39 @@ fn iter_structural_ty_full(&@block_ctxt cx, ValueRef av, ValueRef bv,
24882488
auto b_elem_i8 = bcx.build.PointerCast(b_elem, T_ptr(T_i8()));
24892489
auto b_end_i8 = bcx.build.GEP(b_elem_i8, [len]);
24902490
auto b_end = bcx.build.PointerCast(b_end_i8, T_ptr(llunitty));
2491+
2492+
auto dest_elem_ptr = alloca(bcx, T_ptr(llunitty));
2493+
auto src_elem_ptr = alloca(bcx, T_ptr(llunitty));
2494+
bcx.build.Store(a_elem, dest_elem_ptr);
2495+
bcx.build.Store(b_elem, src_elem_ptr);
2496+
24912497
// Now perform the iteration.
2498+
auto loop_header_cx = new_sub_block_ctxt(bcx,
2499+
"iter_ivec_loop_header");
2500+
bcx.build.Br(loop_header_cx.llbb);
2501+
auto dest_elem = loop_header_cx.build.Load(dest_elem_ptr);
2502+
auto src_elem = loop_header_cx.build.Load(src_elem_ptr);
2503+
auto not_yet_at_end = loop_header_cx.build.ICmp(lib::llvm::LLVMIntULT,
2504+
dest_elem, b_end);
2505+
auto loop_body_cx = new_sub_block_ctxt(bcx, "iter_ivec_loop_body");
2506+
auto next_cx = new_sub_block_ctxt(bcx, "iter_ivec_next");
2507+
loop_header_cx.build.CondBr(not_yet_at_end, loop_body_cx.llbb,
2508+
next_cx.llbb);
2509+
2510+
rslt = f(loop_body_cx,
2511+
load_if_immediate(loop_body_cx, dest_elem, unit_ty),
2512+
load_if_immediate(loop_body_cx, src_elem, unit_ty), unit_ty);
2513+
2514+
loop_body_cx = rslt.bcx;
2515+
loop_body_cx.build.Store(loop_body_cx.build.InBoundsGEP(dest_elem,
2516+
[C_int(1)]), dest_elem_ptr);
2517+
loop_body_cx.build.Store(loop_body_cx.build.InBoundsGEP(src_elem,
2518+
[C_int(1)]), src_elem_ptr);
2519+
loop_body_cx.build.Br(loop_header_cx.llbb);
24922520

2493-
auto vpf = bind adapter(_, _, _, unit_ty, f);
2494-
ret iter_sequence_raw(bcx, a_elem, b_elem, b_end, unit_sz, vpf);
2521+
ret res(next_cx, C_nil());
24952522
}
2523+
24962524
let result r = res(cx, C_nil());
24972525
alt (ty::struct(cx.fcx.lcx.ccx.tcx, t)) {
24982526
case (ty::ty_tup(?args)) {

0 commit comments

Comments
 (0)