Gentoo Archives: gentoo-commits

From: "Mark Wright (gienah)" <gienah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/polyml/files: polyml-5.5.1-inputN-return-for-zero-chars.patch polyml-5.5.1-optimize-closure.patch polyml-5.5.1-mprotect-exec.patch
Date: Tue, 11 Feb 2014 14:35:13
Message-Id: 20140211143509.2999A2004C@flycatcher.gentoo.org
1 gienah 14/02/11 14:35:09
2
3 Added: polyml-5.5.1-inputN-return-for-zero-chars.patch
4 polyml-5.5.1-optimize-closure.patch
5 polyml-5.5.1-mprotect-exec.patch
6 Log:
7 Bump polyml to 5.5.1. Fix bug 453146 - dev-lang/polyml-5.5.0: fails to build (pax kernel?) by paxmark m poly and polyimport.
8
9 (Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 618E971F)
10
11 Revision Changes Path
12 1.1 dev-lang/polyml/files/polyml-5.5.1-inputN-return-for-zero-chars.patch
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/polyml/files/polyml-5.5.1-inputN-return-for-zero-chars.patch?rev=1.1&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/polyml/files/polyml-5.5.1-inputN-return-for-zero-chars.patch?rev=1.1&content-type=text/plain
16
17 Index: polyml-5.5.1-inputN-return-for-zero-chars.patch
18 ===================================================================
19 http://sourceforge.net/p/polyml/code/1875/
20 Required for sci-mathematics/isabelle-2013.2
21
22 ------------------------------------------------------------------------
23 r1875 | dcjm | 2013-10-30 10:49:05 -0600 (Wed, 30 Oct 2013) | 1 line
24
25 Backport commit 1874 from trunk. This fixes TextIO.inputN and StreamIO.inputN so they return immediately if the request is for zero characters.
26 Index: polyml/basis/BasicStreamIO.sml
27 ===================================================================
28 --- polyml/basis/BasicStreamIO.sml (revision 1851)
29 +++ polyml/basis/BasicStreamIO.sml (working copy)
30 @@ -213,6 +213,8 @@
31 fun inputN (f, n) =
32 if n < 0
33 then raise Size
34 + else if n = 0 (* Defined to return the empty vector and f *)
35 + then (emptyVec, f)
36 else
37 let
38 val (vecs, f') = inputNList (f, n)
39 Index: polyml/basis/TextIO.sml
40 ===================================================================
41 --- polyml/basis/TextIO.sml (revision 1851)
42 +++ polyml/basis/TextIO.sml (working copy)
43 @@ -597,6 +597,8 @@
44 | inputN' n (ref(Direct(strm as {buffer, bufp, buflimit, ...}))) =
45 if n < 0 orelse n > CharVector.maxLen
46 then raise Size
47 + else if n = 0
48 + then "" (* Return the empty string without blocking *)
49 else if !buflimit = 0
50 then (* Last read returned end-of-file. Clear the EOF state once
51 we return this empty string. *)
52
53
54
55 1.1 dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch
56
57 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch?rev=1.1&view=markup
58 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch?rev=1.1&content-type=text/plain
59
60 Index: polyml-5.5.1-optimize-closure.patch
61 ===================================================================
62 http://sourceforge.net/p/polyml/code/1869/
63 Required for sci-mathematics/isabelle-2013.2
64
65 ------------------------------------------------------------------------
66 r1869 | dcjm | 2013-10-11 05:59:58 -0600 (Fri, 11 Oct 2013) | 1 line
67
68 Back-port commits 1855 and 1867 from trunk. These fix two optimiser bugs. Includes the regression tests.
69
70 Index: polyml/mlsource/MLCompiler/CodeTree/CODETREE_OPTIMISER.sml
71 ===================================================================
72 --- polyml/mlsource/MLCompiler/CodeTree/CODETREE_OPTIMISER.sml (revision 1851)
73 +++ polyml/mlsource/MLCompiler/CodeTree/CODETREE_OPTIMISER.sml (working copy)
74 @@ -645,8 +645,9 @@
75 (thisDec :: decs, thisArg @ args, LoadLocal newAddr :: mapList)
76 end
77
78 - | mapPattern(ArgPattCurry(currying, ArgPattTuple{allConst=false, filter, ...}) :: patts, n, m) =
79 - (* It's a function that returns a tuple. *)
80 + | mapPattern(ArgPattCurry(currying as [_], ArgPattTuple{allConst=false, filter, ...}) :: patts, n, m) =
81 + (* It's a function that returns a tuple. The function must not be curried because
82 + otherwise it returns a function not a tuple. *)
83 let
84 val (thisDec, thisArg, thisMap) =
85 transformFunctionArgument(currying, [LoadArgument m], [LoadArgument n], SOME filter)
86 @@ -657,7 +658,7 @@
87
88 | mapPattern(ArgPattCurry(currying as firstArgSet :: _, _) :: patts, n, m) =
89 (* Transform it if it's curried or if there is a tuple in the first arg. *)
90 - if List.length currying >= 2 orelse
91 + if (*List.length currying >= 2 orelse *) (* This transformation is unsafe. *)
92 List.exists(fn ArgPattTuple{allConst=false, ...} => true | _ => false) firstArgSet
93 then
94 let
95 @@ -685,6 +686,13 @@
96
97 and transformFunctionArgument(argumentArgs, loadPack, loadThisArg, filterOpt) =
98 let
99 + (* Disable the transformation of curried arguments for the moment.
100 + This is unsafe. See Test146. The problem is that this transformation
101 + is only safe if the function is applied immediately to all the arguments.
102 + However the usage information is propagated so that if the result of
103 + the first application is bound to a variable and then that variable is
104 + applied it still appears as curried. *)
105 + val argumentArgs = [hd argumentArgs]
106 (* We have a function that takes a series of curried argument.
107 Change that so that the function takes a list of arguments. *)
108 val newAddr = ! localCounter before localCounter := ! localCounter + 1
109 @@ -1214,9 +1222,11 @@
110 let
111 fun checkArg (ArgPattTuple{allConst=false, ...}) = true
112 (* Function has at least one tupled arg. *)
113 - | checkArg (ArgPattCurry(_, ArgPattTuple{allConst=false, ...})) = true
114 - (* Function has an arg that is a function that returns a tuple. *)
115 - | checkArg (ArgPattCurry(_ :: _ :: _, _)) = true
116 + | checkArg (ArgPattCurry([_], ArgPattTuple{allConst=false, ...})) = true
117 + (* Function has an arg that is a function that returns a tuple.
118 + It must not be curried otherwise it returns a function not a tuple. *)
119 + (* This transformation is unsafe. See comment in transformFunctionArgument above. *)
120 + (*| checkArg (ArgPattCurry(_ :: _ :: _, _)) = true *)
121 (* Function has an arg that is a curried function. *)
122 | checkArg (ArgPattCurry(firstArgSet :: _, _)) =
123 (* Function has an arg that is a function that
124 Index: polyml/Tests/Succeed/Test146.ML
125 ===================================================================
126 --- polyml/Tests/Succeed/Test146.ML (revision 0)
127 +++ polyml/Tests/Succeed/Test146.ML (revision 1875)
128 @@ -0,0 +1,24 @@
129 +(* Bug in transformation of arguments which are curried functions. It is not
130 + safe to transform "f" in the argument to "bar". Although it is curried
131 + the application to the first argument "()" is not immediately followed
132 + by the application to the second. *)
133 +
134 +local
135 + val r = ref 0
136 +in
137 + (* Foo should be called exactly once *)
138 + fun foo () = (r:= !r+1; fn i => i)
139 +
140 + fun checkOnce () = if !r = 1 then () else raise Fail "bad"
141 +end;
142 +
143 +fun bar f = let val r = f() in (r 1; r 2; List.map r [1, 2, 3]) end;
144 +
145 +bar foo;
146 +
147 +checkOnce();
148 +
149 +exception A and B and C;
150 +fun rA () = raise A and rB () = raise B;
151 +fun h (f, g) = let val a = f() in g(); a () end;
152 +h(rA, rB) handle A => ();
153
154 Property changes on: polyml/Tests/Succeed/Test146.ML
155 ___________________________________________________________________
156 Added: svn:eol-style
157 ## -0,0 +1 ##
158 +native
159 \ No newline at end of property
160 Index: polyml/Tests/Succeed/Test147.ML
161 ===================================================================
162 --- polyml/Tests/Succeed/Test147.ML (revision 0)
163 +++ polyml/Tests/Succeed/Test147.ML (revision 1875)
164 @@ -0,0 +1,31 @@
165 +(* Bug in optimiser transformation. A function argument that returns a tuple
166 + can be transformed to take a container but only if it is not curried. *)
167 +
168 +(* Cut down example from Isabelle that caused an internal error exception. *)
169 +
170 +fun one _ [] = raise Fail "bad"
171 + | one pred (x :: xs) =
172 + if pred x then (x, xs) else raise Fail "bad";
173 +
174 +fun foo (scan, f) xs = let val (x, y) = scan xs in (f x, y) end;
175 +
176 +fun bar (scan1, scan2) xs =
177 + let
178 + val (x, ys) = scan1 xs;
179 + val (y, zs) = scan2 x ys;
180 + in ((x, y), zs) end;
181 +
182 +fun bub (scan1, scan2) = foo(bar(scan1, (fn _ => scan2)), op ^);
183 +
184 +val qqq: string list -> string * int = bub(one (fn _ => raise Match), (foo((fn _ => raise Match), String.concat)));
185 +
186 +(* Further example - This caused a segfault. *)
187 +
188 +PolyML.Compiler.maxInlineSize := 1;
189 +fun f g = let val (x,y) = g 1 2 in x+y end;
190 +
191 +fun r (x, y, z) = fn _ => (x, y+z);
192 +
193 +val h: int-> int*int = r (4,5,6);
194 +
195 +f (fn _ => h);
196
197 Property changes on: polyml/Tests/Succeed/Test147.ML
198 ___________________________________________________________________
199 Added: svn:eol-style
200 ## -0,0 +1 ##
201 +native
202 \ No newline at end of property
203
204
205
206 1.1 dev-lang/polyml/files/polyml-5.5.1-mprotect-exec.patch
207
208 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/polyml/files/polyml-5.5.1-mprotect-exec.patch?rev=1.1&view=markup
209 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/polyml/files/polyml-5.5.1-mprotect-exec.patch?rev=1.1&content-type=text/plain
210
211 Index: polyml-5.5.1-mprotect-exec.patch
212 ===================================================================
213 --- polyml.5.5.1-orig/libpolyml/memmgr.cpp 2013-07-10 22:56:07.000000000 +1000
214 +++ polyml.5.5.1/libpolyml/memmgr.cpp 2014-02-10 14:08:51.866219101 +1100
215 @@ -80,7 +80,7 @@
216 // Allocate the heap itself.
217 size_t iSpace = size*sizeof(PolyWord);
218 bottom =
219 - (PolyWord*)osMemoryManager->Allocate(iSpace, PERMISSION_READ|PERMISSION_WRITE|PERMISSION_EXEC);
220 + (PolyWord*)osMemoryManager->Allocate(iSpace, PERMISSION_READ|PERMISSION_EXEC);
221
222 if (bottom == 0)
223 return false;
224 @@ -359,7 +359,7 @@
225 // Allocate the memory itself.
226 size_t iSpace = size*sizeof(PolyWord);
227 space->bottom =
228 - (PolyWord*)osMemoryManager->Allocate(iSpace, PERMISSION_READ|PERMISSION_WRITE|PERMISSION_EXEC);
229 + (PolyWord*)osMemoryManager->Allocate(iSpace, PERMISSION_READ|PERMISSION_EXEC);
230
231 if (space->bottom == 0)
232 {
233 @@ -728,7 +728,7 @@
234 LocalMemSpace *space = lSpaces[i];
235 if (! space->isMutable)
236 osMemoryManager->SetPermissions(space->bottom, (char*)space->top - (char*)space->bottom,
237 - on ? PERMISSION_READ|PERMISSION_EXEC : PERMISSION_READ|PERMISSION_EXEC|PERMISSION_WRITE);
238 + on ? PERMISSION_READ|PERMISSION_EXEC : PERMISSION_READ|PERMISSION_WRITE);
239 }
240 }
241 }