Mercurial > hg > graal-jvmci-8
annotate mx.jvmci/mx_jvmci.py @ 22603:2448e3c0cd98
set default jvmci.compiler property explicitly based on available suites
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 22 Sep 2015 23:14:18 +0200 |
parents | bc2d4dac0cd3 |
children | 0851eafff5c9 |
rev | line source |
---|---|
3718 | 1 # |
2 # ---------------------------------------------------------------------------------------------------- | |
3 # | |
18897
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
4 # Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. |
3718 | 5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6 # | |
7 # This code is free software; you can redistribute it and/or modify it | |
8 # under the terms of the GNU General Public License version 2 only, as | |
9 # published by the Free Software Foundation. | |
10 # | |
11 # This code is distributed in the hope that it will be useful, but WITHOUT | |
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 # version 2 for more details (a copy is included in the LICENSE file that | |
15 # accompanied this code). | |
16 # | |
17 # You should have received a copy of the GNU General Public License version | |
18 # 2 along with this work; if not, write to the Free Software Foundation, | |
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
20 # | |
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
22 # or visit www.oracle.com if you need additional information or have any | |
23 # questions. | |
24 # | |
25 # ---------------------------------------------------------------------------------------------------- | |
26 | |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
27 import os, stat, errno, sys, shutil, zipfile, tarfile, tempfile, re, time, datetime, platform, subprocess, socket |
16419
7520833c6e7f
eliminate JUnitWrapper
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16417
diff
changeset
|
28 from os.path import join, exists, dirname, basename |
22020
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
22019
diff
changeset
|
29 from argparse import ArgumentParser, REMAINDER |
13472
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
30 import xml.dom.minidom |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
31 import json, textwrap |
22031
434fbaaf53d7
moved findbugs support from mx_graal.py to mx_findbugs.py
Doug Simon <doug.simon@oracle.com>
parents:
22024
diff
changeset
|
32 |
434fbaaf53d7
moved findbugs support from mx_graal.py to mx_findbugs.py
Doug Simon <doug.simon@oracle.com>
parents:
22024
diff
changeset
|
33 import mx |
434fbaaf53d7
moved findbugs support from mx_graal.py to mx_findbugs.py
Doug Simon <doug.simon@oracle.com>
parents:
22024
diff
changeset
|
34 import mx_unittest |
22274
ed0b8310ac56
import unittest from mx_unittest.py
Doug Simon <doug.simon@oracle.com>
parents:
22273
diff
changeset
|
35 from mx_unittest import unittest |
22286
2ecfec90e51e
moved gate from mx_jvmci.py to mx_gate.py in core mx
Doug Simon <doug.simon@oracle.com>
parents:
22284
diff
changeset
|
36 from mx_gate import Task |
2ecfec90e51e
moved gate from mx_jvmci.py to mx_gate.py in core mx
Doug Simon <doug.simon@oracle.com>
parents:
22284
diff
changeset
|
37 import mx_gate |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
38 import mx_jvmci_makefile |
3718 | 39 |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
40 _suite = mx.suite('jvmci') |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
41 |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
42 """ The VMs that can be built and run along with an optional description. Only VMs with a |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
43 description are listed in the dialogue for setting the default VM (see get_vm()). """ |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
44 _vmChoices = { |
22099
10b08d53b060
removed TRUFFLE distribution - only use TRUFFLE library
Doug Simon <doug.simon@oracle.com>
parents:
22096
diff
changeset
|
45 'jvmci' : 'VM triggered compilation is performed with a tiered system (C1 + Graal) and Graal is available for hosted compilation.', |
10b08d53b060
removed TRUFFLE distribution - only use TRUFFLE library
Doug Simon <doug.simon@oracle.com>
parents:
22096
diff
changeset
|
46 'server' : 'Normal compilation is performed with a tiered system (C1 + C2) and Graal is available for hosted compilation.', |
10b08d53b060
removed TRUFFLE distribution - only use TRUFFLE library
Doug Simon <doug.simon@oracle.com>
parents:
22096
diff
changeset
|
47 'client' : None, # VM compilation with client compiler, hosted compilation with Graal |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
48 'server-nojvmci' : None, # all compilation with tiered system (i.e., client + server), JVMCI omitted |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
49 'client-nojvmci' : None, # all compilation with client compiler, JVMCI omitted |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
50 'original' : None, # default VM copied from bootstrap JDK |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
51 } |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
52 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
53 # Aliases for legacy VM names |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
54 _vmAliases = { |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
55 'graal' : 'jvmci', |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
56 'server-nograal' : 'server-nojvmci', |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
57 'client-nograal' : 'client-nograal', |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
58 } |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
59 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
60 _JVMCI_JDK_TAG = 'jvmci' |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
61 |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
62 """ The VM that will be run by the 'vm' command and built by default by the 'build' command. |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
63 This can be set via the global '--vm' option or the DEFAULT_VM environment variable. |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
64 It can also be temporarily set by using of a VM context manager object in a 'with' statement. """ |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
65 _vm = None |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
66 |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
67 """ The VM builds that will be run by the 'vm' command - default is first in list """ |
9157
a38d748d4130
Add support for the 'optimized' build in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9130
diff
changeset
|
68 _vmbuildChoices = ['product', 'fastdebug', 'debug', 'optimized'] |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
69 |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
70 """ The VM build that will be run by the 'vm' command. |
11371
74414b248381
mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents:
11368
diff
changeset
|
71 This can be set via the global '--vmbuild' option. |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
72 It can also be temporarily set by using of a VM context manager object in a 'with' statement. """ |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
73 _vmbuild = _vmbuildChoices[0] |
3718 | 74 |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
75 """ The current working directory to switch to before running the VM. """ |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
76 _vm_cwd = None |
10454
590b0c26877f
mx: add --workdir argument
Bernhard Urban <bernhard.urban@jku.at>
parents:
10417
diff
changeset
|
77 |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
78 """ The base directory in which the JDKs cloned from $JAVA_HOME exist. """ |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
79 _installed_jdks = None |
10570
2f80624df8a2
Add a --vmdir argument to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10568
diff
changeset
|
80 |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
81 """ Prefix for running the VM. """ |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
82 _vm_prefix = None |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5871
diff
changeset
|
83 |
5194
a6eceb5efb0e
added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents:
5189
diff
changeset
|
84 _make_eclipse_launch = False |
a6eceb5efb0e
added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents:
5189
diff
changeset
|
85 |
15594
62738ce98804
mx: set _minVersion to 1.8
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15593
diff
changeset
|
86 _minVersion = mx.VersionSpec('1.8') |
7916
9bff64f43299
Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7788
diff
changeset
|
87 |
20102
6e5df2d60fbd
mx: fix compliance check for EXTRA_JAVA_HOMES, add maximum JAVA_HOME version in mx_graal
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20032
diff
changeset
|
88 # max version (first _unsupported_ version) |
20805
379471b334cb
Lift 8u40 mx restriction
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20102
diff
changeset
|
89 _untilVersion = None |
20102
6e5df2d60fbd
mx: fix compliance check for EXTRA_JAVA_HOMES, add maximum JAVA_HOME version in mx_graal
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20032
diff
changeset
|
90 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
91 class JDKDeployedDist(object): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
92 def __init__(self, name): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
93 self._name = name |
22143
616739e61fb6
changed JDKDeployedDist.postJdkInstall to be an overridable method
Doug Simon <doug.simon@oracle.com>
parents:
22142
diff
changeset
|
94 |
616739e61fb6
changed JDKDeployedDist.postJdkInstall to be an overridable method
Doug Simon <doug.simon@oracle.com>
parents:
22142
diff
changeset
|
95 def dist(self): |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
96 return mx.distribution(self._name) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
97 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
98 def deploy(self, jdkDir): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
99 mx.nyi('deploy', self) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
100 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
101 class JarJDKDeployedDist(JDKDeployedDist): |
22287
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
102 def __init__(self, name, partOfHotSpot=False): |
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
103 JDKDeployedDist.__init__(self, name) |
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
104 self.partOfHotSpot = partOfHotSpot |
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
105 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
106 def targetDir(self): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
107 mx.nyi('targetDir', self) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
108 |
22452
b6fd47c5dc0b
Add ability to define a source target folder for distribution deployments.
Christian Humer <christian.humer@oracle.com>
parents:
22438
diff
changeset
|
109 def sourceTargetDir(self): |
b6fd47c5dc0b
Add ability to define a source target folder for distribution deployments.
Christian Humer <christian.humer@oracle.com>
parents:
22438
diff
changeset
|
110 return 'src' |
b6fd47c5dc0b
Add ability to define a source target folder for distribution deployments.
Christian Humer <christian.humer@oracle.com>
parents:
22438
diff
changeset
|
111 |
b6fd47c5dc0b
Add ability to define a source target folder for distribution deployments.
Christian Humer <christian.humer@oracle.com>
parents:
22438
diff
changeset
|
112 def _copyToJdk(self, jdkDir, target, sourceTarget): |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
113 targetDir = join(jdkDir, target) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
114 dist = self.dist() |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
115 mx.logv('Deploying {} to {}'.format(dist.name, targetDir)) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
116 copyToJdk(dist.path, targetDir) |
22452
b6fd47c5dc0b
Add ability to define a source target folder for distribution deployments.
Christian Humer <christian.humer@oracle.com>
parents:
22438
diff
changeset
|
117 |
b6fd47c5dc0b
Add ability to define a source target folder for distribution deployments.
Christian Humer <christian.humer@oracle.com>
parents:
22438
diff
changeset
|
118 if dist.sourcesPath and sourceTarget is not None: |
b6fd47c5dc0b
Add ability to define a source target folder for distribution deployments.
Christian Humer <christian.humer@oracle.com>
parents:
22438
diff
changeset
|
119 sourceTargetDir = join(jdkDir, sourceTarget) |
b6fd47c5dc0b
Add ability to define a source target folder for distribution deployments.
Christian Humer <christian.humer@oracle.com>
parents:
22438
diff
changeset
|
120 copyToJdk(dist.sourcesPath, sourceTargetDir) |
b6fd47c5dc0b
Add ability to define a source target folder for distribution deployments.
Christian Humer <christian.humer@oracle.com>
parents:
22438
diff
changeset
|
121 mx.logv('Deploying source {} to {}'.format(dist.name, sourceTargetDir)) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
122 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
123 def deploy(self, jdkDir): |
22452
b6fd47c5dc0b
Add ability to define a source target folder for distribution deployments.
Christian Humer <christian.humer@oracle.com>
parents:
22438
diff
changeset
|
124 self._copyToJdk(jdkDir, self.targetDir(), self.sourceTargetDir()) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
125 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
126 class ExtJDKDeployedDist(JarJDKDeployedDist): |
22287
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
127 def __init__(self, name, partOfHotSpot=False): |
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
128 JarJDKDeployedDist.__init__(self, name, partOfHotSpot) |
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
129 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
130 def targetDir(self): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
131 return join('jre', 'lib', 'ext') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
132 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
133 class LibJDKDeployedDist(JarJDKDeployedDist): |
22287
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
134 def __init__(self, name, partOfHotSpot=False): |
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
135 JarJDKDeployedDist.__init__(self, name, partOfHotSpot) |
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
136 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
137 def targetDir(self): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
138 return join('jre', 'lib') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
139 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
140 class JvmciJDKDeployedDist(JarJDKDeployedDist): |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22427
diff
changeset
|
141 def __init__(self, name, partOfHotSpot=False, compilers=False): |
22287
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
142 JarJDKDeployedDist.__init__(self, name, partOfHotSpot) |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22427
diff
changeset
|
143 self._compilers = compilers |
22287
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
144 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
145 def targetDir(self): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
146 return join('jre', 'lib', 'jvmci') |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
147 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
148 def deploy(self, jdkDir): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
149 JarJDKDeployedDist.deploy(self, jdkDir) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
150 _updateJVMCIFiles(jdkDir) |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22427
diff
changeset
|
151 if self._compilers: |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22427
diff
changeset
|
152 _updateJVMCIProperties(jdkDir, self._compilers) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
153 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
154 def _exe(l): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
155 return mx.exe_suffix(l) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
156 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
157 def _lib(l): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
158 return mx.add_lib_suffix(mx.add_lib_prefix(l)) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
159 |
22330
856aeb17e892
Add debug info files in hotspot's results
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22328
diff
changeset
|
160 def _lib_dbg(l): |
856aeb17e892
Add debug info files in hotspot's results
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22328
diff
changeset
|
161 return mx.add_debug_lib_suffix(mx.add_lib_prefix(l)) |
856aeb17e892
Add debug info files in hotspot's results
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22328
diff
changeset
|
162 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
163 class HotSpotVMJDKDeployedDist(JDKDeployedDist): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
164 def dist(self): |
22282
9ab88ee1f79f
spelling fix: instanciate -> instantiate
Doug Simon <doug.simon@oracle.com>
parents:
22281
diff
changeset
|
165 name = mx.instantiatedDistributionName(self._name, dict(vm=get_vm(), vmbuild=_vmbuild), context=self._name) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
166 return mx.distribution(name) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
167 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
168 def deploy(self, jdkDir): |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
169 vmbuild = _vmbuildFromJdkDir(jdkDir) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
170 if vmbuild != _vmbuild: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
171 return |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
172 _hs_deploy_map = { |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
173 'jvmti.h' : 'include', |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
174 'sa-jdi.jar' : 'lib', |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
175 _lib('jvm') : join(relativeVmLibDirInJdk(), get_vm()), |
22330
856aeb17e892
Add debug info files in hotspot's results
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22328
diff
changeset
|
176 _lib_dbg('jvm') : join(relativeVmLibDirInJdk(), get_vm()), |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
177 _lib('saproc') : relativeVmLibDirInJdk(), |
22330
856aeb17e892
Add debug info files in hotspot's results
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22328
diff
changeset
|
178 _lib_dbg('saproc') : relativeVmLibDirInJdk(), |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
179 _lib('jsig') : relativeVmLibDirInJdk(), |
22330
856aeb17e892
Add debug info files in hotspot's results
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22328
diff
changeset
|
180 _lib_dbg('jsig') : relativeVmLibDirInJdk(), |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
181 } |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
182 dist = self.dist() |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
183 with tarfile.open(dist.path, 'r') as tar: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
184 for m in tar.getmembers(): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
185 if m.name in _hs_deploy_map: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
186 targetDir = join(jdkDir, _hs_deploy_map[m.name]) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
187 mx.logv('Deploying {} from {} to {}'.format(m.name, dist.name, targetDir)) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
188 tar.extract(m, targetDir) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
189 updateJvmCfg(jdkDir, get_vm()) |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
190 |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
191 """ |
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
192 List of distributions that are deployed into a JDK by mx. |
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
193 """ |
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
194 jdkDeployedDists = [ |
22287
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
195 LibJDKDeployedDist('JVMCI_SERVICE', partOfHotSpot=True), |
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
196 JvmciJDKDeployedDist('JVMCI_API', partOfHotSpot=True), |
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22286
diff
changeset
|
197 JvmciJDKDeployedDist('JVMCI_HOTSPOT', partOfHotSpot=True), |
22323
6128b5118a28
Resolve cyclic dependencies involving annotation processors.
Roland Schatz <roland.schatz@oracle.com>
parents:
22322
diff
changeset
|
198 JvmciJDKDeployedDist('JVMCI_HOTSPOTVMCONFIG', partOfHotSpot=True), |
6128b5118a28
Resolve cyclic dependencies involving annotation processors.
Roland Schatz <roland.schatz@oracle.com>
parents:
22322
diff
changeset
|
199 JvmciJDKDeployedDist('JVMCI_OPTIONS', partOfHotSpot=True), |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
200 HotSpotVMJDKDeployedDist('JVM_<vmbuild>_<vm>'), |
16902
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
201 ] |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
202 |
16627
68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
Bernhard Urban <bernhard.urban@jku.at>
parents:
16623
diff
changeset
|
203 JDK_UNIX_PERMISSIONS_DIR = 0755 |
68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
Bernhard Urban <bernhard.urban@jku.at>
parents:
16623
diff
changeset
|
204 JDK_UNIX_PERMISSIONS_FILE = 0644 |
16782
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
205 JDK_UNIX_PERMISSIONS_EXEC = 0755 |
13919
9d70445ea369
mx: set correct permissions for graal.jar
Bernhard Urban <bernhard.urban@jku.at>
parents:
13846
diff
changeset
|
206 |
14602
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
207 def isVMSupported(vm): |
18799
750db34c9fe1
client-nograal is supported on Mac
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18733
diff
changeset
|
208 if 'client' == vm and len(platform.mac_ver()[0]) != 0: |
14602
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
209 # Client VM not supported: java launcher on Mac OS X translates '-client' to '-server' |
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
210 return False |
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
211 return True |
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
212 |
22141
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
213 def get_vm_cwd(): |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
214 """ |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
215 Get the current working directory to switch to before running the VM. |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
216 """ |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
217 return _vm_cwd |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
218 |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
219 def get_installed_jdks(): |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
220 """ |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
221 Get the base directory in which the JDKs cloned from $JAVA_HOME exist. |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
222 """ |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
223 return _installed_jdks |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
224 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
225 def get_vm_prefix(asList=True): |
22141
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
226 """ |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
227 Get the prefix for running the VM ("/usr/bin/gdb --args"). |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
228 """ |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
229 if asList: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
230 return _vm_prefix.split() if _vm_prefix is not None else [] |
22141
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
231 return _vm_prefix |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
232 |
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
233 def get_vm_choices(): |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
234 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
235 Get the names of available VMs. |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
236 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
237 return _vmChoices.viewkeys() |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
238 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
239 def dealiased_vm(vm): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
240 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
241 If 'vm' is an alias, returns the aliased name otherwise returns 'vm'. |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
242 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
243 if vm and vm in _vmAliases: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
244 return _vmAliases[vm] |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
245 return vm |
22141
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
246 |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
247 def get_vm(): |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
248 """ |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
249 Gets the configured VM, presenting a dialogue if there is no currently configured VM. |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
250 """ |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
251 global _vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
252 if _vm: |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
253 return _vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
254 vm = mx.get_env('DEFAULT_VM') |
22018
11ed27b2abe8
remove hard-coded use of 'mx' to refer to the mxDir for the graal suite
Doug Simon <doug.simon@oracle.com>
parents:
22017
diff
changeset
|
255 envPath = join(_suite.mxDir, 'env') |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
256 if vm and vm in _vmAliases: |
21584
9bb04af58490
support DEFAULT_VM=graal in mx/env
Doug Simon <doug.simon@oracle.com>
parents:
21580
diff
changeset
|
257 if exists(envPath): |
9bb04af58490
support DEFAULT_VM=graal in mx/env
Doug Simon <doug.simon@oracle.com>
parents:
21580
diff
changeset
|
258 with open(envPath) as fp: |
21642 | 259 if 'DEFAULT_VM=' + vm in fp.read(): |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
260 mx.log('Please update the DEFAULT_VM value in ' + envPath + ' to replace "' + vm + '" with "' + _vmAliases[vm] + '"') |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
261 vm = _vmAliases[vm] |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
262 if vm is None: |
21169
41ec6d89cb84
mx: fix calls to is_interactive()
Andreas Woess <andreas.woess@oracle.com>
parents:
21166
diff
changeset
|
263 if not mx.is_interactive(): |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
264 mx.abort('Need to specify VM with --vm option or DEFAULT_VM environment variable') |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
265 mx.log('Please select the VM to be executed from the following: ') |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
266 items = [k for k in _vmChoices.keys() if _vmChoices[k] is not None] |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
267 descriptions = [_vmChoices[k] for k in _vmChoices.keys() if _vmChoices[k] is not None] |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
268 vm = mx.select_items(items, descriptions, allowMultiple=False) |
21976
36e37644f91e
mx: improve first usage experience:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21975
diff
changeset
|
269 mx.ask_persist_env('DEFAULT_VM', vm) |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
270 _vm = vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
271 return vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
272 |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
273 """ |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
274 A context manager that can be used with the 'with' statement to set the VM |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
275 used by all VM executions within the scope of the 'with' statement. For example: |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
276 |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
277 with VM('server'): |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
278 dacapo(['pmd']) |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
279 """ |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
280 class VM: |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
281 def __init__(self, vm=None, build=None): |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
282 assert vm is None or vm in _vmChoices.keys() |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
283 assert build is None or build in _vmbuildChoices |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
284 self.vm = vm if vm else _vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
285 self.build = build if build else _vmbuild |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
286 |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
287 def __enter__(self): |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
288 global _vm, _vmbuild |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
289 self.previousVm = _vm |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
290 self.previousBuild = _vmbuild |
22286
2ecfec90e51e
moved gate from mx_jvmci.py to mx_gate.py in core mx
Doug Simon <doug.simon@oracle.com>
parents:
22284
diff
changeset
|
291 mx.reInstantiateDistribution('JVM_<vmbuild>_<vm>', dict(vm=self.previousVm, vmbuild=self.previousBuild), dict(vm=self.vm, vmbuild=self.build)) |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
292 _vm = self.vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
293 _vmbuild = self.build |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
294 |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
295 def __exit__(self, exc_type, exc_value, traceback): |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
296 global _vm, _vmbuild |
22286
2ecfec90e51e
moved gate from mx_jvmci.py to mx_gate.py in core mx
Doug Simon <doug.simon@oracle.com>
parents:
22284
diff
changeset
|
297 mx.reInstantiateDistribution('JVM_<vmbuild>_<vm>', dict(vm=self.vm, vmbuild=self.build), dict(vm=self.previousVm, vmbuild=self.previousBuild)) |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
298 _vm = self.previousVm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
299 _vmbuild = self.previousBuild |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
300 |
16627
68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
Bernhard Urban <bernhard.urban@jku.at>
parents:
16623
diff
changeset
|
301 def chmodRecursive(dirname, chmodFlagsDir): |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
302 if mx.get_os() == 'windows': |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
303 return |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
304 |
16627
68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
Bernhard Urban <bernhard.urban@jku.at>
parents:
16623
diff
changeset
|
305 def _chmodDir(chmodFlags, dirname, fnames): |
68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
Bernhard Urban <bernhard.urban@jku.at>
parents:
16623
diff
changeset
|
306 os.chmod(dirname, chmodFlagsDir) |
6705
0cb1ac637dd0
Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6702
diff
changeset
|
307 |
16627
68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
Bernhard Urban <bernhard.urban@jku.at>
parents:
16623
diff
changeset
|
308 os.path.walk(dirname, _chmodDir, chmodFlagsDir) |
6705
0cb1ac637dd0
Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6702
diff
changeset
|
309 |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
310 def export(args): |
15420
5947bb02474f
mx export: change the way of marking a repo as dirty
Bernhard Urban <bernhard.urban@jku.at>
parents:
15405
diff
changeset
|
311 """create archives of builds split by vmbuild and vm""" |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
312 |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
313 parser = ArgumentParser(prog='mx export') |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
314 args = parser.parse_args(args) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
315 |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
316 # collect data about export |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
317 infos = dict() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
318 infos['timestamp'] = time.time() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
319 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
320 hgcfg = mx.HgConfig() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
321 hgcfg.check() |
15420
5947bb02474f
mx export: change the way of marking a repo as dirty
Bernhard Urban <bernhard.urban@jku.at>
parents:
15405
diff
changeset
|
322 infos['revision'] = hgcfg.tip('.') + ('+' if hgcfg.isDirty('.') else '') |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
323 # TODO: infos['repository'] |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
324 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
325 infos['jdkversion'] = str(get_jvmci_bootstrap_jdk().version) |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
326 |
17012
ad10671d1bbd
mx: move get_arch() to mxtool
Bernhard Urban <bernhard.urban@jku.at>
parents:
16983
diff
changeset
|
327 infos['architecture'] = mx.get_arch() |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
328 infos['platform'] = mx.get_os() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
329 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
330 if mx.get_os != 'windows': |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
331 pass |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
332 # infos['ccompiler'] |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
333 # infos['linker'] |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
334 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
335 infos['hostname'] = socket.gethostname() |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
336 |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
337 def _writeJson(suffix, properties): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
338 d = infos.copy() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
339 for k, v in properties.iteritems(): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
340 assert not d.has_key(k) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
341 d[k] = v |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
342 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
343 jsonFileName = 'export-' + suffix + '.json' |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
344 with open(jsonFileName, 'w') as f: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
345 print >> f, json.dumps(d) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
346 return jsonFileName |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
347 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
348 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
349 def _genFileName(archivetype, middle): |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
350 idPrefix = infos['revision'] + '_' |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
351 idSuffix = '.tar.gz' |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
352 return join(_suite.dir, "graalvm_" + archivetype + "_" + idPrefix + middle + idSuffix) |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
353 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
354 def _genFileArchPlatformName(archivetype, middle): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
355 return _genFileName(archivetype, infos['platform'] + '_' + infos['architecture'] + '_' + middle) |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
356 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
357 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
358 # archive different build types of hotspot |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
359 for vmBuild in _vmbuildChoices: |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
360 jdkDir = join(_jdksDir(), vmBuild) |
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
361 if not exists(jdkDir): |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
362 mx.logv("skipping " + vmBuild) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
363 continue |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
364 |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
365 tarName = _genFileArchPlatformName('basejdk', vmBuild) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
366 mx.logv("creating basejdk " + tarName) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
367 vmSet = set() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
368 with tarfile.open(tarName, 'w:gz') as tar: |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
369 for root, _, files in os.walk(jdkDir): |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
370 if basename(root) in _vmChoices.keys(): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
371 # TODO: add some assert to check path assumption |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
372 vmSet.add(root) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
373 continue |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
374 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
375 for f in files: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
376 name = join(root, f) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
377 # print name |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
378 tar.add(name, name) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
379 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
380 n = _writeJson("basejdk-" + vmBuild, {'vmbuild' : vmBuild}) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
381 tar.add(n, n) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
382 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
383 # create a separate archive for each VM |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
384 for vm in vmSet: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
385 bVm = basename(vm) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
386 vmTarName = _genFileArchPlatformName('vm', vmBuild + '_' + bVm) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
387 mx.logv("creating vm " + vmTarName) |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
388 |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
389 debugFiles = set() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
390 with tarfile.open(vmTarName, 'w:gz') as tar: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
391 for root, _, files in os.walk(vm): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
392 for f in files: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
393 # TODO: mac, windows, solaris? |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
394 if any(map(f.endswith, [".debuginfo"])): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
395 debugFiles.add(f) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
396 else: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
397 name = join(root, f) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
398 # print name |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
399 tar.add(name, name) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
400 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
401 n = _writeJson("vm-" + vmBuild + "-" + bVm, {'vmbuild' : vmBuild, 'vm' : bVm}) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
402 tar.add(n, n) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
403 |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
404 if len(debugFiles) > 0: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
405 debugTarName = _genFileArchPlatformName('debugfilesvm', vmBuild + '_' + bVm) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
406 mx.logv("creating debugfilesvm " + debugTarName) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
407 with tarfile.open(debugTarName, 'w:gz') as tar: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
408 for f in debugFiles: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
409 name = join(root, f) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
410 # print name |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
411 tar.add(name, name) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
412 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
413 n = _writeJson("debugfilesvm-" + vmBuild + "-" + bVm, {'vmbuild' : vmBuild, 'vm' : bVm}) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
414 tar.add(n, n) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
415 |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
416 # jvmci directory |
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
417 jvmciDirTarName = _genFileName('classfiles', 'javac') |
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
418 mx.logv("creating jvmci " + jvmciDirTarName) |
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
419 with tarfile.open(jvmciDirTarName, 'w:gz') as tar: |
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
420 for root, _, files in os.walk("jvmci"): |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
421 for f in [f for f in files if not f.endswith('.java')]: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
422 name = join(root, f) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
423 # print name |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
424 tar.add(name, name) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
425 |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
426 n = _writeJson("jvmci", {'javacompiler' : 'javac'}) |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
427 tar.add(n, n) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
428 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
429 def relativeVmLibDirInJdk(): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
430 mxos = mx.get_os() |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
431 if mxos == 'darwin': |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
432 return join('jre', 'lib') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
433 if mxos == 'windows' or mxos == 'cygwin': |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
434 return join('jre', 'bin') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
435 return join('jre', 'lib', mx.get_arch()) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
436 |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
437 def vmLibDirInJdk(jdkDir): |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
438 """ |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
439 Gets the directory within a JDK where the server and client |
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
440 sub-directories are located. |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
441 """ |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
442 return join(jdkDir, relativeVmLibDirInJdk()) |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
443 |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
444 def getVmJliLibDirs(jdkDir): |
17014
6a30738791f7
mx: add helper for determine jli location
Bernhard Urban <bernhard.urban@jku.at>
parents:
17012
diff
changeset
|
445 """ |
6a30738791f7
mx: add helper for determine jli location
Bernhard Urban <bernhard.urban@jku.at>
parents:
17012
diff
changeset
|
446 Get the directories within a JDK where the jli library designates to. |
6a30738791f7
mx: add helper for determine jli location
Bernhard Urban <bernhard.urban@jku.at>
parents:
17012
diff
changeset
|
447 """ |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
448 mxos = mx.get_os() |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
449 if mxos == 'darwin': |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
450 return [join(jdkDir, 'jre', 'lib', 'jli')] |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
451 if mxos == 'windows' or mxos == 'cygwin': |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
452 return [join(jdkDir, 'jre', 'bin'), join(jdkDir, 'bin')] |
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
453 return [join(jdkDir, 'jre', 'lib', mx.get_arch(), 'jli'), join(jdkDir, 'lib', mx.get_arch(), 'jli')] |
17014
6a30738791f7
mx: add helper for determine jli location
Bernhard Urban <bernhard.urban@jku.at>
parents:
17012
diff
changeset
|
454 |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
455 def getVmCfgInJdk(jdkDir, jvmCfgFile='jvm.cfg'): |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
456 """ |
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
457 Get the jvm.cfg file. |
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
458 """ |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
459 mxos = mx.get_os() |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
460 if mxos == "windows" or mxos == "cygwin": |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
461 return join(jdkDir, 'jre', 'lib', mx.get_arch(), jvmCfgFile) |
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
462 return join(vmLibDirInJdk(jdkDir), jvmCfgFile) |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
463 |
9119
0c9c4ae236b2
refactoring to ensure the path to the JDKs dir is consistent between the _jdk() and clean() command
Doug Simon <doug.simon@oracle.com>
parents:
9118
diff
changeset
|
464 def _jdksDir(): |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
465 return os.path.abspath(join(_installed_jdks if _installed_jdks else _suite.dir, 'jdk' + str(get_jvmci_bootstrap_jdk().version))) |
9119
0c9c4ae236b2
refactoring to ensure the path to the JDKs dir is consistent between the _jdk() and clean() command
Doug Simon <doug.simon@oracle.com>
parents:
9118
diff
changeset
|
466 |
17055
3e4d3be0b6bf
mx: fix default handling of vm config and build type
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17052
diff
changeset
|
467 def _handle_missing_VM(bld, vm=None): |
3e4d3be0b6bf
mx: fix default handling of vm config and build type
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17052
diff
changeset
|
468 if not vm: |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
469 vm = get_vm() |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
470 mx.log('The ' + bld + ' ' + vm + ' VM has not been created') |
21169
41ec6d89cb84
mx: fix calls to is_interactive()
Andreas Woess <andreas.woess@oracle.com>
parents:
21166
diff
changeset
|
471 if mx.is_interactive(): |
11511
3110bea9a6b0
mx: add helper method for yes/no question
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11493
diff
changeset
|
472 if mx.ask_yes_no('Build it now', 'y'): |
11371
74414b248381
mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents:
11368
diff
changeset
|
473 with VM(vm, bld): |
74414b248381
mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents:
11368
diff
changeset
|
474 build([]) |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
475 return |
11493
94779c895aad
fixed documentation of --installed-jdks mx option
Doug Simon <doug.simon@oracle.com>
parents:
11424
diff
changeset
|
476 mx.abort('You need to run "mx --vm ' + vm + ' --vmbuild ' + bld + ' build" to build the selected VM') |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
477 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
478 def check_VM_exists(vm, jdkDir, build=None): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
479 if not build: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
480 build = _vmbuild |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
481 jvmCfg = getVmCfgInJdk(jdkDir) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
482 found = False |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
483 with open(jvmCfg) as f: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
484 for line in f: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
485 if line.strip() == '-' + vm + ' KNOWN': |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
486 found = True |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
487 break |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
488 if not found: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
489 _handle_missing_VM(build, vm) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
490 |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
491 def get_jvmci_jdk_dir(build=None, vmToCheck=None, create=False, deployDists=True): |
4155
394404b2d9bd
Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents:
4153
diff
changeset
|
492 """ |
22491
917b3ad10c32
renamed 'installJars' parameter of get_jvmci_jdk to 'deployDists'
Doug Simon <doug.simon@oracle.com>
parents:
22479
diff
changeset
|
493 Gets the path of the JVMCI JDK corresponding to 'build' (or '_vmbuild'), creating it |
917b3ad10c32
renamed 'installJars' parameter of get_jvmci_jdk to 'deployDists'
Doug Simon <doug.simon@oracle.com>
parents:
22479
diff
changeset
|
494 first if it does not exist and 'create' is True. If the JDK was created or |
917b3ad10c32
renamed 'installJars' parameter of get_jvmci_jdk to 'deployDists'
Doug Simon <doug.simon@oracle.com>
parents:
22479
diff
changeset
|
495 'deployDists' is True, then the JDK deployable distributions are deployed into |
917b3ad10c32
renamed 'installJars' parameter of get_jvmci_jdk to 'deployDists'
Doug Simon <doug.simon@oracle.com>
parents:
22479
diff
changeset
|
496 the JDK. |
4155
394404b2d9bd
Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents:
4153
diff
changeset
|
497 """ |
17055
3e4d3be0b6bf
mx: fix default handling of vm config and build type
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17052
diff
changeset
|
498 if not build: |
22019
07cfd3d7072b
removed _vmSourcesAvailable
Doug Simon <doug.simon@oracle.com>
parents:
22018
diff
changeset
|
499 build = _vmbuild |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
500 jdkDir = join(_jdksDir(), build) |
4582
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
501 if create: |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
502 srcJdk = get_jvmci_bootstrap_jdk().home |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
503 if not exists(jdkDir): |
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
504 mx.log('Creating ' + jdkDir + ' from ' + srcJdk) |
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
505 shutil.copytree(srcJdk, jdkDir) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
506 |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
507 # Make a copy of the default VM so that this JDK can be |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
508 # reliably used as the bootstrap for a HotSpot build. |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
509 jvmCfg = getVmCfgInJdk(jdkDir) |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
510 if not exists(jvmCfg): |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
511 mx.abort(jvmCfg + ' does not exist') |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
512 |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
513 defaultVM = None |
8647
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
514 jvmCfgLines = [] |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
515 with open(jvmCfg) as f: |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
516 for line in f: |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
517 if line.startswith('-') and defaultVM is None: |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
518 parts = line.split() |
12540
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
519 if len(parts) == 2: |
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
520 assert parts[1] == 'KNOWN', parts[1] |
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
521 defaultVM = parts[0][1:] |
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
522 jvmCfgLines += ['# default VM is a copy of the unmodified ' + defaultVM + ' VM\n'] |
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
523 jvmCfgLines += ['-original KNOWN\n'] |
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
524 else: |
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
525 # skip lines which we cannot parse (e.g. '-hotspot ALIASED_TO -client') |
12583
110c3faa57e9
mx: print warning if encounter a non-parsable line in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12540
diff
changeset
|
526 mx.log("WARNING: skipping not parsable line \"" + line + "\"") |
8647
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
527 else: |
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
528 jvmCfgLines += [line] |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
529 |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
530 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
531 chmodRecursive(jdkDir, JDK_UNIX_PERMISSIONS_DIR) |
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
532 shutil.move(join(vmLibDirInJdk(jdkDir), defaultVM), join(vmLibDirInJdk(jdkDir), 'original')) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
533 |
18733
d7ec30ebb0f2
Properly chmod files modified when creating JDK image
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18714
diff
changeset
|
534 if mx.get_os() != 'windows': |
d7ec30ebb0f2
Properly chmod files modified when creating JDK image
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18714
diff
changeset
|
535 os.chmod(jvmCfg, JDK_UNIX_PERMISSIONS_FILE) |
8261
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
536 with open(jvmCfg, 'w') as fp: |
8647
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
537 for line in jvmCfgLines: |
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
538 fp.write(line) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
539 |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
540 # patch 'release' file (append jvmci revision) |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
541 releaseFile = join(jdkDir, 'release') |
13523
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
542 if exists(releaseFile): |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
543 releaseFileLines = [] |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
544 with open(releaseFile) as f: |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
545 for line in f: |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
546 releaseFileLines.append(line) |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
547 |
18733
d7ec30ebb0f2
Properly chmod files modified when creating JDK image
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18714
diff
changeset
|
548 if mx.get_os() != 'windows': |
d7ec30ebb0f2
Properly chmod files modified when creating JDK image
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18714
diff
changeset
|
549 os.chmod(releaseFile, JDK_UNIX_PERMISSIONS_FILE) |
13523
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
550 with open(releaseFile, 'w') as fp: |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
551 for line in releaseFileLines: |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
552 if line.startswith("SOURCE="): |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
553 try: |
13695
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
554 sourceLine = line[0:-2] # remove last char |
13523
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
555 hgcfg = mx.HgConfig() |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
556 hgcfg.check() |
13695
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
557 revision = hgcfg.tip('.')[:12] # take first 12 chars |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
558 fp.write(sourceLine + ' jvmci:' + revision + '\"\n') |
13523
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
559 except: |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
560 fp.write(line) |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
561 else: |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
562 fp.write(line) |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
563 |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
564 # Install a copy of the disassembler library |
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
565 try: |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
566 hsdis([], copyToDir=vmLibDirInJdk(jdkDir)) |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
567 except SystemExit: |
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
568 pass |
3718 | 569 else: |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
570 if not exists(jdkDir): |
11797
65dbed1fdf46
be verbose when the JDK specified by --installed-jdks is missing
Doug Simon <doug.simon@oracle.com>
parents:
11784
diff
changeset
|
571 if _installed_jdks: |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
572 mx.log("The selected JDK directory does not (yet) exist: " + jdkDir) |
17055
3e4d3be0b6bf
mx: fix default handling of vm config and build type
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17052
diff
changeset
|
573 _handle_missing_VM(build, vmToCheck) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
574 |
22491
917b3ad10c32
renamed 'installJars' parameter of get_jvmci_jdk to 'deployDists'
Doug Simon <doug.simon@oracle.com>
parents:
22479
diff
changeset
|
575 if deployDists: |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
576 for jdkDist in jdkDeployedDists: |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
577 dist = jdkDist.dist() |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
578 if exists(dist.path): |
21031
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
579 _installDistInJdks(jdkDist) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
580 |
8261
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
581 if vmToCheck is not None: |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
582 jvmCfg = getVmCfgInJdk(jdkDir) |
8261
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
583 found = False |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
584 with open(jvmCfg) as f: |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
585 for line in f: |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
586 if line.strip() == '-' + vmToCheck + ' KNOWN': |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
587 found = True |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
588 break |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
589 if not found: |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
590 _handle_missing_VM(build, vmToCheck) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
591 |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
592 return jdkDir |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
593 |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
594 def _updateInstalledJVMCIOptionsFile(jdkDir): |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
595 jvmciOptions = join(_suite.dir, 'jvmci.options') |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
596 jreLibDir = join(jdkDir, 'jre', 'lib') |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
597 if exists(jvmciOptions): |
22511
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22493
diff
changeset
|
598 shutil.copy(jvmciOptions, join(jreLibDir, 'jvmci', 'options')) |
11936
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
599 else: |
22511
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22493
diff
changeset
|
600 toDelete = join(jreLibDir, 'jvmci', 'options') |
11936
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
601 if exists(toDelete): |
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
602 os.unlink(toDelete) |
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
603 |
22141
f85b80b29176
removed '_' prefix from exported methods and fields and provided accessors
Doug Simon <doug.simon@oracle.com>
parents:
22140
diff
changeset
|
604 def copyToJdk(src, dst, permissions=JDK_UNIX_PERMISSIONS_FILE): |
16782
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
605 name = os.path.basename(src) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
606 if not exists(dst): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
607 os.makedirs(dst) |
16782
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
608 dstLib = join(dst, name) |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
609 if mx.get_env('SYMLINK_GRAAL_JAR', None) == 'true': |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
610 # Using symlinks is much faster than copying but may |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
611 # cause issues if the lib is being updated while |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
612 # the VM is running. |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
613 if not os.path.islink(dstLib) or not os.path.realpath(dstLib) == src: |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
614 if exists(dstLib): |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
615 os.remove(dstLib) |
16858
a8af2abc2039
fixed regression in mx causing problems for the SYMLINK_GRAAL_JAR feature
Doug Simon <doug.simon@oracle.com>
parents:
16782
diff
changeset
|
616 os.symlink(src, dstLib) |
16782
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
617 else: |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
618 # do a copy and then a move to get atomic updating (on Unix) |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
619 fd, tmp = tempfile.mkstemp(suffix='', prefix=name, dir=dst) |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
620 shutil.copyfile(src, tmp) |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
621 os.close(fd) |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
622 shutil.move(tmp, dstLib) |
16863
0d2e3399acfe
mx: add argument for permissions to copyToJdk()
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16862
diff
changeset
|
623 os.chmod(dstLib, permissions) |
16782
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
624 |
22400
b876144b52f3
moved JVMCI option parsing back into Java (missing bits)
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
625 def _extractJVMCIFiles(jdkJars, jvmciJars, servicesDir, obsoleteCheck): |
22079
59b0fd9e6b27
instead of cleaning jvmci/services and jvmci/options directories in a JDK, look for stale entries and offer to delete them if mx is running interactively
Doug Simon <doug.simon@oracle.com>
parents:
22077
diff
changeset
|
626 |
59b0fd9e6b27
instead of cleaning jvmci/services and jvmci/options directories in a JDK, look for stale entries and offer to delete them if mx is running interactively
Doug Simon <doug.simon@oracle.com>
parents:
22077
diff
changeset
|
627 oldServices = os.listdir(servicesDir) if exists(servicesDir) else os.makedirs(servicesDir) |
59b0fd9e6b27
instead of cleaning jvmci/services and jvmci/options directories in a JDK, look for stale entries and offer to delete them if mx is running interactively
Doug Simon <doug.simon@oracle.com>
parents:
22077
diff
changeset
|
628 |
21937
3a292e8b9e51
replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents:
21936
diff
changeset
|
629 jvmciServices = {} |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
630 for jar in jvmciJars: |
21070
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
631 if os.path.isfile(jar): |
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
632 with zipfile.ZipFile(jar) as zf: |
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
633 for member in zf.namelist(): |
22079
59b0fd9e6b27
instead of cleaning jvmci/services and jvmci/options directories in a JDK, look for stale entries and offer to delete them if mx is running interactively
Doug Simon <doug.simon@oracle.com>
parents:
22077
diff
changeset
|
634 if member.startswith('META-INF/jvmci.services/') and member != 'META-INF/jvmci.services/': |
21937
3a292e8b9e51
replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents:
21936
diff
changeset
|
635 service = basename(member) |
22079
59b0fd9e6b27
instead of cleaning jvmci/services and jvmci/options directories in a JDK, look for stale entries and offer to delete them if mx is running interactively
Doug Simon <doug.simon@oracle.com>
parents:
22077
diff
changeset
|
636 assert service != "", member |
21518
c2e58b2a2a76
Extract options file to build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21514
diff
changeset
|
637 with zf.open(member) as serviceFile: |
21937
3a292e8b9e51
replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents:
21936
diff
changeset
|
638 providers = jvmciServices.setdefault(service, []) |
21518
c2e58b2a2a76
Extract options file to build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21514
diff
changeset
|
639 for line in serviceFile.readlines(): |
c2e58b2a2a76
Extract options file to build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21514
diff
changeset
|
640 line = line.strip() |
22173
1a7f71d13b6e
avoid duplicate declarations of JVMCI service providers
Doug Simon <doug.simon@oracle.com>
parents:
22171
diff
changeset
|
641 if line and line not in providers: |
21937
3a292e8b9e51
replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents:
21936
diff
changeset
|
642 providers.append(line) |
3a292e8b9e51
replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents:
21936
diff
changeset
|
643 for service, providers in jvmciServices.iteritems(): |
22140
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
644 if not obsoleteCheck: |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
645 fd, tmp = tempfile.mkstemp(prefix=service) |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
646 f = os.fdopen(fd, 'w+') |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
647 for provider in providers: |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
648 f.write(provider + os.linesep) |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
649 target = join(servicesDir, service) |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
650 f.close() |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
651 shutil.move(tmp, target) |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
652 if mx.get_os() != 'windows': |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
653 os.chmod(target, JDK_UNIX_PERMISSIONS_FILE) |
22079
59b0fd9e6b27
instead of cleaning jvmci/services and jvmci/options directories in a JDK, look for stale entries and offer to delete them if mx is running interactively
Doug Simon <doug.simon@oracle.com>
parents:
22077
diff
changeset
|
654 if oldServices and service in oldServices: |
59b0fd9e6b27
instead of cleaning jvmci/services and jvmci/options directories in a JDK, look for stale entries and offer to delete them if mx is running interactively
Doug Simon <doug.simon@oracle.com>
parents:
22077
diff
changeset
|
655 oldServices.remove(service) |
21562 | 656 |
22400
b876144b52f3
moved JVMCI option parsing back into Java (missing bits)
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
657 if obsoleteCheck and mx.is_interactive() and oldServices: |
b876144b52f3
moved JVMCI option parsing back into Java (missing bits)
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
658 if mx.ask_yes_no('These files in ' + servicesDir + ' look obsolete:\n ' + '\n '.join(oldServices) + '\nDelete them', 'n'): |
b876144b52f3
moved JVMCI option parsing back into Java (missing bits)
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
659 for f in oldServices: |
b876144b52f3
moved JVMCI option parsing back into Java (missing bits)
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
660 path = join(servicesDir, f) |
b876144b52f3
moved JVMCI option parsing back into Java (missing bits)
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
661 os.remove(path) |
b876144b52f3
moved JVMCI option parsing back into Java (missing bits)
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
662 mx.log('Deleted ' + path) |
22079
59b0fd9e6b27
instead of cleaning jvmci/services and jvmci/options directories in a JDK, look for stale entries and offer to delete them if mx is running interactively
Doug Simon <doug.simon@oracle.com>
parents:
22077
diff
changeset
|
663 |
22140
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
664 def _updateJVMCIFiles(jdkDir, obsoleteCheck=False): |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
665 jreJVMCIDir = join(jdkDir, 'jre', 'lib', 'jvmci') |
21607
71b338926f2e
moved JVMCI classes into their own distributions (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
666 jvmciJars = [join(jreJVMCIDir, e) for e in os.listdir(jreJVMCIDir) if e.endswith('.jar')] |
21671
8d0c2aabfc2d
missed Graal -> JVMCI renamings
Doug Simon <doug.simon@oracle.com>
parents:
21642
diff
changeset
|
667 jreJVMCIServicesDir = join(jreJVMCIDir, 'services') |
22400
b876144b52f3
moved JVMCI option parsing back into Java (missing bits)
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
668 _extractJVMCIFiles(_getJdkDeployedJars(jdkDir), jvmciJars, jreJVMCIServicesDir, obsoleteCheck) |
21070
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
669 |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22427
diff
changeset
|
670 def _updateJVMCIProperties(jdkDir, compilers): |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22427
diff
changeset
|
671 jvmciProperties = join(jdkDir, 'jre', 'lib', 'jvmci', 'jvmci.properties') |
22530
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
672 def createFile(lines): |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22427
diff
changeset
|
673 with open(jvmciProperties, 'w') as fp: |
22530
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
674 header = "# the last definition of a property wins (i.e., it overwrites any earlier definitions)" |
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
675 if header not in lines: |
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
676 print >> fp, header |
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
677 for line in lines: |
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
678 print >> fp, line |
22438
dfd506f2ed61
Add comment to jvmci.properties file.
Roland Schatz <roland.schatz@oracle.com>
parents:
22436
diff
changeset
|
679 |
22530
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
680 lines = [] |
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
681 if exists(jvmciProperties): |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22427
diff
changeset
|
682 with open(jvmciProperties) as fp: |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22427
diff
changeset
|
683 for line in fp: |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22427
diff
changeset
|
684 if line.startswith('jvmci.compiler='): |
22530
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
685 compiler = line.strip().split('=')[1] |
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
686 if compiler not in compilers: |
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
687 lines.append(line.strip()) |
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
688 else: |
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
689 lines.append(line.strip()) |
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
690 for compiler in compilers: |
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
691 lines.append("jvmci.compiler=" + compiler) |
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22520
diff
changeset
|
692 createFile(lines) |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22427
diff
changeset
|
693 |
21031
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
694 def _installDistInJdks(deployableDist): |
16623
addc0564e5b5
split com.oracle.graal.truffle.* projects into a separate graal-truffle.jar and added truffle.jar to the boot class path
Doug Simon <doug.simon@oracle.com>
parents:
16622
diff
changeset
|
695 """ |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
696 Installs the jar(s) for a given Distribution into all existing JVMCI JDKs |
16623
addc0564e5b5
split com.oracle.graal.truffle.* projects into a separate graal-truffle.jar and added truffle.jar to the boot class path
Doug Simon <doug.simon@oracle.com>
parents:
16622
diff
changeset
|
697 """ |
10574
0cad5096735e
commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10570
diff
changeset
|
698 jdks = _jdksDir() |
8134
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
699 if exists(jdks): |
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
700 for e in os.listdir(jdks): |
21070
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
701 jdkDir = join(jdks, e) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
702 deployableDist.deploy(jdkDir) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
703 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
704 def _vmbuildFromJdkDir(jdkDir): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
705 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
706 Determines the VM build corresponding to 'jdkDir'. |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
707 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
708 jdksDir = _jdksDir() |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
709 assert jdkDir.startswith(jdksDir) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
710 vmbuild = os.path.relpath(jdkDir, jdksDir) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
711 assert vmbuild in _vmbuildChoices, 'The vmbuild derived from ' + jdkDir + ' is unknown: ' + vmbuild |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
712 return vmbuild |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
713 |
22140
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
714 def _check_for_obsolete_jvmci_files(): |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
715 jdks = _jdksDir() |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
716 if exists(jdks): |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
717 for e in os.listdir(jdks): |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
718 jdkDir = join(jdks, e) |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
719 _updateJVMCIFiles(jdkDir, obsoleteCheck=True) |
60d9e50d5481
only perform check for obsolete JVMCI files during full build
Doug Simon <doug.simon@oracle.com>
parents:
22139
diff
changeset
|
720 |
21613
60154926b513
replaced use of javap with a small Java utility for refining service class list to only those implementing com.oracle.jvmci.service.Service
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
721 def _getJdkDeployedJars(jdkDir): |
60154926b513
replaced use of javap with a small Java utility for refining service class list to only those implementing com.oracle.jvmci.service.Service
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
722 """ |
60154926b513
replaced use of javap with a small Java utility for refining service class list to only those implementing com.oracle.jvmci.service.Service
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
723 Gets jar paths for all deployed distributions in the context of |
60154926b513
replaced use of javap with a small Java utility for refining service class list to only those implementing com.oracle.jvmci.service.Service
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
724 a given JDK directory. |
60154926b513
replaced use of javap with a small Java utility for refining service class list to only those implementing com.oracle.jvmci.service.Service
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
725 """ |
60154926b513
replaced use of javap with a small Java utility for refining service class list to only those implementing com.oracle.jvmci.service.Service
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
726 jars = [] |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
727 for dist in jdkDeployedDists: |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
728 if not isinstance(dist, JarJDKDeployedDist): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
729 continue |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
730 jar = basename(dist.dist().path) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
731 jars.append(join(dist.targetDir(), jar)) |
21613
60154926b513
replaced use of javap with a small Java utility for refining service class list to only those implementing com.oracle.jvmci.service.Service
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
732 return jars |
60154926b513
replaced use of javap with a small Java utility for refining service class list to only those implementing com.oracle.jvmci.service.Service
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
733 |
60154926b513
replaced use of javap with a small Java utility for refining service class list to only those implementing com.oracle.jvmci.service.Service
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
734 |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
735 # run a command in the windows SDK Debug Shell |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
736 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo=None): |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
737 if respondTo is None: |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
738 respondTo = {} |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
739 newLine = os.linesep |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
740 startToken = 'RUNINDEBUGSHELL_STARTSEQUENCE' |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
741 endToken = 'RUNINDEBUGSHELL_ENDSEQUENCE' |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
742 |
4252
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
743 winSDK = mx.get_env('WIN_SDK', 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\') |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
744 |
17262
b641450c19ce
mx: rename helper functions for cygwin support and update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
17233
diff
changeset
|
745 if not exists(mx._cygpathW2U(winSDK)): |
6306
2a819543cc45
Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6294
diff
changeset
|
746 mx.abort("Could not find Windows SDK : '" + winSDK + "' does not exist") |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
747 |
17262
b641450c19ce
mx: rename helper functions for cygwin support and update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
17233
diff
changeset
|
748 winSDKSetEnv = mx._cygpathW2U(join(winSDK, 'Bin', 'SetEnv.cmd')) |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
749 if not exists(winSDKSetEnv): |
6306
2a819543cc45
Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6294
diff
changeset
|
750 mx.abort("Invalid Windows SDK path (" + winSDK + ") : could not find Bin/SetEnv.cmd (you can use the WIN_SDK environment variable to specify an other path)") |
4252
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
751 |
17262
b641450c19ce
mx: rename helper functions for cygwin support and update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
17233
diff
changeset
|
752 wincmd = 'cmd.exe /E:ON /V:ON /K "' + mx._cygpathU2W(winSDKSetEnv) + '"' |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
753 p = subprocess.Popen(wincmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
4269
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
754 stdout = p.stdout |
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
755 stdin = p.stdin |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
756 if logFile: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
757 log = open(logFile, 'w') |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
758 ret = False |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
759 |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
760 def _writeProcess(s): |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
761 stdin.write(s + newLine) |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
762 |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
763 _writeProcess("echo " + startToken) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
764 while True: |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
765 # encoding may be None on windows plattforms |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
766 if sys.stdout.encoding is None: |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
767 encoding = 'utf-8' |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
768 else: |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
769 encoding = sys.stdout.encoding |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
770 |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
771 line = stdout.readline().decode(encoding) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
772 if logFile: |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
773 log.write(line.encode('utf-8')) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
774 line = line.strip() |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
775 mx.log(line) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
776 if line == startToken: |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
777 _writeProcess('cd /D ' + workingDir + ' & ' + cmd + ' & echo ' + endToken) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
778 for regex in respondTo.keys(): |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
779 match = regex.search(line) |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
780 if match: |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
781 _writeProcess(respondTo[regex]) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
782 if findInOutput: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
783 match = findInOutput.search(line) |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
784 if match: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
785 ret = True |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
786 if line == endToken: |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
787 if not findInOutput: |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
788 _writeProcess('echo ERRXXX%errorlevel%') |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
789 else: |
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
790 break |
5868
a10e72af4dc5
Make windows build work even if Visual Studio is not installed (only the Windows SDK is required)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5782
diff
changeset
|
791 if line.startswith('ERRXXX'): |
a10e72af4dc5
Make windows build work even if Visual Studio is not installed (only the Windows SDK is required)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5782
diff
changeset
|
792 if line == 'ERRXXX0': |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
793 ret = True |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
794 break |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
795 _writeProcess("exit") |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
796 if logFile: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
797 log.close() |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
798 return ret |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
799 |
11605
3676540f71cf
Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents:
11534
diff
changeset
|
800 def jdkhome(vm=None): |
3676540f71cf
Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents:
11534
diff
changeset
|
801 """return the JDK directory selected for the 'vm' command""" |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
802 return get_jvmci_jdk_dir(deployDists=False) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
803 |
11605
3676540f71cf
Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents:
11534
diff
changeset
|
804 def print_jdkhome(args, vm=None): |
3676540f71cf
Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents:
11534
diff
changeset
|
805 """print the JDK directory selected for the 'vm' command""" |
3676540f71cf
Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents:
11534
diff
changeset
|
806 print jdkhome(vm) |
5103
276e14614531
Added jdkhome command to mx.
Doug Simon <doug.simon@oracle.com>
parents:
5094
diff
changeset
|
807 |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
808 def buildvars(args): |
11377
0fbc1e418c88
fixed capitalization and tense in documentation of some mx commands
Doug Simon <doug.simon@oracle.com>
parents:
11373
diff
changeset
|
809 """describe the variables that can be set by the -D option to the 'mx build' commmand""" |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
810 |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
811 buildVars = { |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
812 'ALT_BOOTDIR' : 'The location of the bootstrap JDK installation (default: ' + get_jvmci_bootstrap_jdk().home + ')', |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
813 'ALT_OUTPUTDIR' : 'Build directory', |
18876
c446d00f2cdf
mx: added support for Jython 2.7b3 and made ordering in generated files more deterministic\nContributed-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Doug Simon <doug.simon@oracle.com>
parents:
18869
diff
changeset
|
814 'HOTSPOT_BUILD_JOBS' : 'Number of CPUs used by make (default: ' + str(mx.cpu_count()) + ')', |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
815 'INSTALL' : 'Install the built VM into the JDK? (default: y)', |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
816 'ZIP_DEBUGINFO_FILES' : 'Install zipped debug symbols file? (default: 0)', |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
817 } |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
818 |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
819 mx.log('HotSpot build variables that can be set by the -D option to "mx build":') |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
820 mx.log('') |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
821 for n in sorted(buildVars.iterkeys()): |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
822 mx.log(n) |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
823 mx.log(textwrap.fill(buildVars[n], initial_indent=' ', subsequent_indent=' ', width=200)) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
824 |
9120
9f361c0f912b
added note about mx/env to the output of 'mx buildvars'
Doug Simon <doug.simon@oracle.com>
parents:
9119
diff
changeset
|
825 mx.log('') |
22018
11ed27b2abe8
remove hard-coded use of 'mx' to refer to the mxDir for the graal suite
Doug Simon <doug.simon@oracle.com>
parents:
22017
diff
changeset
|
826 mx.log('Note that these variables can be given persistent values in the file ' + join(_suite.mxDir, 'env') + ' (see \'mx about\').') |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
827 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
828 def _hotspotReplaceResultsVar(m): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
829 var = m.group(1) |
22283
65eb572cbcb7
extended JVM_<vmbuild>_<vm> template distribution with MacOS support
Doug Simon <doug.simon@oracle.com>
parents:
22282
diff
changeset
|
830 if var == 'os': |
22332
4dfa1275ffa3
Fix alt outputdir for -nojvmci builds
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22331
diff
changeset
|
831 return _hotspotOs(mx.get_os()) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
832 if var == 'nojvmci': |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
833 if get_vm().endswith('nojvmci'): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
834 return '-nojvmci' |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
835 return '' |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
836 if var == 'buildname': |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
837 return _hotspotGetVariant() |
22284
09acb1bc3a56
make hotspot native project's results parameterized on <vmbuild>
Doug Simon <doug.simon@oracle.com>
parents:
22283
diff
changeset
|
838 if var == 'vmbuild': |
09acb1bc3a56
make hotspot native project's results parameterized on <vmbuild>
Doug Simon <doug.simon@oracle.com>
parents:
22283
diff
changeset
|
839 return _vmbuild |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
840 return mx._replaceResultsVar(m) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
841 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
842 class HotSpotProject(mx.NativeProject): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
843 def __init__(self, suite, name, deps, workingSets, results, output, **args): |
22436
5bf761306682
Don't create empty jvmci/src/{s,r,c} directories in mx.
Roland Schatz <roland.schatz@oracle.com>
parents:
22429
diff
changeset
|
844 mx.NativeProject.__init__(self, suite, name, "", [], deps, workingSets, results, output, join(suite.dir, "src")) # TODO... |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
845 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
846 def getOutput(self, replaceVar=_hotspotReplaceResultsVar): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
847 return mx.NativeProject.getOutput(self, replaceVar=replaceVar) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
848 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
849 def getResults(self, replaceVar=_hotspotReplaceResultsVar): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
850 return mx.NativeProject.getResults(self, replaceVar=replaceVar) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
851 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
852 def getBuildTask(self, args): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
853 return HotSpotBuildTask(self, args, _vmbuild, get_vm()) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
854 |
22332
4dfa1275ffa3
Fix alt outputdir for -nojvmci builds
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22331
diff
changeset
|
855 def _hotspotOs(mx_os): |
4dfa1275ffa3
Fix alt outputdir for -nojvmci builds
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22331
diff
changeset
|
856 if mx_os == 'darwin': |
4dfa1275ffa3
Fix alt outputdir for -nojvmci builds
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22331
diff
changeset
|
857 return 'bsd' |
4dfa1275ffa3
Fix alt outputdir for -nojvmci builds
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22331
diff
changeset
|
858 return mx_os |
4dfa1275ffa3
Fix alt outputdir for -nojvmci builds
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22331
diff
changeset
|
859 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
860 def _hotspotGetVariant(vm=None): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
861 if not vm: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
862 vm = get_vm() |
22328
3a95164b033c
Fix nojvmci builds.
Roland Schatz <roland.schatz@oracle.com>
parents:
22327
diff
changeset
|
863 variant = {'client': 'compiler1', 'server': 'compiler2', 'client-nojvmci': 'compiler1', 'server-nojvmci': 'compiler2'}.get(vm, vm) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
864 return variant |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
865 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
866 class HotSpotBuildTask(mx.NativeBuildTask): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
867 def __init__(self, project, args, vmbuild, vm): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
868 mx.NativeBuildTask.__init__(self, args, project) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
869 self.vm = vm |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
870 self.vmbuild = vmbuild |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
871 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
872 def __str__(self): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
873 return 'Building HotSpot[{}, {}]'.format(self.vmbuild, self.vm) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
874 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
875 def build(self): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
876 isWindows = platform.system() == 'Windows' or "CYGWIN" in platform.system() |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
877 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
878 if self.vm.startswith('server'): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
879 buildSuffix = '' |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
880 elif self.vm.startswith('client'): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
881 buildSuffix = '1' |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
882 else: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
883 assert self.vm == 'jvmci', self.vm |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
884 buildSuffix = 'jvmci' |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
885 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
886 if isWindows: |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
887 t_compilelogfile = mx._cygpathU2W(os.path.join(_suite.dir, "jvmciCompile.log")) |
22335
8217ef77a80a
Work on Windows build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22334
diff
changeset
|
888 mksHome = mx.get_env('MKS_HOME', 'C:\\cygwin\\bin') |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
889 |
22335
8217ef77a80a
Work on Windows build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22334
diff
changeset
|
890 variant = _hotspotGetVariant(self.vm) |
8217ef77a80a
Work on Windows build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22334
diff
changeset
|
891 project_config = variant + '_' + self.vmbuild |
8217ef77a80a
Work on Windows build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22334
diff
changeset
|
892 jvmciHome = mx._cygpathU2W(_suite.dir) |
8217ef77a80a
Work on Windows build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22334
diff
changeset
|
893 _runInDebugShell('msbuild ' + jvmciHome + r'\build\vs-amd64\jvm.vcproj /p:Configuration=' + project_config + ' /target:clean', jvmciHome) |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
894 winCompileCmd = r'set HotSpotMksHome=' + mksHome + r'& set JAVA_HOME=' + mx._cygpathU2W(get_jvmci_bootstrap_jdk().home) + r'& set path=%JAVA_HOME%\bin;%path%;%HotSpotMksHome%& cd /D "' + jvmciHome + r'\make\windows"& call create.bat ' + jvmciHome |
22335
8217ef77a80a
Work on Windows build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22334
diff
changeset
|
895 print winCompileCmd |
8217ef77a80a
Work on Windows build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22334
diff
changeset
|
896 winCompileSuccess = re.compile(r"^Writing \.vcxproj file:") |
8217ef77a80a
Work on Windows build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22334
diff
changeset
|
897 if not _runInDebugShell(winCompileCmd, jvmciHome, t_compilelogfile, winCompileSuccess): |
8217ef77a80a
Work on Windows build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22334
diff
changeset
|
898 mx.abort('Error executing create command') |
8217ef77a80a
Work on Windows build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22334
diff
changeset
|
899 winBuildCmd = 'msbuild ' + jvmciHome + r'\build\vs-amd64\jvm.vcxproj /p:Configuration=' + project_config + ' /p:Platform=x64' |
8217ef77a80a
Work on Windows build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22334
diff
changeset
|
900 if not _runInDebugShell(winBuildCmd, jvmciHome, t_compilelogfile): |
8217ef77a80a
Work on Windows build
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22334
diff
changeset
|
901 mx.abort('Error building project') |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
902 else: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
903 def filterXusage(line): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
904 if not 'Xusage.txt' in line: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
905 sys.stderr.write(line + os.linesep) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
906 cpus = self.parallelism |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
907 makeDir = join(_suite.dir, 'make') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
908 runCmd = [mx.gmake_cmd(), '-C', makeDir] |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
909 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
910 env = os.environ.copy() |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
911 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
912 # These must be passed as environment variables |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
913 env.setdefault('LANG', 'C') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
914 #env['JAVA_HOME'] = jdk |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
915 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
916 def setMakeVar(name, default, env=None): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
917 """Sets a make variable on the command line to the value |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
918 of the variable in 'env' with the same name if defined |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
919 and 'env' is not None otherwise to 'default' |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
920 """ |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
921 runCmd.append(name + '=' + (env.get(name, default) if env else default)) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
922 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
923 if self.args.D: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
924 for nv in self.args.D: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
925 name, value = nv.split('=', 1) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
926 setMakeVar(name.strip(), value) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
927 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
928 setMakeVar('ARCH_DATA_MODEL', '64', env=env) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
929 setMakeVar('HOTSPOT_BUILD_JOBS', str(cpus), env=env) |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
930 setMakeVar('ALT_BOOTDIR', get_jvmci_bootstrap_jdk().home, env=env) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
931 # setMakeVar("EXPORT_PATH", jdk) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
932 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
933 setMakeVar('MAKE_VERBOSE', 'y' if mx._opts.verbose else '') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
934 if self.vm.endswith('nojvmci'): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
935 setMakeVar('INCLUDE_JVMCI', 'false') |
22332
4dfa1275ffa3
Fix alt outputdir for -nojvmci builds
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22331
diff
changeset
|
936 setMakeVar('ALT_OUTPUTDIR', join(_suite.dir, 'build-nojvmci', _hotspotOs(mx.get_os())), env=env) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
937 else: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
938 version = _suite.release_version() |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
939 setMakeVar('USER_RELEASE_SUFFIX', 'jvmci-' + version) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
940 setMakeVar('INCLUDE_JVMCI', 'true') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
941 # setMakeVar('INSTALL', 'y', env=env) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
942 if mx.get_os() == 'darwin' and platform.mac_ver()[0] != '': |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
943 # Force use of clang on MacOS |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
944 setMakeVar('USE_CLANG', 'true') |
22395
63e7eb179710
Set COMPILER_WARNINGS_FATAL=false during HotSpot build on MacOS
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22335
diff
changeset
|
945 setMakeVar('COMPILER_WARNINGS_FATAL', 'false') |
63e7eb179710
Set COMPILER_WARNINGS_FATAL=false during HotSpot build on MacOS
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22335
diff
changeset
|
946 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
947 if mx.get_os() == 'solaris': |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
948 # If using sparcWorks, setup flags to avoid make complaining about CC version |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
949 cCompilerVersion = subprocess.Popen('CC -V', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).stderr.readlines()[0] |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
950 if cCompilerVersion.startswith('CC: Sun C++'): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
951 compilerRev = cCompilerVersion.split(' ')[3] |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
952 setMakeVar('ENFORCE_COMPILER_REV', compilerRev, env=env) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
953 setMakeVar('ENFORCE_CC_COMPILER_REV', compilerRev, env=env) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
954 if self.vmbuild == 'jvmg': |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
955 # We want ALL the symbols when debugging on Solaris |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
956 setMakeVar('STRIP_POLICY', 'no_strip') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
957 # This removes the need to unzip the *.diz files before debugging in gdb |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
958 setMakeVar('ZIP_DEBUGINFO_FILES', '0', env=env) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
959 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
960 if buildSuffix == "1": |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
961 setMakeVar("BUILD_CLIENT_ONLY", "true") |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
962 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
963 # Clear this variable as having it set can cause very confusing build problems |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
964 env.pop('CLASSPATH', None) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
965 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
966 # Issue an env prefix that can be used to run the make on the command line |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
967 if not mx._opts.verbose: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
968 mx.log('--------------- make command line ----------------------') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
969 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
970 envPrefix = ' '.join([key + '=' + env[key] for key in env.iterkeys() if not os.environ.has_key(key) or env[key] != os.environ[key]]) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
971 if len(envPrefix): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
972 mx.log('env ' + envPrefix + ' \\') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
973 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
974 runCmd.append(self.vmbuild + buildSuffix) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
975 runCmd.append("docs") |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
976 # runCmd.append("export_" + build) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
977 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
978 if not mx._opts.verbose: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
979 mx.log(' '.join(runCmd)) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
980 mx.log('--------------------------------------------------------') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
981 mx.run(runCmd, err=filterXusage, env=env) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
982 self._newestOutput = None |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
983 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
984 def needsBuild(self, newestInput): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
985 newestOutput = self.newestOutput() |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
986 for d in ['src', 'make', join('jvmci', 'jdk.internal.jvmci.hotspot', 'src_gen', 'hotspot')]: # TODO should this be replaced by a dependency to the project? |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
987 for root, dirnames, files in os.walk(join(_suite.dir, d)): |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
988 # ignore src/share/tools |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
989 if root == join(_suite.dir, 'src', 'share'): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
990 dirnames.remove('tools') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
991 for f in (join(root, name) for name in files): |
22413
454a38908a59
newestInput parameter to HotSpotBuildTask.needsBuild() is a TimeStampFile as of mx 5.3.3
Doug Simon <doug.simon@oracle.com>
parents:
22400
diff
changeset
|
992 ts = mx.TimeStampFile(f) |
454a38908a59
newestInput parameter to HotSpotBuildTask.needsBuild() is a TimeStampFile as of mx 5.3.3
Doug Simon <doug.simon@oracle.com>
parents:
22400
diff
changeset
|
993 if newestOutput: |
454a38908a59
newestInput parameter to HotSpotBuildTask.needsBuild() is a TimeStampFile as of mx 5.3.3
Doug Simon <doug.simon@oracle.com>
parents:
22400
diff
changeset
|
994 if not newestOutput.exists(): |
454a38908a59
newestInput parameter to HotSpotBuildTask.needsBuild() is a TimeStampFile as of mx 5.3.3
Doug Simon <doug.simon@oracle.com>
parents:
22400
diff
changeset
|
995 return (True, '{} does not exist'.format(newestOutput)) |
454a38908a59
newestInput parameter to HotSpotBuildTask.needsBuild() is a TimeStampFile as of mx 5.3.3
Doug Simon <doug.simon@oracle.com>
parents:
22400
diff
changeset
|
996 if ts.isNewerThan(newestOutput): |
454a38908a59
newestInput parameter to HotSpotBuildTask.needsBuild() is a TimeStampFile as of mx 5.3.3
Doug Simon <doug.simon@oracle.com>
parents:
22400
diff
changeset
|
997 return (True, '{} is newer than {}'.format(ts, newestOutput)) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
998 return (False, None) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
999 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1000 def buildForbidden(self): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1001 if mx.NativeBuildTask.buildForbidden(self): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1002 return True |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1003 if self.vm == 'original': |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1004 if self.vmbuild != 'product': |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1005 mx.log('only product build of original VM exists') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1006 return True |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1007 if not isVMSupported(self.vm): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1008 mx.log('The ' + self.vm + ' VM is not supported on this platform - skipping') |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1009 return True |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1010 return False |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1011 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1012 def clean(self, forBuild=False): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1013 if forBuild: # Let make handle incremental builds |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1014 return |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1015 def handleRemoveReadonly(func, path, exc): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1016 excvalue = exc[1] |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1017 if mx.get_os() == 'windows' and func in (os.rmdir, os.remove) and excvalue.errno == errno.EACCES: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1018 os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) # 0777 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1019 func(path) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1020 else: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1021 raise |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1022 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1023 def rmIfExists(name): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1024 if os.path.isdir(name): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1025 shutil.rmtree(name, ignore_errors=False, onerror=handleRemoveReadonly) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1026 elif os.path.isfile(name): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1027 os.unlink(name) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1028 |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1029 rmIfExists(join(_suite.dir, 'build')) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1030 rmIfExists(join(_suite.dir, 'build-nojvmci')) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1031 rmIfExists(_jdksDir()) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1032 self._newestOutput = None |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1033 |
4577
bc8b58c11768
Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4575
diff
changeset
|
1034 def build(args, vm=None): |
4575
ccb5369481a2
Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents:
4572
diff
changeset
|
1035 """build the VM binary |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1036 |
11392
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1037 The global '--vm' and '--vmbuild' options select which VM type and build target to build.""" |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1038 |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1039 # Override to fail quickly if extra arguments are given |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1040 # at the end of the command line. This allows for a more |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1041 # helpful error message. |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1042 class AP(ArgumentParser): |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1043 def __init__(self): |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1044 ArgumentParser.__init__(self, prog='mx build') |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1045 def parse_args(self, args): |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1046 result = ArgumentParser.parse_args(self, args) |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1047 if len(result.remainder) != 0: |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1048 firstBuildTarget = result.remainder[0] |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1049 mx.abort('To specify the ' + firstBuildTarget + ' VM build target, you need to use the global "--vmbuild" option. For example:\n' + |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1050 ' mx --vmbuild ' + firstBuildTarget + ' build') |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
1051 return result |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1052 |
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1053 # Call mx.build to compile the Java sources |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1054 parser = AP() |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
1055 parser.add_argument('-D', action='append', help='set a HotSpot build variable (run \'mx buildvars\' to list variables)', metavar='name=value') |
21791
cd36556e1b78
Remove conditional makefile-based compilation of jvmci from mx_graal.py
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21790
diff
changeset
|
1056 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1057 # initialize jdk |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
1058 get_jvmci_jdk_dir(create=True) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1059 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1060 mx.build(['--source', '1.7'] + args, parser=parser) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1061 |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1062 |
22492
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
1063 def updateJvmCfg(jdkDir, vm): |
f22fd96605ee
renamed get_jvmci_jdk to get_jvmci_jdk_dir and where relevant, variables named jdk to jdkDir
Doug Simon <doug.simon@oracle.com>
parents:
22491
diff
changeset
|
1064 jvmCfg = getVmCfgInJdk(jdkDir) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1065 if not exists(jvmCfg): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1066 mx.abort(jvmCfg + ' does not exist') |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1067 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1068 prefix = '-' + vm + ' ' |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1069 vmKnown = prefix + 'KNOWN\n' |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1070 lines = [] |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1071 found = False |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1072 with open(jvmCfg) as f: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1073 for line in f: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1074 if line.strip() == vmKnown.strip(): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1075 found = True |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1076 lines.append(line) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1077 |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1078 if not found: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1079 mx.log('Prepending "' + prefix + 'KNOWN" to ' + jvmCfg) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1080 if mx.get_os() != 'windows': |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1081 os.chmod(jvmCfg, JDK_UNIX_PERMISSIONS_FILE) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1082 with open(jvmCfg, 'w') as f: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1083 written = False |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1084 for line in lines: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1085 if line.startswith('#'): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1086 f.write(line) |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1087 continue |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1088 if not written: |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1089 f.write(vmKnown) |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1090 for alias, aliased in _vmAliases.iteritems(): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1091 if vm == aliased: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1092 f.write('-' + alias + ' ALIASED_TO -' + aliased + '\n') |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1093 written = True |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1094 if line.startswith(prefix): |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1095 line = vmKnown |
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1096 if written: |
21990
2a98e51646c2
Graal VM should be the default one after building basic-graal. Prepending rather than appending selected DEFAULT_VM to jvm.cfg file.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21976
diff
changeset
|
1097 continue |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1098 f.write(line) |
5239
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
1099 |
22286
2ecfec90e51e
moved gate from mx_jvmci.py to mx_gate.py in core mx
Doug Simon <doug.simon@oracle.com>
parents:
22284
diff
changeset
|
1100 mx_gate.add_jacoco_includes(['jdk.internal.jvmci.*']) |
5257
a549662f6c6f
added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents:
5245
diff
changeset
|
1101 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1102 def run_vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1103 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1104 Runs a Java program by executing the java executable in a JVMCI JDK. |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1105 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1106 jdkTag = mx.get_jdk_option().tag |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1107 if jdkTag and jdkTag != _JVMCI_JDK_TAG: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1108 mx.abort('The "--jdk" option must have the tag "' + _JVMCI_JDK_TAG + '" when running a command requiring a JVMCI VM') |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1109 jdk = get_jvmci_jdk(vmbuild=vmbuild) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1110 return jdk.run_java(args, vm=vm, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) |
3718 | 1111 |
22182
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1112 def _unittest_config_participant(config): |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1113 vmArgs, mainClass, mainClassArgs = config |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1114 if isJVMCIEnabled(get_vm()): |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1115 # Remove entries from class path that are in JVMCI loaded jars |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1116 cpIndex, cp = mx.find_classpath_arg(vmArgs) |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1117 if cp: |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1118 excluded = set() |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1119 for jdkDist in jdkDeployedDists: |
22281
2333f2f5baed
Fixes for new jdkDeployedDists model in _unittest_config_participant
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22280
diff
changeset
|
1120 dist = jdkDist.dist() |
22182
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1121 excluded.update([d.output_dir() for d in dist.archived_deps() if d.isJavaProject()]) |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1122 cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e not in excluded]) |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1123 vmArgs[cpIndex] = cp |
18351 | 1124 |
22182
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1125 # Run the VM in a mode where application/test classes can |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1126 # access JVMCI loaded classes. |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1127 vmArgs = ['-XX:-UseJVMCIClassLoader'] + vmArgs |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1128 return (vmArgs, mainClass, mainClassArgs) |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1129 return config |
16395
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16394
diff
changeset
|
1130 |
22182
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1131 def _unittest_vm_launcher(vmArgs, mainClass, mainClassArgs): |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1132 run_vm(vmArgs + [mainClass] + mainClassArgs) |
22182
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1133 |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1134 mx_unittest.add_config_participant(_unittest_config_participant) |
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1135 mx_unittest.set_vm_launcher('JVMCI VM launcher', _unittest_vm_launcher) |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
1136 |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
1137 def shortunittest(args): |
22020
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
22019
diff
changeset
|
1138 """alias for 'unittest --whitelist test/whitelist_shortunittest.txt'""" |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
1139 |
15324
5b5f47104c0d
mx: add whitelist for shortunittest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15323
diff
changeset
|
1140 args = ['--whitelist', 'test/whitelist_shortunittest.txt'] + args |
22182
9bbd878b17af
use unittest extensibility
Doug Simon <doug.simon@oracle.com>
parents:
22181
diff
changeset
|
1141 mx_unittest.unittest(args) |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
1142 |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
1143 def buildvms(args): |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
1144 """build one or more VMs in various configurations""" |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1145 |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
1146 vmsDefault = ','.join(_vmChoices.keys()) |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1147 vmbuildsDefault = ','.join(_vmbuildChoices) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1148 |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1149 parser = ArgumentParser(prog='mx buildvms') |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1150 parser.add_argument('--vms', help='a comma separated list of VMs to build (default: ' + vmsDefault + ')', metavar='<args>', default=vmsDefault) |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1151 parser.add_argument('--builds', help='a comma separated list of build types (default: ' + vmbuildsDefault + ')', metavar='<args>', default=vmbuildsDefault) |
9096
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
1152 parser.add_argument('-n', '--no-check', action='store_true', help='omit running "java -version" after each build') |
9097
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1153 parser.add_argument('-c', '--console', action='store_true', help='send build output to console instead of log file') |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
1154 |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
1155 args = parser.parse_args(args) |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
1156 vms = args.vms.split(',') |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
1157 builds = args.builds.split(',') |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1158 |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
1159 allStart = time.time() |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1160 for vm in vms: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1161 if not isVMSupported(vm): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1162 mx.log('The ' + vm + ' VM is not supported on this platform - skipping') |
14602
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
1163 continue |
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
1164 |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
1165 for vmbuild in builds: |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1166 if vm == 'original' and vmbuild != 'product': |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1167 continue |
9097
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1168 if not args.console: |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1169 logFile = join(vm + '-' + vmbuild + '.log') |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1170 log = open(join(_suite.dir, logFile), 'wb') |
9097
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1171 start = time.time() |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1172 mx.log('BEGIN: ' + vm + '-' + vmbuild + '\t(see: ' + logFile + ')') |
17317
f434913f9cba
mx: buildvms should inherit verbosity
Bernhard Urban <bernhard.urban@jku.at>
parents:
17307
diff
changeset
|
1173 verbose = ['-v'] if mx._opts.verbose else [] |
9097
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1174 # Run as subprocess so that output can be directed to a file |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1175 cmd = [sys.executable, '-u', mx.__file__] + verbose + ['--vm', vm, '--vmbuild', vmbuild, 'build'] |
17317
f434913f9cba
mx: buildvms should inherit verbosity
Bernhard Urban <bernhard.urban@jku.at>
parents:
17307
diff
changeset
|
1176 mx.logv("executing command: " + str(cmd)) |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1177 subprocess.check_call(cmd, cwd=_suite.dir, stdout=log, stderr=subprocess.STDOUT) |
9097
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1178 duration = datetime.timedelta(seconds=time.time() - start) |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1179 mx.log('END: ' + vm + '-' + vmbuild + '\t[' + str(duration) + ']') |
9097
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1180 else: |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1181 with VM(vm, vmbuild): |
22292 | 1182 build([]) |
9096
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
1183 if not args.no_check: |
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
1184 vmargs = ['-version'] |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1185 if vm == 'jvmci': |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1186 vmargs.insert(0, '-XX:-BootstrapJVMCI') |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1187 run_vm(vmargs, vm=vm, vmbuild=vmbuild) |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
1188 allDuration = datetime.timedelta(seconds=time.time() - allStart) |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
1189 mx.log('TOTAL TIME: ' + '[' + str(allDuration) + ']') |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
1190 |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1191 |
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1192 def _jvmci_gate_runner(args, tasks): |
22286
2ecfec90e51e
moved gate from mx_jvmci.py to mx_gate.py in core mx
Doug Simon <doug.simon@oracle.com>
parents:
22284
diff
changeset
|
1193 with Task('Check jvmci.make in sync with suite.py', tasks) as t: |
2ecfec90e51e
moved gate from mx_jvmci.py to mx_gate.py in core mx
Doug Simon <doug.simon@oracle.com>
parents:
22284
diff
changeset
|
1194 if t: |
2ecfec90e51e
moved gate from mx_jvmci.py to mx_gate.py in core mx
Doug Simon <doug.simon@oracle.com>
parents:
22284
diff
changeset
|
1195 jvmciMake = join(_suite.dir, 'make', 'jvmci.make') |
2ecfec90e51e
moved gate from mx_jvmci.py to mx_gate.py in core mx
Doug Simon <doug.simon@oracle.com>
parents:
22284
diff
changeset
|
1196 if mx_jvmci_makefile.build_makefile(['-o', jvmciMake]) != 0: |
2ecfec90e51e
moved gate from mx_jvmci.py to mx_gate.py in core mx
Doug Simon <doug.simon@oracle.com>
parents:
22284
diff
changeset
|
1197 t.abort('Rerun "mx makefile -o ' + jvmciMake + ' and check-in the modified ' + jvmciMake) |
2ecfec90e51e
moved gate from mx_jvmci.py to mx_gate.py in core mx
Doug Simon <doug.simon@oracle.com>
parents:
22284
diff
changeset
|
1198 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1199 # Build server-hosted-jvmci now so we can run the unit tests |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1200 with Task('BuildHotSpotJVMCIHosted: product', tasks) as t: |
22326
f150f5e00ccd
Remove unused --check-distributions option.
Roland Schatz <roland.schatz@oracle.com>
parents:
22323
diff
changeset
|
1201 if t: buildvms(['--vms', 'server', '--builds', 'product']) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1202 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1203 # Run unit tests on server-hosted-jvmci |
19162
32c7a5a88523
Run unit tests even earlier during gate
Doug Simon <doug.simon@oracle.com>
parents:
19160
diff
changeset
|
1204 with VM('server', 'product'): |
22333
fa6dd3cadaaf
Run only jvmci unit tests in gate.
Roland Schatz <roland.schatz@oracle.com>
parents:
22332
diff
changeset
|
1205 with Task('JVMCI UnitTests: hosted-product', tasks) as t: |
fa6dd3cadaaf
Run only jvmci unit tests in gate.
Roland Schatz <roland.schatz@oracle.com>
parents:
22332
diff
changeset
|
1206 if t: unittest(['--suite', 'jvmci', '--enable-timing', '--verbose', '--fail-fast']) |
19160
d4f80cf249d0
Run unittest earlier during gate
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19044
diff
changeset
|
1207 |
19162
32c7a5a88523
Run unit tests even earlier during gate
Doug Simon <doug.simon@oracle.com>
parents:
19160
diff
changeset
|
1208 # Build the other VM flavors |
22334
aef178739a23
Fix name of gate task.
Roland Schatz <roland.schatz@oracle.com>
parents:
22333
diff
changeset
|
1209 with Task('BuildHotSpotJVMCIOthers: fastdebug,product', tasks) as t: |
22326
f150f5e00ccd
Remove unused --check-distributions option.
Roland Schatz <roland.schatz@oracle.com>
parents:
22323
diff
changeset
|
1210 if t: buildvms(['--vms', 'jvmci,server', '--builds', 'fastdebug,product']) |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1211 |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1212 with Task('CleanAndBuildIdealGraphVisualizer', tasks, disableJacoco=True) as t: |
20996
5e78d067ebbe
Do not build IGV in gate when running on SPARC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
20994
diff
changeset
|
1213 if t and platform.processor() != 'sparc': |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1214 buildxml = mx._cygpathU2W(join(_suite.dir, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')) |
21165
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1215 mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=_igvBuildEnv()) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1216 |
21566 | 1217 # Prevent JVMCI modifications from breaking the standard builds |
1218 if args.buildNonJVMCI: | |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1219 with Task('BuildHotSpotVarieties', tasks, disableJacoco=True) as t: |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1220 if t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1221 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product']) |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1222 if mx.get_os() not in ['windows', 'cygwin']: |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1223 buildvms(['--vms', 'server-nojvmci', '--builds', 'product,optimized']) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1224 |
22291
ccee68149d93
added --all-suites option to gate
Doug Simon <doug.simon@oracle.com>
parents:
22290
diff
changeset
|
1225 mx_gate.add_gate_runner(_suite, _jvmci_gate_runner) |
22286
2ecfec90e51e
moved gate from mx_jvmci.py to mx_gate.py in core mx
Doug Simon <doug.simon@oracle.com>
parents:
22284
diff
changeset
|
1226 mx_gate.add_gate_argument('-g', '--only-build-jvmci', action='store_false', dest='buildNonJVMCI', help='only build the JVMCI VM') |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1227 |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1228 def deoptalot(args): |
22108
51ceda0cf404
mx: make deoptalot command more flexible in terms of VM management
Doug Simon <doug.simon@oracle.com>
parents:
22099
diff
changeset
|
1229 """bootstrap a VM with DeoptimizeALot and VerifyOops on |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1230 |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1231 If the first argument is a number, the process will be repeated |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1232 this number of times. All other arguments are passed to the VM.""" |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1233 count = 1 |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1234 if len(args) > 0 and args[0].isdigit(): |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1235 count = int(args[0]) |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1236 del args[0] |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1237 |
7509 | 1238 for _ in range(count): |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1239 if not run_vm(['-XX:-TieredCompilation', '-XX:+DeoptimizeALot', '-XX:+VerifyOops'] + args + ['-version']) == 0: |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1240 mx.abort("Failed") |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1241 |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1242 def longtests(args): |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1243 |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1244 deoptalot(['15', '-Xmx48m']) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1245 |
21165
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1246 def _igvJdk(): |
18893
19d99eec8876
Fix mx igv: do not use Java < 1.8, handle the case where no JDKs are supported. Give some hints when the igv ant build fails.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18876
diff
changeset
|
1247 v8u20 = mx.VersionSpec("1.8.0_20") |
19d99eec8876
Fix mx igv: do not use Java < 1.8, handle the case where no JDKs are supported. Give some hints when the igv ant build fails.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18876
diff
changeset
|
1248 v8u40 = mx.VersionSpec("1.8.0_40") |
19d99eec8876
Fix mx igv: do not use Java < 1.8, handle the case where no JDKs are supported. Give some hints when the igv ant build fails.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18876
diff
changeset
|
1249 v8 = mx.VersionSpec("1.8") |
21165
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1250 def _igvJdkVersionCheck(version): |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1251 return version >= v8 and (version < v8u20 or version >= v8u40) |
22327
2c352e8d76ec
Fix 'mx igv' command.
Roland Schatz <roland.schatz@oracle.com>
parents:
22326
diff
changeset
|
1252 return mx.get_jdk(_igvJdkVersionCheck, versionDescription='>= 1.8 and < 1.8.0u20 or >= 1.8.0u40', purpose="building & running IGV").home |
21165
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1253 |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1254 def _igvBuildEnv(): |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1255 # When the http_proxy environment variable is set, convert it to the proxy settings that ant needs |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1256 env = dict(os.environ) |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1257 proxy = os.environ.get('http_proxy') |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1258 if not (proxy is None) and len(proxy) > 0: |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1259 if '://' in proxy: |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1260 # Remove the http:// prefix (or any other protocol prefix) |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1261 proxy = proxy.split('://', 1)[1] |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1262 # Separate proxy server name and port number |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1263 proxyName, proxyPort = proxy.split(':', 1) |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1264 proxyEnv = '-DproxyHost="' + proxyName + '" -DproxyPort=' + proxyPort |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1265 env['ANT_OPTS'] = proxyEnv |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1266 |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1267 env['JAVA_HOME'] = _igvJdk() |
17388
9e5abd0e7916
mx/igv: fallback mechanism to work around a javac bug in jdk8u20
Bernhard Urban <bernhard.urban@jku.at>
parents:
17372
diff
changeset
|
1268 return env |
9e5abd0e7916
mx/igv: fallback mechanism to work around a javac bug in jdk8u20
Bernhard Urban <bernhard.urban@jku.at>
parents:
17372
diff
changeset
|
1269 |
5089
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1270 def igv(args): |
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1271 """run the Ideal Graph Visualizer""" |
18893
19d99eec8876
Fix mx igv: do not use Java < 1.8, handle the case where no JDKs are supported. Give some hints when the igv ant build fails.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18876
diff
changeset
|
1272 logFile = '.ideal_graph_visualizer.log' |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1273 with open(join(_suite.dir, logFile), 'w') as fp: |
10568
070b4a3c56f3
disabled "noisy" log statements unless -v option (i.e. verbose) is specified to mx
Doug Simon <doug.simon@oracle.com>
parents:
10527
diff
changeset
|
1274 mx.logv('[Ideal Graph Visualizer log is in ' + fp.name + ']') |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1275 nbplatform = join(_suite.dir, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'nbplatform') |
13472
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1276 |
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1277 # Remove NetBeans platform if it is earlier than the current supported version |
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1278 if exists(nbplatform): |
19430
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1279 updateTrackingFile = join(nbplatform, 'platform', 'update_tracking', 'org-netbeans-core.xml') |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1280 if not exists(updateTrackingFile): |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1281 mx.log('Could not find \'' + updateTrackingFile + '\', removing NetBeans platform') |
13472
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1282 shutil.rmtree(nbplatform) |
19430
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1283 else: |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1284 dom = xml.dom.minidom.parse(updateTrackingFile) |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1285 currentVersion = mx.VersionSpec(dom.getElementsByTagName('module_version')[0].getAttribute('specification_version')) |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1286 supportedVersion = mx.VersionSpec('3.43.1') |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1287 if currentVersion < supportedVersion: |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1288 mx.log('Replacing NetBeans platform version ' + str(currentVersion) + ' with version ' + str(supportedVersion)) |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1289 shutil.rmtree(nbplatform) |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1290 elif supportedVersion < currentVersion: |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1291 mx.log('Supported NetBeans version in igv command should be updated to ' + str(currentVersion)) |
13472
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1292 |
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1293 if not exists(nbplatform): |
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1294 mx.logv('[This execution may take a while as the NetBeans platform needs to be downloaded]') |
21165
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1295 |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1296 env = _igvBuildEnv() |
18983
43baadc1913a
Automatically install Batik for SVG export in IGV
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18931
diff
changeset
|
1297 # make the jar for Batik 1.7 available. |
43baadc1913a
Automatically install Batik for SVG export in IGV
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18931
diff
changeset
|
1298 env['IGV_BATIK_JAR'] = mx.library('BATIK').get_path(True) |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1299 if mx.run(['ant', '-f', mx._cygpathU2W(join(_suite.dir, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')), '-l', mx._cygpathU2W(fp.name), 'run'], env=env, nonZeroIsFatal=False): |
18893
19d99eec8876
Fix mx igv: do not use Java < 1.8, handle the case where no JDKs are supported. Give some hints when the igv ant build fails.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18876
diff
changeset
|
1300 mx.abort("IGV ant build & launch failed. Check '" + logFile + "'. You can also try to delete 'src/share/tools/IdealGraphVisualizer/nbplatform'.") |
14116
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1301 |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1302 def c1visualizer(args): |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1303 """run the Cl Compiler Visualizer""" |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1304 libpath = join(_suite.dir, 'lib') |
14116
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1305 if mx.get_os() == 'windows': |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1306 executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer.exe') |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1307 else: |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1308 executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer') |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1309 |
16599
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1310 # Check whether the current C1Visualizer installation is the up-to-date |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1311 if exists(executable) and not exists(mx.library('C1VISUALIZER_DIST').get_path(resolve=False)): |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1312 mx.log('Updating C1Visualizer') |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1313 shutil.rmtree(join(libpath, 'c1visualizer')) |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1314 |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1315 archive = mx.library('C1VISUALIZER_DIST').get_path(resolve=True) |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1316 |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1317 if not exists(executable): |
14116
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1318 zf = zipfile.ZipFile(archive, 'r') |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1319 zf.extractall(libpath) |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1320 |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1321 if not exists(executable): |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1322 mx.abort('C1Visualizer binary does not exist: ' + executable) |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1323 |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1324 if mx.get_os() != 'windows': |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1325 # Make sure that execution is allowed. The zip file does not always specfiy that correctly |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1326 os.chmod(executable, 0777) |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1327 |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1328 mx.run([executable]) |
5089
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1329 |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1330 def _get_jmh_path(): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1331 path = mx.get_env('JMH_BENCHMARKS', None) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1332 if not path: |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1333 probe = join(dirname(_suite.dir), 'java-benchmarks') |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1334 if exists(probe): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1335 path = probe |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1336 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1337 if not path: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1338 mx.abort("Please set the JMH_BENCHMARKS environment variable to point to the java-benchmarks workspace") |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1339 if not exists(path): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1340 mx.abort("The directory denoted by the JMH_BENCHMARKS environment variable does not exist: " + path) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1341 return path |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1342 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1343 def makejmhdeps(args): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1344 """creates and installs Maven dependencies required by the JMH benchmarks |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1345 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1346 The dependencies are specified by files named pom.mxdeps in the |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1347 JMH directory tree. Each such file contains a list of dependencies |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1348 defined in JSON format. For example: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1349 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1350 '[{"artifactId" : "compiler.test", "groupId" : "com.oracle.graal", "deps" : ["com.oracle.graal.compiler.test"]}]' |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1351 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1352 will result in a dependency being installed in the local Maven repository |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1353 that can be referenced in a pom.xml file as follows: |
15178
0c53453c4d5e
mx: improved jmh command to (a) look for JMH benchmarks in ../java-benchmarks, (b) omit building benchmarks if they are up to date and (c) offer better message with 'mx help jmh'
Doug Simon <doug.simon@oracle.com>
parents:
15114
diff
changeset
|
1354 |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1355 <dependency> |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1356 <groupId>com.oracle.graal</groupId> |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1357 <artifactId>compiler.test</artifactId> |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1358 <version>1.0-SNAPSHOT</version> |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1359 </dependency>""" |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1360 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1361 parser = ArgumentParser(prog='mx makejmhdeps') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1362 parser.add_argument('-s', '--settings', help='alternative path for Maven user settings file', metavar='<path>') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1363 parser.add_argument('-p', '--permissive', action='store_true', help='issue note instead of error if a Maven dependency cannot be built due to missing projects/libraries') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1364 args = parser.parse_args(args) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1365 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1366 def makejmhdep(artifactId, groupId, deps): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1367 path = artifactId + '.jar' |
22169
f9ddf6b6dd6b
minor fixes related to mx2 transition
Doug Simon <doug.simon@oracle.com>
parents:
22167
diff
changeset
|
1368 allDeps = [] |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1369 if args.permissive: |
22181
ffdee9fe0ded
fixed uses of dist.sorted_deps()
Doug Simon <doug.simon@oracle.com>
parents:
22180
diff
changeset
|
1370 for name, dep in [(d, mx.dependency(d, fatalIfMissing=False)) for d in deps]: |
ffdee9fe0ded
fixed uses of dist.sorted_deps()
Doug Simon <doug.simon@oracle.com>
parents:
22180
diff
changeset
|
1371 if dep is None: |
ffdee9fe0ded
fixed uses of dist.sorted_deps()
Doug Simon <doug.simon@oracle.com>
parents:
22180
diff
changeset
|
1372 mx.log('Skipping dependency ' + groupId + '.' + artifactId + ' as ' + name + ' cannot be resolved') |
ffdee9fe0ded
fixed uses of dist.sorted_deps()
Doug Simon <doug.simon@oracle.com>
parents:
22180
diff
changeset
|
1373 return |
ffdee9fe0ded
fixed uses of dist.sorted_deps()
Doug Simon <doug.simon@oracle.com>
parents:
22180
diff
changeset
|
1374 if dep.isDistribution(): |
22476
6050079bb7bd
removed microbench command (use jmh command instead)
Doug Simon <doug.simon@oracle.com>
parents:
22452
diff
changeset
|
1375 allDeps = allDeps + [d for d in dep.archived_deps() if d.isJavaProject()] |
17356
115de469a26b
support distributions in pom.mxdeps files
Doug Simon <doug.simon@oracle.com>
parents:
17321
diff
changeset
|
1376 else: |
22476
6050079bb7bd
removed microbench command (use jmh command instead)
Doug Simon <doug.simon@oracle.com>
parents:
22452
diff
changeset
|
1377 allDeps.append(dep) |
6050079bb7bd
removed microbench command (use jmh command instead)
Doug Simon <doug.simon@oracle.com>
parents:
22452
diff
changeset
|
1378 d = mx.JARDistribution(_suite, name=artifactId, subDir=_suite.dir, path=path, sourcesPath=path, deps=allDeps, \ |
6050079bb7bd
removed microbench command (use jmh command instead)
Doug Simon <doug.simon@oracle.com>
parents:
22452
diff
changeset
|
1379 mainClass=None, excludedLibs=[], distDependencies=[], javaCompliance=None, platformDependent=False, theLicense=None) |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1380 d.make_archive() |
22170
480635800a1b
buildjmhdeps should use Graal for JAVA_HOME
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22169
diff
changeset
|
1381 env = os.environ.copy() |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1382 jdkDir = get_jvmci_jdk_dir() |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1383 check_VM_exists('server', jdkDir) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1384 env['JAVA_HOME'] = jdkDir |
22170
480635800a1b
buildjmhdeps should use Graal for JAVA_HOME
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22169
diff
changeset
|
1385 env['MAVEN_OPTS'] = '-server -XX:-UseJVMCIClassLoader' |
15253
9ff9f6643986
mx: unconditionally ensure mx injected dependencies are up to date in buildjmh command
Doug Simon <doug.simon@oracle.com>
parents:
15250
diff
changeset
|
1386 cmd = ['mvn', 'install:install-file', '-DgroupId=' + groupId, '-DartifactId=' + artifactId, |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1387 '-Dversion=1.0-SNAPSHOT', '-Dpackaging=jar', '-Dfile=' + d.path] |
15253
9ff9f6643986
mx: unconditionally ensure mx injected dependencies are up to date in buildjmh command
Doug Simon <doug.simon@oracle.com>
parents:
15250
diff
changeset
|
1388 if not mx._opts.verbose: |
9ff9f6643986
mx: unconditionally ensure mx injected dependencies are up to date in buildjmh command
Doug Simon <doug.simon@oracle.com>
parents:
15250
diff
changeset
|
1389 cmd.append('-q') |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1390 if args.settings: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1391 cmd = cmd + ['-s', args.settings] |
22170
480635800a1b
buildjmhdeps should use Graal for JAVA_HOME
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22169
diff
changeset
|
1392 mx.run(cmd, env=env) |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1393 os.unlink(d.path) |
15178
0c53453c4d5e
mx: improved jmh command to (a) look for JMH benchmarks in ../java-benchmarks, (b) omit building benchmarks if they are up to date and (c) offer better message with 'mx help jmh'
Doug Simon <doug.simon@oracle.com>
parents:
15114
diff
changeset
|
1394 |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1395 jmhPath = _get_jmh_path() |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1396 for root, _, filenames in os.walk(jmhPath): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1397 for f in [join(root, n) for n in filenames if n == 'pom.mxdeps']: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1398 mx.logv('[processing ' + f + ']') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1399 try: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1400 with open(f) as fp: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1401 for d in json.load(fp): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1402 artifactId = d['artifactId'] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1403 groupId = d['groupId'] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1404 deps = d['deps'] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1405 makejmhdep(artifactId, groupId, deps) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1406 except ValueError as e: |
18635
a8b46348b79f
mx: converted format strings to be python 2.6 compliant
Doug Simon <doug.simon@oracle.com>
parents:
18613
diff
changeset
|
1407 mx.abort('Error parsing {0}:\n{1}'.format(f, e)) |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1408 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1409 def buildjmh(args): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1410 """build the JMH benchmarks""" |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1411 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1412 parser = ArgumentParser(prog='mx buildjmh') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1413 parser.add_argument('-s', '--settings', help='alternative path for Maven user settings file', metavar='<path>') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1414 parser.add_argument('-c', action='store_true', dest='clean', help='clean before building') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1415 args = parser.parse_args(args) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1416 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1417 jmhPath = _get_jmh_path() |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1418 mx.log('JMH benchmarks: ' + jmhPath) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1419 |
15253
9ff9f6643986
mx: unconditionally ensure mx injected dependencies are up to date in buildjmh command
Doug Simon <doug.simon@oracle.com>
parents:
15250
diff
changeset
|
1420 # Ensure the mx injected dependencies are up to date |
9ff9f6643986
mx: unconditionally ensure mx injected dependencies are up to date in buildjmh command
Doug Simon <doug.simon@oracle.com>
parents:
15250
diff
changeset
|
1421 makejmhdeps(['-p'] + (['-s', args.settings] if args.settings else [])) |
9ff9f6643986
mx: unconditionally ensure mx injected dependencies are up to date in buildjmh command
Doug Simon <doug.simon@oracle.com>
parents:
15250
diff
changeset
|
1422 |
22018
11ed27b2abe8
remove hard-coded use of 'mx' to refer to the mxDir for the graal suite
Doug Simon <doug.simon@oracle.com>
parents:
22017
diff
changeset
|
1423 timestamp = mx.TimeStampFile(join(_suite.mxDir, 'jmh', jmhPath.replace(os.sep, '_') + '.timestamp')) |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1424 mustBuild = args.clean |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1425 if not mustBuild: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1426 try: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1427 hgfiles = [join(jmhPath, f) for f in subprocess.check_output(['hg', '-R', jmhPath, 'locate']).split('\n')] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1428 mustBuild = timestamp.isOlderThan(hgfiles) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1429 except: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1430 # not a Mercurial repository or hg commands are not available. |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1431 mustBuild = True |
15178
0c53453c4d5e
mx: improved jmh command to (a) look for JMH benchmarks in ../java-benchmarks, (b) omit building benchmarks if they are up to date and (c) offer better message with 'mx help jmh'
Doug Simon <doug.simon@oracle.com>
parents:
15114
diff
changeset
|
1432 |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1433 if mustBuild: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1434 buildOutput = [] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1435 def _redirect(x): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1436 if mx._opts.verbose: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1437 mx.log(x[:-1]) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1438 else: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1439 buildOutput.append(x) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1440 env = os.environ.copy() |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1441 jdkDir = get_jvmci_jdk_dir() |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1442 check_VM_exists('server', jdkDir) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1443 env['JAVA_HOME'] = jdkDir |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1444 env['MAVEN_OPTS'] = '-server -XX:-UseJVMCIClassLoader' |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1445 mx.log("Building benchmarks...") |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1446 cmd = ['mvn'] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1447 if args.settings: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1448 cmd = cmd + ['-s', args.settings] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1449 if args.clean: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1450 cmd.append('clean') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1451 cmd.append('package') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1452 retcode = mx.run(cmd, cwd=jmhPath, out=_redirect, env=env, nonZeroIsFatal=False) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1453 if retcode != 0: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1454 mx.log(''.join(buildOutput)) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1455 mx.abort(retcode) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1456 timestamp.touch() |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1457 else: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1458 mx.logv('[all Mercurial controlled files in ' + jmhPath + ' are older than ' + timestamp.path + ' - skipping build]') |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1459 |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1460 def jmh(args): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1461 """run the JMH benchmarks |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1462 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1463 This command respects the standard --vm and --vmbuild options |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1464 for choosing which VM to run the benchmarks with.""" |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1465 if '-h' in args: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1466 mx.help_(['jmh']) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1467 mx.abort(1) |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1468 |
22020
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
22019
diff
changeset
|
1469 vmArgs, benchmarksAndJsons = mx.extract_VM_args(args) |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1470 if isJVMCIEnabled(get_vm()) and '-XX:-UseJVMCIClassLoader' not in vmArgs: |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1471 vmArgs = ['-XX:-UseJVMCIClassLoader'] + vmArgs |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1472 |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1473 benchmarks = [b for b in benchmarksAndJsons if not b.startswith('{')] |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1474 jmhArgJsons = [b for b in benchmarksAndJsons if b.startswith('{')] |
22018
11ed27b2abe8
remove hard-coded use of 'mx' to refer to the mxDir for the graal suite
Doug Simon <doug.simon@oracle.com>
parents:
22017
diff
changeset
|
1475 jmhOutDir = join(_suite.mxDir, 'jmh') |
15593
e381346a8223
JMH: do not abort on missing jar file. Create necessary output directory if needed
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15580
diff
changeset
|
1476 if not exists(jmhOutDir): |
e381346a8223
JMH: do not abort on missing jar file. Create necessary output directory if needed
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15580
diff
changeset
|
1477 os.makedirs(jmhOutDir) |
e381346a8223
JMH: do not abort on missing jar file. Create necessary output directory if needed
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15580
diff
changeset
|
1478 jmhOut = join(jmhOutDir, 'jmh.out') |
e381346a8223
JMH: do not abort on missing jar file. Create necessary output directory if needed
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15580
diff
changeset
|
1479 jmhArgs = {'-rff' : jmhOut, '-v' : 'EXTRA' if mx._opts.verbose else 'NORMAL'} |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1480 |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1481 # e.g. '{"-wi" : 20}' |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1482 for j in jmhArgJsons: |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1483 try: |
15051
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
1484 for n, v in json.loads(j).iteritems(): |
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
1485 if v is None: |
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
1486 del jmhArgs[n] |
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
1487 else: |
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
1488 jmhArgs[n] = v |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1489 except ValueError as e: |
18635
a8b46348b79f
mx: converted format strings to be python 2.6 compliant
Doug Simon <doug.simon@oracle.com>
parents:
18613
diff
changeset
|
1490 mx.abort('error parsing JSON input: {0}\n{1}'.format(j, e)) |
14965
c64cd1dd4bd1
moved Maven installation of Graal dependency from build to jmh command
Doug Simon <doug.simon@oracle.com>
parents:
14938
diff
changeset
|
1491 |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1492 jmhPath = _get_jmh_path() |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
1493 mx.log('Using benchmarks in ' + jmhPath) |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1494 |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1495 matchedSuites = set() |
13949
f694daada5bf
mx jmh: display the number of benchmarks that will run
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13948
diff
changeset
|
1496 numBench = [0] |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1497 for micros in os.listdir(jmhPath): |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1498 absoluteMicro = os.path.join(jmhPath, micros) |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1499 if not os.path.isdir(absoluteMicro): |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1500 continue |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1501 if not micros.startswith("micros-"): |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1502 mx.logv('JMH: ignored ' + absoluteMicro + " because it doesn't start with 'micros-'") |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1503 continue |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1504 |
13948
69928d77bc0a
mx jmh: avoid mx crash if JMH_BENCHMARKS is not defined at all and skip suites that do not contain the correct jar
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13935
diff
changeset
|
1505 microJar = os.path.join(absoluteMicro, "target", "microbenchmarks.jar") |
69928d77bc0a
mx jmh: avoid mx crash if JMH_BENCHMARKS is not defined at all and skip suites that do not contain the correct jar
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13935
diff
changeset
|
1506 if not exists(microJar): |
15593
e381346a8223
JMH: do not abort on missing jar file. Create necessary output directory if needed
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15580
diff
changeset
|
1507 mx.log('Missing ' + microJar + ' - please run "mx buildjmh"') |
e381346a8223
JMH: do not abort on missing jar file. Create necessary output directory if needed
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15580
diff
changeset
|
1508 continue |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1509 if benchmarks: |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1510 def _addBenchmark(x): |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1511 if x.startswith("Benchmark:"): |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1512 return |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1513 match = False |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1514 for b in benchmarks: |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1515 match = match or (b in x) |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1516 |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1517 if match: |
13949
f694daada5bf
mx jmh: display the number of benchmarks that will run
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13948
diff
changeset
|
1518 numBench[0] += 1 |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1519 matchedSuites.add(micros) |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1520 |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
1521 mx.run_java(['-jar', microJar, "-l"], cwd=jmhPath, out=_addBenchmark, addDefaultArgs=False) |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1522 else: |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1523 matchedSuites.add(micros) |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1524 |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1525 mx.logv("matchedSuites: " + str(matchedSuites)) |
13949
f694daada5bf
mx jmh: display the number of benchmarks that will run
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13948
diff
changeset
|
1526 plural = 's' if not benchmarks or numBench[0] > 1 else '' |
f694daada5bf
mx jmh: display the number of benchmarks that will run
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13948
diff
changeset
|
1527 number = str(numBench[0]) if benchmarks else "all" |
f694daada5bf
mx jmh: display the number of benchmarks that will run
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13948
diff
changeset
|
1528 mx.log("Running " + number + " benchmark" + plural + '...') |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1529 |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1530 regex = [] |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1531 if benchmarks: |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1532 regex.append(r".*(" + "|".join(benchmarks) + ").*") |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1533 |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1534 for suite in matchedSuites: |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1535 absoluteMicro = os.path.join(jmhPath, suite) |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1536 jdk = get_jvmci_jdk() |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1537 vm = get_vm() |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1538 pfx = get_vm_prefix() |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1539 forkedVmArgs = jdk.parseVmArgs(vmArgs) |
22479
f5fee32d3d6e
mx jmh: quote forked vmArgs with spaces.
Josef Eisl <josef.eisl@jku.at>
parents:
22476
diff
changeset
|
1540 def quoteSpace(s): |
f5fee32d3d6e
mx jmh: quote forked vmArgs with spaces.
Josef Eisl <josef.eisl@jku.at>
parents:
22476
diff
changeset
|
1541 if " " in s: |
f5fee32d3d6e
mx jmh: quote forked vmArgs with spaces.
Josef Eisl <josef.eisl@jku.at>
parents:
22476
diff
changeset
|
1542 return '"' + s + '"' |
f5fee32d3d6e
mx jmh: quote forked vmArgs with spaces.
Josef Eisl <josef.eisl@jku.at>
parents:
22476
diff
changeset
|
1543 return s |
f5fee32d3d6e
mx jmh: quote forked vmArgs with spaces.
Josef Eisl <josef.eisl@jku.at>
parents:
22476
diff
changeset
|
1544 |
f5fee32d3d6e
mx jmh: quote forked vmArgs with spaces.
Josef Eisl <josef.eisl@jku.at>
parents:
22476
diff
changeset
|
1545 forkedVmArgs = map(quoteSpace, forkedVmArgs) |
13951
392b6ac8da36
Allow using run_java without the arguments from -J -Ja -Jp. Factor out the argument processing of mx_graal.vm and use it to pass tested-vm args down through the jmh harness
Bernhard Urban <bernhard.urban@jku.at>
parents:
13949
diff
changeset
|
1546 if pfx: |
18306 | 1547 mx.log("JMH ignores prefix: \"" + ' '.join(pfx) + "\"") |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1548 javaArgs = ['-jar', os.path.join(absoluteMicro, "target", "microbenchmarks.jar"), |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1549 '--jvm', jdk.java, |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1550 '--jvmArgs', ' '.join(["-" + vm] + forkedVmArgs)] |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1551 for k, v in jmhArgs.iteritems(): |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1552 javaArgs.append(k) |
15051
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
1553 if len(str(v)): |
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
1554 javaArgs.append(str(v)) |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
1555 mx.run_java(javaArgs + regex, addDefaultArgs=False, cwd=jmhPath) |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
1556 |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
1557 def hsdis(args, copyToDir=None): |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
1558 """download the hsdis library |
4482
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
1559 |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
1560 This is needed to support HotSpot's assembly dumping features. |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
1561 By default it downloads the Intel syntax version, use the 'att' argument to install AT&T syntax.""" |
4482
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
1562 flavor = 'intel' |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
1563 if 'att' in args: |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
1564 flavor = 'att' |
19691
84b85c43633b
[SPARC] Install hsdis-sparcv9.so into the jvm with mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
19430
diff
changeset
|
1565 if mx.get_arch() == "sparcv9": |
84b85c43633b
[SPARC] Install hsdis-sparcv9.so into the jvm with mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
19430
diff
changeset
|
1566 flavor = "sparcv9" |
17012
ad10671d1bbd
mx: move get_arch() to mxtool
Bernhard Urban <bernhard.urban@jku.at>
parents:
16983
diff
changeset
|
1567 lib = mx.add_lib_suffix('hsdis-' + mx.get_arch()) |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1568 path = join(_suite.dir, 'lib', lib) |
16599
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1569 |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1570 sha1s = { |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1571 'att/hsdis-amd64.dll' : 'bcbd535a9568b5075ab41e96205e26a2bac64f72', |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1572 'att/hsdis-amd64.so' : '58919ba085d4ef7a513f25bae75e7e54ee73c049', |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1573 'intel/hsdis-amd64.dll' : '6a388372cdd5fe905c1a26ced614334e405d1f30', |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1574 'intel/hsdis-amd64.so' : '844ed9ffed64fe9599638f29a8450c50140e3192', |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1575 'intel/hsdis-amd64.dylib' : 'fdb13ef0d7d23d93dacaae9c98837bea0d4fc5a2', |
20989
4213d02d95b5
Update hsdis for SPARC to latest binutils version (VIS3 and OSA2011 architecture included)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
20967
diff
changeset
|
1576 'sparcv9/hsdis-sparcv9.so': '970640a9af0bd63641f9063c11275b371a59ee60', |
16599
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1577 } |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1578 |
16976
87fc600ec586
mx: skip downloading hsdis if not available.
Josef Eisl <josef.eisl@jku.at>
parents:
16918
diff
changeset
|
1579 flavoredLib = flavor + "/" + lib |
87fc600ec586
mx: skip downloading hsdis if not available.
Josef Eisl <josef.eisl@jku.at>
parents:
16918
diff
changeset
|
1580 if flavoredLib not in sha1s: |
87fc600ec586
mx: skip downloading hsdis if not available.
Josef Eisl <josef.eisl@jku.at>
parents:
16918
diff
changeset
|
1581 mx.logv("hsdis not supported on this plattform or architecture") |
87fc600ec586
mx: skip downloading hsdis if not available.
Josef Eisl <josef.eisl@jku.at>
parents:
16918
diff
changeset
|
1582 return |
87fc600ec586
mx: skip downloading hsdis if not available.
Josef Eisl <josef.eisl@jku.at>
parents:
16918
diff
changeset
|
1583 |
5189
6fbf12b8e572
automated download of hsdis lib if PrintAssembly option is used; added support for hsdis on the Mac
Doug Simon <doug.simon@oracle.com>
parents:
5153
diff
changeset
|
1584 if not exists(path): |
16599
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1585 sha1 = sha1s[flavoredLib] |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1586 sha1path = path + '.sha1' |
22520 | 1587 mx.download_file_with_sha1('hsdis', path, ['https://lafo.ssw.uni-linz.ac.at/pub/hsdis/' + flavoredLib], sha1, sha1path, True, True, sources=False) |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
1588 if copyToDir is not None and exists(copyToDir): |
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
1589 shutil.copy(path, copyToDir) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1590 |
5245 | 1591 def hcfdis(args): |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
1592 """disassemble HexCodeFiles embedded in text files |
5245 | 1593 |
1594 Run a tool over the input files to convert all embedded HexCodeFiles | |
1595 to a disassembled format.""" | |
6958
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1596 |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1597 parser = ArgumentParser(prog='mx hcfdis') |
6958
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1598 parser.add_argument('-m', '--map', help='address to symbol map applied to disassembler output') |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1599 parser.add_argument('files', nargs=REMAINDER, metavar='files...') |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1600 |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1601 args = parser.parse_args(args) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1602 |
16599
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1603 path = mx.library('HCFDIS').get_path(resolve=True) |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1604 mx.run_java(['-cp', path, 'com.oracle.max.hcfdis.HexCodeFileDis'] + args.files) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1605 |
6958
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1606 if args.map is not None: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1607 addressRE = re.compile(r'0[xX]([A-Fa-f0-9]+)') |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1608 with open(args.map) as fp: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1609 lines = fp.read().splitlines() |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1610 symbols = dict() |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1611 for l in lines: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1612 addressAndSymbol = l.split(' ', 1) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1613 if len(addressAndSymbol) == 2: |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1614 address, symbol = addressAndSymbol |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1615 if address.startswith('0x'): |
6958
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1616 address = long(address, 16) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1617 symbols[address] = symbol |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1618 for f in args.files: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1619 with open(f) as fp: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1620 lines = fp.read().splitlines() |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1621 updated = False |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1622 for i in range(0, len(lines)): |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1623 l = lines[i] |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1624 for m in addressRE.finditer(l): |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1625 sval = m.group(0) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1626 val = long(sval, 16) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1627 sym = symbols.get(val) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1628 if sym: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1629 l = l.replace(sval, sym) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1630 updated = True |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1631 lines[i] = l |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1632 if updated: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1633 mx.log('updating ' + f) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1634 with open('new_' + f, "w") as fp: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1635 for l in lines: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1636 print >> fp, l |
5245 | 1637 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1638 def isJVMCIEnabled(vm): |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1639 return vm != 'original' and not vm.endswith('nojvmci') |
9803
8e33b4ebfef1
add isGraalEnabled(vm) function in commands.py
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9667
diff
changeset
|
1640 |
16167
1f4955abca9b
mx: add jol command for java object layout introspection
Andreas Woess <andreas.woess@jku.at>
parents:
16117
diff
changeset
|
1641 def jol(args): |
1f4955abca9b
mx: add jol command for java object layout introspection
Andreas Woess <andreas.woess@jku.at>
parents:
16117
diff
changeset
|
1642 """Java Object Layout""" |
16599
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1643 joljar = mx.library('JOL_INTERNALS').get_path(resolve=True) |
16167
1f4955abca9b
mx: add jol command for java object layout introspection
Andreas Woess <andreas.woess@jku.at>
parents:
16117
diff
changeset
|
1644 candidates = mx.findclass(args, logToConsole=False, matcher=lambda s, classname: s == classname or classname.endswith('.' + s) or classname.endswith('$' + s)) |
18218
8588db09f5e9
mx jol: let user select from found classes, skip duplicates
Andreas Woess <andreas.woess@jku.at>
parents:
18163
diff
changeset
|
1645 |
8588db09f5e9
mx jol: let user select from found classes, skip duplicates
Andreas Woess <andreas.woess@jku.at>
parents:
18163
diff
changeset
|
1646 if len(candidates) > 0: |
18601
676f1800077c
mx: removed unused _read_projects_file function
Doug Simon <doug.simon@oracle.com>
parents:
18414
diff
changeset
|
1647 candidates = mx.select_items(sorted(candidates)) |
18218
8588db09f5e9
mx jol: let user select from found classes, skip duplicates
Andreas Woess <andreas.woess@jku.at>
parents:
18163
diff
changeset
|
1648 else: |
8588db09f5e9
mx jol: let user select from found classes, skip duplicates
Andreas Woess <andreas.woess@jku.at>
parents:
18163
diff
changeset
|
1649 # mx.findclass can be mistaken, don't give up yet |
8588db09f5e9
mx jol: let user select from found classes, skip duplicates
Andreas Woess <andreas.woess@jku.at>
parents:
18163
diff
changeset
|
1650 candidates = args |
16167
1f4955abca9b
mx: add jol command for java object layout introspection
Andreas Woess <andreas.woess@jku.at>
parents:
16117
diff
changeset
|
1651 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1652 run_vm(['-javaagent:' + joljar, '-cp', os.pathsep.join([mx.classpath(), joljar]), "org.openjdk.jol.MainObjectInternals"] + candidates) |
16167
1f4955abca9b
mx: add jol command for java object layout introspection
Andreas Woess <andreas.woess@jku.at>
parents:
16117
diff
changeset
|
1653 |
22167
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1654 mx.update_commands(_suite, { |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1655 'build': [build, ''], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1656 'buildjmh': [buildjmh, '[-options]'], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1657 'buildvars': [buildvars, ''], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1658 'buildvms': [buildvms, '[-options]'], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1659 'c1visualizer' : [c1visualizer, ''], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1660 'export': [export, '[-options] [zipfile]'], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1661 'hsdis': [hsdis, '[att]'], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1662 'hcfdis': [hcfdis, ''], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1663 'igv' : [igv, ''], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1664 'jdkhome': [print_jdkhome, ''], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1665 'jmh': [jmh, '[VM options] [filters|JMH-args-as-json...]'], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1666 'makejmhdeps' : [makejmhdeps, ''], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1667 'shortunittest' : [shortunittest, '[unittest options] [--] [VM options] [filters...]', mx_unittest.unittestHelpSuffix], |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1668 'vm': [run_vm, '[-options] class [args...]'], |
22167
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1669 'deoptalot' : [deoptalot, '[n]'], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1670 'longtests' : [longtests, ''], |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1671 'jol' : [jol, ''], |
22427
9c55f608b79e
Generate jvmci.make with all defined dependencies/bootclasspath regardless availability in the current enviornment
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22418
diff
changeset
|
1672 'makefile' : [mx_jvmci_makefile.build_makefile, 'build makefiles for JDK build', None, {'keepUnsatisfiedDependencies': True}], |
22167
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1673 }) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1674 |
22167
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1675 mx.add_argument('--vmcwd', dest='vm_cwd', help='current directory will be changed to <path> before the VM is executed', default=None, metavar='<path>') |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1676 mx.add_argument('--installed-jdks', help='the base directory in which the JDKs cloned from $JAVA_HOME exist. ' + |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1677 'The VM selected by --vm and --vmbuild options is under this directory (i.e., ' + |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1678 join('<path>', '<jdk-version>', '<vmbuild>', 'jre', 'lib', '<vm>', mx.add_lib_prefix(mx.add_lib_suffix('jvm'))) + ')', default=None, metavar='<path>') |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
1679 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1680 mx.add_argument('--vm', action='store', dest='vm', choices=_vmChoices.keys() + _vmAliases.keys(), help='the VM type to build/run') |
22167
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1681 mx.add_argument('--vmbuild', action='store', dest='vmbuild', choices=_vmbuildChoices, help='the VM build to build/run (default: ' + _vmbuildChoices[0] + ')') |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1682 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse') |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1683 mx.add_argument('--vmprefix', action='store', dest='vm_prefix', help='prefix for running the VM (e.g. "/usr/bin/gdb --args")', metavar='<prefix>') |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1684 mx.add_argument('--gdb', action='store_const', const='/usr/bin/gdb --args', dest='vm_prefix', help='alias for --vmprefix "/usr/bin/gdb --args"') |
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1685 mx.add_argument('--lldb', action='store_const', const='lldb --', dest='vm_prefix', help='alias for --vmprefix "lldb --"') |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
1686 |
22041
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1687 class JVMCIArchiveParticipant: |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1688 def __init__(self, dist): |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1689 self.dist = dist |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1690 self.jvmciServices = {} |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1691 |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1692 def __opened__(self, arc, srcArc, services): |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1693 self.services = services |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1694 self.arc = arc |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1695 |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1696 def __add__(self, arcname, contents): |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1697 if arcname.startswith('META-INF/jvmci.services/'): |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1698 service = arcname[len('META-INF/jvmci.services/'):] |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1699 self.jvmciServices.setdefault(service, []).extend([provider for provider in contents.split('\n')]) |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1700 return True |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1701 if arcname.startswith('META-INF/jvmci.providers/'): |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1702 provider = arcname[len('META-INF/jvmci.providers/'):] |
22591
0dcb75831004
avoid creating providers for unnamed JVMCI services
Doug Simon <doug.simon@oracle.com>
parents:
22561
diff
changeset
|
1703 for service in contents.strip().split(os.linesep): |
0dcb75831004
avoid creating providers for unnamed JVMCI services
Doug Simon <doug.simon@oracle.com>
parents:
22561
diff
changeset
|
1704 assert service |
22041
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1705 self.jvmciServices.setdefault(service, []).append(provider) |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1706 return True |
22512
1852abfbaca3
removed use of intermediate jvmci.options/ directory to create OptionDescriptors service files
Doug Simon <doug.simon@oracle.com>
parents:
22511
diff
changeset
|
1707 elif arcname.endswith('_OptionDescriptors.class'): |
22041
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1708 # Need to create service files for the providers of the |
22054 | 1709 # jdk.internal.jvmci.options.Options service created by |
1710 # jdk.internal.jvmci.options.processor.OptionProcessor. | |
22512
1852abfbaca3
removed use of intermediate jvmci.options/ directory to create OptionDescriptors service files
Doug Simon <doug.simon@oracle.com>
parents:
22511
diff
changeset
|
1711 provider = arcname[:-len('.class'):].replace('/', '.') |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22395
diff
changeset
|
1712 self.services.setdefault('jdk.internal.jvmci.options.OptionDescriptors', []).append(provider) |
22041
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1713 return False |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1714 |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1715 def __addsrc__(self, arcname, contents): |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1716 return False |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1717 |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1718 def __closing__(self): |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1719 for service, providers in self.jvmciServices.iteritems(): |
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1720 arcname = 'META-INF/jvmci.services/' + service |
22042
db48a62aba36
only (re)make archives from build command if at least one compilation occurred
Doug Simon <doug.simon@oracle.com>
parents:
22041
diff
changeset
|
1721 # Convert providers to a set before printing to remove duplicates |
22142
8704244e4f6a
service provider configuration files must end with a new line
Doug Simon <doug.simon@oracle.com>
parents:
22141
diff
changeset
|
1722 self.arc.zf.writestr(arcname, '\n'.join(frozenset(providers))+ '\n') |
22041
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1723 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1724 _jvmci_bootstrap_jdk = None |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1725 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1726 def get_jvmci_bootstrap_jdk(): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1727 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1728 Gets the JDK from which a JVMCI JDK is created. |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1729 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1730 global _jvmci_bootstrap_jdk |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1731 if not _jvmci_bootstrap_jdk: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1732 def _versionCheck(version): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1733 return version >= _minVersion and (not _untilVersion or version >= _untilVersion) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1734 versionDesc = ">=" + str(_minVersion) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1735 if _untilVersion: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1736 versionDesc += " and <=" + str(_untilVersion) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1737 _jvmci_bootstrap_jdk = mx.get_jdk(_versionCheck, versionDescription=versionDesc, tag='default') |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1738 return _jvmci_bootstrap_jdk |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1739 |
22561
ba4ef98ae535
Add mx_jvmci API to prepend ClasspathDependencies to the bootclasspath of the jvmci JDK
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22534
diff
changeset
|
1740 _jvmci_bootclasspath_prepends = [] |
ba4ef98ae535
Add mx_jvmci API to prepend ClasspathDependencies to the bootclasspath of the jvmci JDK
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22534
diff
changeset
|
1741 |
ba4ef98ae535
Add mx_jvmci API to prepend ClasspathDependencies to the bootclasspath of the jvmci JDK
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22534
diff
changeset
|
1742 def add_bootclasspath_prepend(dep): |
ba4ef98ae535
Add mx_jvmci API to prepend ClasspathDependencies to the bootclasspath of the jvmci JDK
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22534
diff
changeset
|
1743 assert isinstance(dep, mx.ClasspathDependency) |
ba4ef98ae535
Add mx_jvmci API to prepend ClasspathDependencies to the bootclasspath of the jvmci JDK
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22534
diff
changeset
|
1744 _jvmci_bootclasspath_prepends.append(dep) |
ba4ef98ae535
Add mx_jvmci API to prepend ClasspathDependencies to the bootclasspath of the jvmci JDK
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22534
diff
changeset
|
1745 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1746 class JVMCIJDKConfig(mx.JDKConfig): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1747 def __init__(self, vmbuild): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1748 # Ignore the deployable distributions here - they are only deployed during building. |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1749 # This significantly reduces the latency of the "mx java" command. |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1750 self.vmbuild = vmbuild |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1751 jdkDir = get_jvmci_jdk_dir(build=self.vmbuild, create=True, deployDists=False) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1752 mx.JDKConfig.__init__(self, jdkDir, tag=_JVMCI_JDK_TAG) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1753 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1754 def parseVmArgs(self, args, addDefaultArgs=True): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1755 args = mx.expand_project_in_args(args, insitu=False) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1756 jacocoArgs = mx_gate.get_jacoco_agent_args() |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1757 if jacocoArgs: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1758 args = jacocoArgs + args |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1759 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1760 # Support for -G: options |
22601
bc2d4dac0cd3
JVMCI options are now passed as individual -Djvmci.option.<name>=<value> arguments on the command line instead of -Djvmci.options=<multiple options settings separated by spaces>
Doug Simon <doug.simon@oracle.com>
parents:
22591
diff
changeset
|
1761 def translateGOption(arg): |
bc2d4dac0cd3
JVMCI options are now passed as individual -Djvmci.option.<name>=<value> arguments on the command line instead of -Djvmci.options=<multiple options settings separated by spaces>
Doug Simon <doug.simon@oracle.com>
parents:
22591
diff
changeset
|
1762 if arg.startswith('-G:+'): |
bc2d4dac0cd3
JVMCI options are now passed as individual -Djvmci.option.<name>=<value> arguments on the command line instead of -Djvmci.options=<multiple options settings separated by spaces>
Doug Simon <doug.simon@oracle.com>
parents:
22591
diff
changeset
|
1763 arg = '-Djvmci.option.' + arg[len('-G:+'):] + '=true' |
bc2d4dac0cd3
JVMCI options are now passed as individual -Djvmci.option.<name>=<value> arguments on the command line instead of -Djvmci.options=<multiple options settings separated by spaces>
Doug Simon <doug.simon@oracle.com>
parents:
22591
diff
changeset
|
1764 elif arg.startswith('-G:-'): |
bc2d4dac0cd3
JVMCI options are now passed as individual -Djvmci.option.<name>=<value> arguments on the command line instead of -Djvmci.options=<multiple options settings separated by spaces>
Doug Simon <doug.simon@oracle.com>
parents:
22591
diff
changeset
|
1765 arg = '-Djvmci.option.' + arg[len('-G:+'):] + '=false' |
bc2d4dac0cd3
JVMCI options are now passed as individual -Djvmci.option.<name>=<value> arguments on the command line instead of -Djvmci.options=<multiple options settings separated by spaces>
Doug Simon <doug.simon@oracle.com>
parents:
22591
diff
changeset
|
1766 elif arg.startswith('-G:'): |
bc2d4dac0cd3
JVMCI options are now passed as individual -Djvmci.option.<name>=<value> arguments on the command line instead of -Djvmci.options=<multiple options settings separated by spaces>
Doug Simon <doug.simon@oracle.com>
parents:
22591
diff
changeset
|
1767 arg = '-Djvmci.option.' + arg[len('-G:'):] |
bc2d4dac0cd3
JVMCI options are now passed as individual -Djvmci.option.<name>=<value> arguments on the command line instead of -Djvmci.options=<multiple options settings separated by spaces>
Doug Simon <doug.simon@oracle.com>
parents:
22591
diff
changeset
|
1768 return arg |
bc2d4dac0cd3
JVMCI options are now passed as individual -Djvmci.option.<name>=<value> arguments on the command line instead of -Djvmci.options=<multiple options settings separated by spaces>
Doug Simon <doug.simon@oracle.com>
parents:
22591
diff
changeset
|
1769 args = map(translateGOption, args) |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1770 |
22561
ba4ef98ae535
Add mx_jvmci API to prepend ClasspathDependencies to the bootclasspath of the jvmci JDK
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22534
diff
changeset
|
1771 args = ['-Xbootclasspath/p:' + dep.classpath_repr() for dep in _jvmci_bootclasspath_prepends] + args |
ba4ef98ae535
Add mx_jvmci API to prepend ClasspathDependencies to the bootclasspath of the jvmci JDK
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22534
diff
changeset
|
1772 |
22603
2448e3c0cd98
set default jvmci.compiler property explicitly based on available suites
Doug Simon <doug.simon@oracle.com>
parents:
22601
diff
changeset
|
1773 # Set the default JVMCI compiler |
2448e3c0cd98
set default jvmci.compiler property explicitly based on available suites
Doug Simon <doug.simon@oracle.com>
parents:
22601
diff
changeset
|
1774 for jdkDist in reversed(jdkDeployedDists): |
2448e3c0cd98
set default jvmci.compiler property explicitly based on available suites
Doug Simon <doug.simon@oracle.com>
parents:
22601
diff
changeset
|
1775 if isinstance(jdkDist, JvmciJDKDeployedDist): |
2448e3c0cd98
set default jvmci.compiler property explicitly based on available suites
Doug Simon <doug.simon@oracle.com>
parents:
22601
diff
changeset
|
1776 if jdkDist._compilers: |
2448e3c0cd98
set default jvmci.compiler property explicitly based on available suites
Doug Simon <doug.simon@oracle.com>
parents:
22601
diff
changeset
|
1777 jvmciCompiler = jdkDist._compilers[-1] |
2448e3c0cd98
set default jvmci.compiler property explicitly based on available suites
Doug Simon <doug.simon@oracle.com>
parents:
22601
diff
changeset
|
1778 args = ['-Djvmci.compiler=' + jvmciCompiler] + args |
2448e3c0cd98
set default jvmci.compiler property explicitly based on available suites
Doug Simon <doug.simon@oracle.com>
parents:
22601
diff
changeset
|
1779 break |
2448e3c0cd98
set default jvmci.compiler property explicitly based on available suites
Doug Simon <doug.simon@oracle.com>
parents:
22601
diff
changeset
|
1780 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1781 if '-version' in args: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1782 ignoredArgs = args[args.index('-version') + 1:] |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1783 if len(ignoredArgs) > 0: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1784 mx.log("Warning: The following options will be ignored by the vm because they come after the '-version' argument: " + ' '.join(ignoredArgs)) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1785 return self.processArgs(args, addDefaultArgs=addDefaultArgs) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1786 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1787 # Overrides JDKConfig |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1788 def run_java(self, args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, env=None, addDefaultArgs=True): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1789 if vm is None: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1790 vm = get_vm() |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1791 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1792 if not isVMSupported(vm): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1793 mx.abort('The ' + vm + ' is not supported on this platform') |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1794 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1795 if cwd is None: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1796 cwd = _vm_cwd |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1797 elif _vm_cwd is not None and _vm_cwd != cwd: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1798 mx.abort("conflicting working directories: do not set --vmcwd for this command") |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1799 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1800 _updateInstalledJVMCIOptionsFile(self.home) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1801 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1802 args = self.parseVmArgs(args, addDefaultArgs=addDefaultArgs) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1803 if _make_eclipse_launch: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1804 mx.make_eclipse_launch(_suite, args, _suite.name + '-' + build, name=None, deps=mx.dependencies()) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1805 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1806 pfx = _vm_prefix.split() if _vm_prefix is not None else [] |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1807 cmd = pfx + [self.java] + ['-' + vm] + args |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1808 return mx.run(cmd, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1809 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1810 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1811 The dict of JVMCI JDKs indexed by vmbuild names. |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1812 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1813 _jvmci_jdks = {} |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1814 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1815 def get_jvmci_jdk(vmbuild=None): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1816 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1817 Gets the JVMCI JDK corresponding to 'vmbuild'. |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1818 """ |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1819 if not vmbuild: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1820 vmbuild = _vmbuild |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1821 jdk = _jvmci_jdks.get(vmbuild) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1822 if jdk is None: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1823 jdk = JVMCIJDKConfig(vmbuild) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1824 _jvmci_jdks[vmbuild] = jdk |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1825 return jdk |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1826 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1827 class JVMCIJDKFactory(mx.JDKFactory): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1828 def getJDKConfig(self): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1829 jdk = get_jvmci_jdk(_vmbuild) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1830 check_VM_exists(get_vm(), jdk.home) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1831 return jdk |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1832 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1833 def description(self): |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1834 return "JVMCI JDK" |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1835 |
22167
22b37f37be0a
adapted to removal of mx_init() mechanism from mx2
Doug Simon <doug.simon@oracle.com>
parents:
22166
diff
changeset
|
1836 def mx_post_parse_cmd_line(opts): |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1837 mx.addJDKFactory(_JVMCI_JDK_TAG, mx.JavaCompliance('8'), JVMCIJDKFactory()) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1838 mx.set_java_command_default_jdk_tag(_JVMCI_JDK_TAG) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1839 |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1840 # Execute for the side-effect of checking that the |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1841 # boot strap JDK has a compatible version |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1842 get_jvmci_bootstrap_jdk() |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1843 |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1844 jdkTag = mx.get_jdk_option().tag |
22019
07cfd3d7072b
removed _vmSourcesAvailable
Doug Simon <doug.simon@oracle.com>
parents:
22018
diff
changeset
|
1845 if hasattr(opts, 'vm') and opts.vm is not None: |
07cfd3d7072b
removed _vmSourcesAvailable
Doug Simon <doug.simon@oracle.com>
parents:
22018
diff
changeset
|
1846 global _vm |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1847 _vm = dealiased_vm(opts.vm) |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1848 if jdkTag and jdkTag != _JVMCI_JDK_TAG: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1849 mx.warn('Ignoring "--vm" option as "--jdk" tag is not "' + _JVMCI_JDK_TAG + '"') |
22019
07cfd3d7072b
removed _vmSourcesAvailable
Doug Simon <doug.simon@oracle.com>
parents:
22018
diff
changeset
|
1850 if hasattr(opts, 'vmbuild') and opts.vmbuild is not None: |
07cfd3d7072b
removed _vmSourcesAvailable
Doug Simon <doug.simon@oracle.com>
parents:
22018
diff
changeset
|
1851 global _vmbuild |
07cfd3d7072b
removed _vmSourcesAvailable
Doug Simon <doug.simon@oracle.com>
parents:
22018
diff
changeset
|
1852 _vmbuild = opts.vmbuild |
22493
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1853 if jdkTag and jdkTag != _JVMCI_JDK_TAG: |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1854 mx.warn('Ignoring "--vmbuild" option as "--jdk" tag is not "' + _JVMCI_JDK_TAG + '"') |
63b12d69147d
added JVMCI JDK factory; clarified distinction between VM aliases and real VMs; removed left-over "graal" references; rename 'vm' function to 'run_vm'
Doug Simon <doug.simon@oracle.com>
parents:
22492
diff
changeset
|
1855 |
22019
07cfd3d7072b
removed _vmSourcesAvailable
Doug Simon <doug.simon@oracle.com>
parents:
22018
diff
changeset
|
1856 global _make_eclipse_launch |
07cfd3d7072b
removed _vmSourcesAvailable
Doug Simon <doug.simon@oracle.com>
parents:
22018
diff
changeset
|
1857 _make_eclipse_launch = getattr(opts, 'make_eclipse_launch', False) |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
1858 global _vm_cwd |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
1859 _vm_cwd = opts.vm_cwd |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
1860 global _installed_jdks |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
1861 _installed_jdks = opts.installed_jdks |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
1862 global _vm_prefix |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
1863 _vm_prefix = opts.vm_prefix |
8134
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
1864 |
22282
9ab88ee1f79f
spelling fix: instanciate -> instantiate
Doug Simon <doug.simon@oracle.com>
parents:
22281
diff
changeset
|
1865 mx.instantiateDistribution('JVM_<vmbuild>_<vm>', dict(vmbuild=_vmbuild, vm=get_vm())) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1866 |
22139
ed35cb998428
Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents:
22108
diff
changeset
|
1867 for jdkDist in jdkDeployedDists: |
21031
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
1868 def _close(jdkDeployable): |
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
1869 def _install(dist): |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1870 _installDistInJdks(jdkDeployable) |
21031
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
1871 return _install |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1872 dist = jdkDist.dist() |
22041
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1873 dist.add_update_listener(_close(jdkDist)) |
22280
ac5551e3ff9c
Make the JVM a distribution
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22279
diff
changeset
|
1874 if isinstance(jdkDist, JvmciJDKDeployedDist): |
22041
56c50504d60d
mx: removed JVMCI code from Distribution.make_archive
Doug Simon <doug.simon@oracle.com>
parents:
22031
diff
changeset
|
1875 dist.set_archiveparticipant(JVMCIArchiveParticipant(dist)) |