Mercurial > hg > graal-compiler
comparison mx/mx_graal.py @ 16167:1f4955abca9b
mx: add jol command for java object layout introspection
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Fri, 20 Jun 2014 13:43:47 +0200 |
parents | 3b4690ddd92e |
children | 6140fd60abe9 |
comparison
equal
deleted
inserted
replaced
16166:d69ede72299a | 16167:1f4955abca9b |
---|---|
1856 vmArgs, slArgs = _extract_VM_args(args) | 1856 vmArgs, slArgs = _extract_VM_args(args) |
1857 vm(vmArgs + ['-cp', mx.classpath("com.oracle.truffle.sl"), "com.oracle.truffle.sl.SLMain"] + slArgs) | 1857 vm(vmArgs + ['-cp', mx.classpath("com.oracle.truffle.sl"), "com.oracle.truffle.sl.SLMain"] + slArgs) |
1858 | 1858 |
1859 def isGraalEnabled(vm): | 1859 def isGraalEnabled(vm): |
1860 return vm != 'original' and not vm.endswith('nograal') | 1860 return vm != 'original' and not vm.endswith('nograal') |
1861 | |
1862 def jol(args): | |
1863 """Java Object Layout""" | |
1864 jolurl = "http://lafo.ssw.uni-linz.ac.at/truffle/jol/jol-internals.jar" | |
1865 joljar = "lib/jol-internals.jar" | |
1866 if not exists(joljar): | |
1867 mx.download(joljar, [jolurl]) | |
1868 | |
1869 candidates = mx.findclass(args, logToConsole=False, matcher=lambda s, classname: s == classname or classname.endswith('.' + s) or classname.endswith('$' + s)) | |
1870 if len(candidates) > 10: | |
1871 print "Found %d candidates. Please be more precise." % (len(candidates)) | |
1872 return | |
1873 | |
1874 vm(['-javaagent:' + joljar, '-cp', os.pathsep.join([mx.classpath(), joljar]), "org.openjdk.jol.MainObjectInternals"] + candidates) | |
1861 | 1875 |
1862 def site(args): | 1876 def site(args): |
1863 """create a website containing javadoc and the project dependency graph""" | 1877 """create a website containing javadoc and the project dependency graph""" |
1864 | 1878 |
1865 return mx.site(['--name', 'Graal', | 1879 return mx.site(['--name', 'Graal', |
2083 'vm': [vm, '[-options] class [args...]'], | 2097 'vm': [vm, '[-options] class [args...]'], |
2084 'vmg': [vmg, '[-options] class [args...]'], | 2098 'vmg': [vmg, '[-options] class [args...]'], |
2085 'vmfg': [vmfg, '[-options] class [args...]'], | 2099 'vmfg': [vmfg, '[-options] class [args...]'], |
2086 'deoptalot' : [deoptalot, '[n]'], | 2100 'deoptalot' : [deoptalot, '[n]'], |
2087 'longtests' : [longtests, ''], | 2101 'longtests' : [longtests, ''], |
2088 'sl' : [sl, '[SL args|@VM options]'] | 2102 'sl' : [sl, '[SL args|@VM options]'], |
2103 'jol' : [jol, ''], | |
2089 } | 2104 } |
2090 | 2105 |
2091 mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append']) | 2106 mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append']) |
2092 mx.add_argument('--vmcwd', dest='vm_cwd', help='current directory will be changed to <path> before the VM is executed', default=None, metavar='<path>') | 2107 mx.add_argument('--vmcwd', dest='vm_cwd', help='current directory will be changed to <path> before the VM is executed', default=None, metavar='<path>') |
2093 mx.add_argument('--installed-jdks', help='the base directory in which the JDKs cloned from $JAVA_HOME exist. ' + | 2108 mx.add_argument('--installed-jdks', help='the base directory in which the JDKs cloned from $JAVA_HOME exist. ' + |