From 482d0c7bf40628c9bff8c3e219b8eb33e39d9935 Mon Sep 17 00:00:00 2001 From: hlolli Date: Tue, 14 May 2019 16:13:31 +0200 Subject: [PATCH] graalvm: rc15->19.0.0 --- .../compilers/graalvm/001_mx.py.patch | 24 ++++---- .../development/compilers/graalvm/default.nix | 57 ++++++++++++------- 2 files changed, 49 insertions(+), 32 deletions(-) diff --git a/pkgs/development/compilers/graalvm/001_mx.py.patch b/pkgs/development/compilers/graalvm/001_mx.py.patch index 25a9efa9641..a87a030aa39 100644 --- a/pkgs/development/compilers/graalvm/001_mx.py.patch +++ b/pkgs/development/compilers/graalvm/001_mx.py.patch @@ -1,8 +1,8 @@ diff --git a/mx.py b/mx.py -index d119b62..471fe98 100644 +index af7a9c2..08c0ea8 100755 --- a/mx.py +++ b/mx.py -@@ -4961,30 +4961,6 @@ class PackedResourceLibrary(ResourceLibrary): +@@ -4976,30 +4976,6 @@ class PackedResourceLibrary(ResourceLibrary): def get_path(self, resolve): extract_path = _make_absolute(self.extract_path, self.suite.dir) @@ -33,7 +33,7 @@ index d119b62..471fe98 100644 return extract_path def _check_download_needed(self): -@@ -5885,7 +5861,7 @@ class HgConfig(VC): +@@ -5900,7 +5876,7 @@ class HgConfig(VC): def update_to_branch(self, vcdir, branch, abortOnError=True): cmd = ['update', branch] @@ -42,7 +42,7 @@ index d119b62..471fe98 100644 def add(self, vcdir, path, abortOnError=True): return self.run(['hg', '-q', '-R', vcdir, 'add', path]) == 0 -@@ -5922,7 +5898,7 @@ class HgConfig(VC): +@@ -5937,7 +5913,7 @@ class HgConfig(VC): return None def parent_info(self, vcdir, abortOnError=True): @@ -51,7 +51,7 @@ index d119b62..471fe98 100644 author, date = out.split("|||") ts, _ = date.split(" ") return self._sanitize_parent_info({ -@@ -8287,46 +8263,8 @@ class SuiteImport: +@@ -8301,46 +8277,8 @@ class SuiteImport: version = import_dict.get("version") suite_dir = None version_from = import_dict.get("versionFrom") @@ -100,7 +100,7 @@ index d119b62..471fe98 100644 @staticmethod def get_source_urls(source, kind=None): -@@ -8367,8 +8305,6 @@ class Suite(object): +@@ -8381,8 +8319,6 @@ class Suite(object): :type dists: list[Distribution] """ def __init__(self, mxDir, primary, internal, importing_suite, load, vc, vc_dir, dynamicallyImported=False): @@ -109,7 +109,7 @@ index d119b62..471fe98 100644 self.imported_by = [] if primary else [importing_suite] self.mxDir = mxDir self.dir = dirname(mxDir) -@@ -8396,7 +8332,7 @@ class Suite(object): +@@ -8410,7 +8346,7 @@ class Suite(object): self._outputRoot = None self._preloaded_suite_dict = None self.vc = vc @@ -118,7 +118,7 @@ index d119b62..471fe98 100644 self._preload_suite_dict() self._init_imports() if load: -@@ -9295,7 +9231,9 @@ def get_dynamic_imports(): +@@ -9310,7 +9246,9 @@ def get_dynamic_imports(): class SourceSuite(Suite): """A source suite""" def __init__(self, mxDir, primary=False, load=True, internal=False, importing_suite=None, dynamicallyImported=False): @@ -129,7 +129,7 @@ index d119b62..471fe98 100644 Suite.__init__(self, mxDir, primary, internal, importing_suite, load, vc, vc_dir, dynamicallyImported=dynamicallyImported) logvv("SourceSuite.__init__({}), got vc={}, vc_dir={}".format(mxDir, self.vc, self.vc_dir)) self.projects = [] -@@ -9344,17 +9282,7 @@ class SourceSuite(Suite): +@@ -9359,17 +9297,7 @@ class SourceSuite(Suite): """ Gets the release tag from VC or create a time based once if VC is unavailable """ @@ -148,7 +148,7 @@ index d119b62..471fe98 100644 def scm_metadata(self, abortOnError=False): scm = self.scm -@@ -12526,55 +12454,8 @@ def _attempt_download(url, path, jarEntryName=None): +@@ -12541,55 +12469,8 @@ def _attempt_download(url, path, jarEntryName=None): return False def download(path, urls, verbose=False, abortOnError=True, verifyOnly=False): @@ -206,7 +206,7 @@ index d119b62..471fe98 100644 def update_file(path, content, showDiff=False): """ -@@ -13378,6 +13259,7 @@ class Archiver(SafeFileCreation): +@@ -13393,6 +13274,7 @@ class Archiver(SafeFileCreation): def _add_zip(self, filename, archive_name, provenance): self._add_provenance(archive_name, provenance) @@ -214,7 +214,7 @@ index d119b62..471fe98 100644 self.zf.write(filename, archive_name) def _add_str_zip(self, data, archive_name, provenance): -@@ -18526,12 +18408,35 @@ def _find_suite_import(importing_suite, suite_import, fatalIfMissing=True, load= +@@ -18541,12 +18423,35 @@ def _find_suite_import(importing_suite, suite_import, fatalIfMissing=True, load= Attempts to locate an existing suite in the local context Returns the path to the mx.name dir if found else None """ diff --git a/pkgs/development/compilers/graalvm/default.nix b/pkgs/development/compilers/graalvm/default.nix index 3cb0d7430ab..b343e20e55f 100644 --- a/pkgs/development/compilers/graalvm/default.nix +++ b/pkgs/development/compilers/graalvm/default.nix @@ -1,10 +1,10 @@ { stdenv, lib, fetchFromGitHub, fetchurl, fetchzip, fetchgit, mercurial, python27, - zlib, makeWrapper, openjdk, unzip, git, clang, llvm, which, icu, ruby, bzip2 + zlib, makeWrapper, openjdk, unzip, git, clang, llvm, which, icu, ruby, bzip2, glibc # gfortran, readline, bzip2, lzma, pcre, curl, ed, tree ## WIP: fastr deps }: let - version = "1.0.0-rc15"; + version = "19.0.0"; truffleMake = ./truffle.make; R = fetchurl { url = "http://cran.rstudio.com/src/base/R-3/R-3.5.1.tar.gz"; @@ -36,7 +36,7 @@ let hg checkout ${lib.escapeShellArg "vm${version}"} ''; - # pre-download some cache entries ('mx' will not be able to download under nixbld1) + # pre-download some cache entries ('mx' will not be able to download under nixbld) makeMxCache = list: stdenv.mkDerivation { name = "mx-cache"; @@ -118,8 +118,8 @@ let rec { sha1 = "280c265b789e041c02e5c97815793dfc283fb1e6"; name = "LIBFFI_SOURCES_${sha1}/libffi-sources.tar.gz"; url = https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/libffi-3.2.1.tar.gz; } rec { sha1 = "8819cea8bfe22c9c63f55465e296b3855ea41786"; name = "TruffleJSON_${sha1}/trufflejson.jar"; url = https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/trufflejson-20180130.jar; } rec { sha1 = "9712a8124c40298015f04a74f61b3d81a51513af"; name = "CHECKSTYLE_8.8_${sha1}/checkstyle-8.8.jar"; url = https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/checkstyle-8.8-all.jar; } - rec { sha1 = "5a5574f03b58465226166a638641a384b9f44445"; name = "VISUALVM_COMMON_${sha1}/visualvm-common.tar.gz"; url = https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/visualvm-655.tar.gz; } - rec { sha1 = "64f07398bac9897e9b8123edeaf5cf9ff19517b5"; name = "VISUALVM_PLATFORM_SPECIFIC_${sha1}/visualvm-platform-specific.tar.gz"; url = https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/visualvm-655-linux-amd64.tar.gz; } + rec { sha1 = "aee7dd2a9663701df57a96e501b9219a7c90cbc3"; name = "VISUALVM_COMMON_${sha1}/visualvm-common.tar.gz"; url = https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/visualvm-670.tar.gz; } + rec { sha1 = "e607a0c40716f4a232de3726ab101f5c54798cfa"; name = "VISUALVM_PLATFORM_SPECIFIC_${sha1}/visualvm-platform-specific.tar.gz"; url = https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/visualvm-670-linux-amd64.tar.gz; } rec { sha1 = "e6e60889b7211a80b21052a249bd7e0f88f79fee"; name = "Java-WebSocket_${sha1}/java-websocket.jar"; url = mirror://maven/org/java-websocket/Java-WebSocket/1.3.9/Java-WebSocket-1.3.9.jar; } rec { sha1 = "7a4d00d5ec5febd252a6182e8b6e87a0a9821f81"; name = "ICU4J_${sha1}/icu4j.jar"; url = mirror://maven/com/ibm/icu/icu4j/62.1/icu4j-62.1.jar; } # This duplication of asm with underscore and minus is totally weird @@ -149,14 +149,14 @@ let ]; graal-mxcachegit = [ - { sha256 = "0siryzvmj9h8zkyr0d3gy9fqgyxb9s5xs15rf7lnx9zh3ykq549y"; name = "graaljs"; - url = "http://github.com/graalvm/graaljs.git"; rev = "vm-${version}"; } - { sha256 = "1ii3mwa0c2zk9vm51hyrymdz3whfihm6sccd2r5ja2v53jcdc1a3"; name = "truffleruby"; + { sha256 = "0idc2jn69pyrj2xivisrc8p59zd49jbz67476j8z3rfaf0hqnr3z"; name = "graaljs"; + url = "http://github.com/graalvm/graaljs.git"; rev = "fd578bf87e2bbf668482d4928603bdc63b9a0d97"; } + { sha256 = "1zyaaygzd8fc1a1684h75h21k8rs2rnhkr5y217wlazyd78j65nr"; name = "truffleruby"; url = "http://github.com/oracle/truffleruby.git"; rev = "vm-${version}"; } - { sha256 = "1nz8yqg2k9shpmhj3jv7k2icfg72cm55baf354rsh1pqanay8qb7"; name = "fastr"; + { sha256 = "0kyzx5y2kag08m9vla5x117al9ijs10783qpnv8b7zr116fwi28h"; name = "fastr"; url = "http://github.com/oracle/fastr.git"; rev = "vm-${version}"; } - { sha256 = "1c8nnrl30fys22gk3y6dvxzq0fq1a5hjkqrw15p68cwpz9wma4gi"; name = "graalpython"; - url = "https://github.com/graalvm/graalpython.git"; rev = "vm-${version}"; } + { sha256 = "1v4dqml2kwy1qiirw09vjsivp7mbmc5pmflskvc4x5m841dwgsgb"; name = "graalpython"; + url = "https://github.com/graalvm/graalpython.git"; rev = "0c20d4d09329323f5b74137000c6e0a4645053ad"; } ]; ninja-syntax = python27.pkgs.buildPythonPackage rec { @@ -180,13 +180,13 @@ let in rec { mx = stdenv.mkDerivation rec { - version = "5.215.4"; + version = "5.216.4"; pname = "mx"; src = fetchFromGitHub { owner = "graalvm"; repo = "mx"; rev = version; - sha256 = "0wrwfiwqjw6xp0bvp2g15jn6yrjb9w6jw1xnwvkyhkw1s6m0w0z1"; + sha256 = "0m4yy3i64r7sc46y04cfbb5834lc9j3wzmmbbjgx3d53s9wqrvyr"; }; nativeBuildInputs = [ makeWrapper ]; prePatch = '' @@ -219,19 +219,19 @@ in rec { meta = with stdenv.lib; { homepage = https://github.com/graalvm/mx; description = "Command-line tool used for the development of Graal projects"; - license = licenses.unfree; + license = licenses.gpl2; platforms = python27.meta.platforms; }; }; jvmci8 = stdenv.mkDerivation rec { - version = "0.58"; + version = "19-b01"; name = "jvmci-${version}"; src = fetchFromGitHub { owner = "graalvm"; repo = "graal-jvmci-8"; rev = "jvmci-${version}"; - sha256 = "0p8icn3d99zggsh6pqb15dz1j186ck442sjpn2cv43n4nvdmmp1m"; + sha256 = "1l75z3jjc4i0vc3qs9xba4mvy3y8ba860yf7kpywlfl0xh51jm10"; }; buildInputs = [ mx mercurial openjdk ]; postUnpack = '' @@ -249,6 +249,9 @@ in rec { # The hotspot version name regex fix substituteInPlace mx.jvmci/mx_jvmci.py \ --replace "\\d+.\\d+-b\\d+" "\\d+.\\d+-bga" + substituteInPlace src/share/vm/jvmci/jvmciCompilerToVM.cpp \ + --replace 'method->name_and_sig_as_C_string(), method->native_function(), entry' \ + 'method->name_and_sig_as_C_string(), p2i(method->native_function()), p2i(entry)' || exit -1 ''; hardeningDisable = [ "fortify" ]; NIX_CFLAGS_COMPILE = [ @@ -270,7 +273,7 @@ in rec { ''; dontFixup = true; # do not nuke path of ffmpeg etc dontStrip = true; # why? see in oraclejdk derivation - meta = openjdk.meta // { inherit (graalvm8.meta) platforms; }; + inherit (openjdk) meta; inherit (openjdk) postFixup; }; @@ -281,7 +284,7 @@ in rec { owner = "oracle"; repo = "graal"; rev = "vm-${version}"; - sha256 = "18fqah8x7gwz02ji40b4vyqav9x5dw703xwikjc117wlyymb1k56"; + sha256 = "07gy4xvjhrnl74v0vnixgfvgjp0dba0l8l7qlh28pfrc97dkcm9r"; }; patches = [ ./002_setjmp.c.patch ./003_mx_truffle.py.patch ]; buildInputs = [ mx zlib mercurial jvmci8 git clang llvm @@ -324,6 +327,10 @@ in rec { # Patch the native-image template, as it will be run during build chmod +x vm/mx.vm/launcher_template.sh && patchShebangs vm/mx.vm + # Prevent random errors from too low maxRuntimecompilemethods + substituteInPlace truffle/mx.truffle/tools-truffle.properties \ + --replace '-H:MaxRuntimeCompileMethods=1400' \ + '-H:MaxRuntimeCompileMethods=28000' ''; buildPhase = '' @@ -349,15 +356,20 @@ in rec { installPhase = '' mkdir -p $out - cp -rf $MX_ALT_OUTPUT_ROOT/vm/linux-amd64/GRAALVM_CMP_GU_GVM_INS_JS_LIBPOLY_NFI_NJS_POLY_POLYNATIVE_PRO_PYN_RGX_SLG_SVM_SVMAG_SVMCF_SVML_TFL_VVM/graalvm-unknown-${version}/* $out + rm -rf $MX_ALT_OUTPUT_ROOT/vm/linux-amd64/GRAALVM_*STAGE1* + cp -rf $MX_ALT_OUTPUT_ROOT/vm/linux-amd64/GRAALVM*/graalvm-unknown-${version}/* $out # BUG workaround http://mail.openjdk.java.net/pipermail/graal-dev/2017-December/005141.html substituteInPlace $out/jre/lib/security/java.security \ --replace file:/dev/random file:/dev/./urandom \ --replace NativePRNGBlocking SHA1PRNG + # copy static and dynamic libraries needed for static compilation + cp -rf ${glibc}/lib/* $out/jre/lib/svm/clibraries/linux-amd64/ + cp ${glibc.static}/lib/* $out/jre/lib/svm/clibraries/linux-amd64/ + cp ${zlib.static}/lib/libz.a $out/jre/lib/svm/clibraries/linux-amd64/libz.a # Organize the out dir mkdir -p $out/share && mv $out/man $out/share - rm $out/ASSEMBLY_EXCEPTION $out/release $out/LICENSE $out/THIRD_PARTY_README + rm $out/ASSEMBLY_EXCEPTION $out/release $out/LICENSE $out/THIRD_PARTY_README $out/*.txt $out/*.md ''; dontFixup = true; # do not nuke path of ffmpeg etc @@ -381,6 +393,11 @@ in rec { $out/bin/native-image --no-server HelloWorld ./helloworld ./helloworld | fgrep 'Hello World' + + # Ahead-Of-Time compilation with --static + $out/bin/native-image --no-server --static HelloWorld + ./helloworld + ./helloworld | fgrep 'Hello World' ''; passthru.home = graalvm8;