:version: 110.94
:date: October 31, 2019
:dist-dir: https://smlnj.org/dist/working/{version}/
:history: {dist-dir}HISTORY.html
:stem: latexmath
:source-highlighter: pygments
:stylesheet: release-notes.css
:notitle:

= Standard ML of New Jersey Release Notes

[subs=attributes]
++++
<div class="smlnj-banner">
  <span class="title"> Standard ML of New Jersey <br/> Release Notes </span>
  <br/> <br/>
  <span class="subtitle"> Version {version} <br/> {date} </span>
</div>
++++

''''''''
--
SML/NJ HOME::
  https://www.smlnj.org/index.html[[.tt]#https://smlnj.org#]
FILES::
  {dist-dir}index.html[[.tt]#{dist-dir}#]
--
''''''''

== Summary

This release is the first to provide support for 64-bit executables on
Linux and macOS.  Support for other operating systems (BSD variants and
64-bit windows) will be included in future releases.

This release also fixes a critical bug in the Windows implementation of
some of the `Math` functions.

== Details

=== Installation

==== 64-bit support

The various installation and configuration scripts have been updated
to accept a command-line argument to override the
default machine size when running on the x86/amd64 architecture.
For the `config/install.sh` script, you can specify the machine-word
size of the target architecture as follows:

--
  **-default** __size__::
    specify the default size for the **sml** and other commands, where
    __size__ is either **32** or **64**.

  **-32**::
    install the 32-bit version of the system.

  **-64**::
    install the 64-bit version of the system.
--

It is possible to install both versions in the same location by running
the `install.sh` script twice.  For example, the commands

[source,shell]
--------------
  % config/install.sh -32
  % config/install.sh -default 64
--------------

will install both versions with the 64-bit version as default.  One
would then use the command **sml -32** to run the 32-bit version of
the system.

If both versions are installed, then use the **-32** or **-64** flag
to override the default version.

==== 32-bit macOS issues

While the {dist-dir}smlnj-x86-{version}.pkg[x86 installer]
for {version} works on **macOs** 10.14 Mojave, building from source
requires some extra steps because the version of **Xcode**
distributed for Mojave does not include a 32-bit SDK.

Another issue that you may encounter
when building on **macOs** 10.14 Mojave is an error message for a shell
script of the form

.....
  /bin/sh: bad interpreter: Operation not permitted
.....

This error arises because the `com.apple.quarantine` attribute is set on the
shell script.  To fix the problem, remove the attribute using the command

[source,shell]
-----
  xattr -d com.apple.quarantine shell-script
-----
and resume the build.


=== Compiler

Various changes were made to support 64-bit targets.

Improved the CPS optimizer to do constant folding on numeric conversions when
the argument is a constant.

The fix for bug 130 required a change in the semantics of the type checker.
The definition of SML specifies that when typechecking a binding like
the following:
[source,sml]
------------
  val (x, NONE) = ([], SOME 1)
------------
the type of `x` should be polymorphic since the right-hand-side of the
binding is a syntactic value.  As of version 110.94, we now have a more
restrictive rule for when the left-hand-side variables are made polymorphic.
Specifically, the right-hand-side expression must be a syntactic value and
the left-hand-side pattern must be **irrefutable** (which is not the case
in this example).

=== MLRISC

Fixed a number of bugs in the instruction selection and encoding for the
**amd64** architecture.  Also made a slight improvement to the **x86**
instruction selector.

=== Runtime System

The runtime system has a two-level data structure for the garbage-collector's
BIBOP on 64-bit machines.

Made the handling of the `SysInt.int` and `SysWord.word` types consistent between
the runtime system and **SML** code.

=== ML-LPT

Switched the type of source-file positions from `Position.int` to `Int.int`.
This change is because the `Position.int` type was changed to `Int64.int` in
https://smlnj.org/dist/working/110.89/110.89-README.html[version 110.89],
which is excessive for source-file parsing and which introduces space
overhead (64-bit integers are boxed).

== Bugs

Here is a list of tracked bugs fixed (or closed) with this release, please see the
https://smlnj-gforge.cs.uchicago.edu/projects/smlnj-bugs[bug tracker]
for more details.

[.buglist,cols="^1,<15"]
|=======
| [.bugid]#130#
| failure to raise `Bind` exception
| [.bugid]#180#
| Missing warning for nonexhaustive valbind patterns
| [.bugid]#190#
| Unexpected exception in SML/NJ with invalid list pattern match
| [.bugid]#199#
| Compiler bug in pretty printing of result
| [.bugid]#225#
| `Math.ln` giving erroneous answers on **Windows**
| [.bugid]#226#
| **SML/NJ** does not support 64-bit systems
| [.bugid]#227#
| CPS contraction is taking an excessive amount of time on word8 basis test
|=======

== Supported systems

We believe that SML/NJ will build and run on the following systems, but have only
tested some of them:

[.support-table,cols="^2s,^4v,^3v",options="header",strips="none"]
|=======
| Architecture | Operating System | Status
| AMD64 | macOS 10.14 (Mojave) | Tested
| | macOS 10.15 (Catalina) | Tested
| | Ubuntu 16.04.3 LTS | Tested
| {nbsp} | |
| Power PC | Mac OS X 10.5 (Leopard) |
| | AIX |
| {nbsp} | |
| Sparc | Solaris |
| | Linux |
| {nbsp} | |
| x86 (32-bit) | Mac OS X 10.6 (Snow Leopard) |
| | Mac OS X 10.7 (Lion) |
| | Mac OS X 10.8 (Mountain Lion) |
| | Mac OS X 10.9 (Mavericks) |
| | Mac OS X 10.10 (Yosemite) |
| | Mac OS X 10.11 (El Capitan) |
| | macOS 10.12 (Sierra) | Tested
| | macOS 10.13 (High Sierra) | Tested
| | macOS 10.14 (Mojave) | Tested
| | Ubuntu 16.04.3 LTS | Tested
| | Other Linux variants |
| | BSD variants |
| | Windows 7 |
| | Windows 10 |
| | Cygwin (32-bit) |
| {nbsp} | |
|=======

