Poly/ML Home
About Poly/ML
Support for Poly/ML
Documentation
Get Poly/ML

Poly/ML Version 5.5.1

Released September 2013

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.

Poly/ML Version 5.5

Released September 2012

Major New Features

  • Storage management rewrite. The storage management system has been almost completely rewritten. The garbage collector is parallelised and a new mechanism has been introduced to adjust the size of the heap. When space is very short an extra pass may be triggered that merges immutable cells with the same contents. Thanks to Tobias Nipkow and the Technical University of Munich for support for this work.
  • PolyML.shareCommonData has been parallelised and now uses a dynamic stack to avoid a possible segfault if the C stack overflows with deep data structures.
  • There is now support for 64-bit on Windows using either mingw or Visual Studio.
  • Added a PolyML.Statistics structure to extract information about the current ML program or that running in another process.
  • The standard "text" and "data" areas are now used for exported object files. In particular this removes the need for --segprot when linking the object files on Mac OS X with previous versions.
  • libffi is now used for foreign function interface (CInterface). Among other things this allows the full range of types to be use on X86/64. A version of libffi is included in the source but those packaging Poly/ML may prefer to use the --with-system-libffi option to the configure script to use the version installed on the machine.
  • Withdrawn support for native-code on PPC and Sparc. The configure script will now fall back to the interpreted version on these platforms.

Minor Additions and Changes

  • Added G, M, K suffix to RTS arguments for --maxheap and --minheap.
  • Some changes to where "op" is allowed to conform more closely to the Definition.
  • --debug and --logfile options. These allow fine control of debugging information within the run-time system.
  • Added --error-exit option to terminate the top-level loop if any command raises an exception.
  • Added PolyML.IntInf with gcd and lcm functions to use GMP's gcd function if available.
  • Added PolyML.Compiler.allocationProfiling to work with PolyML.profiling 4. This causes each full GC to print a profile indicating where the currently live data has been allocated.
  • Removed NetDB structure from the library since this was in an early draft of the basis library but not in the final book.
  • Added PolyML.Codetree structure within PolyML. This allows ML code to build intermediate code data structures and generate machine code from them.
  • Added "--use FILENAME" command line argument to run a command from a file before starting the main Read-Eval-Print loop.

Bug Fixes

  • Fixes related to Word32 on X86-64 and Word.~>>.
  • Vol allocation locking issue
  • Floating point box issue
  • Fix some functions in the Windows structure to match the Basis Library definition
  • Fix a possible crash if a GC happened while another thread was in foreign code.
  • Fix error in printer function for a datatype where the effect of PolyML.print_depth depended on the posiition of a constructor in the datatype.
  • Fix bug with flexible record handling.
  • Fix Real.fmt and Real.toString to conform to the Basis Library definition.
  • Fix Real.abs with nan argument.
  • Fix IEEEReal.toString for nan argument.
  • Fix code-generator bug which resulted in incorrect result for Real.nextAfter.
  • Fix bug the produced Subscript exceptions in stream IO.

Poly/ML Version 5.4

Released September 2010

Major New Features

  • Major rewrite of the X86 code-generator and combining the 32 and 64-bit versions into a single module. It now supports the floating point instructions.
  • Changes to the way functions with polymorphic equality are handled to eliminate the "structural equality" code.
  • Uses the GMP library if that is available when Poly/ML is built otherwise falls back to the old Poly/ML code.

Minor Additions and Changes

  • Added a SingleAssignment structure
  • Support for the Itanium processor using the interpreted version.
  • Various bug fixes.

Poly/ML Version 5.3

Released November 2009

Major New Features

  • Addition of IDE interface support.
  • Changes to pretty-printing and equality. These are now inherited across module boundaries. Addition of PolyML.addPrettyPrinter to install a new-style pretty printer.
  • Reworked implementation of signatures reducing the memory requirements when a named signature is used in multiple places.
  • Improvements to printing of types and error messages.

Minor Additions and Changes

  • Support for out-of-tree builds
  • Added finalisation for foreign-function interface (CInterface)
  • Removed remaining support for ML90
  • Added PolyML.sourceLocation pseudo-function that returns the current source location, PolyML.raiseWithLocation that raises an exception with an explicit location and PolyML.exceptionLocation that returns the location where an exception was raised.
  • Added PolyML.Compiler.reportUnreferencedIds switch to enable reporting of unreferenced identifiers.
  • Added breakEx and clearEx to debugger functions. These enter the debugger when the code raises a given exception.
  • Improvement to resonsiveness to pipes especially in Windows.
  • Added X86-64 version of Word32 structure. 64-bit machines do not require 32-bit values to be "boxed".

Bug Fixes

  • Now builds on Mac OS X 10.6 (Snow Leopard)
  • Fix multi-threading on Sparc but now only supports v9 processors.
  • Fix timing-related crash when Poly/ML exits
  • Fix string argument to OS.SysErr exception
  • Fix to OS.FileSys.mkDir in Windows
  • Fix to pow(~1, n) where n is even
  • Various fixes to conform more closely to the standard.

Poly/ML Version 5.2.1

Released October 2008

Bug Fixes

  • Various fixes to the run-time system.
  • Fix in Thread.ConditionVar.waitUntil. This could deadlock if the time calculation resulted in a garbage collection.
  • Fix to Substring.isPrefix and Substring.isSuffix with single character arguments.
Minor Additions and Changes
  • X-Windows/Motif is now not included by default. The --with-x option is required for configure
  • Functional I/O has been changed to be more efficient.

Poly/ML Version 5.2

Released June 2008

Major New Features

  • Changes to PolyML.compiler. Addition of "namespaces" to allow top-level declarations to be grouped
  • Improvements to real numbers on X86 (32 and 64-bit)
  • Improvements to the source-level debugger
  • Addition of weak references in the Weak structure.

Minor Additions and Changes

  • Fixed a hot-spot in the compiler.
  • Changes to handling of signals in the Signal structure

Poly/ML Version 5.1

Released November 2007

Major New Features

  • True multi-threading
  • Saving state

Minor Additions and Changes

  • Support for building Windows version on msys.
  • Support for building interpreted version for ARM processor.
  • Changes to some message values in the Windows interface structure. The type of Windows callback functions has changed.
  • Addition of Int32 structure and TEXT_IO signature to the basis library.
  • Support for building Sparc version on Linux.
  • SIGALRM is no longer used by the run-time system.

Bug Fixes

  • Now builds on Mac OS X 10.5 (Leopard)
  • Fix for Sparc Solaris 10 which would crash because Poly/ML used the g7 register
  • Added signature constraints after structure values (strexp: sigexp)
  • Word8Array.vector produced wrong value when applied to an empty array.
  • Fix to type of Real.fromDecimal and changes to handling of overflow in conversion of strings to reals.
  • Fix to Word32.~ and addition of overload for it.
  • Fix to start-up code on PowerPC which could cause a crash under some C compilers.

Poly/ML Version 5

New Features

  • Support for stand-alone binaries
  • Support for additional platforms: AMD64, Intel Macs, Cygwin
  • No artificial limits on size of heaps or saved image
  • Uses standard GNU tools for building
  • Fixed address mmap and trap-handling removed

Version 5

Thanks to some financial support from the Verisoft project organised through the Technical University of Munich I have spent several months updating the Poly/ML run-time system. There are many internal changes detailed below but there is one major change that is likely to affect all users. The persistent storage system that has been a feature of Poly/ML almost since the beginning has finally reached its sell-by date and has been removed. In its place there is the facility to export ML functions as object files and link them to produce stand-alone executables.

Although the ML code has not been significantly changed, with the exception of a new code-generator for the 64-bit AMD/Intel processor, the run-time system has been modified substantially. The aim has been to try to produce a version that will work across a wider range of systems than before and will be much simpler to maintain. The C code has been converted to C++ and standard GNU tools: autoconf, automake and libtool are used to build the system. Memory mapping to fixed addresses, which caused problems with various Linux distributions, has been removed and the use of traps to handle arbitrary precision overflow and heap limits has been replaced by calls into the run-time system. The artificial limits on the size of the heap and of the saved database have been removed and the only limit on the size of the working heap is likely to be swap space.

To build and install Poly/ML download and unpack the source. You can then build poly with the commands

./configure
make
make install

./configure by default places installed files within /usr/local and in particular the libraries are placed in /usr/local/lib. Some Unix distributions (e.g. Fedora Core) do not include /usr/local/lib in the library search path and on those distributions it may be better to override this by specifying
./configure --prefix=/usr

You build an application by constructing your application as an ML function and calling PolyML.export. PolyML.export takes as its argument a file name for the resulting object file and a function to export. It will automatically add the normal extension for an object file (.o or .obj as appropriate) unless it already included and write out the function and any data reachable from it as a normal operating system object file. This can then be linked with the poly libraries to build an application.

Example of building an application

$ poly
Poly/ML 5.0 Release
> fun f () = print "Hello World\n";
val f = fn : unit -> unit
> PolyML.export("hello", f);
val it = () : unit
> ^D
$ cc -o hello hello.o -lpolymain -lpolyml
$ ./hello
Hello World

If you have installed the libraries in a directory that is not in the search path you may need to add this. For example
cc -o hello hello.o -L/usr/local/lib -lpolymain -lpolyml
It is possible to use the ld command rather than cc here but you may need to include some of the default C and C++ libraries on the command line. On some platforms it may be necessary to add -lstdc++ and on Mac OS X you may need to add -segprot POLY rwx rwx to prevent a Bus Error when you run your application.

It is often the case that applications built using Poly/ML will want to use the normal Poly/ML top-level but with additional ML functions or structures built in. In the old version this was achieved by compiling the new declarations and then committing the database. The new version does this slightly differently. First compile in the new declarations as before and then export the Poly/ML top level by exporting PolyML.rootFunction.

$ poly
Poly/ML 5.0 Release
> val myValue = "This is a new value";
val myValue = "This is a new value" : string
> PolyML.export("mypoly", PolyML.rootFunction);
val it = () : unit
> ^D
$ cc -o mypoly mypoly.o -lpolymain -lpolyml
$ ./mypoly
Poly/ML 5.0 Beta1
> myValue;
val it = "This is a new value" : string
>

PolyML.export writes its output to an object file in the native format on the machine on which it is running. Currently Poly/ML supports three different formats: ELF, used on Linux, FreeBSD and Solaris; PCOFF, used on Windows and Cygwin and Mach-O, used on Mac OS X. If it is necessary to distribute software in object format it would be inconvenient to have to produce versions for each combination of architecture (e.g. X86-32, X86-64, PPC and Sparc) and each possible object format. To avoid this there is a PolyML.exportPortable function which takes similar arguments to PolyML.export but writes its output to a text file in a portable format. There is a polyimport command which loads a file stored in this format and runs it.

$ poly
Poly/ML 5.0
Release
> fun f () = print "Hello World\n";
val f = fn : unit -> unit
> PolyML.exportPortable("hello", f);
val it = () : unit
> ^D
$ polyimport hello.txt
Hello World

While this is convenient for porting the portable format is not designed for efficiency. The Poly/ML build process uses the portable format within the distribution but the build script then exports the code in the native format. N.B. The portable format only avoids the need to produce different object code formats. It is not portable across different architectures (e.g. i386 to PPC) since the portable file still contains native machine instructions encoded as strings.

The previous version of Poly/ML had a command line option to compress a database by sharing immutable data. This has been replaced in the new version by the PolyML.shareCommonData function. This takes as its argument any data structure and it processes this structure replacing any multiple occurrences of the same immutable data by a pointer to a single occurrence. In effect, wherever in the data structure there are two substructures which would be equal using the ML definition of equality there will be a pointer to a single data structure.

The intended use of this is primarily to reduce the size of a data structure before it is exported. It can be used in the above example but in this case the function being exported is so simple that it is unlikely to be worthwhile.

$ poly
Poly/ML 5.0
Release
> fun f () = print "Hello World\n";
val f = fn : unit -> unit
> PolyML.shareCommonData f;
val it = () : unit
> PolyML.export("hello", f);
val it = () : unit
> ^D

The new version uses the standard GNU tools: autoconf, automake and libtool. There is no need to install these tools in order to install and run Poly/ML unless you need to make modifications to the setup which are not handled within the configure and make files. Using these tools should make porting to other versions of Unix easier and should make it fairly simple to build binary or source distributions to include in Unix distributions.

The command line arguments to Poly/ML have been simplified. There are a few command line arguments that are taken by the Poly/ML run time system and the remainder are passed to the application via the standard basis library CommandLine structure. The run-time system recognises the following arguments:

-H <Initial heap size (MB)>
--immutable <Initial size of immutable buffer (MB)>
--mutable <Initial size of mutable buffer(MB)>
--debug <Debug options>
--timeslice <Time slice (ms)>

The poly application itself recognises a few arguments:

-v Print the version of Poly/ML and exit
--help Print the list of arguments and exit
-q Suppress the start-up message

If you are building your own application that recognises --help as a command line argument you should call PolyML.rtsArgumentHelp() to retrieve the information about the run-time system arguments and include this in any help text you produce.

The heap size arguments set the initial heap size but the heap may grow beyond this if your application needs more space. If no argument is set the default size is half the physical memory available on your machine.

Release notes: Version 4.1.4 Release

New features and Changes

Converted PolyML.dsw and PolyML.dsp to binary. This simplifies building from source on Windows.

The exception PolyML.Commit now has type string->exn.

PolyML.commit now raises PolyML.Commit if the database is read-only.

Timing functions no longer fail occasionally with getrusage: EINTR on Solaris (actually a work-around for a bug/documentation error in Solaris).

Release notes: Version 4.1.3 Release

New features and Changes

Printing control switches
New switches have been added to the Poly/ML.Compiler structure to control the printing of declarations. In both cases the default setting is true. Setting PolyML.Compiler.printInAlphabeticalOrder causes declarations to be printed in the order in which they were made rather than in alphabetical order. Setting PolyML.Compiler.printTypesWithStructureName to false causes types to be printed without the structure from which they came.

Large database support
The support for large databases has been improved and it is now possible to create a database which will occupy all of the virtual memory reserved for it. The actual limits vary between operating systems and platforms but are typically around 400Mbytes.

To aid this the -S option when running the disc garbage-collector (-d option), introduced in 4.1.1, has been extended with -Smin and -Smax. The options can be written using either -s or -S and with or without a space. Setting a size is now "sticky" so if no -s/-S option is given the previous limits are retained rather than being reset to the default. The -Smax option sets the limits to the maximum space available. This space now depends only on the size reserved for any parent databases and not, as before, on the history of the database.

The -Smin option compacts the database into a size whose upper limit is set to the size actually in use before compaction. To make best use of it it is probably best to run it twice, once to compact the database and again to set the upper limits to the now reduced size. It is useful when a database has been created which will not be modified further but where child databases may be created. Compacting a database to the minimum size allows any child databases to occupy as much space as possible.

The disc garbage collection has been changed so that it is now possible to use all the address space. Previously it was always necessary to reserve a certain portion of the space to allow the database to be collected.

Bugs fixed

Mac OS X 10.2
Mac OS X 10.2 introduced a undocumented change to the kernel interface when delivering signals. This meant that the original binaries will not run on 10.2. This has now been fixed.

Crash on delivering console interrupt on PowerPC
There was a bug in the Poly/ML process (lightweight thread) code on the PowerPC which caused a crash when a process terminated. This could happen when a user-installed signal handler was called, for example the console interrupt handler in Isabelle.

Crash in equality code
An error in the compilation of the equality function meant that certain expressions involving equality could cause a crash. This has been fixed.

 

Release notes: Version 4.1.2 Release

New features and Changes

Flexible records (Pattern rows with record wildcards)
The Standard requires that a flexible record must be constrained to a fixed set of labels by the program context.  It does not specify what that context should be.   Previous versions of Poly/ML, along with most other compilers, have required the context to be the point at which the declaration containing the flexible record was generalised, often requiring a type constraint.  For example:
let fun f {a, ...} = a in f{a=1,b=2} end;
was rejected.  Poly/ML now allows the record to be constrained anywhere within the same topdec.

 

Bugs fixed

"moveToVec - invalid constant address"
The compiler failed with an exception and this message when trying to take apart a tuple which was known at compile time to be an exception.  For example: let val (x,y) = raise Fail "" in x end; .

Infinite loop with unterminated input
If an input stream contained an error (e.g. a syntax or type error) and ended without a newline Poly would go into an infinite loop.

Linux/i386 - Crashes with large heaps
There were a number of crashes when the heap grew to several hundred megabytes as a result of it overwriting other data.  The virtual address range used has now been changed.   The maximum size of the heap on this architecture has also been increased to 1.1 Gigabytes for the immutable heap and 256 Megabytes for the mutable.

Linux - Compiling
The sources would not compile on some versions of Linux due to the use of <sys/time.h> instead of <time.h>.

Syntax of specifications and signature
There were a number of cases where Poly/ML would not accept the full syntax of Standard ML 97.  Empty specifications were not accepted, signature declarations were not accepted after type declarations within the same topdec and multiple type abbreviations connected by "and" were not accepted.

Windows bitViewer example
The bitViewer example contained a reference to the Base structure which has been removed, preventing it from compiling.

Interrupt exception while running the compiler
Raising an Interrupt exception from the console at certain points within the compiler could result in confusing traceback information being printed.

 

Release notes: Version 4.1.1Release

Update on 5th November 2001(driver source only).  Bug fix: Overflowing Poly stack could cause crash.
A deeply or infinitely recursing function could result in a segmentation fault.  It will now raise an Interrupt exception.

Update on 28th October 2001 (driver source only).  Bug fix: Large heaps in Linux caused random errors.
If the heap grew very large in Linux it could overwrite local variables, causing random failures.

New features and Changes

Windows™ interface
This release includes structures to allow Windows graphical programs to be written in Poly/ML.  See the Windows Programming in Poly/ML and  Windows Interface Reference for more information.

Extensions to the Symbolic Debugger.
The symbolic debugger introduced in version 4.1 has been extended.  There are additional functions to step over a function and to step out.  The debugger attempts to print the source line when it stops at a breakpoint.  For this to work the source must have been compiled using a full path name or the debugger must be run in the same directory that the source was compiled in.  The debugger now displays values from opened structures and in abstype declarations.

Printing top-level exceptions.
When an exception is raised at the top-level the compiler now prints the parameters in the exception packet if the exception is declared at the top-level or in any top-level structure.  Previously it would only print the parameters if the exception was declared unqualified at the top-level.
This is particularly useful for exceptions raised by the Standard Basis Library such as IO.Io and OS.SysErr.  Previously if, for example, TextIO.openIn failed to open a file the only information available was that the Io exception had been raised.  Now the parameters will be printed giving much more useful information.

Large databases.
Previous versions of Poly/ML had limits on the size of the database of around 63Mbytes.  This remains the default limit but larger databases are now possible, up to around 400Mbytes.  To increase the limit it is necessary to run the disc garbage collector and specify the -S option.
e.g. poly -d -S 250 ML_dbase
This will compact the database and set the maximum size to 250Mbytes.  Attempts to set the size to a value which is too large will fail with the message "Not enough address spaces".  The limit on the size depends on the current maximum database size (the larger the current size the smaller the new size may be) and is reduced if the database is a child database.
There are actually two limits on the size of a database: the mutable data size (space for refs and arrays) and the immutable data size (everything else) and a database cannot be expanded if either of these limits is reached.  The space available is divided between these two in the ratio 1:8.  There is currently no way of changing this.

CInterface structure
Added unsigned integer conversions.  Added functions to convert between Word8Vector.vector and C arrays.  toCchar and fromCchar now convert between the ML char type and C char rather using the ML string type.

Bugs fixed

Changes to representation of datatypes.
There was a potential bug in the way datatypes were implemented.  Previously the representation of a datatype was implemented using static information about the number of constructors and their types.  Various optimisations are possible if, for example, it is known that the only non-nullary constructor takes a tuple as an argument.   These optimisations are not always possible if a datatype can be passed as an argument to a functor.  Simon Finn pointed out that datatype replication could result in a datatype being passed into a functor in circumstances that was not possible in ML90.   Rather than remove the optimisation the handling of datatypes has been changed so that constructors are passed as arguments to a functor.  In practice these are optimised away if functors are expanded inline (the default setting).  Because it is now possible to use the optimised representation in all cases the code is likely to be faster than before.

Correctly converts negative hexadecimal numbers
Previously values such as ~0x1 were always converted as zero.

Correctly prints singleton records
Singleton records (e.g. {a=1}) were previously printed as {...}.

Some functions with side-effects were not evaluated if their results were not used
For example, fun f s = (print s; true); fun p s = not (f s); val _ = p "OK\n"; did not work correctly in 4.1.  This has been fixed.

Changes to allow compilation on Solaris 6.
There was a problem compiling the sources in older versions of Solaris.

 

Release notes: Version 4.1 Experimental

Bugs fixed

Exception matching in val bindings.
Previous releases contained a bug in the processing of val bindings when the pattern was an exception constructor.

Closing Standard Output.
Closing standard output caused an infinite loop in previous versions.

Changes since Version 4.0 Release

Source Level Debugger.
This release includes a source level debugger which allows the use to set and clear breakpoints and view local variables.  Code compiled for use with the debugger can be freely mixed with other code.  See here for a full description.  A PolyML.Debug structure has been added and a PolyML.Compiler.debug flag.

Free type variables.
The language definition says that no free type variables may enter the basis but leaves it to the implementer whether to refuse elaboration or instead replace the type variables by monotypes.  Version 4.0 refused to elaborate expressions such as
fun f () = raise Fail "error"; f();
Version 4.1 allows it to elaborate but produces a warning message.  The result is bound to a unique monotype distinct from any other type in the basis.

Substantial changes to the optimiser.
The optimiser has been substantially changed so that many more cases can be compiled in-line.  Small tail-recursive functions, such as List.foldl, are now compiled as while-loops within the calling functions.   Small recursive functions which are not tail-recursive, such as List.map, are compiled as specialised functions so that the function being mapped is inserted into the specialised function.   When mapping a small function over a list this can produce big improvements by avoiding the need for a function call for each element of the list.  Applying these optimisations and a few others within the compiler itself has produced a substantial speed up.

Formatting of pretty-printed output.
The format used when printing top-level expressions, particularly structures and functors, has been improved to give a more consistent appearance.

Tuples as results.
Previous versions of the compiler allocated memory to contain tuples returned from functions or even from an if-expression.  This version now allocates store on the stack to receive the results, reducing the load on the garbage collector.

Improvement to TextIO.
The TextIO structure is defined as imperative operations on top of the functional IO layer.  Implementing it in this way, though, turned out to be inefficient if the functional layer was not used.  TextIO has now been rewritten so that if TextIO.getInstream is never called on a stream it can be handled entirely within the imperative layer.

Specialised equality functions.
Previous releases contained specialised code for equality for a few built-in types such as int and string but defaulted to the general structure equality in more general cases.   The compiler now generates functions for equality in most cases.  Because of the changes to the optimiser these will usually be compiled in-line even when operating on recursive types such as lists.  This is most successful when the compiler has specific type information so the addition of a cast may well speed up a function.   

X-Windows/Motif - new functions.
The following functions have been added to the Motif structure:

val XtGetApplicationResources: Widget -> (string * string * XmRType) list -> Arg list
val XtAddEventHandler: > Widget -> XWindows.EventMask list -> bool -> (Widget * 'a XWindows.XEvent -> unit) -> unit
val XmMenuPosition: Widget -> 'a XWindows.XEvent -> unit

Assignment to references in the database.
Older versions of the compiler always made calls to the run-time system to handle assignment.  In version 4.0 this was changed so that the assignment operation was compile in-line, speeding up imperative functions when the reference being updated was local.  If the reference was in the database assignment involved a trap and the assignment was emulated by the run-time system.  This has now been changed so that there is only a trap the first time a reference is updated.  More specifically, references in the database are packed into pages and if any of the references in a page are updated the whole page is marked "dirty" and no further traps will occur for that page.
The format of a database has changed slightly as a result so version 4.1 databases may only be used with a run-time system built for this version.

Low-level code-generation.
Various changes have been made to the low-level code-generators, particularly in the handling of constants and calls to functions which are known at compile-time.  The code-generators now generate code for more functions such as Word.* which previously required calls to the run-time system.   Functions now contain information about the registers they modify to reduce the need to save registers across calls.

Mac OS/X
Real number rounding control (IEEEReal.getRoundingMode and IEEEReal.setRoundingMode) has now been added to the Mac OS/X version  of Poly/ML 4.1.  This version has been tested with the release version of Mac OS/X.  The foreign function interface (CInterface structure), time profiling (PolyML.profiling 1) and polling (OS.IO.poll) do not work in Mac OS/X.

Update on 25th April 2001.  Slow "commit" and database compaction in Linux and Solaris
There was a problem with writing to the database which appeared in some versions of Unix.   This was particularly noticeable on machines with slow discs or where the database was accessed over a network.  A revised version of the driver sources has now been installed to correct this problem.

Update on 3rd May 2001.  Bug fix: Corrupted parent database file name.
When running the disc garbage collector on a child database in Mac OS X the parent file name became corrupted.

Update on 3rd May 2001.  Fix to allow compilation on Mac OS X with X-Windows/Motif.

Release notes: Version 4.0 Release

Bugs fixed since Version 4.0 beta1

Negative integers printed strangely.
Bug in Version 4.0 beta1: Negative numbers printed as large positive numbers.

Files were created with execute permission.
The default creation mask for files was 777 (read, write and execute permission).   This has been changed to 666 (read and write permission).

i386 code-generator bug.
A bug was found in the i386 code-generator which among other things caused Poly/ML to crash when given an integer in hexadecimal (e.g. 0x1).

Linux:  Typing control-C would sometimes cause a crash.
Poly/ML would sometimes crash if control-C was pressed.   This was highly timing-dependent and occurred only if the SIGINT arrived at the same time as another signal such as a SIGSEGV used to indicate a garbage-collection or arbitrary-precision emulation trap.

 

Changes since Version 4.0 beta1

The default for print depth is now 100.
The default value for PolyML.print_depth is now 100 instead of 1.

Power architecture version now fully supported.
The Power architecture is now supported under MacOS-X beta and LinuxPPC.

Removed various exceptions from the PolyML structure.
The Interrupt, Div, Bind, Match, Size, Overflow, Underflow and Subscript exceptions have been removed from the PolyML structure.  These are either free in the basis or are in the SML90 structure.

X-Windows/Motif now compiles with LessTif and OpenMotif.

Sparc/Solaris: Removed check that the whole of the address space was available.
The Sparc/Solaris version attempts to reserve a very large region of memory to prevent any other library from allocating within the area that Poly/ML might use for its heap.   This caused problems if there was a limit on the amount of virtual memory that a program could reserve and has been removed.

Links as "discgarb" and "changeParent" now work for path names.
For backwards compatibility it is possible to create a link to the poly executable called "discgarb" and invoke the program through that rather than specify the -d option to poly.  This previously worked only if the program was invoked as "discgarb" not as, for example, "/usr/bin/discgarb".  This has now been changed so that only the last component of the name is examined.

 

Release notes: Version 4.0 beta1

Bugs fixed since Beta 4.0

"InternalError: equality - Overloadset found raised while compiling"
This message was produced when compiling certain combinations of overloaded functions and equality.

Failed to compile properly on RedHat 6.2 and other recent versions of Linux
The SRPM version of the 4.0 beta release would compile on RedHat 6.2, provided a few changes were made to the sources but the resulting binary crashed.

StringCvt.padLeft and padRight crashed when applied to single character strings
These functions caused a page fault when applied to strings containing a single character.

Changes since Beta 4.0

Introduced the POLYPATH environment variable to allow databases to be found using a path.
When searching for a database, whether given on the command line or to find the parent of a child database, poly searches using the path given in the POLYPATH environment variable.   On most platforms it defaults to ".:/usr/lib/poly:./usr/local/lib/poly" meaning that when searching for a database called "dbase" it will first look in the current directory and if that fails look for /usr/lib/poly/dbase and finally /usr/local/lib/poly/dbase before giving up.  Setting the POLYPATH to an explicit path allows the user to specify where databases are to be found.

As a result of this change poly now defaults to searching for a database called ML_dbase in the path if no database is given on the command line.   The restriction that a child database can only be created if the parent path name is fully specified has been removed.

Removed discgarb and changeParent.
The discgarb and changeParent programs have been removed and the functionality incorporated into the poly program.  New options have been added to poly.  The '-d' option compacts a database in the manner of discgarb.  An additional option '-c' can be used to run the
common-expression elimination phase.  The '-p' option changes the parent of a database as with changeParent.   The old behaviour can be retained by creating links to the poly binary called discgarb and changeParent and invoking the binary through these names.

Changed TextIO.stdOut to use line buffering.
In Beta 4.0 this was unbuffered.

Added interruptConsoleProcesses to the Process structure.
Process.interruptConsoleProcesses() causes all console process to be sent the SML90.Interrupt exception.   Usually there will only be one console process, the top-level loop which runs the compiler and executes the code.

 

Version 4.0 beta

Features and changes in this release.

Supports ML97

The revised definition of Standard ML (ML97) introduced a   number of changes.  Poly/ML now implements this version of the language.   Some of the old (ML90) features are available by setting PolyML.Compiler.ml90 to true.  The major changes include value polymorphism, which removes the need for imperative type variables and changes to the way structure sharing is handled.  Type abbreviations in signatures and datatype replication are also included.

Supports the Standard Basis Library

The Standard Basis Library is a suite of modules which provides a standard set of functions for many purposes as well as access to many operating system facilities. 

Other changes

Linux: supports larger database size.
Values are printed in alphabetical order.
Various code-generator changes and fixes.
Windows: the console is replaced by a Windows-style console.
Signal structure allows signals to be handled or blocked.