aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2021-01-06 16:35:07 +0100
committerCyril SIX <cyril.six@kalray.eu>2021-01-06 16:35:07 +0100
commit6a77f39a8e8ea383ddfa76cbe444b93ef5501429 (patch)
tree6c056bb38ece5eabcfdd8fd420ac91abe25776fa
parent75bee70a6481c6bcf5bfa85f2558b08f5387db9c (diff)
downloadcompcert-kvx-6a77f39a8e8ea383ddfa76cbe444b93ef5501429.tar.gz
compcert-kvx-6a77f39a8e8ea383ddfa76cbe444b93ef5501429.zip
Solving a stack overflow issue (was failing in yarpgen ran000089 for armhf)
Note : the issue is still present later in Duplicateproof. This is because I am examining an "identity ptree" which is way too big. I am having a look to see if I could make this ptree less big - to not include nodes that are identity
-rw-r--r--backend/Duplicateaux.ml18
1 files changed, 9 insertions, 9 deletions
diff --git a/backend/Duplicateaux.ml b/backend/Duplicateaux.ml
index 21078975..b3635527 100644
--- a/backend/Duplicateaux.ml
+++ b/backend/Duplicateaux.ml
@@ -433,21 +433,21 @@ let update_direction direction = function
| Some _ -> Icond (cond, lr, n, n', pred) )
| i -> i
-let rec update_direction_rec directions = function
-| [] -> PTree.empty
-| m::lm -> let (n, i) = m
- in let direction = get_some @@ PTree.get n directions
- in PTree.set n (update_direction direction i) (update_direction_rec directions lm)
-
(* Uses branch prediction to write prediction annotations in Icond *)
let update_directions f code entrypoint = begin
debug "Update_directions\n";
- let directions = get_directions f code entrypoint
- in begin
+ let directions = get_directions f code entrypoint in
+ let code' = ref code in
+ begin
+ debug "Get Directions done, now proceeding to update all direction information..\n";
(* debug "Ifso directions: ";
ptree_printbool directions;
debug "\n"; *)
- update_direction_rec directions (PTree.elements code)
+ List.iter (fun (n, i) ->
+ let direction = get_some @@ PTree.get n directions in
+ code' := PTree.set n (update_direction direction i) !code'
+ ) (PTree.elements code);
+ !code'
end
end