Skip to content

Commit a6530ed

Browse files
jorendorffgraydon
authored andcommitted
---
yaml --- r: 287 b: refs/heads/master c: 7671828 h: refs/heads/master i: 285: b2fe5fd 283: 4220462 279: b27e219 271: bdb2264 255: 37303de v: v3
1 parent 03c1813 commit a6530ed

File tree

14 files changed

+1657
-896
lines changed

14 files changed

+1657
-896
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: 5d8430afa711bd694ce035c72e98f57ad49240a7
2+
refs/heads/master: 7671828d45ea3b0d2f3814fc59bb01cba3d481d5

trunk/src/Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,6 @@ MUT_BOX_XFAILS := $(addprefix test/run-pass/, \
347347
TEST_XFAILS_X86 := $(MUT_BOX_XFAILS) \
348348
test/run-pass/mlist-cycle.rs \
349349
test/run-pass/clone-with-exterior.rs \
350-
test/run-pass/destructor-ordering.rs \
351350
test/run-pass/obj-as.rs \
352351
test/run-pass/rec-auto.rs \
353352
test/run-pass/vec-slice.rs \
@@ -357,14 +356,12 @@ TEST_XFAILS_X86 := $(MUT_BOX_XFAILS) \
357356
test/run-pass/generic-recursive-tag.rs \
358357
test/run-pass/mutable-vec-drop.rs \
359358
test/run-pass/bind-obj-ctor.rs \
360-
test/run-pass/vec-alloc-append.rs \
361359
test/run-pass/task-comm.rs \
362360
test/compile-fail/rec-missing-fields.rs \
363361
test/compile-fail/bad-send.rs \
364362
test/compile-fail/bad-recv.rs \
365363
test/compile-fail/infinite-tag-type-recursion.rs \
366-
test/compile-fail/infinite-vec-type-recursion.rs \
367-
test/compile-fail/writing-through-read-alias.rs
364+
test/compile-fail/infinite-vec-type-recursion.rs
368365

369366
TEST_XFAILS_LLVM := $(addprefix test/run-pass/, \
370367
acyclic-unwind.rs \
@@ -468,7 +465,6 @@ TEST_XFAILS_LLVM := $(addprefix test/run-pass/, \
468465
use-import-export.rs \
469466
use-uninit.rs \
470467
utf8.rs \
471-
vec-alloc-append.rs \
472468
vec-append.rs \
473469
vec-concat.rs \
474470
vec-drop.rs \
@@ -496,7 +492,6 @@ TEST_XFAILS_LLVM := $(addprefix test/run-pass/, \
496492
bad-recv.rs \
497493
infinite-tag-type-recursion.rs \
498494
infinite-vec-type-recursion.rs \
499-
writing-through-read-alias.rs \
500495
)
501496

502497
ifdef MINGW_CROSS

trunk/src/boot/me/trans.ml

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,11 @@ let trans_visitor
453453
Il.Mem (fp_imm out_mem_disp, args_rty)
454454
in
455455

456+
let fp_to_args (fp:Il.cell) (args_rty:Il.referent_ty): Il.cell =
457+
let (reg, _) = force_to_reg (Il.Cell fp) in
458+
Il.Mem(based_imm reg out_mem_disp, args_rty)
459+
in
460+
456461
let get_ty_param (ty_params:Il.cell) (param_idx:int) : Il.cell =
457462
get_element_ptr ty_params param_idx
458463
in
@@ -753,6 +758,28 @@ let trans_visitor
753758
Il.Mem (mem, (pointee_type ptr))
754759
in
755760

761+
(*
762+
* Within a for-each block, calculate the fp of an enclosing for-each block
763+
* or the enclosing function by chasing static links.
764+
*)
765+
let get_nth_outer_frame_ptr (diff:int) : Il.cell =
766+
(* All for-each block frames have the same args. *)
767+
let block_args_rty = current_fn_args_rty None in
768+
let current_fp = Il.Reg (abi.Abi.abi_fp_reg, Il.AddrTy Il.OpaqueTy) in
769+
let rec out (n:int) (fp:Il.cell) : Il.cell =
770+
if n == 0
771+
then fp
772+
else
773+
let args = fp_to_args fp block_args_rty in
774+
let iter_args = get_element_ptr args Abi.calltup_elt_iterator_args in
775+
let outer_fp =
776+
get_element_ptr iter_args Abi.iterator_args_elt_outer_frame_ptr
777+
in
778+
out (n - 1) outer_fp
779+
in
780+
out diff current_fp
781+
in
782+
756783
let cell_of_block_slot
757784
(slot_id:node_id)
758785
: Il.cell =
@@ -820,28 +847,13 @@ let trans_visitor
820847
in
821848
let diff = stmt_depth - slot_depth in
822849
let _ = annotate "get outer frame pointer" in
823-
let fp =
824-
get_iter_outer_frame_ptr_for_current_frame ()
850+
let fp = get_nth_outer_frame_ptr diff in
851+
let _ = annotate "calculate size" in
852+
let p =
853+
based_sz (get_ty_params_of_current_frame())
854+
(fst (force_to_reg (Il.Cell fp))) off
825855
in
826-
if diff > 1
827-
then
828-
bug () "unsupported nested for each loop";
829-
for i = 2 to diff do
830-
(* FIXME (issue #79): access outer
831-
* caller-block fps, given nearest
832-
* caller-block fp.
833-
*)
834-
let _ =
835-
annotate "step to outer-outer frame"
836-
in
837-
mov fp (Il.Cell fp)
838-
done;
839-
let _ = annotate "calculate size" in
840-
let p =
841-
based_sz (get_ty_params_of_current_frame())
842-
(fst (force_to_reg (Il.Cell fp))) off
843-
in
844-
Il.Mem (p, referent_type)
856+
Il.Mem (p, referent_type)
845857
else
846858
Il.Mem (fp_off_sz off, referent_type)
847859
end

0 commit comments

Comments
 (0)