From 50a76e655d708006d543ad29d01332ace3e0a334 Mon Sep 17 00:00:00 2001 From: Gilles Duboscq <gilles.m.duboscq@oracle.com> Date: Thu, 15 Mar 2018 14:16:30 +0100 Subject: [PATCH] Fix dynamic dependencies on graal and sulong - Make sure there is no suite loading ordering issues by avoiding the capture of suites at module-loading time. - Make sure the SULONG build-time dependency is only added to `r.native.recommended` if the project is available (i.e., fastr is not a binary suite) --- mx.fastr/mx_fastr.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/mx.fastr/mx_fastr.py b/mx.fastr/mx_fastr.py index 700ba88357..7dd035c9cb 100644 --- a/mx.fastr/mx_fastr.py +++ b/mx.fastr/mx_fastr.py @@ -44,11 +44,6 @@ was passed as an mx global option. ''' _fastr_suite = mx.suite('fastr') -''' -If this is None, then we run under the standard VM in interpreted mode only. -''' -_mx_graal = mx.suite("compiler", fatalIfMissing=False) -_mx_sulong = mx.suite("sulong", fatalIfMissing=False) _command_class_dict = {'r': "com.oracle.truffle.r.launcher.RCommand", 'rscript': "com.oracle.truffle.r.launcher.RscriptCommand", @@ -64,7 +59,7 @@ def r_version(): return 'R-3.4.0' def get_default_jdk(): - if _mx_graal: + if mx.suite("compiler", fatalIfMissing=False): tag = 'jvmci' else: tag = None @@ -92,7 +87,7 @@ def do_run_r(args, command, extraVmArgs=None, jdk=None, **kwargs): jdk = get_default_jdk() dists = ['FASTR'] - if _mx_sulong: + if mx.suite("sulong", fatalIfMissing=False): dists.append('SULONG') vmArgs = mx.get_runtime_jvm_args(dists, jdk=jdk) @@ -141,15 +136,16 @@ def set_graal_options(): ''' If Graal is enabled, set some options specific to FastR ''' - if _mx_graal: + if mx.suite("compiler", fatalIfMissing=False): result = ['-Dgraal.InliningDepthError=500', '-Dgraal.EscapeAnalysisIterations=3', '-XX:JVMCINMethodSizeLimit=1000000'] return result else: return [] def _sulong_options(): - if _mx_sulong: - return ['-Dpolyglot.llvm.libraryPath=' + _mx_sulong.dir + '/mxbuild/sulong-libs'] + mx_sulong = mx.suite("sulong", fatalIfMissing=False) + if mx_sulong: + return ['-Dpolyglot.llvm.libraryPath=' + mx_sulong.dir + '/mxbuild/sulong-libs'] else: return [] @@ -552,11 +548,14 @@ def nativebuild(args): def mx_post_parse_cmd_line(opts): mx_fastr_dists.mx_post_parse_cmd_line(opts) - if _mx_sulong: + if mx.suite("sulong", fatalIfMissing=False): # native.recommended runs FastR, it already has a build dependency to the FASTR distribution # if we are running with sulong we also need the SULONG distribution - rec = mx.project('com.oracle.truffle.r.native.recommended') - rec.buildDependencies += [mx.distribution('SULONG')] + rec = mx.project('com.oracle.truffle.r.native.recommended', fatalIfMissing=False) + if rec: + rec.buildDependencies += [mx.distribution('SULONG')] + else: + assert _fastr_suite.isBinarySuite() mx_unittest.add_config_participant(_unittest_config_participant) -- GitLab