From 828af5795b215f43b75cf108c9e324231801914e Mon Sep 17 00:00:00 2001 From: asau Date: Sun, 15 Dec 2013 18:35:22 +0000 Subject: [PATCH] Update to Poly/ML 5.5.1 Contributed by Imre Vadasz on pkgsrc-users (slightly adapted). Changes in Poly/ML Version 5.5.1 Major New Features and Changes * The intermediate code optimiser has been largely rewritten. The optimiser now detects various additional cases where a closures or tuples can be stored on the stack rather than requiring heap storage * The match compiler that processes a sequence of patterns in a case or fun-binding has been reworked. This now handles complex matches that used to result in a code blow-up * A"polyc" script has been added to aid compiling and linking ML code to produce a stand-alone binary. This is intended as an analogue of cc and gcc. The easiest way to build a binary is now to put the ML code into a file (foo.ML) with a function "main" that is the entry point to the code. Then run polyc -o foo foo.ML The script takes care of any libraries that may be required. It does require that the poly binary and libraries have been installed to the location that was specified in the configure script. * Set the default in the configure script not to build a shared library. This can be overidden with --enable-shared. The advantage of this is that binaries created from Poly/ML, including poly itself, do not require libpolyml at run-time. * Additions and changes to the command-line options when starting the ML top-level + The --eval option can be followed by a string which is compiled and executed before the top-level is entered + The --script option can be used to allow ML code to be run as a script (a "shell script") in Unix. It reads the file name given as the last option, skipping the first line if it begins #!. Implies -q option. Note: because of the way scripts pass their options if used this must be the only option. To use ML as a script put the ML code into a file, put #! /usr/local/bin/poly --script as the first line, modifying the path depending on where poly is installed, and set the file to have execute permission. + The -q option now sets the print depth to zero as well as suppressing the start-up message + The input prompt (> or #) is only produced if the input is a terminal. The -i option should be used to cause the prompt to be produced if, for example, the input is from a pipe. Minor Additions and Changes * The -H option now sets the initial heap size rather than being a synonym for --minheap * Add large file support * When printing the fields a record print them in alphabetical order rather than the system order used in the compiler * Convert the representation of the statistics to use ASN1 encoding. This is byte-order and word-length independent and allows 32-bit Poly/ML to read the statistics of 64-bit Poly/ ML on the same machine and vice-versa. * Add a substructure Exception to the PolyML structure to hold all the functions related to exceptions. * The default for --gc-threads is now the number of independent physical processors. Hyperthreaded cores are counted as single cores rather than dual cores. * Improve the GC and allocation code for very large arrays * Improve handling of OS.Process.system in Cygwin * Improved versions of Word32 and Word64. These are used for SystemWord and LargeWord. Bug Fixes * Fix Word32.fromLargeInt which could return values outside the range of Word32 * Fix segfault in PolyML.stackTrace * Fix errors in conversion of string to real values * Fix segfault when a thread created in foreign code called an ML callback * Fix profiler which could often report UNKNOWN function * Fix bug with overlapped areas in ArraySlice.copy * Fix InternalError exception with ML code where a fixed record type could not be found * Fix bug with equality on BoolVector.vector * Raise the correct exception (Size) for negative lengths in canInput and inputN * Fix Real.fromInt with an argument that was an arbitrary precision number in the long form * Fix error in the timing information printed with PolyML.timing true in Windows. * Fix occasional problem with input/output as a result of the stream token being represented by an immutable value but then being checked for equality * Fix bug in X86-64 code-generator with literal constants that do not fit in 32-bits. It could result in an "InternalError: gen32s: invalid word" exception. Includes regression test. * Fix LargWord.fromInt which was wrong for large negative values * Fix bug in power-of-two function in code-generator. This caused an infinite loop with Word.* when multiplying by a constant with the highest bit set and not a power of two. * Fix bug in structure matching code * Use ELF_Rela relocation structures for all relocations in X86-64. Some systems e.g. Solaris require this. --- lang/polyml/Makefile | 13 +++++++++---- lang/polyml/PLIST | 4 +++- lang/polyml/distinfo | 11 ++++++----- lang/polyml/patches/patch-buildpolyc | 16 ++++++++++++++++ .../polyml/patches/patch-libpolyml_elfexport.cpp | 10 +++++----- 5 files changed, 39 insertions(+), 15 deletions(-) create mode 100644 lang/polyml/patches/patch-buildpolyc diff --git a/lang/polyml/Makefile b/lang/polyml/Makefile index 747aae031db6..b525235ea360 100644 --- a/lang/polyml/Makefile +++ b/lang/polyml/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.8 2012/10/08 14:34:06 asau Exp $ +# $NetBSD: Makefile,v 1.9 2013/12/15 18:35:22 asau Exp $ -DISTNAME= polyml.5.5 -PKGNAME= polyml-5.5 +DISTNAME= polyml.5.5.1 +PKGNAME= polyml-5.5.1 CATEGORIES= lang MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=polyml/} @@ -10,7 +10,6 @@ HOMEPAGE= http://polyml.org/ COMMENT= Poly/ML is an implementation of Standard ML # ONLY_FOR_PLATFORM= *-*-i386 *-*-x86_64 *-*-sparc *-*-powerpc -# Dumps core on NetBSD/amd64 GNU_CONFIGURE= yes CONFIGURE_ARGS= --with-system-libffi @@ -18,6 +17,12 @@ USE_LIBTOOL= yes USE_LANGUAGES= c c++ TEST_TARGET= tests +SUBST_CLASSES+= fix-rpath-flag +SUBST_STAGE.fix-rpath-flag= pre-configure +SUBST_MESSAGE.fix-rpath-flag= Fixing RPATH flag. +SUBST_FILES.fix-rpath-flag= buildpolyc +SUBST_SED.fix-rpath-flag= -e 's:@COMPILER_RPATH_FLAG@:${COMPILER_RPATH_FLAG}:g' + .include "options.mk" .include "../../devel/libffi/buildlink3.mk" diff --git a/lang/polyml/PLIST b/lang/polyml/PLIST index 13f47ca57b2a..bb85542212dd 100644 --- a/lang/polyml/PLIST +++ b/lang/polyml/PLIST @@ -1,7 +1,9 @@ -@comment $NetBSD: PLIST,v 1.1.1.1 2009/03/20 21:12:51 asau Exp $ +@comment $NetBSD: PLIST,v 1.2 2013/12/15 18:35:22 asau Exp $ bin/poly +bin/polyc bin/polyimport lib/libpolymain.la lib/libpolyml.la man/man1/poly.1 +man/man1/polyc.1 man/man1/polyimport.1 diff --git a/lang/polyml/distinfo b/lang/polyml/distinfo index 8761f04ca5e6..3b5b8ae861f3 100644 --- a/lang/polyml/distinfo +++ b/lang/polyml/distinfo @@ -1,6 +1,7 @@ -$NetBSD: distinfo,v 1.4 2012/10/08 14:33:32 asau Exp $ +$NetBSD: distinfo,v 1.5 2013/12/15 18:35:22 asau Exp $ -SHA1 (polyml.5.5.tar.gz) = 9b308d3ac69316d1fcb0f6ac5f9b9e2d2390d511 -RMD160 (polyml.5.5.tar.gz) = a2daf4230e7643c1febb455dea0c4f5682096d63 -Size (polyml.5.5.tar.gz) = 5504389 bytes -SHA1 (patch-libpolyml_elfexport.cpp) = b32d52ea2a0b00b15cab1ec3aff0dac84add1d56 +SHA1 (polyml.5.5.1.tar.gz) = f5a0d289eb0a891af5ac6e897ccc7718ccf32d89 +RMD160 (polyml.5.5.1.tar.gz) = 504a9e8c064355bcee638a3735f7e97b3f92d03e +Size (polyml.5.5.1.tar.gz) = 5465794 bytes +SHA1 (patch-buildpolyc) = 9106912954a05355f7eab3b8a531bc016a85ac6c +SHA1 (patch-libpolyml_elfexport.cpp) = 7291a7a1410651bee00662feb5f8d74337c14f3a diff --git a/lang/polyml/patches/patch-buildpolyc b/lang/polyml/patches/patch-buildpolyc new file mode 100644 index 000000000000..b19e8663f5ef --- /dev/null +++ b/lang/polyml/patches/patch-buildpolyc @@ -0,0 +1,16 @@ +$NetBSD: patch-buildpolyc,v 1.1 2013/12/15 18:35:23 asau Exp $ + +--- buildpolyc.orig 2013-08-03 12:23:37.000000000 +0000 ++++ buildpolyc +@@ -15,9 +15,9 @@ link() + { + if [ X"$2" = "X" ] + then +- ${LINK} ${EXTRALDFLAGS} $1 -L${LIBDIR} -lpolymain -lpolyml ${LIBS} ++ ${LINK} ${EXTRALDFLAGS} $1 -L${LIBDIR} @COMPILER_RPATH_FLAG@${LIBDIR} -lpolymain -lpolyml ${LIBS} + else +- ${LINK} ${EXTRALDFLAGS} $1 -o $2 -L${LIBDIR} -lpolymain -lpolyml ${LIBS} ++ ${LINK} ${EXTRALDFLAGS} $1 -o $2 -L${LIBDIR} @COMPILER_RPATH_FLAG@{LIBDIR} -lpolymain -lpolyml ${LIBS} + fi + } + diff --git a/lang/polyml/patches/patch-libpolyml_elfexport.cpp b/lang/polyml/patches/patch-libpolyml_elfexport.cpp index df1a7952dec3..5172efb0930c 100644 --- a/lang/polyml/patches/patch-libpolyml_elfexport.cpp +++ b/lang/polyml/patches/patch-libpolyml_elfexport.cpp @@ -1,10 +1,10 @@ -$NetBSD: patch-libpolyml_elfexport.cpp,v 1.1 2012/03/22 20:48:45 asau Exp $ +$NetBSD: patch-libpolyml_elfexport.cpp,v 1.2 2013/12/15 18:35:23 asau Exp $ ---- libpolyml/elfexport.cpp.orig 2010-04-14 22:13:42.000000000 +0000 +--- libpolyml/elfexport.cpp.orig 2013-06-11 11:13:52.000000000 +0000 +++ libpolyml/elfexport.cpp -@@ -62,6 +62,13 @@ - #ifdef HAVE_SYS_ELF_386_H - #include +@@ -65,6 +65,13 @@ + #ifdef HAVE_SYS_ELF_AMD64_H + #include #endif +#if defined(__NetBSD__) && defined(HOSTARCHITECTURE_X86_64) +#include