Mercurial > hg > graal-compiler
annotate mx.graal/mx_graal_8.py @ 23394:964f28c04d7b default tip
Don't fill the code cache with nmethods from CTW
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Fri, 05 Feb 2016 22:48:36 -0800 |
parents | 3cbb2c456543 |
children |
rev | line source |
---|---|
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 # |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 # ---------------------------------------------------------------------------------------------------- |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 # |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 # Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 # |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 # This code is free software; you can redistribute it and/or modify it |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 # under the terms of the GNU General Public License version 2 only, as |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 # published by the Free Software Foundation. |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 # |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 # This code is distributed in the hope that it will be useful, but WITHOUT |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 # version 2 for more details (a copy is included in the LICENSE file that |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 # accompanied this code). |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 # |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU General Public License version |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 # 2 along with this work; if not, write to the Free Software Foundation, |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 # |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 # or visit www.oracle.com if you need additional information or have any |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 # questions. |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 # |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 # ---------------------------------------------------------------------------------------------------- |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 import os |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 from os.path import join, exists, basename |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 from argparse import ArgumentParser |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 import sanitycheck |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 import re |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 import mx |
23324
ed6a5ffb2e9c
use JVMCI_VERSION constant to avoid too much eagerness when loading mx_graal_8
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
34 from mx_jvmci import JVMCI_VERSION, JvmciJDKDeployedDist, JVMCIArchiveParticipant, jdkDeployedDists, add_bootclasspath_prepend, buildvms, get_jvmci_jdk, _JVMCI_JDK_TAG, VM, relativeVmLibDirInJdk, isJVMCIEnabled |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 from mx_jvmci import get_vm as _jvmci_get_vm |
23209
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
36 from mx_jvmci import run_vm as _jvmci_run_vm |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 from mx_gate import Task |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 from sanitycheck import _noneAsEmptyList |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 from mx_unittest import unittest |
22952
1ba34f16d176
Factor out benchmarks from mx_graal_n.py and add specjbb2015
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22882
diff
changeset
|
41 from mx_graal_bench import dacapo |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 import mx_gate |
23209
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
43 import mx_unittest |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 _suite = mx.suite('graal') |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 def get_vm(): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 """ |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 Gets the name of the currently selected JVM variant. |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 """ |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 vm = _jvmci_get_vm() |
23324
ed6a5ffb2e9c
use JVMCI_VERSION constant to avoid too much eagerness when loading mx_graal_8
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
52 if JVMCI_VERSION >= 9: |
ed6a5ffb2e9c
use JVMCI_VERSION constant to avoid too much eagerness when loading mx_graal_8
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
53 assert isinstance(vm, VM) |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 return vm.jvmVariant |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 else: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 assert isinstance(vm, str) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 return vm |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 class GraalJDKDeployedDist(JvmciJDKDeployedDist): |
23222
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
60 def __init__(self, name, compilers=False, updatesGraalProperties=False): |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
61 JvmciJDKDeployedDist.__init__(self, name, compilers=compilers) |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
62 self.updatesGraalProperties = updatesGraalProperties |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 def deploy(self, jdkDir): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 JvmciJDKDeployedDist.deploy(self, jdkDir) |
23222
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
66 if self.updatesGraalProperties: |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
67 self._updateGraalPropertiesFile(join(jdkDir, 'jre', 'lib')) |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
68 |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
69 def set_archiveparticipant(self): |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
70 dist = self.dist() |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
71 dist.set_archiveparticipant(GraalArchiveParticipant(dist)) |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 def _updateGraalPropertiesFile(self, jreLibDir): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 """ |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 Updates (or creates) 'jreLibDir'/jvmci/graal.properties to set/modify the |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 graal.version property. |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 """ |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 version = _suite.release_version() |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 graalProperties = join(jreLibDir, 'jvmci', 'graal.properties') |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 if not exists(graalProperties): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 with open(graalProperties, 'w') as fp: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 print >> fp, 'graal.version=' + version |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 else: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
84 content = [] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
85 with open(graalProperties) as fp: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
86 for line in fp: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
87 if line.startswith('graal.version='): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 content.append('graal.version=' + version) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
89 else: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 content.append(line.rstrip(os.linesep)) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 with open(graalProperties, 'w') as fp: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 fp.write(os.linesep.join(content)) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 jdkDeployedDists += [ |
23222
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
95 GraalJDKDeployedDist('GRAAL_OPTIONS'), |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
96 GraalJDKDeployedDist('GRAAL_NODEINFO'), |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
97 GraalJDKDeployedDist('GRAAL_API'), |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
98 GraalJDKDeployedDist('GRAAL_COMPILER'), |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
99 GraalJDKDeployedDist('GRAAL_RUNTIME'), |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
100 GraalJDKDeployedDist('GRAAL_HOTSPOT', compilers=['graal-economy', 'graal'], updatesGraalProperties=True), |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
101 GraalJDKDeployedDist('GRAAL_TRUFFLE'), |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
102 GraalJDKDeployedDist('GRAAL_TRUFFLE_HOTSPOT'), |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
103 ] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
104 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
105 mx_gate.add_jacoco_includes(['com.oracle.graal.*']) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
106 mx_gate.add_jacoco_excluded_annotations(['@Snippet', '@ClassSubstitution']) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
107 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
108 # This is different than the 'jmh' commmand in that it |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
109 # looks for internal JMH benchmarks (i.e. those that |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
110 # depend on the JMH library). |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
111 def microbench(args): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
112 """run JMH microbenchmark projects""" |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
113 parser = ArgumentParser(prog='mx microbench', description=microbench.__doc__, |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
114 usage="%(prog)s [command options|VM options] [-- [JMH options]]") |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
115 parser.add_argument('--jar', help='Explicitly specify micro-benchmark location') |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
116 known_args, args = parser.parse_known_args(args) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
117 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
118 vmArgs, jmhArgs = mx.extract_VM_args(args, useDoubleDash=True) |
23324
ed6a5ffb2e9c
use JVMCI_VERSION constant to avoid too much eagerness when loading mx_graal_8
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
119 if JVMCI_VERSION < 9: |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
120 if isJVMCIEnabled(get_vm()) and '-XX:-UseJVMCIClassLoader' not in vmArgs: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
121 vmArgs = ['-XX:-UseJVMCIClassLoader'] + vmArgs |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
123 # look for -f in JMH arguments |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 forking = True |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
125 for i in range(len(jmhArgs)): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
126 arg = jmhArgs[i] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
127 if arg.startswith('-f'): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
128 if arg == '-f' and (i+1) < len(jmhArgs): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
129 arg += jmhArgs[i+1] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
130 try: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
131 if int(arg[2:]) == 0: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
132 forking = False |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
133 except ValueError: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
134 pass |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
135 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
136 if known_args.jar: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
137 # use the specified jar |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
138 args = ['-jar', known_args.jar] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
139 if not forking: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
140 args += vmArgs |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
141 else: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
142 # find all projects with a direct JMH dependency |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
143 jmhProjects = [] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 for p in mx.projects_opt_limit_to_suites(): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
145 if 'JMH' in [x.name for x in p.deps]: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
146 jmhProjects.append(p.name) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
147 cp = mx.classpath(jmhProjects) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
148 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
149 # execute JMH runner |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
150 args = ['-cp', cp] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
151 if not forking: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
152 args += vmArgs |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
153 args += ['org.openjdk.jmh.Main'] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
154 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
155 if forking: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
156 jdk = get_jvmci_jdk() |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
157 jvm = get_vm() |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
158 def quoteSpace(s): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
159 if " " in s: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
160 return '"' + s + '"' |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
161 return s |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
162 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
163 forkedVmArgs = map(quoteSpace, jdk.parseVmArgs(vmArgs)) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
164 args += ['--jvmArgsPrepend', ' '.join(['-' + jvm] + forkedVmArgs)] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
165 run_vm(args + jmhArgs) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
166 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
167 def ctw(args, extraVMarguments=None): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
168 """run CompileTheWorld""" |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
169 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
170 defaultCtwopts = '-Inline' |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
171 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
172 parser = ArgumentParser(prog='mx ctw') |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
173 parser.add_argument('--ctwopts', action='store', help='space separated JVMCI options used for CTW compilations (default: --ctwopts="' + defaultCtwopts + '")', default=defaultCtwopts, metavar='<options>') |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
174 parser.add_argument('--cp', '--jar', action='store', help='jar or class path denoting classes to compile', metavar='<path>') |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
175 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
176 args, vmargs = parser.parse_known_args(args) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
177 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
178 if args.ctwopts: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
179 # Replace spaces with '#' since -G: options cannot contain spaces |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
180 vmargs.append('-G:CompileTheWorldConfig=' + re.sub(r'\s+', '#', args.ctwopts)) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
181 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
182 if args.cp: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
183 cp = os.path.abspath(args.cp) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
184 else: |
23324
ed6a5ffb2e9c
use JVMCI_VERSION constant to avoid too much eagerness when loading mx_graal_8
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
185 if JVMCI_VERSION < 9: |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
186 cp = join(get_jvmci_jdk().home, 'jre', 'lib', 'rt.jar') |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
187 else: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
188 cp = join(get_jvmci_jdk().home, 'modules', 'java.base') + os.pathsep + \ |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
189 join(get_jvmci_jdk().home, 'lib', 'modules', 'bootmodules.jimage') |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
190 vmargs.append('-G:CompileTheWorldExcludeMethodFilter=sun.awt.X11.*.*') |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
191 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
192 # suppress menubar and dock when running on Mac; exclude x11 classes as they may cause vm crashes (on Solaris) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
193 vmargs = ['-Djava.awt.headless=true'] + vmargs |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
194 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
195 vm = get_vm() |
23324
ed6a5ffb2e9c
use JVMCI_VERSION constant to avoid too much eagerness when loading mx_graal_8
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
196 if JVMCI_VERSION >= 9: |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
197 jvmciMode = _jvmci_get_vm().jvmciMode |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
198 if jvmciMode == 'disabled': |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
199 vmargs += ['-XX:+CompileTheWorld', '-Xbootclasspath/p:' + cp] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
200 else: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
201 if jvmciMode == 'jit': |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
202 vmargs += ['-XX:+BootstrapJVMCI'] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
203 vmargs += ['-G:CompileTheWorldClasspath=' + cp, 'com.oracle.graal.hotspot.CompileTheWorld'] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
204 else: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
205 if isJVMCIEnabled(vm): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
206 if vm == 'jvmci': |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
207 vmargs += ['-XX:+BootstrapJVMCI'] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
208 vmargs += ['-G:CompileTheWorldClasspath=' + cp, '-XX:-UseJVMCIClassLoader', 'com.oracle.graal.hotspot.CompileTheWorld'] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
209 else: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
210 vmargs += ['-XX:+CompileTheWorld', '-Xbootclasspath/p:' + cp] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
211 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
212 run_vm(vmargs + _noneAsEmptyList(extraVMarguments)) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
213 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
214 class UnitTestRun: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
215 def __init__(self, name, args): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
216 self.name = name |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
217 self.args = args |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
218 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
219 def run(self, suites, tasks, extraVMarguments=None): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
220 for suite in suites: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
221 with Task(self.name + ': hosted-product ' + suite, tasks) as t: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
222 if t: unittest(['--suite', suite, '--enable-timing', '--verbose', '--fail-fast'] + self.args + _noneAsEmptyList(extraVMarguments)) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
223 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
224 class BootstrapTest: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
225 def __init__(self, name, vmbuild, args, suppress=None): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
226 self.name = name |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
227 self.vmbuild = vmbuild |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
228 self.args = args |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
229 self.suppress = suppress |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
230 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
231 def run(self, tasks, extraVMarguments=None): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
232 with VM('jvmci', self.vmbuild): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
233 with Task(self.name + ':' + self.vmbuild, tasks) as t: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
234 if t: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
235 if self.suppress: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
236 out = mx.DuplicateSuppressingStream(self.suppress).write |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
237 else: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
238 out = None |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
239 run_vm(self.args + _noneAsEmptyList(extraVMarguments) + ['-XX:-TieredCompilation', '-XX:+BootstrapJVMCI', '-version'], out=out) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
240 |
23095
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
241 class MicrobenchRun: |
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
242 def __init__(self, name, args): |
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
243 self.name = name |
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
244 self.args = args |
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
245 |
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
246 def run(self, tasks, extraVMarguments=None): |
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
247 with Task(self.name + ': hosted-product ', tasks) as t: |
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
248 if t: microbench(_noneAsEmptyList(extraVMarguments) + ['--'] + self.args) |
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
249 |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
250 def compiler_gate_runner(suites, unit_test_runs, bootstrap_tests, tasks, extraVMarguments=None): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
251 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
252 # Build server-hosted-jvmci now so we can run the unit tests |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
253 with Task('BuildHotSpotGraalHosted: product', tasks) as t: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
254 if t: buildvms(['--vms', 'server', '--builds', 'product']) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
255 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
256 # Run unit tests on server-hosted-jvmci |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
257 with VM('server', 'product'): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
258 for r in unit_test_runs: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
259 r.run(suites, tasks, extraVMarguments) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
260 |
23095
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
261 # Run microbench on server-hosted-jvmci (only for testing the JMH setup) |
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
262 with VM('server', 'product'): |
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
263 for r in [MicrobenchRun('Microbench', ['TestJMH'])]: |
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
264 r.run(tasks, extraVMarguments) |
cfb4dae8d566
gate: add check for verifying the jmh-runner setup.
Josef Eisl <josef.eisl@jku.at>
parents:
23074
diff
changeset
|
265 |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
266 # Run ctw against rt.jar on server-hosted-jvmci |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
267 with VM('server', 'product'): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
268 with Task('CTW:hosted-product', tasks) as t: |
23298
7c75cff3136c
Increase ReservedCodeCacheSize for gate CTW
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
23295
diff
changeset
|
269 if t: ctw(['--ctwopts', '-Inline +ExitVMOnException', '-esa', '-G:+CompileTheWorldMultiThreaded', '-G:-InlineDuringParsing', '-G:-CompileTheWorldVerbose', '-XX:ReservedCodeCacheSize=400m'], _noneAsEmptyList(extraVMarguments)) |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
270 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
271 # Build the jvmci VMs so we can run the other tests |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
272 with Task('BuildHotSpotGraalOthers: fastdebug,product', tasks) as t: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
273 if t: buildvms(['--vms', 'jvmci', '--builds', 'fastdebug,product']) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
274 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
275 # bootstrap tests |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
276 for b in bootstrap_tests: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
277 b.run(tasks, extraVMarguments) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
278 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
279 # run dacapo sanitychecks |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
280 for vmbuild in ['fastdebug', 'product']: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
281 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild, extraVmArguments=extraVMarguments) \ |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
282 + sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild, extraVmArguments=extraVMarguments): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
283 with Task(str(test) + ':' + vmbuild, tasks) as t: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
284 if t and not test.test('jvmci'): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
285 t.abort(test.name + ' Failed') |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
286 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
287 # ensure -Xbatch still works |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
288 with VM('jvmci', 'product'): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
289 with Task('DaCapo_pmd:BatchMode:product', tasks) as t: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
290 if t: dacapo(_noneAsEmptyList(extraVMarguments) + ['-Xbatch', 'pmd']) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
291 |
23157
274037591da2
gate: test benchmark counters.
Josef Eisl <josef.eisl@jku.at>
parents:
23108
diff
changeset
|
292 # ensure benchmark counters still work |
274037591da2
gate: test benchmark counters.
Josef Eisl <josef.eisl@jku.at>
parents:
23108
diff
changeset
|
293 with VM('jvmci', 'product'): |
274037591da2
gate: test benchmark counters.
Josef Eisl <josef.eisl@jku.at>
parents:
23108
diff
changeset
|
294 with Task('DaCapo_pmd:BenchmarkCounters:product', tasks) as t: |
274037591da2
gate: test benchmark counters.
Josef Eisl <josef.eisl@jku.at>
parents:
23108
diff
changeset
|
295 if t: dacapo(_noneAsEmptyList(extraVMarguments) + ['-G:+LIRProfileMoves', '-G:+GenericDynamicCounters', '-XX:JVMCICounterSize=10', 'pmd']) |
274037591da2
gate: test benchmark counters.
Josef Eisl <josef.eisl@jku.at>
parents:
23108
diff
changeset
|
296 |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
297 # ensure -Xcomp still works |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
298 with VM('jvmci', 'product'): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
299 with Task('XCompMode:product', tasks) as t: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
300 if t: run_vm(_noneAsEmptyList(extraVMarguments) + ['-Xcomp', '-version']) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
301 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
302 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
303 graal_unit_test_runs = [ |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
304 UnitTestRun('UnitTests', []), |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
305 ] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
306 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
307 _registers = 'o0,o1,o2,o3,f8,f9,d32,d34' if mx.get_arch() == 'sparcv9' else 'rbx,r11,r10,r14,xmm3,xmm11,xmm14' |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
308 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
309 graal_bootstrap_tests = [ |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
310 BootstrapTest('BootstrapWithSystemAssertions', 'fastdebug', ['-esa']), |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
311 BootstrapTest('BootstrapWithSystemAssertionsNoCoop', 'fastdebug', ['-esa', '-XX:-UseCompressedOops', '-G:+ExitVMOnException']), |
23108 | 312 BootstrapTest('BootstrapWithGCVerification', 'product', ['-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-G:+ExitVMOnException'], suppress=['VerifyAfterGC:', 'VerifyBeforeGC:']), |
313 BootstrapTest('BootstrapWithG1GCVerification', 'product', ['-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-G:+ExitVMOnException'], suppress=['VerifyAfterGC:', 'VerifyBeforeGC:']), | |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
314 BootstrapTest('BootstrapEconomyWithSystemAssertions', 'fastdebug', ['-esa', '-Djvmci.compiler=graal-economy', '-G:+ExitVMOnException']), |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
315 BootstrapTest('BootstrapWithExceptionEdges', 'fastdebug', ['-esa', '-G:+StressInvokeWithExceptionNode', '-G:+ExitVMOnException']), |
23378
3cbb2c456543
gate: run BootstrapWithRegisterPressure with LIRUnlockBackendRestart flag.
Josef Eisl <josef.eisl@jku.at>
parents:
23325
diff
changeset
|
316 BootstrapTest('BootstrapWithRegisterPressure', 'product', ['-esa', '-G:RegisterPressure=' + _registers, '-G:+ExitVMOnException', '-G:+LIRUnlockBackendRestart']), |
3cbb2c456543
gate: run BootstrapWithRegisterPressure with LIRUnlockBackendRestart flag.
Josef Eisl <josef.eisl@jku.at>
parents:
23325
diff
changeset
|
317 BootstrapTest('BootstrapTraceRAWithRegisterPressure', 'product', ['-esa', '-G:+TraceRA', '-G:RegisterPressure=' + _registers, '-G:+ExitVMOnException', '-G:+LIRUnlockBackendRestart']), |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
318 BootstrapTest('BootstrapWithImmutableCode', 'product', ['-esa', '-G:+ImmutableCode', '-G:+VerifyPhases', '-G:+ExitVMOnException']), |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
319 ] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
320 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
321 def _graal_gate_runner(args, tasks): |
23277
f0e34c710768
added Tuffle unit test to Graal gate
Doug Simon <doug.simon@oracle.com>
parents:
23222
diff
changeset
|
322 compiler_gate_runner(['graal', 'truffle'], graal_unit_test_runs, graal_bootstrap_tests, tasks, args.extra_vm_argument) |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
323 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
324 mx_gate.add_gate_runner(_suite, _graal_gate_runner) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
325 mx_gate.add_gate_argument('--extra-vm-argument', action='append', help='add extra vm argument to gate tasks if applicable (multiple occurrences allowed)') |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
326 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
327 def jdkartifactstats(args): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
328 """show stats about JDK deployed Graal artifacts""" |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
329 artifacts = {} |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
330 jdkDir = get_jvmci_jdk().home |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
331 def _getDeployedJars(): |
23324
ed6a5ffb2e9c
use JVMCI_VERSION constant to avoid too much eagerness when loading mx_graal_8
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
332 if JVMCI_VERSION < 9: |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
333 for root, _, filenames in os.walk(join(jdkDir, 'jre', 'lib')): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
334 for f in filenames: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
335 if f.endswith('.jar') and not f.endswith('.stripped.jar'): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
336 yield join(root, f) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
337 else: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
338 for jdkDist in jdkDeployedDists: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
339 dist = jdkDist.dist() |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
340 if isinstance(jdkDist, JvmciJDKDeployedDist): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
341 yield dist.path |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
342 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
343 for jar in _getDeployedJars(): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
344 f = basename(jar) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
345 if 'truffle' in f: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
346 if 'enterprise' in f: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
347 artifacts.setdefault('GraalEnterpriseTruffle', []).append(jar) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
348 else: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
349 artifacts.setdefault('GraalTruffle', []).append(jar) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
350 elif 'enterprise' in f: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
351 artifacts.setdefault('GraalEnterprise', []).append(jar) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
352 elif 'jvmci' in f: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
353 artifacts.setdefault('JVMCI', []).append(jar) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
354 elif 'graal' in f: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
355 artifacts.setdefault('Graal', []).append(jar) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
356 else: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
357 mx.logv('ignored: ' + jar) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
358 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
359 print '{:>10} {:>10} {:>10} {}'.format('All', 'NoVars', 'None', 'Jar') |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
360 for category in sorted(artifacts.viewkeys()): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
361 jars = artifacts[category] |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
362 if jars: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
363 totals = (0, 0, 0) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
364 print |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
365 for j in jars: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
366 gSize = os.path.getsize(j) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
367 stripped = j[:-len('.jar')] + '.stripped.jar' |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
368 mx.run([mx.get_jdk().pack200, '--repack', '--quiet', '-J-Djava.util.logging.config.file=', '-DLocalVariableTypeTable=strip', '-DLocalVariableTable=strip', stripped, j]) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
369 gLinesSourceSize = os.path.getsize(stripped) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
370 mx.run([mx.get_jdk().pack200, '--repack', '--quiet', '-J-Djava.util.logging.config.file=', '-G', stripped, j]) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
371 gNoneSize = os.path.getsize(stripped) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
372 os.remove(stripped) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
373 print '{:10,} {:10,} {:10,} {}:{}'.format(gSize, gLinesSourceSize, gNoneSize, category, basename(j)) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
374 t1, t2, t3 = totals |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
375 totals = (t1 + gSize, t2 + gLinesSourceSize, t3 + gNoneSize) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
376 t1, t2, t3 = totals |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
377 print '{:10,} {:10,} {:10,} {}'.format(t1, t2, t3, category) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
378 |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
379 jvmLib = join(jdkDir, relativeVmLibDirInJdk(), get_vm(), mx.add_lib_suffix(mx.add_lib_prefix('jvm'))) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
380 print |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
381 if exists(jvmLib): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
382 print '{:10,} {}'.format(os.path.getsize(jvmLib), jvmLib) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
383 else: |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
384 print '{:>10} {}'.format('<missing>', jvmLib) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
385 |
23209
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
386 # Support for -G: options |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
387 def _translateGOption(arg): |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
388 if arg.startswith('-G:+'): |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
389 if '=' in arg: |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
390 mx.abort('Mixing + and = in -G: option specification: ' + arg) |
23290
fd7e09778f42
changed system property prefix for @Option based Graal options to "graal."
Doug Simon <doug.simon@oracle.com>
parents:
23280
diff
changeset
|
391 arg = '-Dgraal.' + arg[len('-G:+'):] + '=true' |
23209
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
392 elif arg.startswith('-G:-'): |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
393 if '=' in arg: |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
394 mx.abort('Mixing - and = in -G: option specification: ' + arg) |
23290
fd7e09778f42
changed system property prefix for @Option based Graal options to "graal."
Doug Simon <doug.simon@oracle.com>
parents:
23280
diff
changeset
|
395 arg = '-Dgraal.' + arg[len('-G:+'):] + '=false' |
23209
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
396 elif arg.startswith('-G:'): |
23280
c238d6294bc3
detect misformatted -G option
Doug Simon <doug.simon@oracle.com>
parents:
23277
diff
changeset
|
397 if '=' not in arg: |
c238d6294bc3
detect misformatted -G option
Doug Simon <doug.simon@oracle.com>
parents:
23277
diff
changeset
|
398 mx.abort('Missing "=" in non-boolean -G: option specification: ' + arg) |
23290
fd7e09778f42
changed system property prefix for @Option based Graal options to "graal."
Doug Simon <doug.simon@oracle.com>
parents:
23280
diff
changeset
|
399 arg = '-Dgraal.' + arg[len('-G:'):] |
23209
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
400 return arg |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
401 |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
402 def run_vm(*positionalargs, **kwargs): |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
403 """run a Java program by executing the java executable in a Graal JDK""" |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
404 |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
405 # convert positional args to a list so the first element can be updated |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
406 positionalargs = list(positionalargs) |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
407 args = positionalargs[0] |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
408 if '-G:+PrintFlags' in args and '-Xcomp' not in args: |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
409 mx.warn('Using -G:+PrintFlags may have no effect without -Xcomp as Graal initialization is lazy') |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
410 positionalargs[0] = map(_translateGOption, args) |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
411 return _jvmci_run_vm(*positionalargs, **kwargs) |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
412 |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
413 def _unittest_config_participant(config): |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
414 vmArgs, mainClass, mainClassArgs = config |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
415 if isJVMCIEnabled(get_vm()): |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
416 return (map(_translateGOption, vmArgs), mainClass, mainClassArgs) |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
417 return config |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
418 |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
419 mx_unittest.add_config_participant(_unittest_config_participant) |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
420 |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
421 mx.update_commands(_suite, { |
23325
e153ecca9b36
fix mx vm command regression
Andreas Woess <andreas.woess@oracle.com>
parents:
23324
diff
changeset
|
422 'vm': [run_vm, '[-options] class [args...]'], |
22952
1ba34f16d176
Factor out benchmarks from mx_graal_n.py and add specjbb2015
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22882
diff
changeset
|
423 'jdkartifactstats' : [jdkartifactstats, ''], |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
424 'ctw': [ctw, '[-vmoptions|noinline|nocomplex|full]'], |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
425 'microbench' : [microbench, '[VM options] [-- [JMH options]]'], |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
426 }) |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
427 |
23209
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
428 class GraalArchiveParticipant(JVMCIArchiveParticipant): |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
429 def __init__(self, dist): |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
430 JVMCIArchiveParticipant.__init__(self, dist) |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
431 |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
432 def __add__(self, arcname, contents): |
23222
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
433 if arcname.startswith('META-INF/providers/'): |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
434 # Handles files generated by ServiceProviderProcessor |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
435 provider = arcname[len('META-INF/providers/'):] |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
436 for service in contents.strip().split(os.linesep): |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
437 assert service |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
438 self.jvmciServices.setdefault(service, []).append(provider) |
56359eb3abfa
moved @ServiceProvider mechanism from JVMCI to Graal (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
23218
diff
changeset
|
439 return True |
23209
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
440 if arcname.endswith('_OptionDescriptors.class'): |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
441 # Need to create service files for the providers of the |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
442 # com.oracle.graal.options.Options service created by |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
443 # com.oracle.graal.options.processor.OptionProcessor. |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
444 provider = arcname[:-len('.class'):].replace('/', '.') |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
445 self.services.setdefault('com.oracle.graal.options.OptionDescriptors', []).append(provider) |
f35e653aa876
moved @Option mechanism from JVMCI to Graal (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
23157
diff
changeset
|
446 return JVMCIArchiveParticipant.__add__(self, arcname, contents) |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
447 |
23295
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
448 """ |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
449 The Graal JDK(s). |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
450 """ |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
451 _graal_jdks = {} |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
452 |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
453 def get_graal_jdk(): |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
454 """ |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
455 Gets a Graal JDK which adds support for handling the -G format of Graal options. |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
456 """ |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
457 jvmci_jdk = get_jvmci_jdk() |
23324
ed6a5ffb2e9c
use JVMCI_VERSION constant to avoid too much eagerness when loading mx_graal_8
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
458 if JVMCI_VERSION < 9: |
23322
0653faea0327
rename JVMCIJDKConfig to reflect the JVMCI renaming changes.
Manuel Rigger <rigger.manuel@gmail.com>
parents:
23307
diff
changeset
|
459 from mx_jvmci import check_VM_exists, JVMCI8JDKConfig # pylint: disable=no-name-in-module |
23295
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
460 vmbuild = jvmci_jdk.vmbuild |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
461 check_VM_exists(get_vm(), jvmci_jdk.home, vmbuild) |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
462 jdk = _graal_jdks.get(vmbuild) |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
463 if jdk is None: |
23322
0653faea0327
rename JVMCIJDKConfig to reflect the JVMCI renaming changes.
Manuel Rigger <rigger.manuel@gmail.com>
parents:
23307
diff
changeset
|
464 class GraalJDK8Config(JVMCI8JDKConfig): |
23307
c2e662ca2423
temporary workaround for pylint bug
Manuel Rigger <rigger.manuel@gmail.com>
parents:
23298
diff
changeset
|
465 def __init__(self, vmbuild): # pylint: disable=super-init-not-called |
23322
0653faea0327
rename JVMCIJDKConfig to reflect the JVMCI renaming changes.
Manuel Rigger <rigger.manuel@gmail.com>
parents:
23307
diff
changeset
|
466 JVMCI8JDKConfig.__init__(self, vmbuild) |
23295
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
467 |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
468 def parseVmArgs(self, args, addDefaultArgs=True): |
23322
0653faea0327
rename JVMCIJDKConfig to reflect the JVMCI renaming changes.
Manuel Rigger <rigger.manuel@gmail.com>
parents:
23307
diff
changeset
|
469 return JVMCI8JDKConfig.parseVmArgs(self, map(_translateGOption, args), addDefaultArgs=addDefaultArgs) |
23295
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
470 |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
471 jdk = GraalJDK8Config(vmbuild) |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
472 _graal_jdks[vmbuild] = jdk |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
473 else: |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
474 jdk = _graal_jdks.get('default') |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
475 if jdk is None: |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
476 from mx_jvmci import JVMCI9JDKConfig # pylint: disable=no-name-in-module |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
477 class GraalJDK9Config(JVMCI9JDKConfig): |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
478 def __init__(self, debugLevel): |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
479 JVMCI9JDKConfig.__init__(self, debugLevel) |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
480 |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
481 def parseVmArgs(self, args, addDefaultArgs=True): |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
482 return JVMCI9JDKConfig.parseVmArgs(self, map(_translateGOption, args), addDefaultArgs=addDefaultArgs) |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
483 jdk = GraalJDK9Config(jvmci_jdk.debugLevel) |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
484 _graal_jdks['default'] = jdk |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
485 return jdk |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
486 |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
487 class GraalJDKFactory(mx.JDKFactory): |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
488 def getJDKConfig(self): |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
489 return get_graal_jdk() |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
490 |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
491 def description(self): |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
492 return "Graal JDK" |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
493 |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
494 # This will override the 'generic' JVMCI JDK with a Graal JVMCI JDK that has |
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
495 # support for -G style Graal options. |
23324
ed6a5ffb2e9c
use JVMCI_VERSION constant to avoid too much eagerness when loading mx_graal_8
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
496 mx.addJDKFactory(_JVMCI_JDK_TAG, mx.JavaCompliance(str(JVMCI_VERSION)), GraalJDKFactory()) |
23295
22f57623221f
override "jvmci" tag for --jdk option with Graal specific JDK config
Doug Simon <doug.simon@oracle.com>
parents:
23290
diff
changeset
|
497 |
22882
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
498 def mx_post_parse_cmd_line(opts): |
9fed99d7f32d
made Graal work on a JDK9 image without needing the jvmci mx suite or extensions
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
499 add_bootclasspath_prepend(mx.distribution('truffle:TRUFFLE_API')) |