Skip to content

Commit

Permalink
MLKit 64bit (#25)
Browse files Browse the repository at this point in the history
MLKit now generates 64bit assembler under both Linux and macOS for all combinations of GC, Region-based memory management, and profiling. All tests are working, including the following targets:

* `make mlkit`
* `make mlkit_libs`
* `(cd test_dev; make test)`
* `(cd test; make test_mlkit)``
* `make bootstrap`

There are a number of possibilities for improvements and features that are not currently included. In particular, the KAM backend, which is the basis for SMLserver, has not yet been ported. 

Possibilities for improvements include:

* Elimination of the `gen->b` pointer (use alignment properties instead).
* Inlining of allocation in regions (for the common case).
* Figure out how to assign certain C callee-save registers to variables that are live across C calls.
* Many peep-hole optimisations seem possible.
* Eliminate the need for dynamic stack alignment on 16-byte boundaries.
* Test the preliminary support for generational garbage collection.
* Use conditional move instructions instead of conditional jumps when possible.
* Add Word64 and Word63 modules and friends. Whenever we have WordX, we should also have IntX. We should then also modify the default word type to be Word64.word if GC is disabled and Word63.word if GC is enabled. Immediate constants of size 64 and 63 should also be supported.
  • Loading branch information
melsman authored Jan 30, 2019
1 parent 75be78c commit e9ceb56
Show file tree
Hide file tree
Showing 185 changed files with 19,462 additions and 3,301 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ install:
- make mlkit_bin_dist

script:
- cd test && make test_mlkit
- cd ../js/test && make test
- make -C test_dev test
- make -C test test_mlkit
- make -C js/test test

deploy:
provider: releases
Expand Down
20 changes: 12 additions & 8 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ SHELL=@SHELL@
KITVERSION=@PACKAGE_VERSION@

prefix=@prefix@
datarootdir=@datarootdir@
datadir=@datadir@
srcdir=@srcdir@
top_srcdir=@top_srcdir@
exec_prefix=@exec_prefix@
Expand Down Expand Up @@ -162,7 +164,7 @@ clean:
cd ml-yacc-lib && $(CLEAN)
cd kitdemo && $(CLEAN) run */*~
cd test && $(MAKE) clean
cd test_dev && $(CLEAN) run *.out *.log
cd test_dev && $(MAKE) clean
cd src && $(MAKE) clean
$(MAKE) -C smlserver_demo clean
cd smlserver && $(CLEAN)
Expand Down Expand Up @@ -291,6 +293,7 @@ install_src:
$(MKDIR) $(INSTDIR)/src/Compiler/Backend $(INSTDIR)/src/Compiler/Lambda $(INSTDIR)/src/Compiler/Regions
$(MKDIR) $(INSTDIR)/src/Compiler/Backend/Barry $(INSTDIR)/src/Compiler/Backend/Dummy $(INSTDIR)/src/Compiler/Backend/KAM
$(MKDIR) $(INSTDIR)/src/Compiler/Backend/X86
$(MKDIR) $(INSTDIR)/src/Compiler/Backend/X64
$(MKDIR) $(INSTDIR)/src/Tools/Benchmark $(INSTDIR)/src/Tools/GenOpcodes $(INSTDIR)/src/Tools/MlbMake $(INSTDIR)/src/Tools/Rp2ps
$(MKDIR) $(INSTDIR)/src/Tools/Tester $(INSTDIR)/src/Tools/MspComp
$(INSTALLDATA) src/Makefile src/*.{sml,in} $(INSTDIR)/src
Expand All @@ -304,6 +307,7 @@ install_src:
$(INSTALLDATA) src/Compiler/Backend/Dummy/*.sml $(INSTDIR)/src/Compiler/Backend/Dummy
$(INSTALLDATA) src/Compiler/Backend/KAM/*.{sml,spec} $(INSTDIR)/src/Compiler/Backend/KAM
$(INSTALLDATA) src/Compiler/Backend/X86/*.sml $(INSTDIR)/src/Compiler/Backend/X86
$(INSTALLDATA) src/Compiler/Backend/X64/*.sml $(INSTDIR)/src/Compiler/Backend/X64
$(INSTALLDATA) src/Manager/*.{sml,sig,mlb} $(INSTDIR)/src/Manager
$(INSTALLDATA) src/Kitlib/*.{sml,sig,mlb} $(INSTDIR)/src/Kitlib
$(INSTALLDATA) src/Pickle/*.{sml,sig,mlb} $(INSTDIR)/src/Pickle
Expand Down Expand Up @@ -333,7 +337,7 @@ bootstrap_first:

bootstrap_next_build:
cd src && $(MAKE) genopcodes BINDIR=../$(BINDIR)
cd src/Compiler && SML_LIB=$(CWD) ../../bin/mlkit -gc native.mlb
cd src/Compiler && SML_LIB=$(CWD) ../../bin/mlkit -gc native64.mlb

bootstrap_next_install:
$(MAKE) install_top
Expand Down Expand Up @@ -386,9 +390,9 @@ man_smltojs:
# $ ./configure
# $ make all
# -----------------------------------------------------
MLKIT_DIST_BIN=mlkit-$(KITVERSION)-x86
.PHONY: mlkit_x86_tgz
mlkit_x86_tgz:
MLKIT_DIST_BIN=mlkit-$(KITVERSION)-x64
.PHONY: mlkit_x64_tgz
mlkit_x64_tgz:
$(MKDIR) dist
rm -rf dist/$(MLKIT_DIST_BIN)
$(MAKE) install0 DESTDIR=$(CWD)/dist/$(MLKIT_DIST_BIN) prefix=
Expand All @@ -403,9 +407,9 @@ mlkit_x86_tgz:
# $ make smltojs
# $ make smltojs_basislibs
# -----------------------------------------------------
SMLTOJS_DIST_BIN=smltojs-$(KITVERSION)-x86
.PHONY: smltojs_x86_tgz
smltojs_x86_tgz:
SMLTOJS_DIST_BIN=smltojs-$(KITVERSION)-x64
.PHONY: smltojs_x64_tgz
smltojs_x64_tgz:
$(MKDIR) dist
rm -rf dist/$(SMLTOJS_DIST_BIN)
$(MAKE) install_smltojs0 DESTDIR=$(CWD)/dist/$(SMLTOJS_DIST_BIN) prefix=
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## MLKit NEWS

* mael 2019-01-22: MLKit now uses a native 64bit backend.

* mael 2018-08-25: Support for automatic deployment of binary builds.

### MLKit version 4.3.12 is released
Expand Down
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ Library.
[![Issue Stats](http://issuestats.com/github/melsman/mlkit/badge/issue)](http://issuestats.com/github/melsman/mlkit)
[![Build Status](https://travis-ci.org/melsman/mlkit.svg?branch=master)](https://travis-ci.org/melsman/mlkit)

## Installation

Under macOS, MLKit is available through Homebrew: Just execute `brew
install mlkit`. Under Linux, you may install a binary version of MLKit
using an [mlkit PPA from Launchpad](https://launchpad.net/~pmunksgaard/+archive/ubuntu/mlkit).


## MLKit Features

* Covers all of Standard ML. The MLKit compiles all of Standard ML,
Expand All @@ -33,10 +40,10 @@ Library.
this respect.

* Reference-tracing Garbage Collection: The MLKit supports
reference-tracing garbage collection in combination with region
reference-tracing garbage collection in combination with region-based
memory management.

* Native backend for the x86 architecture.
* Native backend for the x64 architecture (under Linux and macOS).

* [Documentation](http://www.elsman.com/mlkit/doc.html). A
comprehensive guide on programming with the MLKit is
Expand Down Expand Up @@ -69,7 +76,7 @@ for details. The runtime system (`/src/Runtime/`) and libraries

To compile, install, and use the MLKit, a Linux box running Ubuntu
Linux, Debian, gentoo, or similar is needed. The MLKit also works on
Mac OS and has also earlier been reported to run on the FreeBSD/x86
macOS and has also earlier been reported to run on the FreeBSD/x86
platform, with a little tweaking.

To compile the MLKit, a Standard ML compiler is needed, which needs to
Expand Down Expand Up @@ -137,7 +144,7 @@ Execute the following command:
$ make mlkit_libs
````

## Installation
## Installation after Compilation

For a system wide installation of the MLKit, installation including
man-pages and tools, execute the command:
Expand All @@ -155,13 +162,15 @@ $ make install

To build a binary package, execute the command
````bash
$ make mlkit_i386_tgz
$ make mlkit_x64_tgz
````

This command leaves a package `mlkit-X.Y.Z-i386.tgz` in the `dist/`
This command leaves a package `mlkit-X.Y.Z-x64.tgz` in the `dist/`
directory. For building a binary package, the installation step above
is not needed and the bootstrapping step is optional.

For building packages containing both MLKit and SMLtoJs, consult the Makefile.

## Try It

To test the installation, copy the directory `/usr/share/mlkit/kitdemo` to
Expand All @@ -188,7 +197,7 @@ and `man/man1`. License information is located in the file

## Comments and Bug Reports

The MLKit has a number of [known bugs and limitations](http://www.elsman.com/mlkit/bugs.html). To file a bug-report, create an issue at the Github page.
The MLKit has a number of [known bugs and limitations](http://elsman.com/mlkit/bugs.html). To file a bug-report, create an issue at the Github page.

## Appendix A: Directory Structure of the Sources

Expand All @@ -214,14 +223,16 @@ After having checked out the sources from Github, execute the command:
$ ./autobuild
````

To compile and install the MLKit, execute the following commands:
To compile the MLKit, execute the following commands:
````bash
$ ./configure
$ make mlkit
$ make bootstrap
$ make mlkit_libs
````

The `make bootstrap` command is optional.

To install the MLKit and related tools, execute:
````bash
$ sudo make install
Expand Down
Loading

0 comments on commit e9ceb56

Please sign in to comment.