Mercurial > hg > graal-compiler
comparison mx.graal/mx_graal.py @ 22797:9329eb8678f7
fixed CompileTheWorld functionality for jdk9
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 12 Oct 2015 01:45:13 +0200 |
parents | 087d6b3e4c9b |
children | 509a9eadd120 |
comparison
equal
deleted
inserted
replaced
22796:ed5fd346003c | 22797:9329eb8678f7 |
---|---|
31 import itertools | 31 import itertools |
32 import json | 32 import json |
33 import re | 33 import re |
34 | 34 |
35 import mx | 35 import mx |
36 from mx_jvmci import JvmciJDKDeployedDist, add_bootclasspath_prepend, buildvms | 36 from mx_jvmci import JvmciJDKDeployedDist, add_bootclasspath_prepend, buildvms, get_jvmci_jdk, get_vm, run_vm, VM |
37 from mx_jvmci import jdkDeployedDists #pylint: disable=unused-import | 37 from mx_jvmci import jdkDeployedDists #pylint: disable=unused-import |
38 from mx_gate import Task | 38 from mx_gate import Task |
39 from sanitycheck import _noneAsEmptyList | 39 from sanitycheck import _noneAsEmptyList |
40 | 40 |
41 try: | 41 try: |
42 from mx_jvmci import run_vm, VM, get_vm, isJVMCIEnabled, relativeVmLibDirInJdk, get_jvmci_jdk, get_jvmci_jdk_dir #pylint: disable=no-name-in-module | 42 from mx_jvmci import isJVMCIEnabled, relativeVmLibDirInJdk, get_jvmci_jdk_dir #pylint: disable=no-name-in-module |
43 except ImportError: | 43 except ImportError: |
44 pass | 44 pass |
45 from mx_unittest import unittest | 45 from mx_unittest import unittest |
46 import mx_gate | 46 import mx_gate |
47 | 47 |
202 | 202 |
203 defaultCtwopts = '-Inline' | 203 defaultCtwopts = '-Inline' |
204 | 204 |
205 parser = ArgumentParser(prog='mx ctw') | 205 parser = ArgumentParser(prog='mx ctw') |
206 parser.add_argument('--ctwopts', action='store', help='space separated JVMCI options used for CTW compilations (default: --ctwopts="' + defaultCtwopts + '")', default=defaultCtwopts, metavar='<options>') | 206 parser.add_argument('--ctwopts', action='store', help='space separated JVMCI options used for CTW compilations (default: --ctwopts="' + defaultCtwopts + '")', default=defaultCtwopts, metavar='<options>') |
207 parser.add_argument('--jar', action='store', help='jar of classes to compiled instead of rt.jar', metavar='<path>') | 207 parser.add_argument('--cp', '--jar', action='store', help='jar or class path denoting classes to compile', metavar='<path>') |
208 | 208 |
209 args, vmargs = parser.parse_known_args(args) | 209 args, vmargs = parser.parse_known_args(args) |
210 | 210 |
211 if args.ctwopts: | 211 if args.ctwopts: |
212 # Replace spaces with '#' since -G: options cannot contain spaces | 212 # Replace spaces with '#' since -G: options cannot contain spaces |
213 # when they are collated in the "jvmci.options" system property | 213 # when they are collated in the "jvmci.options" system property |
214 vmargs.append('-G:CompileTheWorldConfig=' + re.sub(r'\s+', '#', args.ctwopts)) | 214 vmargs.append('-G:CompileTheWorldConfig=' + re.sub(r'\s+', '#', args.ctwopts)) |
215 | 215 |
216 if args.jar: | 216 if args.cp: |
217 jar = os.path.abspath(args.jar) | 217 cp = os.path.abspath(args.cp) |
218 else: | 218 else: |
219 jar = join(get_jvmci_jdk_dir(deployDists=False), 'jre', 'lib', 'rt.jar') | 219 if get_jvmci_jdk().javaCompliance < '9': |
220 cp = join(get_jvmci_jdk().home, 'jre', 'lib', 'rt.jar') | |
221 else: | |
222 cp = join(get_jvmci_jdk().home, 'modules', 'java.base') | |
220 vmargs.append('-G:CompileTheWorldExcludeMethodFilter=sun.awt.X11.*.*') | 223 vmargs.append('-G:CompileTheWorldExcludeMethodFilter=sun.awt.X11.*.*') |
221 | 224 |
222 # suppress menubar and dock when running on Mac; exclude x11 classes as they may cause vm crashes (on Solaris) | 225 # suppress menubar and dock when running on Mac; exclude x11 classes as they may cause vm crashes (on Solaris) |
223 vmargs = ['-Djava.awt.headless=true'] + vmargs | 226 vmargs = ['-Djava.awt.headless=true'] + vmargs |
224 | 227 |
225 vm_ = get_vm() | 228 vm = get_vm() |
226 if isJVMCIEnabled(vm_): | 229 if isinstance(vm, VM): |
227 if vm_ == 'jvmci': | 230 if vm.jvmciMode == 'disabled': |
228 vmargs += ['-XX:+BootstrapJVMCI'] | 231 vmargs += ['-XX:+CompileTheWorld', '-Xbootclasspath/p:' + cp] |
229 vmargs += ['-G:CompileTheWorldClasspath=' + jar, '-XX:-UseJVMCIClassLoader', 'com.oracle.graal.hotspot.CompileTheWorld'] | 232 else: |
230 else: | 233 if vm.jvmciMode == 'jit': |
231 vmargs += ['-XX:+CompileTheWorld', '-Xbootclasspath/p:' + jar] | 234 vmargs += ['-XX:+BootstrapJVMCI'] |
235 vmargs += ['-G:CompileTheWorldClasspath=' + cp, 'com.oracle.graal.hotspot.CompileTheWorld'] | |
236 else: | |
237 if isJVMCIEnabled(vm): | |
238 if vm == 'jvmci': | |
239 vmargs += ['-XX:+BootstrapJVMCI'] | |
240 vmargs += ['-G:CompileTheWorldClasspath=' + cp, '-XX:-UseJVMCIClassLoader', 'com.oracle.graal.hotspot.CompileTheWorld'] | |
241 else: | |
242 vmargs += ['-XX:+CompileTheWorld', '-Xbootclasspath/p:' + cp] | |
232 | 243 |
233 run_vm(vmargs + _noneAsEmptyList(extraVMarguments)) | 244 run_vm(vmargs + _noneAsEmptyList(extraVMarguments)) |
234 | 245 |
235 class UnitTestRun: | 246 class UnitTestRun: |
236 def __init__(self, name, args): | 247 def __init__(self, name, args): |