annotate mxtool/mx @ 12690:c3bdd186e6cf

fix possible NPE in TruffleCompiler with TraceTruffleCompilation and background compilation enabled. With background compilation, the installed code can already be invalidated when compiledMethod.getCode() is called, in which case it returns null.
author Andreas Woess <andreas.woess@jku.at>
date Wed, 06 Nov 2013 13:31:28 +0100
parents 98918f518640
children 841a9f98b97c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3723
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 #!/bin/bash
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 #
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 # ----------------------------------------------------------------------------------------------------
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 #
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 # Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 #
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 # This code is free software; you can redistribute it and/or modify it
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 # under the terms of the GNU General Public License version 2 only, as
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 # published by the Free Software Foundation.
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 #
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 # This code is distributed in the hope that it will be useful, but WITHOUT
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 # version 2 for more details (a copy is included in the LICENSE file that
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 # accompanied this code).
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 #
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 # You should have received a copy of the GNU General Public License version
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 # 2 along with this work; if not, write to the Free Software Foundation,
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 #
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 # or visit www.oracle.com if you need additional information or have any
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24 # questions.
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 #
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26 # ----------------------------------------------------------------------------------------------------
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
28 dir=`/bin/pwd`
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
29
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
30 # Resolve location of this script so that mx.py can be found in the same directory
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31 source="${BASH_SOURCE[0]}"
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
32 while [ -h "$source" ] ; do source="$(readlink "$source")"; done
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
33 dir="$( cd -P "$( dirname "$source" )" && pwd )"
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
34
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
35 if [ ! -f "$dir/mx.py" ]; then
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36 echo "Cannot find mx.py in $dir"
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
37 exit 1
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
38 fi
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
39
8460
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
40 # Not all systems (e.g. Mac OS X) have 'python2' on the path.
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
41 type python2.7 >/dev/null 2>&1
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
42 if [ $? -eq 0 ]; then
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
43 python_exe=python2.7
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
44 else
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
45 type python2 > /dev/null 2>&1
9830
98918f518640 fixed bash syntax error
Doug Simon <doug.simon@oracle.com>
parents: 8460
diff changeset
46 if [ $? -eq 0 ]; then
8460
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
47 python_exe=python2
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
48 else
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
49 python_exe=python
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
50 fi
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
51 fi
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
52
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
53 $python_exe <<END
3723
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
54 import sys
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
55 major, minor, micro, _, _ = sys.version_info
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
56 if major != 2 or minor != 7:
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
57 raise SystemExit('The mx.py script requires Python 2.7, not {0}.{1}.{2}'.format(major, minor, micro))
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
58 END
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
59 if [ $? -eq 0 ]; then
8460
a607682f7ba6 mx.sh should select python2.7 python2 or python depending on what is available.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4186
diff changeset
60 exec $python_exe -u "$dir/mx.py" "$@"
3723
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
61 fi
6c5f528c7aac Added a copy of the mxtool to repo.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
62
4167
3e749481e445 Trivial change to test gate.
Doug Simon <doug.simon@oracle.com>
parents: 3723
diff changeset
63 #end of file