summaryrefslogtreecommitdiff
path: root/dev-lang/polyml/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /dev-lang/polyml/files
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'dev-lang/polyml/files')
-rw-r--r--dev-lang/polyml/files/polyml-5.4.1-asm.patch28
-rw-r--r--dev-lang/polyml/files/polyml-5.4.1-configure.patch11
-rw-r--r--dev-lang/polyml/files/polyml-5.5.0-asm.patch10
-rw-r--r--dev-lang/polyml/files/polyml-5.5.0-configure.patch138
-rw-r--r--dev-lang/polyml/files/polyml-5.5.0-x-it-basis.patch21
-rw-r--r--dev-lang/polyml/files/polyml-5.5.1-inputN-return-for-zero-chars.patch33
-rw-r--r--dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch141
-rw-r--r--dev-lang/polyml/files/polyml-5.5.2-r1952-check_for_negative_sized_array.patch13
-rw-r--r--dev-lang/polyml/files/polyml-5.5.2-r1954_Fix_segfault_in_FFI_when_malloc_runs_out_of_memory.patch112
-rw-r--r--dev-lang/polyml/files/polyml-5.5.2-r2007_Ensure_the_large_object_cache_pointer_is_cleared.patch27
-rw-r--r--dev-lang/polyml/files/polyml-5.5.2-r2009_Initialise_the_largeObjectCache_fully_in_the_constructor.patch21
11 files changed, 555 insertions, 0 deletions
diff --git a/dev-lang/polyml/files/polyml-5.4.1-asm.patch b/dev-lang/polyml/files/polyml-5.4.1-asm.patch
new file mode 100644
index 000000000000..af8bd8d49149
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.4.1-asm.patch
@@ -0,0 +1,28 @@
+--- polyml.5.4.1-orig/libpolyml/x86asm.asm 2011-07-13 00:06:49.000000000 +1000
++++ polyml.5.4.1/libpolyml/x86asm.asm 2012-01-08 16:00:09.740684843 +1100
+@@ -2714,4 +2714,7 @@
+
+
+ ENDIF
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+ END
+--- polyml.5.4.1-orig/libpolyml/power_assembly.S 2010-04-09 01:49:20.000000000 +1000
++++ polyml.5.4.1/libpolyml/power_assembly.S 2012-01-08 15:46:35.006200143 +1100
+@@ -1735,3 +1735,6 @@
+ dd Mask_assign_byte /* 254 */
+ dd Mask_assign_word /* 255 */
+
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+--- polyml.5.4.1-orig/libpolyml/sparc_assembly.S 2010-08-13 01:01:36.000000000 +1000
++++ polyml.5.4.1/libpolyml/sparc_assembly.S 2012-01-08 15:46:12.516642791 +1100
+@@ -1498,3 +1498,6 @@
+ .long Mask_assign_byte /* 254 */
+ .long Mask_assign_word /* 255 */
+
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
diff --git a/dev-lang/polyml/files/polyml-5.4.1-configure.patch b/dev-lang/polyml/files/polyml-5.4.1-configure.patch
new file mode 100644
index 000000000000..aaaed02f8e16
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.4.1-configure.patch
@@ -0,0 +1,11 @@
+--- polyml.5.4.1-orig/configure.ac 2010-09-03 21:22:40.000000000 +1000
++++ polyml.5.4.1/configure.ac 2012-01-09 22:44:04.153668402 +1100
+@@ -321,7 +321,7 @@
+ AC_ARG_WITH([portable],
+ [AS_HELP_STRING([--with-portable],
+ [Build the portable interpreter version of Poly/ML instead of native @<:@default=no@:>@])], [
+- ac_cv_with_portable=yes], [
++ ac_cv_with_portable="$withval"], [
+ ac_cv_with_portable=no])
+
+ case "${host_cpu}" in
diff --git a/dev-lang/polyml/files/polyml-5.5.0-asm.patch b/dev-lang/polyml/files/polyml-5.5.0-asm.patch
new file mode 100644
index 000000000000..cffa627b9f32
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.0-asm.patch
@@ -0,0 +1,10 @@
+--- polyml.5.5-orig/libpolyml/x86asm.asm 2012-05-03 21:07:59.000000000 +1000
++++ polyml.5.5/libpolyml/x86asm.asm 2012-09-19 17:41:51.767737295 +1000
+@@ -3003,4 +3003,7 @@
+ dd Mask_assign_byte ;# 254
+ dd Mask_assign_word ;# 255
+
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+ END
diff --git a/dev-lang/polyml/files/polyml-5.5.0-configure.patch b/dev-lang/polyml/files/polyml-5.5.0-configure.patch
new file mode 100644
index 000000000000..1a2e114e6503
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.0-configure.patch
@@ -0,0 +1,138 @@
+Index: polyml/configure
+===================================================================
+--- polyml/configure (revision 1599)
++++ polyml/configure (revision 1600)
+@@ -20870,10 +20870,8 @@
+ # Check whether --with-portable was given.
+ if test "${with_portable+set}" = set; then :
+ withval=$with_portable;
+- ac_cv_with_portable=yes
+ else
+-
+- ac_cv_with_portable=no
++ with_portable=check
+ fi
+
+
+@@ -20894,36 +20892,46 @@
+
+ $as_echo "#define HOSTARCHITECTURE_SPARC 1" >>confdefs.h
+
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ power* | ppc*)
+
+ $as_echo "#define HOSTARCHITECTURE_PPC 1" >>confdefs.h
+
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ arm*)
+
+ $as_echo "#define HOSTARCHITECTURE_ARM 1" >>confdefs.h
+
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ ia64*)
+
+ $as_echo "#define HOSTARCHITECTURE_IA64 1" >>confdefs.h
+
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ *) as_fn_error $? "Poly/ML is not supported for this architecture" "$LINENO" 5 ;;
+ esac
+
+-# If we have explicitly set --with-portable or we are on a machine without
+-# a code-generator set to use the interpreter.
+-if test "$ac_cv_with_portable" = "yes"; then
++# If we explicitly asked to use the interpreter set the architecture to interpreted.
++if test "x$with_portable" = "xyes" ; then
++ polyarch=interpret
++fi
+
++# If we asked not to use the interpreter check we have native code support.
++if test "x$with_portable" = "xno" ; then
++ if test "x$polyarch" = "xinterpret" ; then
++ as_fn_error $? "--without-portable was given but native code is not supported on this platform" "$LINENO" 5
++ fi
++fi
++
++# Set the define if this is the interpreter. This is no longer actually used.
++if test "x$polyarch" = "xinterpret" ; then
++
+ $as_echo "#define INTERPRETED 1" >>confdefs.h
+
+- polyarch=interpret
+ fi
+
+ # Put this test at the end where it's less likely to be missed.
+Index: polyml/configure.ac
+===================================================================
+--- polyml/configure.ac (revision 1599)
++++ polyml/configure.ac (revision 1600)
+@@ -368,10 +368,10 @@
+ # Test the --with-portable option to build the interpreter even if
+ # we have a code-generator.
+ AC_ARG_WITH([portable],
+- [AS_HELP_STRING([--with-portable],
+- [Build the portable interpreter version of Poly/ML instead of native @<:@default=no@:>@])], [
+- ac_cv_with_portable=yes], [
+- ac_cv_with_portable=no])
++ [AS_HELP_STRING([--with-portable],
++ [Build the portable interpreter version of Poly/ML instead of native @<:@default=no@:>@])],
++ [],
++ [with_portable=check])
+
+ case "${host_cpu}" in
+ i[[3456]]86*)
+@@ -384,28 +384,39 @@
+ ;;
+ sparc*)
+ AC_DEFINE([HOSTARCHITECTURE_SPARC], [1], [Define if the host is a Sparc (32 bit)])
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ power* | ppc*)
+ AC_DEFINE([HOSTARCHITECTURE_PPC], [1], [Define if the host is a Power PC (32 bit)])
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ arm*)
+ AC_DEFINE([HOSTARCHITECTURE_ARM], [1], [Define if the host is an ARM (32 bit)])
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ ia64*)
+ AC_DEFINE([HOSTARCHITECTURE_IA64], [1], [Define if the host is Itanium])
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ *) AC_MSG_ERROR([Poly/ML is not supported for this architecture]) ;;
+ esac
+
+-# If we have explicitly set --with-portable or we are on a machine without
+-# a code-generator set to use the interpreter.
+-if test "$ac_cv_with_portable" = "yes"; then
++# If we explicitly asked to use the interpreter set the architecture to interpreted.
++if test "x$with_portable" = "xyes" ; then
++ polyarch=interpret
++fi
++
++# If we asked not to use the interpreter check we have native code support.
++if test "x$with_portable" = "xno" ; then
++ if test "x$polyarch" = "xinterpret" ; then
++ AC_MSG_ERROR(
++ [--without-portable was given but native code is not supported on this platform])
++ fi
++fi
++
++# Set the define if this is the interpreter. This is no longer actually used.
++if test "x$polyarch" = "xinterpret" ; then
+ AC_DEFINE([INTERPRETED], [1], [Define if using the interpreter] )
+- polyarch=interpret
+ fi
+
+ # Put this test at the end where it's less likely to be missed.
diff --git a/dev-lang/polyml/files/polyml-5.5.0-x-it-basis.patch b/dev-lang/polyml/files/polyml-5.5.0-x-it-basis.patch
new file mode 100644
index 000000000000..2f6ce7b864bd
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.0-x-it-basis.patch
@@ -0,0 +1,21 @@
+Index: polyml/mlsource/extra/XWindows/ml_bind.ML
+===================================================================
+--- polyml/mlsource/extra/XWindows/ml_bind.ML (revision 1600)
++++ polyml/mlsource/extra/XWindows/ml_bind.ML (revision 1601)
+@@ -2437,7 +2437,7 @@
+
+ exception XWindows = XWindows.XWindows;
+
+-let
++local
+ open XWindows;
+
+ fun printRect _ _ (r:XRectangle) =
+@@ -2447,6 +2447,6 @@
+ PolyML.PrettyString ("Rect " ^ PolyML.makestring R)
+ end;
+ in
+- PolyML.addPrettyPrinter printRect
++ val () = PolyML.addPrettyPrinter printRect
+ end;
+
diff --git a/dev-lang/polyml/files/polyml-5.5.1-inputN-return-for-zero-chars.patch b/dev-lang/polyml/files/polyml-5.5.1-inputN-return-for-zero-chars.patch
new file mode 100644
index 000000000000..8f5b02ee9084
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.1-inputN-return-for-zero-chars.patch
@@ -0,0 +1,33 @@
+https://sourceforge.net/p/polyml/code/1875/
+Required for sci-mathematics/isabelle-2013.2
+
+------------------------------------------------------------------------
+r1875 | dcjm | 2013-10-30 10:49:05 -0600 (Wed, 30 Oct 2013) | 1 line
+
+Backport commit 1874 from trunk. This fixes TextIO.inputN and StreamIO.inputN so they return immediately if the request is for zero characters.
+Index: polyml/basis/BasicStreamIO.sml
+===================================================================
+--- polyml/basis/BasicStreamIO.sml (revision 1851)
++++ polyml/basis/BasicStreamIO.sml (working copy)
+@@ -213,6 +213,8 @@
+ fun inputN (f, n) =
+ if n < 0
+ then raise Size
++ else if n = 0 (* Defined to return the empty vector and f *)
++ then (emptyVec, f)
+ else
+ let
+ val (vecs, f') = inputNList (f, n)
+Index: polyml/basis/TextIO.sml
+===================================================================
+--- polyml/basis/TextIO.sml (revision 1851)
++++ polyml/basis/TextIO.sml (working copy)
+@@ -597,6 +597,8 @@
+ | inputN' n (ref(Direct(strm as {buffer, bufp, buflimit, ...}))) =
+ if n < 0 orelse n > CharVector.maxLen
+ then raise Size
++ else if n = 0
++ then "" (* Return the empty string without blocking *)
+ else if !buflimit = 0
+ then (* Last read returned end-of-file. Clear the EOF state once
+ we return this empty string. *)
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..5b33203d69e1
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch
@@ -0,0 +1,141 @@
+https://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
diff --git a/dev-lang/polyml/files/polyml-5.5.2-r1952-check_for_negative_sized_array.patch b/dev-lang/polyml/files/polyml-5.5.2-r1952-check_for_negative_sized_array.patch
new file mode 100644
index 000000000000..1451d2df8d84
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.2-r1952-check_for_negative_sized_array.patch
@@ -0,0 +1,13 @@
+Index: polyml/basis/Array.sml
+===================================================================
+--- polyml/basis/Array.sml (revision 1951)
++++ polyml/basis/Array.sml (revision 1952)
+@@ -129,7 +129,7 @@
+
+ fun array(len, a) =
+ let
+- val () = if len >= maxLen then raise General.Size else ()
++ val () = if len < 0 orelse len >= maxLen then raise General.Size else ()
+ val vec = System_alloc(len+1, 0wx40, RunCall.unsafeCast a)
+ in
+ System_setw(vec, 0, RunCall.unsafeCast len);
diff --git a/dev-lang/polyml/files/polyml-5.5.2-r1954_Fix_segfault_in_FFI_when_malloc_runs_out_of_memory.patch b/dev-lang/polyml/files/polyml-5.5.2-r1954_Fix_segfault_in_FFI_when_malloc_runs_out_of_memory.patch
new file mode 100644
index 000000000000..783577026f67
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.2-r1954_Fix_segfault_in_FFI_when_malloc_runs_out_of_memory.patch
@@ -0,0 +1,112 @@
+Index: polyml/libpolyml/foreign.cpp
+===================================================================
+--- polyml/libpolyml/foreign.cpp (revision 1953)
++++ polyml/libpolyml/foreign.cpp (revision 1954)
+@@ -4,7 +4,7 @@
+
+ Copyright (c) 2000-7
+ Cambridge University Technical Services Limited
+- Further development Copyright David C.J. Matthews 2008-2011.
++ Further development Copyright David C.J. Matthews 2008-2014.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+@@ -251,6 +251,10 @@
+
+ static Volatile *vols;
+ static PLock volLock; // Mutex to protect vols.
++// TODO: There is a theoretical risk of deadlock if any ML allocation is made while this
++// lock is held. An allocation can result in a GC which requires all threads to release
++// ML memory but another thread could block waiting for the mutex.
++// N.B. raising an exception involves an allocation.
+
+ #define FIRST_VOL 0
+
+@@ -268,24 +272,8 @@
+ static unsigned callBackEntries = 0;
+ static PLock callbackTableLock; // Mutex to protect table.
+
+-
+ /**********************************************************************
+ *
+- * Malloc / Free Wrappers
+- *
+- **********************************************************************/
+-
+-static POLYUNSIGNED malloc_count = 0;
+-#if 0
+-#define Vmalloc(where,size) {where = malloc(size); printf("malloc: %p,%d\n",where,size); fflush(stdout); malloc_count++;}
+-#else
+-#define Vmalloc(where,size) {where = malloc(size); malloc_count++;}
+-#endif
+-#define Vfree(p) { free(p); malloc_count--;}
+-
+-
+-/**********************************************************************
+- *
+ * Volatile Allocation
+ *
+ **********************************************************************/
+@@ -349,8 +337,12 @@
+ PLocker plocker(&volLock);
+ Handle res = vol_alloc(taskData);
+ trace(("size= %" POLYUFMT "\n",size));
+- Vmalloc( C_POINTER(UNVOLHANDLE(res)), size );
++ void *p = malloc(size);
++ if (p == 0)
++ RAISE_EXN("Insufficient memory");
++ C_POINTER(UNVOLHANDLE(res)) = p;
+ OWN_C_SPACE(UNVOLHANDLE(res)) = true;
++
+ return res;
+ }
+
+@@ -685,7 +677,7 @@
+ {
+ // Can now free this.
+ trace(("Freeing malloc space of <%" POLYUFMT ">\n",from));
+- Vfree(vols[from].C_pointer);
++ free(vols[from].C_pointer);
+ vols[from].C_pointer = 0;
+ vols[from].Own_C_space = false;
+ }
+@@ -702,7 +694,6 @@
+ }
+ }
+ next_vol = to;
+- info(("unfreed mallocs=<%" POLYUFMT "> next_vol=<%" POLYUFMT ">\n", malloc_count, next_vol));
+
+ /* Callback table. Added DCJM 12/4/04. We always process these as strong references.
+ For the time being at any rate we treat these as permanent entries so that once a
+@@ -910,8 +901,9 @@
+ RAISE_EXN("libffi error: ffi_prep_cif failed");
+
+ // malloc memory for the result
+- void *result;
+- Vmalloc(result, result_type->size);
++ void *result = malloc(result_type->size);
++ if (result == 0)
++ RAISE_EXN("Insufficient memory to allocate space for result");
+
+ processes->ThreadReleaseMLMemory(taskData);
+ ffi_call(&cif, sym, result, arg_values);
+@@ -1580,6 +1572,9 @@
+
+ unsigned num_args = length_list(argTypeList->Word());
+ ffi_type **arg_types = (ffi_type**)malloc(num_args * sizeof(ffi_type*));
++ if (arg_types == 0)
++ RAISE_EXN("Insufficient memory to allocate space for arguments");
++
+ PolyWord p = argTypeList->Word();
+ for (POLYUNSIGNED i=0; i<num_args; i++,p=Tail(p))
+ arg_types[i] = ctypeToFfiType(taskData, Head(p));
+@@ -1587,6 +1582,9 @@
+
+ // The cif needs to be on the heap so that it is available in the callback.
+ ffi_cif *cif = (ffi_cif *)malloc(sizeof(ffi_cif));
++ if (cif == 0)
++ RAISE_EXN("Insufficient memory to allocate space for cif");
++
+ if (ffi_prep_cif(cif, abi, num_args, result_type, arg_types) != FFI_OK)
+ RAISE_EXN("libffi error: ffi_prep_cif failed");
+
diff --git a/dev-lang/polyml/files/polyml-5.5.2-r2007_Ensure_the_large_object_cache_pointer_is_cleared.patch b/dev-lang/polyml/files/polyml-5.5.2-r2007_Ensure_the_large_object_cache_pointer_is_cleared.patch
new file mode 100644
index 000000000000..36c82947f37b
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.2-r2007_Ensure_the_large_object_cache_pointer_is_cleared.patch
@@ -0,0 +1,27 @@
+Index: polyml/libpolyml/gc_mark_phase.cpp
+===================================================================
+--- polyml/libpolyml/gc_mark_phase.cpp (revision 2006)
++++ polyml/libpolyml/gc_mark_phase.cpp (revision 2007)
+@@ -130,13 +130,6 @@
+ if (locPtr == LARGECACHE_SIZE) locPtr = 0;
+ largeObjectCache[locPtr].base = obj;
+ largeObjectCache[locPtr].current = currentPtr;
+- // To try to narrow down a bug that results in the ASSERT failing,
+- // add these extra checks.
+- POLYUNSIGNED lengthWord = obj->LengthWord();
+- ASSERT (OBJ_IS_LENGTH(lengthWord));
+- POLYUNSIGNED length = OBJ_OBJECT_LENGTH(lengthWord);
+- ASSERT(length == originalLength);
+- ASSERT(currentPtr > (PolyWord*)obj && currentPtr < ((PolyWord*)obj)+length);
+ }
+ }
+ else StackOverflow(obj);
+@@ -579,6 +572,8 @@
+ ASSERT(nInUse == 0);
+ MTGCProcessMarkPointers *marker = &markStacks[0];
+ marker->active = true;
++ marker->locPtr = 0;
++ marker->largeObjectCache[0].base = 0;
+ nInUse = 1;
+
+ // Scan the permanent mutable areas.
diff --git a/dev-lang/polyml/files/polyml-5.5.2-r2009_Initialise_the_largeObjectCache_fully_in_the_constructor.patch b/dev-lang/polyml/files/polyml-5.5.2-r2009_Initialise_the_largeObjectCache_fully_in_the_constructor.patch
new file mode 100644
index 000000000000..0629f12f72ca
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.2-r2009_Initialise_the_largeObjectCache_fully_in_the_constructor.patch
@@ -0,0 +1,21 @@
+Index: polyml/libpolyml/gc_mark_phase.cpp
+===================================================================
+--- polyml/libpolyml/gc_mark_phase.cpp (revision 2008)
++++ polyml/libpolyml/gc_mark_phase.cpp (revision 2009)
+@@ -176,6 +176,16 @@
+ // Clear the mark stack
+ for (unsigned i = 0; i < MARK_STACK_SIZE; i++)
+ markStack[i] = 0;
++ // Clear the large object cache. Actually only largeObjectCache[0].base
++ // needs to be set to zero and for the objects allocated on the heap it is
++ // cleared before each GC in either MarkRoots or MarkPointersTask.
++ // The remianing case is the RescanMarked sub-class which is allocated on the stack
++ // but it doesn't hurt to clear it in all cases.
++ for (unsigned j = 0; j < LARGECACHE_SIZE; j++)
++ {
++ largeObjectCache[locPtr].base = 0;
++ largeObjectCache[locPtr].current = 0;
++ }
+ }
+
+ // Called when the stack has overflowed. We need to include this