diff options
| author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
|---|---|---|
| committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
| commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
| tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch | |
| download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip | |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch')
| -rw-r--r-- | dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch b/dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch new file mode 100644 index 000000000000..be37cdf85093 --- /dev/null +++ b/dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch @@ -0,0 +1,141 @@ +http://sourceforge.net/p/polyml/code/1869/ +Required for sci-mathematics/isabelle-2013.2 + +------------------------------------------------------------------------ +r1869 | dcjm | 2013-10-11 05:59:58 -0600 (Fri, 11 Oct 2013) | 1 line + +Back-port commits 1855 and 1867 from trunk. These fix two optimiser bugs. Includes the regression tests. + +Index: polyml/mlsource/MLCompiler/CodeTree/CODETREE_OPTIMISER.sml +=================================================================== +--- polyml/mlsource/MLCompiler/CodeTree/CODETREE_OPTIMISER.sml (revision 1851) ++++ polyml/mlsource/MLCompiler/CodeTree/CODETREE_OPTIMISER.sml (working copy) +@@ -645,8 +645,9 @@ + (thisDec :: decs, thisArg @ args, LoadLocal newAddr :: mapList) + end + +- | mapPattern(ArgPattCurry(currying, ArgPattTuple{allConst=false, filter, ...}) :: patts, n, m) = +- (* It's a function that returns a tuple. *) ++ | mapPattern(ArgPattCurry(currying as [_], ArgPattTuple{allConst=false, filter, ...}) :: patts, n, m) = ++ (* It's a function that returns a tuple. The function must not be curried because ++ otherwise it returns a function not a tuple. *) + let + val (thisDec, thisArg, thisMap) = + transformFunctionArgument(currying, [LoadArgument m], [LoadArgument n], SOME filter) +@@ -657,7 +658,7 @@ + + | mapPattern(ArgPattCurry(currying as firstArgSet :: _, _) :: patts, n, m) = + (* Transform it if it's curried or if there is a tuple in the first arg. *) +- if List.length currying >= 2 orelse ++ if (*List.length currying >= 2 orelse *) (* This transformation is unsafe. *) + List.exists(fn ArgPattTuple{allConst=false, ...} => true | _ => false) firstArgSet + then + let +@@ -685,6 +686,13 @@ + + and transformFunctionArgument(argumentArgs, loadPack, loadThisArg, filterOpt) = + let ++ (* Disable the transformation of curried arguments for the moment. ++ This is unsafe. See Test146. The problem is that this transformation ++ is only safe if the function is applied immediately to all the arguments. ++ However the usage information is propagated so that if the result of ++ the first application is bound to a variable and then that variable is ++ applied it still appears as curried. *) ++ val argumentArgs = [hd argumentArgs] + (* We have a function that takes a series of curried argument. + Change that so that the function takes a list of arguments. *) + val newAddr = ! localCounter before localCounter := ! localCounter + 1 +@@ -1214,9 +1222,11 @@ + let + fun checkArg (ArgPattTuple{allConst=false, ...}) = true + (* Function has at least one tupled arg. *) +- | checkArg (ArgPattCurry(_, ArgPattTuple{allConst=false, ...})) = true +- (* Function has an arg that is a function that returns a tuple. *) +- | checkArg (ArgPattCurry(_ :: _ :: _, _)) = true ++ | checkArg (ArgPattCurry([_], ArgPattTuple{allConst=false, ...})) = true ++ (* Function has an arg that is a function that returns a tuple. ++ It must not be curried otherwise it returns a function not a tuple. *) ++ (* This transformation is unsafe. See comment in transformFunctionArgument above. *) ++ (*| checkArg (ArgPattCurry(_ :: _ :: _, _)) = true *) + (* Function has an arg that is a curried function. *) + | checkArg (ArgPattCurry(firstArgSet :: _, _)) = + (* Function has an arg that is a function that +Index: polyml/Tests/Succeed/Test146.ML +=================================================================== +--- polyml/Tests/Succeed/Test146.ML (revision 0) ++++ polyml/Tests/Succeed/Test146.ML (revision 1875) +@@ -0,0 +1,24 @@ ++(* Bug in transformation of arguments which are curried functions. It is not ++ safe to transform "f" in the argument to "bar". Although it is curried ++ the application to the first argument "()" is not immediately followed ++ by the application to the second. *) ++ ++local ++ val r = ref 0 ++in ++ (* Foo should be called exactly once *) ++ fun foo () = (r:= !r+1; fn i => i) ++ ++ fun checkOnce () = if !r = 1 then () else raise Fail "bad" ++end; ++ ++fun bar f = let val r = f() in (r 1; r 2; List.map r [1, 2, 3]) end; ++ ++bar foo; ++ ++checkOnce(); ++ ++exception A and B and C; ++fun rA () = raise A and rB () = raise B; ++fun h (f, g) = let val a = f() in g(); a () end; ++h(rA, rB) handle A => (); + +Property changes on: polyml/Tests/Succeed/Test146.ML +___________________________________________________________________ +Added: svn:eol-style +## -0,0 +1 ## ++native +\ No newline at end of property +Index: polyml/Tests/Succeed/Test147.ML +=================================================================== +--- polyml/Tests/Succeed/Test147.ML (revision 0) ++++ polyml/Tests/Succeed/Test147.ML (revision 1875) +@@ -0,0 +1,31 @@ ++(* Bug in optimiser transformation. A function argument that returns a tuple ++ can be transformed to take a container but only if it is not curried. *) ++ ++(* Cut down example from Isabelle that caused an internal error exception. *) ++ ++fun one _ [] = raise Fail "bad" ++ | one pred (x :: xs) = ++ if pred x then (x, xs) else raise Fail "bad"; ++ ++fun foo (scan, f) xs = let val (x, y) = scan xs in (f x, y) end; ++ ++fun bar (scan1, scan2) xs = ++ let ++ val (x, ys) = scan1 xs; ++ val (y, zs) = scan2 x ys; ++ in ((x, y), zs) end; ++ ++fun bub (scan1, scan2) = foo(bar(scan1, (fn _ => scan2)), op ^); ++ ++val qqq: string list -> string * int = bub(one (fn _ => raise Match), (foo((fn _ => raise Match), String.concat))); ++ ++(* Further example - This caused a segfault. *) ++ ++PolyML.Compiler.maxInlineSize := 1; ++fun f g = let val (x,y) = g 1 2 in x+y end; ++ ++fun r (x, y, z) = fn _ => (x, y+z); ++ ++val h: int-> int*int = r (4,5,6); ++ ++f (fn _ => h); + +Property changes on: polyml/Tests/Succeed/Test147.ML +___________________________________________________________________ +Added: svn:eol-style +## -0,0 +1 ## ++native +\ No newline at end of property |
