# HG changeset patch # User Bernhard Urban # Date 1409661951 -7200 # Node ID ad10671d1bbd0ed3ed18690d2e47bf9b2114522a # Parent ccd8c2ef112eb75583d34af744f53175f976965b mx: move get_arch() to mxtool diff -r ccd8c2ef112e -r ad10671d1bbd mx/mx_graal.py --- a/mx/mx_graal.py Tue Sep 02 10:30:28 2014 +0200 +++ b/mx/mx_graal.py Tue Sep 02 14:45:51 2014 +0200 @@ -199,7 +199,7 @@ infos['jdkversion'] = str(mx.java().version) - infos['architecture'] = _arch() + infos['architecture'] = mx.get_arch() infos['platform'] = mx.get_os() if mx.get_os != 'windows': @@ -346,22 +346,6 @@ _run_benchmark(args, sanitycheck.dacapoScalaSanityWarmup.keys(), launcher) -def _arch(): - machine = platform.uname()[4] - if machine in ['amd64', 'AMD64', 'x86_64', 'i86pc']: - return 'amd64' - if machine in ['sun4v', 'sun4u']: - return 'sparcv9' - if machine == 'i386' and mx.get_os() == 'darwin': - try: - # Support for Snow Leopard and earlier version of MacOSX - if subprocess.check_output(['sysctl', '-n', 'hw.cpu64bit_capable']).strip() == '1': - return 'amd64' - except OSError: - # sysctl is not available - pass - mx.abort('unknown or unsupported architecture: os=' + mx.get_os() + ', machine=' + machine) - def _vmLibDirInJdk(jdk): """ Get the directory within a JDK where the server and client @@ -371,14 +355,14 @@ return join(jdk, 'jre', 'lib') if platform.system() == 'Windows': return join(jdk, 'jre', 'bin') - return join(jdk, 'jre', 'lib', _arch()) + return join(jdk, 'jre', 'lib', mx.get_arch()) def _vmCfgInJdk(jdk): """ Get the jvm.cfg file. """ if platform.system() == 'Windows': - return join(jdk, 'jre', 'lib', _arch(), 'jvm.cfg') + return join(jdk, 'jre', 'lib', mx.get_arch(), 'jvm.cfg') return join(_vmLibDirInJdk(jdk), 'jvm.cfg') def _jdksDir(): @@ -1952,7 +1936,7 @@ flavor = 'intel' if 'att' in args: flavor = 'att' - lib = mx.add_lib_suffix('hsdis-' + _arch()) + lib = mx.add_lib_suffix('hsdis-' + mx.get_arch()) path = join(_graal_home, 'lib', lib) sha1s = { diff -r ccd8c2ef112e -r ad10671d1bbd mxtool/mx.py --- a/mxtool/mx.py Tue Sep 02 10:30:28 2014 +0200 +++ b/mxtool/mx.py Tue Sep 02 14:45:51 2014 +0200 @@ -33,7 +33,7 @@ Full documentation can be found at https://wiki.openjdk.java.net/display/Graal/The+mx+Tool """ -import sys, os, errno, time, subprocess, shlex, types, StringIO, zipfile, signal, xml.sax.saxutils, tempfile, fnmatch +import sys, os, errno, time, subprocess, shlex, types, StringIO, zipfile, signal, xml.sax.saxutils, tempfile, fnmatch, platform import multiprocessing import textwrap import socket @@ -1207,6 +1207,22 @@ else: abort('Unknown operating system ' + sys.platform) +def get_arch(): + machine = platform.uname()[4] + if machine in ['amd64', 'AMD64', 'x86_64', 'i86pc']: + return 'amd64' + if machine in ['sun4v', 'sun4u']: + return 'sparcv9' + if machine == 'i386' and get_os() == 'darwin': + try: + # Support for Snow Leopard and earlier version of MacOSX + if subprocess.check_output(['sysctl', '-n', 'hw.cpu64bit_capable']).strip() == '1': + return 'amd64' + except OSError: + # sysctl is not available + pass + abort('unknown or unsupported architecture: os=' + get_os() + ', machine=' + machine) + def _loadSuite(mxDir, primary=False): """ Load a suite from 'mxDir'.