Mercurial > hg > truffle
diff mx/mx_graal.py @ 16327:5f01f7c48d40
Merge with 5cdcb94a7cf7d9782107cc582f3e4b50000d5d1f
author | Stefan Anzinger <stefan.anzinger@gmail.com> |
---|---|
date | Mon, 30 Jun 2014 12:02:19 +0200 |
parents | e497100e1fbf bf0e3ff4b2c4 |
children | d91fecb90fc0 |
line wrap: on
line diff
--- a/mx/mx_graal.py Mon Jun 30 08:50:26 2014 +0200 +++ b/mx/mx_graal.py Mon Jun 30 12:02:19 2014 +0200 @@ -168,7 +168,6 @@ rmIfExists(join(_graal_home, 'build')) rmIfExists(join(_graal_home, 'build-nograal')) rmIfExists(_jdksDir()) - rmIfExists(mx.distribution('GRAAL').path) def export(args): """create archives of builds split by vmbuild and vm""" @@ -506,14 +505,23 @@ jreLibDir = join(jdks, e, 'jre', 'lib') if exists(jreLibDir): def install(srcJar, dstDir): - # do a copy and then a move to get atomic updating (on Unix) name = os.path.basename(srcJar) - fd, tmp = tempfile.mkstemp(suffix='', prefix=name, dir=dstDir) - shutil.copyfile(srcJar, tmp) - os.close(fd) dstJar = join(dstDir, name) - shutil.move(tmp, dstJar) - os.chmod(dstJar, JDK_UNIX_PERMISSIONS) + if mx.get_env('SYMLINK_GRAAL_JAR', None) == 'true': + # Using symlinks is much faster than copying but may + # cause issues if graal.jar is being updated while + # the VM is running. + if not os.path.islink(dstJar) or not os.path.realpath(dstJar) == srcJar: + if exists(dstJar): + os.remove(dstJar) + os.symlink(srcJar, dstJar) + else: + # do a copy and then a move to get atomic updating (on Unix) + fd, tmp = tempfile.mkstemp(suffix='', prefix=name, dir=dstDir) + shutil.copyfile(srcJar, tmp) + os.close(fd) + shutil.move(tmp, dstJar) + os.chmod(dstJar, JDK_UNIX_PERMISSIONS) install(graalJar, jreLibDir) if graalDist.sourcesPath: @@ -802,13 +810,19 @@ env.pop('LD_LIBRARY_PATH', None) env.pop('CLASSPATH', None) - if mx._opts.verbose: - # Issue an env prefix that can be used to run the make on the command line - envPrefix = ' '.join([key + '=' + env[key] for key in env.iterkeys() if not os.environ.has_key(key) or env[key] != os.environ[key]]) - if len(envPrefix): - mx.log('env ' + envPrefix + ' \\') + # Issue an env prefix that can be used to run the make on the command line + if not mx._opts.verbose: + mx.log('--------------- make command line ----------------------') + + envPrefix = ' '.join([key + '=' + env[key] for key in env.iterkeys() if not os.environ.has_key(key) or env[key] != os.environ[key]]) + if len(envPrefix): + mx.log('env ' + envPrefix + ' \\') runCmd.append(build + buildSuffix) + + if not mx._opts.verbose: + mx.log(' '.join(runCmd)) + mx.log('--------------------------------------------------------') mx.run(runCmd, err=filterXusage, env=env) jvmCfg = _vmCfgInJdk(jdk) @@ -1798,7 +1812,7 @@ path = join(_graal_home, 'lib', 'hcfdis-1.jar') if not exists(path): - mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hcfdis-1.jar']) + mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hcfdis-2.jar']) mx.run_java(['-jar', path] + args.files) if args.map is not None: @@ -1854,6 +1868,20 @@ def isGraalEnabled(vm): return vm != 'original' and not vm.endswith('nograal') +def jol(args): + """Java Object Layout""" + jolurl = "http://lafo.ssw.uni-linz.ac.at/truffle/jol/jol-internals.jar" + joljar = "lib/jol-internals.jar" + if not exists(joljar): + mx.download(joljar, [jolurl]) + + candidates = mx.findclass(args, logToConsole=False, matcher=lambda s, classname: s == classname or classname.endswith('.' + s) or classname.endswith('$' + s)) + if len(candidates) > 10: + print "Found %d candidates. Please be more precise." % (len(candidates)) + return + + vm(['-javaagent:' + joljar, '-cp', os.pathsep.join([mx.classpath(), joljar]), "org.openjdk.jol.MainObjectInternals"] + candidates) + def site(args): """create a website containing javadoc and the project dependency graph""" @@ -2080,7 +2108,8 @@ 'vmfg': [vmfg, '[-options] class [args...]'], 'deoptalot' : [deoptalot, '[n]'], 'longtests' : [longtests, ''], - 'sl' : [sl, '[SL args|@VM options]'] + 'sl' : [sl, '[SL args|@VM options]'], + 'jol' : [jol, ''], } mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append'])