From 929469c81d863703aa5817bbbd92c697eca3af26 Mon Sep 17 00:00:00 2001 From: Thomas Bauereiss Date: Mon, 4 May 2020 17:53:12 +0100 Subject: Try to fix bug in size parameter rewriting If we call a function where some arguments need to be rewritten, we might need to rewrite those parameters in the caller as well. --- test/mono/itself_rewriting.sail | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/mono/itself_rewriting.sail b/test/mono/itself_rewriting.sail index 912cb99d..4d67ee1a 100644 --- a/test/mono/itself_rewriting.sail +++ b/test/mono/itself_rewriting.sail @@ -83,6 +83,13 @@ function test_execute() = { execute(datasize) } +val transitive_itself : forall 'n. int('n) -> unit + +function transitive_itself(n) = { + needs_size_in_guard(n); + () +} + val run : unit -> unit effect {escape} function run () = { @@ -90,4 +97,5 @@ function run () = { test_execute(); willsplit(true); willsplit(false); + transitive_itself(16); } -- cgit v1.2.3 From dc674a7320e4684e4dbe3ccf618c644bd83796ca Mon Sep 17 00:00:00 2001 From: Thomas Bauereiss Date: Mon, 4 May 2020 17:57:49 +0100 Subject: Mono: Try to fix bug in inter-procedural analysis The monomorphisation analysis decides whether to split function arguments in the callee or in callers. The code previously used a datastructure that can hold results of either the one case or the other, but there might be functions that are called in different contexts leading to different decisions. This patch changes the datastructure to support storing all instances of either case. --- test/mono/itself_rewriting.sail | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/mono/itself_rewriting.sail b/test/mono/itself_rewriting.sail index 4d67ee1a..4540f1a5 100644 --- a/test/mono/itself_rewriting.sail +++ b/test/mono/itself_rewriting.sail @@ -90,6 +90,13 @@ function transitive_itself(n) = { () } +val transitive_split : bool -> unit + +function transitive_split(x) = { + let n = if x then 8 else 16; + transitive_itself(n); +} + val run : unit -> unit effect {escape} function run () = { @@ -98,4 +105,6 @@ function run () = { willsplit(true); willsplit(false); transitive_itself(16); + transitive_split(true); + transitive_split(false); } -- cgit v1.2.3