# HG changeset patch # User duke # Date 1503584818 -7200 # Node ID d9f6bc6ba599d0487dc18b2fbdb6c34eedf6f958 # Parent 830e16e5eef559149475f5bf2208eff5e585b147# Parent 2511cbba2396ef3555a067ea5fdd122ce6e5d6cc Merge diff -r 830e16e5eef5 -r d9f6bc6ba599 .hgtags --- a/.hgtags Mon Jul 03 13:18:55 2017 -0700 +++ b/.hgtags Thu Aug 24 16:26:58 2017 +0200 @@ -399,3 +399,24 @@ 8c70d170e62c0c58b5bc3ba666bd140399b98c9c jdk-10+0 45b751afd11e6c05991cf4913c5a0ac3304fcc4e jdk-9+154 f4aff695ffe05cfdb69d8af25a4ddc6a029754ea jdk-9+155 +06bce0388880b5ff8e040e4a9d72a3ea11dac321 jdk-9+156 +fa3e76b477829afc4476f0b725cfaa440a6fd917 jdk-9+157 +b5015f742ba648184bb7fc547197bd33ebfde30d jdk-9+158 +fd1497902bbe3aa24b21f270ecdcb8de5f7aa9ac jdk-9+159 +6aa8be0c4e054fe8b3ab016ae00d16d680f92145 jdk-9+160 +f6883b1a5a6478437cd4181c4bd45328ab24feaf jdk-9+161 +d16aebbb56d37f12e0c0b0a4fb427db65e1fb1a8 jdk-9+162 +18c41483a082e097ac2f5f983c1226ed94aa4215 jdk-9+163 +32db52c675e7d5bc413605d2e89b68b608b19be0 jdk-9+164 +3965b747cfe1e6cbd66b8739da5a1ea6ec6985e9 jdk-9+165 +d3e973f1809606c67412361041ad197e50fe8cec jdk-9+166 +8fd0a4569191f33c98ee90c2709174a342fefb0d jdk-9+167 +fcabc74bd44e56c7419d111d59b95669ecb33c55 jdk-9+168 +c7efde2b60fc1ec04630be769d9ad60efb39c39c jdk-9+169 +898cbe31fbdae2d25d141384fac746cc244a730c jdk-9+170 +643b5f18c2656fe91b69fea85b07b98d5fad394d jdk-9+171 +dad6746278facbbea57dd462cb56fb743dc0a5f0 jdk-9+172 +6dd7fda42bab7ecf648cafb0a4e9b4ca11b3094f jdk-9+173 +94680c6d60ecd9ed3ffd1847706efde7eb947afc jdk-9+174 +994036e74ab805bcc09afa0646be17a725bec42f jdk-9+175 +43bf6f30fcba031ecf0cc7e511efe3a8179d0f77 jdk-9+176 diff -r 830e16e5eef5 -r d9f6bc6ba599 .hgtags-top-repo --- a/.hgtags-top-repo Mon Jul 03 13:18:55 2017 -0700 +++ b/.hgtags-top-repo Thu Aug 24 16:26:58 2017 +0200 @@ -398,3 +398,24 @@ 816a6d03a7c44edfbd8780110529f1bdc3964fb9 jdk-9+153 8d26916eaa21b689835ffc1c0dbf12470aa9be61 jdk-9+154 688a3863c00ebc089ab17ee1fc46272cbbd96815 jdk-9+155 +783ec7542cf7154e5d2b87f55bb97d28f81e9ada jdk-9+156 +4eb77fb98952dc477a4229575c81d2263a9ce711 jdk-9+157 +a4087bc10a88a43ea3ad0919b5b4af1c86977221 jdk-9+158 +fe8466adaef8178dba94be53c789a0aaa87d13bb jdk-9+159 +4d29ee32d926ebc960072d51a3bc558f95c1cbad jdk-9+160 +cda60babd152d889aba4d8f20a8f643ab151d3de jdk-9+161 +21b063d75b3edbffb9bebc8872d990920c4ae1e5 jdk-9+162 +c38c6b270ccc8e2b86d1631bcf42248241b54d2c jdk-9+163 +7810f75d016a52e32295c4233009de5ca90e31af jdk-9+164 +aff4f339acd40942d3dab499846b52acd87b3af1 jdk-9+165 +ba5b16c9c6d80632b61959a33d424b1c3398ce62 jdk-9+166 +35017c286513ddcbcc6b63b99679c604993fc639 jdk-9+167 +143d4c87bc1ef1ed6dadd613cd9dd4488fdefc29 jdk-9+168 +b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169 +4d163ec59d989a9261ed7f848bc6303f90869af5 jdk-9+170 +4c12464a907db4656c1033f56fa49cba643ac629 jdk-9+171 +2c25fc24103251f9711a1c280c31e1e41016d90f jdk-9+172 +88d7fd969e7df0e07a53b201cfd29393ca33ede9 jdk-9+173 +5466f409346e0446ee9a6daeb7f5d75c8fc76823 jdk-9+174 +8f7227c6012b0051ea4e0bcee040c627bf699b88 jdk-9+175 +84777531d994ef70163d35078ec9c4127f2eadb5 jdk-9+176 diff -r 830e16e5eef5 -r d9f6bc6ba599 README --- a/README Mon Jul 03 13:18:55 2017 -0700 +++ b/README Thu Aug 24 16:26:58 2017 +0200 @@ -1,40 +1,10 @@ -README: - This file should be located at the top of the OpenJDK Mercurial root - repository. A full OpenJDK repository set (forest) should also include - the following 7 nested repositories: - "jdk", "hotspot", "langtools", "nashorn", "corba", "jaxws" and "jaxp". +Welcome to OpenJDK! +=================== - The root repository can be obtained with something like: - hg clone http://hg.openjdk.java.net/jdk9/jdk9 openjdk9 +For information about building OpenJDK, including how to fully retrieve all +source code, please see either of these: - You can run the get_source.sh script located in the root repository to get - the other needed repositories: - cd openjdk9 && sh ./get_source.sh + * common/doc/building.html (html version) + * common/doc/building.md (markdown version) - People unfamiliar with Mercurial should read the first few chapters of - the Mercurial book: http://hgbook.red-bean.com/read/ - - See http://openjdk.java.net/ for more information about OpenJDK. - -Simple Build Instructions: - - 0. Get the necessary system software/packages installed on your system, see - http://hg.openjdk.java.net/jdk9/jdk9/raw-file/tip/README-builds.html - - 1. If you don't have a jdk8 or newer jdk, download and install it from - http://java.sun.com/javase/downloads/index.jsp - Add the /bin directory of this installation to your PATH environment - variable. - - 2. Configure the build: - bash ./configure - - 3. Build the OpenJDK: - make all - The resulting JDK image should be found in build/*/images/jdk - -where make is GNU make 3.81 or newer, /usr/bin/make on Linux usually -is 3.81 or newer. Note that on Solaris, GNU make is called "gmake". - -Complete details are available in the file: - http://hg.openjdk.java.net/jdk9/jdk9/raw-file/tip/README-builds.html +See http://openjdk.java.net/ for more information about OpenJDK. diff -r 830e16e5eef5 -r d9f6bc6ba599 README-builds.html --- a/README-builds.html Mon Jul 03 13:18:55 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1406 +0,0 @@ - - - OpenJDK Build README - - -

OpenJDK

- -

OpenJDK Build README

- -
- -

- -

Introduction

- -

This README file contains build instructions for the -OpenJDK. Building the source code for the OpenJDK -requires a certain degree of technical expertise.

- -

!!!!!!!!!!!!!!! THIS IS A MAJOR RE-WRITE of this document. !!!!!!!!!!!!!

- -

Some Headlines:

- - - -
- -

Contents

- - - -
- - - -
- -

- -

Use of Mercurial

- -

The OpenJDK sources are maintained with the revision control system -Mercurial. If you are new to -Mercurial, please see the Beginner Guides or refer to the Mercurial Book. -The first few chapters of the book provide an excellent overview of Mercurial, -what it is and how it works.

- -

For using Mercurial with the OpenJDK refer to the Developer Guide: Installing -and Configuring Mercurial section for more information.

- -

- -

Getting the Source

- -

To get the entire set of OpenJDK Mercurial repositories use the script -get_source.sh located in the root repository:

- -
  hg clone http://hg.openjdk.java.net/jdk9/jdk9 YourOpenJDK
-  cd YourOpenJDK
-  bash ./get_source.sh
-
- -

Once you have all the repositories, keep in mind that each repository is its -own independent repository. You can also re-run ./get_source.sh anytime to -pull over all the latest changesets in all the repositories. This set of -nested repositories has been given the term "forest" and there are various -ways to apply the same hg command to each of the repositories. For -example, the script make/scripts/hgforest.sh can be used to repeat the -same hg command on every repository, e.g.

- -
  cd YourOpenJDK
-  bash ./make/scripts/hgforest.sh status
-
- -

- -

Repositories

- -

The set of repositories and what they contain:

- - - -

Repository Source Guidelines

- -

There are some very basic guidelines:

- - - -
- -

- -

Building

- -

The very first step in building the OpenJDK is making sure the system itself -has everything it needs to do OpenJDK builds. Once a system is setup, it -generally doesn't need to be done again.

- -

Building the OpenJDK is now done with running a configure script which will -try and find and verify you have everything you need, followed by running -make, e.g.

- -
-

bash ./configure
- make all

-
- -

Where possible the configure script will attempt to located the various -components in the default locations or via component specific variable -settings. When the normal defaults fail or components cannot be found, -additional configure options may be necessary to help configure find the -necessary tools for the build, or you may need to re-visit the setup of your -system due to missing software packages.

- -

NOTE: The configure script file does not have execute permissions and -will need to be explicitly run with bash, see the source guidelines.

- -
- -

- -

System Setup

- -

Before even attempting to use a system to build the OpenJDK there are some very -basic system setups needed. For all systems:

- - - -

And for specific systems:

- - - -

- -

Linux

- -

With Linux, try and favor the system packages over building your own or getting -packages from other areas. Most Linux builds should be possible with the -system's available packages.

- -

Note that some Linux systems have a habit of pre-populating your environment -variables for you, for example JAVA_HOME might get pre-defined for you to -refer to the JDK installed on your Linux system. You will need to unset -JAVA_HOME. It's a good idea to run env and verify the environment variables -you are getting from the default system settings make sense for building the -OpenJDK.

- -

- -

Solaris

- -

- -
Studio Compilers
- -

At a minimum, the Studio 12 Update 4 Compilers (containing -version 5.13 of the C and C++ compilers) is required, including specific -patches.

- -

The Solaris Studio installation should contain at least these packages:

- -
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PackageVersion
developer/solarisstudio-124/backend12.4-1.0.6.0
developer/solarisstudio-124/c++12.4-1.0.10.0
developer/solarisstudio-124/cc12.4-1.0.4.0
developer/solarisstudio-124/library/c++-libs12.4-1.0.10.0
developer/solarisstudio-124/library/math-libs12.4-1.0.0.1
developer/solarisstudio-124/library/studio-gccrt12.4-1.0.0.1
developer/solarisstudio-124/studio-common12.4-1.0.0.1
developer/solarisstudio-124/studio-ja12.4-1.0.0.1
developer/solarisstudio-124/studio-legal12.4-1.0.0.1
developer/solarisstudio-124/studio-zhCN12.4-1.0.0.1

-
- -

In particular backend 12.4-1.0.6.0 contains a critical patch for the sparc -version.

- -

Place the bin directory in PATH.

- -

The Oracle Solaris Studio Express compilers at: Oracle Solaris Studio Express -Download site are also an option, although these compilers -have not been extensively used yet.

- -

- -

Windows

- -
Windows Unix Toolkit
- -

Building on Windows requires a Unix-like environment, notably a Unix-like -shell. There are several such environments available of which -Cygwin and -MinGW/MSYS are currently supported for the -OpenJDK build. One of the differences of these systems from standard Windows -tools is the way they handle Windows path names, particularly path names which -contain spaces, backslashes as path separators and possibly drive letters. -Depending on the use case and the specifics of each environment these path -problems can be solved by a combination of quoting whole paths, translating -backslashes to forward slashes, escaping backslashes with additional -backslashes and translating the path names to their "8.3" -version.

- -

- -
CYGWIN
- -

CYGWIN is an open source, Linux-like environment which tries to emulate a -complete POSIX layer on Windows. It tries to be smart about path names and can -usually handle all kinds of paths if they are correctly quoted or escaped -although internally it maps drive letters <drive>: to a virtual directory -/cygdrive/<drive>.

- -

You can always use the cygpath utility to map pathnames with spaces or the -backslash character into the C:/ style of pathname (called 'mixed'), e.g. -cygpath -s -m "<path>".

- -

Note that the use of CYGWIN creates a unique problem with regards to setting -PATH. Normally on Windows the PATH variable contains directories -separated with the ";" character (Solaris and Linux use ":"). With CYGWIN, it -uses ":", but that means that paths like "C:/path" cannot be placed in the -CYGWIN version of PATH and instead CYGWIN uses something like -/cygdrive/c/path which CYGWIN understands, but only CYGWIN understands.

- -

The OpenJDK build requires CYGWIN version 1.7.16 or newer. Information about -CYGWIN can be obtained from the CYGWIN website at -www.cygwin.com.

- -

By default CYGWIN doesn't install all the tools required for building the -OpenJDK. Along with the default installation, you need to install the following -tools.

- -
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Binary NameCategoryPackageDescription
ar.exeDevelbinutilsThe GNU assembler, linker and binary utilities
make.exeDevelmakeThe GNU version of the 'make' utility built for CYGWIN
m4.exeInterpretersm4GNU implementation of the traditional Unix macro processor
cpio.exeUtilscpioA program to manage archives of files
gawk.exeUtilsawkPattern-directed scanning and processing language
file.exeUtilsfileDetermines file type using 'magic' numbers
zip.exeArchivezipPackage and compress (archive) files
unzip.exeArchiveunzipExtract compressed files in a ZIP archive
free.exeSystemprocpsDisplay amount of free and used memory in the system

-
- -

Note that the CYGWIN software can conflict with other non-CYGWIN software on -your Windows system. CYGWIN provides a FAQ for known issues and problems, of particular interest is the -section on BLODA (applications that interfere with -CYGWIN).

- -

- -
MinGW/MSYS
- -

MinGW ("Minimalist GNU for Windows") is a collection of free Windows specific -header files and import libraries combined with GNU toolsets that allow one to -produce native Windows programs that do not rely on any 3rd-party C runtime -DLLs. MSYS is a supplement to MinGW which allows building applications and -programs which rely on traditional UNIX tools to be present. Among others this -includes tools like bash and make. See MinGW/MSYS for more information.

- -

Like Cygwin, MinGW/MSYS can handle different types of path formats. They are -internally converted to paths with forward slashes and drive letters -<drive>: replaced by a virtual directory /<drive>. Additionally, MSYS -automatically detects binaries compiled for the MSYS environment and feeds them -with the internal, Unix-style path names. If native Windows applications are -called from within MSYS programs their path arguments are automatically -converted back to Windows style path names with drive letters and backslashes -as path separators. This may cause problems for Windows applications which use -forward slashes as parameter separator (e.g. cl /nologo /I) because MSYS may -wrongly replace such parameters by drive letters.

- -

In addition to the tools which will be installed by default, you have to -manually install the msys-zip and msys-unzip packages. This can be easily -done with the MinGW command line installer:

- -
  mingw-get.exe install msys-zip
-  mingw-get.exe install msys-unzip
-
- -

- -
Visual Studio 2013 Compilers
- -

The 32-bit and 64-bit OpenJDK Windows build requires Microsoft Visual Studio -C++ 2013 (VS2013) Professional Edition or Express compiler. The compiler and -other tools are expected to reside in the location defined by the variable -VS120COMNTOOLS which is set by the Microsoft Visual Studio installer.

- -

Only the C++ part of VS2013 is needed. Try to let the installation go to the -default install directory. Always reboot your system after installing VS2013. -The system environment variable VS120COMNTOOLS should be set in your -environment.

- -

Make sure that TMP and TEMP are also set in the environment and refer to -Windows paths that exist, like C:\temp, not /tmp, not /cygdrive/c/temp, -and not C:/temp. C:\temp is just an example, it is assumed that this area -is private to the user, so by default after installs you should see a unique -user path in these variables.

- -

- -

Mac OS X

- -

Make sure you get the right XCode version.

- -
- -

- -

Configure

- -

The basic invocation of the configure script looks like:

- -
-

bash ./configure [options]

-
- -

This will create an output directory containing the "configuration" and setup -an area for the build result. This directory typically looks like:

- -
-

build/linux-x64-normal-server-release

-
- -

configure will try to figure out what system you are running on and where all -necessary build components are. If you have all prerequisites for building -installed, it should find everything. If it fails to detect any component -automatically, it will exit and inform you about the problem. When this -happens, read more below in the configure options.

- -

Some examples:

- -
-

Windows 32bit build with freetype specified:
- bash ./configure --with-freetype=/cygdrive/c/freetype-i586 --with-target- -bits=32

- -

Debug 64bit Build:
- bash ./configure --enable-debug --with-target-bits=64

-
- -

- -

Configure Options

- -

Complete details on all the OpenJDK configure options can be seen with:

- -
-

bash ./configure --help=short

-
- -

Use -help to see all the configure options available. You can generate any -number of different configurations, e.g. debug, release, 32, 64, etc.

- -

Some of the more commonly used configure options are:

- -
-

--enable-debug
- set the debug level to fastdebug (this is a shorthand for --with-debug- - level=fastdebug)

-
- -

- -
-

--with-alsa=path
- select the location of the Advanced Linux Sound Architecture (ALSA)

- -

Version 0.9.1 or newer of the ALSA files are required for building the - OpenJDK on Linux. These Linux files are usually available from an "alsa" of - "libasound" development package, and it's highly recommended that you try - and use the package provided by the particular version of Linux that you are - using.

- -

--with-boot-jdk=path
- select the Bootstrap JDK

- -

--with-boot-jdk-jvmargs="args"
- provide the JVM options to be used to run the Bootstrap JDK

- -

--with-cacerts=path
- select the path to the cacerts file.

- -

See Certificate Authority on Wikipedia for a better understanding of the Certificate - Authority (CA). A certificates file named "cacerts" represents a system-wide - keystore with CA certificates. In JDK and JRE binary bundles, the "cacerts" - file contains root CA certificates from several public CAs (e.g., VeriSign, - Thawte, and Baltimore). The source contain a cacerts file without CA root - certificates. Formal JDK builders will need to secure permission from each - public CA and include the certificates into their own custom cacerts file. - Failure to provide a populated cacerts file will result in verification - errors of a certificate chain during runtime. By default an empty cacerts - file is provided and that should be fine for most JDK developers.

-
- -

- -
-

--with-cups=path
- select the CUPS install location

- -

The Common UNIX Printing System (CUPS) Headers are required for building the - OpenJDK on Solaris and Linux. The Solaris header files can be obtained by - installing the package print/cups.

- -

The CUPS header files can always be downloaded from - www.cups.org.

- -

--with-cups-include=path
- select the CUPS include directory location

- -

--with-debug-level=level
- select the debug information level of release, fastdebug, or slowdebug

- -

--with-dev-kit=path
- select location of the compiler install or developer install location

-
- -

- -
-

--with-freetype=path
- select the freetype files to use.

- -

Expecting the freetype libraries under lib/ and the headers under - include/.

- -

Version 2.3 or newer of FreeType is required. On Unix systems required files - can be available as part of your distribution (while you still may need to - upgrade them). Note that you need development version of package that - includes both the FreeType library and header files.

- -

You can always download latest FreeType version from the FreeType - website. Building the freetype 2 libraries from - scratch is also possible, however on Windows refer to the Windows FreeType - DLL build instructions.

- -

Note that by default FreeType is built with byte code hinting support - disabled due to licensing restrictions. In this case, text appearance and - metrics are expected to differ from Sun's official JDK build. See the - SourceForge FreeType2 Home Page - for more information.

- -

--with-import-hotspot=path
- select the location to find hotspot binaries from a previous build to avoid - building hotspot

- -

--with-target-bits=arg
- select 32 or 64 bit build

- -

--with-jvm-variants=variants
- select the JVM variants to build from, comma separated list that can - include: server, client, kernel, zero and zeroshark

- -

--with-memory-size=size
- select the RAM size that GNU make will think this system has

- -

--with-msvcr-dll=path
- select the msvcr100.dll file to include in the Windows builds (C/C++ - runtime library for Visual Studio).

- -

This is usually picked up automatically from the redist directories of - Visual Studio 2013.

- -

--with-num-cores=cores
- select the number of cores to use (processor count or CPU count)

-
- -

- -
-

--with-x=path
- select the location of the X11 and xrender files.

- -

The XRender Extension Headers are required for building the OpenJDK on - Solaris and Linux. The Linux header files are usually available from a - "Xrender" development package, it's recommended that you try and use the - package provided by the particular distribution of Linux that you are using. - The Solaris XRender header files is included with the other X11 header files - in the package SFWxwinc on new enough versions of Solaris and will be - installed in /usr/X11/include/X11/extensions/Xrender.h or - /usr/openwin/share/include/X11/extensions/Xrender.h

-
- -
- -

- -

Make

- -

The basic invocation of the make utility looks like:

- -
-

make all

-
- -

This will start the build to the output directory containing the -"configuration" that was created by the configure script. Run make help for -more information on the available targets.

- -

There are some of the make targets that are of general interest:

- -
-

empty
- build everything but no images

- -

all
- build everything including images

- -

all-conf
- build all configurations

- -

images
- create complete j2sdk and j2re images

- -

install
- install the generated images locally, typically in /usr/local

- -

clean
- remove all files generated by make, but not those generated by configure

- -

dist-clean
- remove all files generated by both and configure (basically killing the - configuration)

- -

help
- give some help on using make, including some interesting make targets

-
- -
- -

- -

Testing

- -

When the build is completed, you should see the generated binaries and -associated files in the j2sdk-image directory in the output directory. In -particular, the build/*/images/j2sdk-image/bin directory should contain -executables for the OpenJDK tools and utilities for that configuration. The -testing tool jtreg will be needed and can be found at: the jtreg -site. The provided regression tests in the -repositories can be run with the command:

- -
-

cd test && make PRODUCT_HOME=`pwd`/../build/*/images/j2sdk-image all

-
- -
- -

- -

Appendix A: Hints and Tips

- -

- -

FAQ

- -

Q: The generated-configure.sh file looks horrible! How are you going to -edit it?
-A: The generated-configure.sh file is generated (think "compiled") by the -autoconf tools. The source code is in configure.ac and various .m4 files in -common/autoconf, which are much more readable.

- -

Q: Why is the generated-configure.sh file checked in, if it is -generated?
-A: If it was not generated, every user would need to have the autoconf -tools installed, and re-generate the configure file as the first step. Our -goal is to minimize the work needed to be done by the user to start building -OpenJDK, and to minimize the number of external dependencies required.

- -

Q: Do you require a specific version of autoconf for regenerating -generated-configure.sh?
-A: Yes, version 2.69 is required and should be easy enough to aquire on all -supported operating systems. The reason for this is to avoid large spurious -changes in generated-configure.sh.

- -

Q: How do you regenerate generated-configure.sh after making changes to -the input files?
-A: Regnerating generated-configure.sh should always be done using the -script common/autoconf/autogen.sh to ensure that the correct files get -updated. This script should also be run after mercurial tries to merge -generated-configure.sh as a merge of the generated file is not guaranteed to -be correct.

- -

Q: What are the files in common/makefiles/support/* for? They look like -gibberish.
-A: They are a somewhat ugly hack to compensate for command line length -limitations on certain platforms (Windows, Solaris). Due to a combination of -limitations in make and the shell, command lines containing too many files will -not work properly. These helper files are part of an elaborate hack that will -compress the command line in the makefile and then uncompress it safely. We're -not proud of it, but it does fix the problem. If you have any better -suggestions, we're all ears! :-)

- -

Q: I want to see the output of the commands that make runs, like in the old -build. How do I do that?
-A: You specify the LOG variable to make. There are several log levels:

- - - -

Q: When do I have to re-run configure?
-A: Normally you will run configure only once for creating a -configuration. You need to re-run configuration only if you want to change any -configuration options, or if you pull down changes to the configure script.

- -

Q: I have added a new source file. Do I need to modify the makefiles?
-A: Normally, no. If you want to create e.g. a new native library, you will -need to modify the makefiles. But for normal file additions or removals, no -changes are needed. There are certan exceptions for some native libraries where -the source files are spread over many directories which also contain sources -for other libraries. In these cases it was simply easier to create include -lists rather than excludes.

- -

Q: When I run configure --help, I see many strange options, like ---dvidir. What is this?
-A: Configure provides a slew of options by default, to all projects that -use autoconf. Most of them are not used in OpenJDK, so you can safely ignore -them. To list only OpenJDK specific features, use configure --help=short -instead.

- -

Q: configure provides OpenJDK-specific features such as --with- -builddeps-server that are not described in this document. What about those?
-A: Try them out if you like! But be aware that most of these are -experimental features. Many of them don't do anything at all at the moment; the -option is just a placeholder. Others depend on pieces of code or infrastructure -that is currently not ready for prime time.

- -

Q: How will you make sure you don't break anything?
-A: We have a script that compares the result of the new build system with -the result of the old. For most part, we aim for (and achieve) byte-by-byte -identical output. There are however technical issues with e.g. native binaries, -which might differ in a byte-by-byte comparison, even when building twice with -the old build system. For these, we compare relevant aspects (e.g. the symbol -table and file size). Note that we still don't have 100% equivalence, but we're -close.

- -

Q: I noticed this thing X in the build that looks very broken by design. -Why don't you fix it?
-A: Our goal is to produce a build output that is as close as technically -possible to the old build output. If things were weird in the old build, they -will be weird in the new build. Often, things were weird before due to -obscurity, but in the new build system the weird stuff comes up to the surface. -The plan is to attack these things at a later stage, after the new build system -is established.

- -

Q: The code in the new build system is not that well-structured. Will you -fix this?
-A: Yes! The new build system has grown bit by bit as we converted the old -system. When all of the old build system is converted, we can take a step back -and clean up the structure of the new build system. Some of this we plan to do -before replacing the old build system and some will need to wait until after.

- -

Q: Is anything able to use the results of the new build's default make -target?
-A: Yes, this is the minimal (or roughly minimal) set of compiled output -needed for a developer to actually execute the newly built JDK. The idea is -that in an incremental development fashion, when doing a normal make, you -should only spend time recompiling what's changed (making it purely -incremental) and only do the work that's needed to actually run and test your -code. The packaging stuff that is part of the images target is not needed for -a normal developer who wants to test his new code. Even if it's quite fast, -it's still unnecessary. We're targeting sub-second incremental rebuilds! ;-) -(Or, well, at least single-digit seconds...)

- -

Q: I usually set a specific environment variable when building, but I can't -find the equivalent in the new build. What should I do?
-A: It might very well be that we have neglected to add support for an -option that was actually used from outside the build system. Email us and we -will add support for it!

- -

- -

Build Performance Tips

- -

Building OpenJDK requires a lot of horsepower. Some of the build tools can be -adjusted to utilize more or less of resources such as parallel threads and -memory. The configure script analyzes your system and selects reasonable -values for such options based on your hardware. If you encounter resource -problems, such as out of memory conditions, you can modify the detected values -with:

- - - -

It might also be necessary to specify the JVM arguments passed to the Bootstrap -JDK, using e.g. --with-boot-jdk-jvmargs="-Xmx8G -enableassertions". Doing -this will override the default JVM arguments passed to the Bootstrap JDK.

- -

One of the top goals of the new build system is to improve the build -performance and decrease the time needed to build. This will soon also apply to -the java compilation when the Smart Javac wrapper is fully supported.

- -

At the end of a successful execution of configure, you will get a performance -summary, indicating how well the build will perform. Here you will also get -performance hints. If you want to build fast, pay attention to those!

- -

Building with ccache

- -

The OpenJDK build supports building with ccache when using gcc or clang. Using -ccache can radically speed up compilation of native code if you often rebuild -the same sources. Your milage may vary however so we recommend evaluating it -for yourself. To enable it, make sure it's on the path and configure with ---enable-ccache.

- -

Building on local disk

- -

If you are using network shares, e.g. via NFS, for your source code, make sure -the build directory is situated on local disk. The performance penalty is -extremely high for building on a network share, close to unusable.

- -

Building only one JVM

- -

The old build builds multiple JVMs on 32-bit systems (client and server; and on -Windows kernel as well). In the new build we have changed this default to only -build server when it's available. This improves build times for those not -interested in multiple JVMs. To mimic the old behavior on platforms that -support it, use --with-jvm-variants=client,server.

- -

Selecting the number of cores to build on

- -

By default, configure will analyze your machine and run the make process in -parallel with as many threads as you have cores. This behavior can be -overridden, either "permanently" (on a configure basis) using ---with-num-cores=N or for a single build only (on a make basis), using -make JOBS=N.

- -

If you want to make a slower build just this time, to save some CPU power for -other processes, you can run e.g. make JOBS=2. This will force the makefiles -to only run 2 parallel processes, or even make JOBS=1 which will disable -parallelism.

- -

If you want to have it the other way round, namely having slow builds default -and override with fast if you're impatient, you should call configure with ---with-num-cores=2, making 2 the default. If you want to run with more cores, -run make JOBS=8

- -

- -

Troubleshooting

- -

Solving build problems

- -

If the build fails (and it's not due to a compilation error in a source file -you've changed), the first thing you should do is to re-run the build with more -verbosity. Do this by adding LOG=debug to your make command line.

- -

The build log (with both stdout and stderr intermingled, basically the same as -you see on your console) can be found as build.log in your build directory.

- -

You can ask for help on build problems with the new build system on either the -build-dev or the -build-infra-dev -mailing lists. Please include the relevant parts of the build log.

- -

A build can fail for any number of reasons. Most failures are a result of -trying to build in an environment in which all the pre-build requirements have -not been met. The first step in troubleshooting a build failure is to recheck -that you have satisfied all the pre-build requirements for your platform. -Scanning the configure log is a good first step, making sure that what it -found makes sense for your system. Look for strange error messages or any -difficulties that configure had in finding things.

- -

Some of the more common problems with builds are briefly described below, with -suggestions for remedies.

- - - -
- -

- -

Appendix B: GNU make

- -

The Makefiles in the OpenJDK are only valid when used with the GNU version of -the utility command make (usually called gmake on Solaris). A few notes -about using GNU make:

- - - -

Information on GNU make, and access to ftp download sites, are available on the -GNU make web site . The latest -source to GNU make is available at -ftp.gnu.org/pub/gnu/make/.

- -

- -

Building GNU make

- -

First step is to get the GNU make 3.81 or newer source from -ftp.gnu.org/pub/gnu/make/. Building is a -little different depending on the OS but is basically done with:

- -
  bash ./configure
-  make
-
- -
- -

- -

Appendix C: Build Environments

- -

Minimum Build Environments

- -

This file often describes specific requirements for what we call the "minimum -build environments" (MBE) for this specific release of the JDK. What is listed -below is what the Oracle Release Engineering Team will use to build the Oracle -JDK product. Building with the MBE will hopefully generate the most compatible -bits that install on, and run correctly on, the most variations of the same -base OS and hardware architecture. In some cases, these represent what is often -called the least common denominator, but each Operating System has different -aspects to it.

- -

In all cases, the Bootstrap JDK version minimum is critical, we cannot -guarantee builds will work with older Bootstrap JDK's. Also in all cases, more -RAM and more processors is better, the minimums listed below are simply -recommendations.

- -

With Solaris and Mac OS X, the version listed below is the oldest release we -can guarantee builds and works, and the specific version of the compilers used -could be critical.

- -

With Windows the critical aspect is the Visual Studio compiler used, which due -to it's runtime, generally dictates what Windows systems can do the builds and -where the resulting bits can be used.

- -

NOTE: We expect a change here off these older Windows OS releases and to a -'less older' one, probably Windows 2008R2 X64.

- -

With Linux, it was just a matter of picking a stable distribution that is a -good representative for Linux in general.

- -

It is understood that most developers will NOT be using these specific -versions, and in fact creating these specific versions may be difficult due to -the age of some of this software. It is expected that developers are more often -using the more recent releases and distributions of these operating systems.

- -

Compilation problems with newer or different C/C++ compilers is a common -problem. Similarly, compilation problems related to changes to the -/usr/include or system header files is also a common problem with older, -newer, or unreleased OS versions. Please report these types of problems as bugs -so that they can be dealt with accordingly.

- -
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Base OS and ArchitectureOSC/C++ CompilerBootstrap JDKProcessorsRAM MinimumDISK Needs
Linux X86 (32-bit) and X64 (64-bit)Oracle Enterprise Linux 6.4gcc 4.9.2 JDK 82 or more1 GB6 GB
Solaris SPARCV9 (64-bit)Solaris 11 Update 1Studio 12 Update 4 + patchesJDK 84 or more4 GB8 GB
Solaris X64 (64-bit)Solaris 11 Update 1Studio 12 Update 4 + patchesJDK 84 or more4 GB8 GB
Windows X86 (32-bit)Windows Server 2012 R2 x64Microsoft Visual Studio C++ 2013 Professional EditionJDK 82 or more2 GB6 GB
Windows X64 (64-bit)Windows Server 2012 R2 x64Microsoft Visual Studio C++ 2013 Professional EditionJDK 82 or more2 GB6 GB
Mac OS X X64 (64-bit)Mac OS X 10.9 "Mavericks"Xcode 6.3 or newerJDK 82 or more4 GB6 GB

-
- -
- -

- -

Specific Developer Build Environments

- -

We won't be listing all the possible environments, but we will try to provide -what information we have available to us.

- -

NOTE: The community can help out by updating this part of the document.

- -

Fedora

- -

After installing the latest Fedora you need to -install several build dependencies. The simplest way to do it is to execute the -following commands as user root:

- -
  yum-builddep java-1.7.0-openjdk
-  yum install gcc gcc-c++
-
- -

In addition, it's necessary to set a few environment variables for the build:

- -
  export LANG=C
-  export PATH="/usr/lib/jvm/java-openjdk/bin:${PATH}"
-
- -

CentOS 5.5

- -

After installing CentOS 5.5 you need to make sure you -have the following Development bundles installed:

- - - -

Plus the following packages:

- - - -

The freetype 2.3 packages don't seem to be available, but the freetype 2.3 -sources can be downloaded, built, and installed easily enough from the -freetype site. Build and install -with something like:

- -
  bash ./configure
-  make
-  sudo -u root make install
-
- -

Mercurial packages could not be found easily, but a Google search should find -ones, and they usually include Python if it's needed.

- -

Debian 5.0 (Lenny)

- -

After installing Debian 5 you need to install several -build dependencies. The simplest way to install the build dependencies is to -execute the following commands as user root:

- -
  aptitude build-dep openjdk-7
-  aptitude install openjdk-7-jdk libmotif-dev
-
- -

In addition, it's necessary to set a few environment variables for the build:

- -
  export LANG=C
-  export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}"
-
- -

Ubuntu 12.04

- -

After installing Ubuntu 12.04 you need to install several -build dependencies. The simplest way to do it is to execute the following -commands:

- -
  sudo aptitude build-dep openjdk-7
-  sudo aptitude install openjdk-7-jdk
-
- -

In addition, it's necessary to set a few environment variables for the build:

- -
  export LANG=C
-  export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}"
-
- -

OpenSUSE 11.1

- -

After installing OpenSUSE 11.1 you need to install -several build dependencies. The simplest way to install the build dependencies -is to execute the following commands:

- -
  sudo zypper source-install -d java-1_7_0-openjdk
-  sudo zypper install make
-
- -

In addition, it is necessary to set a few environment variables for the build:

- -
  export LANG=C
-  export PATH="/usr/lib/jvm/java-1.7.0-openjdk/bin:$[PATH}"
-
- -

Finally, you need to unset the JAVA_HOME environment variable:

- -
  export -n JAVA_HOME`
-
- -

Mandriva Linux One 2009 Spring

- -

After installing Mandriva Linux One 2009 Spring you need -to install several build dependencies. The simplest way to install the build -dependencies is to execute the following commands as user root:

- -
  urpmi java-1.7.0-openjdk-devel make gcc gcc-c++ freetype-devel zip unzip
-    libcups2-devel libxrender1-devel libalsa2-devel libstc++-static-devel
-    libxtst6-devel libxi-devel
-
- -

In addition, it is necessary to set a few environment variables for the build:

- -
  export LANG=C
-  export PATH="/usr/lib/jvm/java-1.7.0-openjdk/bin:${PATH}"
-
- -

OpenSolaris 2009.06

- -

After installing OpenSolaris 2009.06 you need to -install several build dependencies. The simplest way to install the build -dependencies is to execute the following commands:

- -
  pfexec pkg install SUNWgmake SUNWj7dev sunstudioexpress SUNWcups SUNWzip
-    SUNWunzip SUNWxwhl SUNWxorg-headers SUNWaudh SUNWfreetype2
-
- -

In addition, it is necessary to set a few environment variables for the build:

- -
  export LANG=C
-  export PATH="/opt/SunStudioExpress/bin:${PATH}"
-
- -
- -

End of the OpenJDK build README document.

- -

Please come again!

- - diff -r 830e16e5eef5 -r d9f6bc6ba599 README-builds.md --- a/README-builds.md Mon Jul 03 13:18:55 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1285 +0,0 @@ -![OpenJDK](http://openjdk.java.net/images/openjdk.png) -# OpenJDK Build README - -***** - - -## Introduction - -This README file contains build instructions for the -[OpenJDK](http://openjdk.java.net). Building the source code for the OpenJDK -requires a certain degree of technical expertise. - -### !!!!!!!!!!!!!!! THIS IS A MAJOR RE-WRITE of this document. !!!!!!!!!!!!! - -Some Headlines: - - * The build is now a "`configure && make`" style build - * Any GNU make 3.81 or newer should work, except on Windows where 4.0 or newer - is recommended. - * The build should scale, i.e. more processors should cause the build to be - done in less wall-clock time - * Nested or recursive make invocations have been significantly reduced, - as has the total fork/exec or spawning of sub processes during the build - * Windows MKS usage is no longer supported - * Windows Visual Studio `vsvars*.bat` and `vcvars*.bat` files are run - automatically - * Ant is no longer used when building the OpenJDK - * Use of ALT_* environment variables for configuring the build is no longer - supported - -***** - -## Contents - - * [Introduction](#introduction) - * [Use of Mercurial](#hg) - * [Getting the Source](#get_source) - * [Repositories](#repositories) - * [Building](#building) - * [System Setup](#setup) - * [Linux](#linux) - * [Solaris](#solaris) - * [Mac OS X](#macosx) - * [Windows](#windows) - * [Configure](#configure) - * [Make](#make) - * [Testing](#testing) - -***** - - * [Appendix A: Hints and Tips](#hints) - * [FAQ](#faq) - * [Build Performance Tips](#performance) - * [Troubleshooting](#troubleshooting) - * [Appendix B: GNU Make Information](#gmake) - * [Appendix C: Build Environments](#buildenvironments) - -***** - - -## Use of Mercurial - -The OpenJDK sources are maintained with the revision control system -[Mercurial](http://mercurial.selenic.com/wiki/Mercurial). If you are new to -Mercurial, please see the [Beginner Guides](http://mercurial.selenic.com/wiki/ -BeginnersGuides) or refer to the [Mercurial Book](http://hgbook.red-bean.com/). -The first few chapters of the book provide an excellent overview of Mercurial, -what it is and how it works. - -For using Mercurial with the OpenJDK refer to the [Developer Guide: Installing -and Configuring Mercurial](http://openjdk.java.net/guide/ -repositories.html#installConfig) section for more information. - - -### Getting the Source - -To get the entire set of OpenJDK Mercurial repositories use the script -`get_source.sh` located in the root repository: - - hg clone http://hg.openjdk.java.net/jdk9/jdk9 YourOpenJDK - cd YourOpenJDK - bash ./get_source.sh - -Once you have all the repositories, keep in mind that each repository is its -own independent repository. You can also re-run `./get_source.sh` anytime to -pull over all the latest changesets in all the repositories. This set of -nested repositories has been given the term "forest" and there are various -ways to apply the same `hg` command to each of the repositories. For -example, the script `make/scripts/hgforest.sh` can be used to repeat the -same `hg` command on every repository, e.g. - - cd YourOpenJDK - bash ./make/scripts/hgforest.sh status - - -### Repositories - -The set of repositories and what they contain: - - * **. (root)** contains common configure and makefile logic - * **hotspot** contains source code and make files for building the OpenJDK - Hotspot Virtual Machine - * **langtools** contains source code for the OpenJDK javac and language tools - * **jdk** contains source code and make files for building the OpenJDK runtime - libraries and misc files - * **jaxp** contains source code for the OpenJDK JAXP functionality - * **jaxws** contains source code for the OpenJDK JAX-WS functionality - * **corba** contains source code for the OpenJDK Corba functionality - * **nashorn** contains source code for the OpenJDK JavaScript implementation - -### Repository Source Guidelines - -There are some very basic guidelines: - - * Use of whitespace in source files (.java, .c, .h, .cpp, and .hpp files) is - restricted. No TABs, no trailing whitespace on lines, and files should not - terminate in more than one blank line. - * Files with execute permissions should not be added to the source - repositories. - * All generated files need to be kept isolated from the files maintained or - managed by the source control system. The standard area for generated files - is the top level `build/` directory. - * The default build process should be to build the product and nothing else, - in one form, e.g. a product (optimized), debug (non-optimized, -g plus - assert logic), or fastdebug (optimized, -g plus assert logic). - * The `.hgignore` file in each repository must exist and should include - `^build/`, `^dist/` and optionally any `nbproject/private` directories. **It - should NEVER** include anything in the `src/` or `test/` or any managed - directory area of a repository. - * Directory names and file names should never contain blanks or non-printing - characters. - * Generated source or binary files should NEVER be added to the repository - (that includes `javah` output). There are some exceptions to this rule, in - particular with some of the generated configure scripts. - * Files not needed for typical building or testing of the repository should - not be added to the repository. - -***** - - -## Building - -The very first step in building the OpenJDK is making sure the system itself -has everything it needs to do OpenJDK builds. Once a system is setup, it -generally doesn't need to be done again. - -Building the OpenJDK is now done with running a `configure` script which will -try and find and verify you have everything you need, followed by running -`make`, e.g. - -> **`bash ./configure`** -> **`make all`** - -Where possible the `configure` script will attempt to located the various -components in the default locations or via component specific variable -settings. When the normal defaults fail or components cannot be found, -additional `configure` options may be necessary to help `configure` find the -necessary tools for the build, or you may need to re-visit the setup of your -system due to missing software packages. - -**NOTE:** The `configure` script file does not have execute permissions and -will need to be explicitly run with `bash`, see the source guidelines. - -***** - - -### System Setup - -Before even attempting to use a system to build the OpenJDK there are some very -basic system setups needed. For all systems: - - * Be sure the GNU make utility is version 3.81 (4.0 on windows) or newer, e.g. - run "`make -version`" - - - * Install a Bootstrap JDK. All OpenJDK builds require access to a previously - released JDK called the _bootstrap JDK_ or _boot JDK._ The general rule is - that the bootstrap JDK must be an instance of the previous major release of - the JDK. In addition, there may be a requirement to use a release at or - beyond a particular update level. - - **_Building JDK 9 requires JDK 8. JDK 9 developers should not use JDK 9 as - the boot JDK, to ensure that JDK 9 dependencies are not introduced into the - parts of the system that are built with JDK 8._** - - The JDK 8 binaries can be downloaded from Oracle's [JDK 8 download - site](http://www.oracle.com/technetwork/java/javase/downloads/index.html). - For build performance reasons it is very important that this bootstrap JDK - be made available on the local disk of the machine doing the build. You - should add its `bin` directory to the `PATH` environment variable. If - `configure` has any issues finding this JDK, you may need to use the - `configure` option `--with-boot-jdk`. - - * Ensure that GNU make, the Bootstrap JDK, and the compilers are all in your - PATH environment variable. - -And for specific systems: - - * **Linux** - - Install all the software development packages needed including - [alsa](#alsa), [freetype](#freetype), [cups](#cups), and - [xrender](#xrender). See [specific system packages](#SDBE). - - * **Solaris** - - Install all the software development packages needed including [Studio - Compilers](#studio), [freetype](#freetype), [cups](#cups), and - [xrender](#xrender). See [specific system packages](#SDBE). - - * **Windows** - - * Install one of [CYGWIN](#cygwin) or [MinGW/MSYS](#msys) - * Install [Visual Studio 2013](#vs2013) - - * **Mac OS X** - - Install [XCode 6.3](https://developer.apple.com/xcode/) - - -#### Linux - -With Linux, try and favor the system packages over building your own or getting -packages from other areas. Most Linux builds should be possible with the -system's available packages. - -Note that some Linux systems have a habit of pre-populating your environment -variables for you, for example `JAVA_HOME` might get pre-defined for you to -refer to the JDK installed on your Linux system. You will need to unset -`JAVA_HOME`. It's a good idea to run `env` and verify the environment variables -you are getting from the default system settings make sense for building the -OpenJDK. - - -#### Solaris - - -##### Studio Compilers - -At a minimum, the [Studio 12 Update 4 Compilers](http://www.oracle.com/ -technetwork/server-storage/solarisstudio/downloads/index.htm) (containing -version 5.13 of the C and C++ compilers) is required, including specific -patches. - -The Solaris Studio installation should contain at least these packages: - -> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
**Package****Version**
developer/solarisstudio-124/backend12.4-1.0.6.0
developer/solarisstudio-124/c++12.4-1.0.10.0
developer/solarisstudio-124/cc12.4-1.0.4.0
developer/solarisstudio-124/library/c++-libs12.4-1.0.10.0
developer/solarisstudio-124/library/math-libs12.4-1.0.0.1
developer/solarisstudio-124/library/studio-gccrt12.4-1.0.0.1
developer/solarisstudio-124/studio-common12.4-1.0.0.1
developer/solarisstudio-124/studio-ja12.4-1.0.0.1
developer/solarisstudio-124/studio-legal12.4-1.0.0.1
developer/solarisstudio-124/studio-zhCN12.4-1.0.0.1
- -In particular backend 12.4-1.0.6.0 contains a critical patch for the sparc -version. - -Place the `bin` directory in `PATH`. - -The Oracle Solaris Studio Express compilers at: [Oracle Solaris Studio Express -Download site](http://www.oracle.com/technetwork/server-storage/solarisstudio/ -downloads/index-jsp-142582.html) are also an option, although these compilers -have not been extensively used yet. - - -#### Windows - -##### Windows Unix Toolkit - -Building on Windows requires a Unix-like environment, notably a Unix-like -shell. There are several such environments available of which -[Cygwin](http://www.cygwin.com/) and -[MinGW/MSYS](http://www.mingw.org/wiki/MSYS) are currently supported for the -OpenJDK build. One of the differences of these systems from standard Windows -tools is the way they handle Windows path names, particularly path names which -contain spaces, backslashes as path separators and possibly drive letters. -Depending on the use case and the specifics of each environment these path -problems can be solved by a combination of quoting whole paths, translating -backslashes to forward slashes, escaping backslashes with additional -backslashes and translating the path names to their ["8.3" -version](http://en.wikipedia.org/wiki/8.3_filename). - - -###### CYGWIN - -CYGWIN is an open source, Linux-like environment which tries to emulate a -complete POSIX layer on Windows. It tries to be smart about path names and can -usually handle all kinds of paths if they are correctly quoted or escaped -although internally it maps drive letters `:` to a virtual directory -`/cygdrive/`. - -You can always use the `cygpath` utility to map pathnames with spaces or the -backslash character into the `C:/` style of pathname (called 'mixed'), e.g. -`cygpath -s -m ""`. - -Note that the use of CYGWIN creates a unique problem with regards to setting -[`PATH`](#path). Normally on Windows the `PATH` variable contains directories -separated with the ";" character (Solaris and Linux use ":"). With CYGWIN, it -uses ":", but that means that paths like "C:/path" cannot be placed in the -CYGWIN version of `PATH` and instead CYGWIN uses something like -`/cygdrive/c/path` which CYGWIN understands, but only CYGWIN understands. - -The OpenJDK build requires CYGWIN version 1.7.16 or newer. Information about -CYGWIN can be obtained from the CYGWIN website at -[www.cygwin.com](http://www.cygwin.com). - -By default CYGWIN doesn't install all the tools required for building the -OpenJDK. Along with the default installation, you need to install the following -tools. - -> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Binary NameCategoryPackageDescription
ar.exeDevelbinutilsThe GNU assembler, linker and binary utilities
make.exeDevelmakeThe GNU version of the 'make' utility built for CYGWIN
m4.exeInterpretersm4GNU implementation of the traditional Unix macro processor
cpio.exeUtilscpioA program to manage archives of files
gawk.exeUtilsawkPattern-directed scanning and processing language
file.exeUtilsfileDetermines file type using 'magic' numbers
zip.exeArchivezipPackage and compress (archive) files
unzip.exeArchiveunzipExtract compressed files in a ZIP archive
free.exeSystemprocpsDisplay amount of free and used memory in the system
- -Note that the CYGWIN software can conflict with other non-CYGWIN software on -your Windows system. CYGWIN provides a [FAQ](http://cygwin.com/faq/ -faq.using.html) for known issues and problems, of particular interest is the -section on [BLODA (applications that interfere with -CYGWIN)](http://cygwin.com/faq/faq.using.html#faq.using.bloda). - - -###### MinGW/MSYS - -MinGW ("Minimalist GNU for Windows") is a collection of free Windows specific -header files and import libraries combined with GNU toolsets that allow one to -produce native Windows programs that do not rely on any 3rd-party C runtime -DLLs. MSYS is a supplement to MinGW which allows building applications and -programs which rely on traditional UNIX tools to be present. Among others this -includes tools like `bash` and `make`. See [MinGW/MSYS](http://www.mingw.org/ -wiki/MSYS) for more information. - -Like Cygwin, MinGW/MSYS can handle different types of path formats. They are -internally converted to paths with forward slashes and drive letters -`:` replaced by a virtual directory `/`. Additionally, MSYS -automatically detects binaries compiled for the MSYS environment and feeds them -with the internal, Unix-style path names. If native Windows applications are -called from within MSYS programs their path arguments are automatically -converted back to Windows style path names with drive letters and backslashes -as path separators. This may cause problems for Windows applications which use -forward slashes as parameter separator (e.g. `cl /nologo /I`) because MSYS may -wrongly [replace such parameters by drive letters](http://mingw.org/wiki/ -Posix_path_conversion). - -In addition to the tools which will be installed by default, you have to -manually install the `msys-zip` and `msys-unzip` packages. This can be easily -done with the MinGW command line installer: - - mingw-get.exe install msys-zip - mingw-get.exe install msys-unzip - - -##### Visual Studio 2013 Compilers - -The 32-bit and 64-bit OpenJDK Windows build requires Microsoft Visual Studio -C++ 2013 (VS2013) Professional Edition or Express compiler. The compiler and -other tools are expected to reside in the location defined by the variable -`VS120COMNTOOLS` which is set by the Microsoft Visual Studio installer. - -Only the C++ part of VS2013 is needed. Try to let the installation go to the -default install directory. Always reboot your system after installing VS2013. -The system environment variable VS120COMNTOOLS should be set in your -environment. - -Make sure that TMP and TEMP are also set in the environment and refer to -Windows paths that exist, like `C:\temp`, not `/tmp`, not `/cygdrive/c/temp`, -and not `C:/temp`. `C:\temp` is just an example, it is assumed that this area -is private to the user, so by default after installs you should see a unique -user path in these variables. - - -#### Mac OS X - -Make sure you get the right XCode version. - -***** - - -### Configure - -The basic invocation of the `configure` script looks like: - -> **`bash ./configure [options]`** - -This will create an output directory containing the "configuration" and setup -an area for the build result. This directory typically looks like: - -> **`build/linux-x64-normal-server-release`** - -`configure` will try to figure out what system you are running on and where all -necessary build components are. If you have all prerequisites for building -installed, it should find everything. If it fails to detect any component -automatically, it will exit and inform you about the problem. When this -happens, read more below in [the `configure` options](#configureoptions). - -Some examples: - -> **Windows 32bit build with freetype specified:** -> `bash ./configure --with-freetype=/cygdrive/c/freetype-i586 --with-target- -bits=32` - -> **Debug 64bit Build:** -> `bash ./configure --enable-debug --with-target-bits=64` - - -#### Configure Options - -Complete details on all the OpenJDK `configure` options can be seen with: - -> **`bash ./configure --help=short`** - -Use `-help` to see all the `configure` options available. You can generate any -number of different configurations, e.g. debug, release, 32, 64, etc. - -Some of the more commonly used `configure` options are: - -> **`--enable-debug`** -> set the debug level to fastdebug (this is a shorthand for `--with-debug- - level=fastdebug`) - - -> **`--with-alsa=`**_path_ -> select the location of the Advanced Linux Sound Architecture (ALSA) - -> Version 0.9.1 or newer of the ALSA files are required for building the - OpenJDK on Linux. These Linux files are usually available from an "alsa" of - "libasound" development package, and it's highly recommended that you try - and use the package provided by the particular version of Linux that you are - using. - -> **`--with-boot-jdk=`**_path_ -> select the [Bootstrap JDK](#bootjdk) - -> **`--with-boot-jdk-jvmargs=`**"_args_" -> provide the JVM options to be used to run the [Bootstrap JDK](#bootjdk) - -> **`--with-cacerts=`**_path_ -> select the path to the cacerts file. - -> See [Certificate Authority on Wikipedia](http://en.wikipedia.org/wiki/ - Certificate_Authority) for a better understanding of the Certificate - Authority (CA). A certificates file named "cacerts" represents a system-wide - keystore with CA certificates. In JDK and JRE binary bundles, the "cacerts" - file contains root CA certificates from several public CAs (e.g., VeriSign, - Thawte, and Baltimore). The source contain a cacerts file without CA root - certificates. Formal JDK builders will need to secure permission from each - public CA and include the certificates into their own custom cacerts file. - Failure to provide a populated cacerts file will result in verification - errors of a certificate chain during runtime. By default an empty cacerts - file is provided and that should be fine for most JDK developers. - - -> **`--with-cups=`**_path_ -> select the CUPS install location - -> The Common UNIX Printing System (CUPS) Headers are required for building the - OpenJDK on Solaris and Linux. The Solaris header files can be obtained by - installing the package **print/cups**. - -> The CUPS header files can always be downloaded from - [www.cups.org](http://www.cups.org). - -> **`--with-cups-include=`**_path_ -> select the CUPS include directory location - -> **`--with-debug-level=`**_level_ -> select the debug information level of release, fastdebug, or slowdebug - -> **`--with-dev-kit=`**_path_ -> select location of the compiler install or developer install location - - -> **`--with-freetype=`**_path_ -> select the freetype files to use. - -> Expecting the freetype libraries under `lib/` and the headers under - `include/`. - -> Version 2.3 or newer of FreeType is required. On Unix systems required files - can be available as part of your distribution (while you still may need to - upgrade them). Note that you need development version of package that - includes both the FreeType library and header files. - -> You can always download latest FreeType version from the [FreeType - website](http://www.freetype.org). Building the freetype 2 libraries from - scratch is also possible, however on Windows refer to the [Windows FreeType - DLL build instructions](http://freetype.freedesktop.org/wiki/FreeType_DLL). - -> Note that by default FreeType is built with byte code hinting support - disabled due to licensing restrictions. In this case, text appearance and - metrics are expected to differ from Sun's official JDK build. See the - [SourceForge FreeType2 Home Page](http://freetype.sourceforge.net/freetype2) - for more information. - -> **`--with-import-hotspot=`**_path_ -> select the location to find hotspot binaries from a previous build to avoid - building hotspot - -> **`--with-target-bits=`**_arg_ -> select 32 or 64 bit build - -> **`--with-jvm-variants=`**_variants_ -> select the JVM variants to build from, comma separated list that can - include: server, client, kernel, zero and zeroshark - -> **`--with-memory-size=`**_size_ -> select the RAM size that GNU make will think this system has - -> **`--with-msvcr-dll=`**_path_ -> select the `msvcr100.dll` file to include in the Windows builds (C/C++ - runtime library for Visual Studio). - -> This is usually picked up automatically from the redist directories of - Visual Studio 2013. - -> **`--with-num-cores=`**_cores_ -> select the number of cores to use (processor count or CPU count) - - -> **`--with-x=`**_path_ -> select the location of the X11 and xrender files. - -> The XRender Extension Headers are required for building the OpenJDK on - Solaris and Linux. The Linux header files are usually available from a - "Xrender" development package, it's recommended that you try and use the - package provided by the particular distribution of Linux that you are using. - The Solaris XRender header files is included with the other X11 header files - in the package **SFWxwinc** on new enough versions of Solaris and will be - installed in `/usr/X11/include/X11/extensions/Xrender.h` or - `/usr/openwin/share/include/X11/extensions/Xrender.h` - -***** - - -### Make - -The basic invocation of the `make` utility looks like: - -> **`make all`** - -This will start the build to the output directory containing the -"configuration" that was created by the `configure` script. Run `make help` for -more information on the available targets. - -There are some of the make targets that are of general interest: - -> _empty_ -> build everything but no images - -> **`all`** -> build everything including images - -> **`all-conf`** -> build all configurations - -> **`images`** -> create complete j2sdk and j2re images - -> **`install`** -> install the generated images locally, typically in `/usr/local` - -> **`clean`** -> remove all files generated by make, but not those generated by `configure` - -> **`dist-clean`** -> remove all files generated by both and `configure` (basically killing the - configuration) - -> **`help`** -> give some help on using `make`, including some interesting make targets - -***** - - -## Testing - -When the build is completed, you should see the generated binaries and -associated files in the `j2sdk-image` directory in the output directory. In -particular, the `build/*/images/j2sdk-image/bin` directory should contain -executables for the OpenJDK tools and utilities for that configuration. The -testing tool `jtreg` will be needed and can be found at: [the jtreg -site](http://openjdk.java.net/jtreg/). The provided regression tests in the -repositories can be run with the command: - -> **``cd test && make PRODUCT_HOME=`pwd`/../build/*/images/j2sdk-image all``** - -***** - - -## Appendix A: Hints and Tips - - -### FAQ - -**Q:** The `generated-configure.sh` file looks horrible! How are you going to -edit it? -**A:** The `generated-configure.sh` file is generated (think "compiled") by the -autoconf tools. The source code is in `configure.ac` and various .m4 files in -common/autoconf, which are much more readable. - -**Q:** Why is the `generated-configure.sh` file checked in, if it is -generated? -**A:** If it was not generated, every user would need to have the autoconf -tools installed, and re-generate the `configure` file as the first step. Our -goal is to minimize the work needed to be done by the user to start building -OpenJDK, and to minimize the number of external dependencies required. - -**Q:** Do you require a specific version of autoconf for regenerating -`generated-configure.sh`? -**A:** Yes, version 2.69 is required and should be easy enough to aquire on all -supported operating systems. The reason for this is to avoid large spurious -changes in `generated-configure.sh`. - -**Q:** How do you regenerate `generated-configure.sh` after making changes to -the input files? -**A:** Regnerating `generated-configure.sh` should always be done using the -script `common/autoconf/autogen.sh` to ensure that the correct files get -updated. This script should also be run after mercurial tries to merge -`generated-configure.sh` as a merge of the generated file is not guaranteed to -be correct. - -**Q:** What are the files in `common/makefiles/support/*` for? They look like -gibberish. -**A:** They are a somewhat ugly hack to compensate for command line length -limitations on certain platforms (Windows, Solaris). Due to a combination of -limitations in make and the shell, command lines containing too many files will -not work properly. These helper files are part of an elaborate hack that will -compress the command line in the makefile and then uncompress it safely. We're -not proud of it, but it does fix the problem. If you have any better -suggestions, we're all ears! :-) - -**Q:** I want to see the output of the commands that make runs, like in the old -build. How do I do that? -**A:** You specify the `LOG` variable to make. There are several log levels: - - * **`warn`** -- Default and very quiet. - * **`info`** -- Shows more progress information than warn. - * **`debug`** -- Echos all command lines and prints all macro calls for - compilation definitions. - * **`trace`** -- Echos all $(shell) command lines as well. - -**Q:** When do I have to re-run `configure`? -**A:** Normally you will run `configure` only once for creating a -configuration. You need to re-run configuration only if you want to change any -configuration options, or if you pull down changes to the `configure` script. - -**Q:** I have added a new source file. Do I need to modify the makefiles? -**A:** Normally, no. If you want to create e.g. a new native library, you will -need to modify the makefiles. But for normal file additions or removals, no -changes are needed. There are certan exceptions for some native libraries where -the source files are spread over many directories which also contain sources -for other libraries. In these cases it was simply easier to create include -lists rather than excludes. - -**Q:** When I run `configure --help`, I see many strange options, like -`--dvidir`. What is this? -**A:** Configure provides a slew of options by default, to all projects that -use autoconf. Most of them are not used in OpenJDK, so you can safely ignore -them. To list only OpenJDK specific features, use `configure --help=short` -instead. - -**Q:** `configure` provides OpenJDK-specific features such as `--with- -builddeps-server` that are not described in this document. What about those? -**A:** Try them out if you like! But be aware that most of these are -experimental features. Many of them don't do anything at all at the moment; the -option is just a placeholder. Others depend on pieces of code or infrastructure -that is currently not ready for prime time. - -**Q:** How will you make sure you don't break anything? -**A:** We have a script that compares the result of the new build system with -the result of the old. For most part, we aim for (and achieve) byte-by-byte -identical output. There are however technical issues with e.g. native binaries, -which might differ in a byte-by-byte comparison, even when building twice with -the old build system. For these, we compare relevant aspects (e.g. the symbol -table and file size). Note that we still don't have 100% equivalence, but we're -close. - -**Q:** I noticed this thing X in the build that looks very broken by design. -Why don't you fix it? -**A:** Our goal is to produce a build output that is as close as technically -possible to the old build output. If things were weird in the old build, they -will be weird in the new build. Often, things were weird before due to -obscurity, but in the new build system the weird stuff comes up to the surface. -The plan is to attack these things at a later stage, after the new build system -is established. - -**Q:** The code in the new build system is not that well-structured. Will you -fix this? -**A:** Yes! The new build system has grown bit by bit as we converted the old -system. When all of the old build system is converted, we can take a step back -and clean up the structure of the new build system. Some of this we plan to do -before replacing the old build system and some will need to wait until after. - -**Q:** Is anything able to use the results of the new build's default make -target? -**A:** Yes, this is the minimal (or roughly minimal) set of compiled output -needed for a developer to actually execute the newly built JDK. The idea is -that in an incremental development fashion, when doing a normal make, you -should only spend time recompiling what's changed (making it purely -incremental) and only do the work that's needed to actually run and test your -code. The packaging stuff that is part of the `images` target is not needed for -a normal developer who wants to test his new code. Even if it's quite fast, -it's still unnecessary. We're targeting sub-second incremental rebuilds! ;-) -(Or, well, at least single-digit seconds...) - -**Q:** I usually set a specific environment variable when building, but I can't -find the equivalent in the new build. What should I do? -**A:** It might very well be that we have neglected to add support for an -option that was actually used from outside the build system. Email us and we -will add support for it! - - -### Build Performance Tips - -Building OpenJDK requires a lot of horsepower. Some of the build tools can be -adjusted to utilize more or less of resources such as parallel threads and -memory. The `configure` script analyzes your system and selects reasonable -values for such options based on your hardware. If you encounter resource -problems, such as out of memory conditions, you can modify the detected values -with: - - * **`--with-num-cores`** -- number of cores in the build system, e.g. - `--with-num-cores=8` - * **`--with-memory-size`** -- memory (in MB) available in the build system, - e.g. `--with-memory-size=1024` - -It might also be necessary to specify the JVM arguments passed to the Bootstrap -JDK, using e.g. `--with-boot-jdk-jvmargs="-Xmx8G -enableassertions"`. Doing -this will override the default JVM arguments passed to the Bootstrap JDK. - -One of the top goals of the new build system is to improve the build -performance and decrease the time needed to build. This will soon also apply to -the java compilation when the Smart Javac wrapper is fully supported. - -At the end of a successful execution of `configure`, you will get a performance -summary, indicating how well the build will perform. Here you will also get -performance hints. If you want to build fast, pay attention to those! - -#### Building with ccache - -The OpenJDK build supports building with ccache when using gcc or clang. Using -ccache can radically speed up compilation of native code if you often rebuild -the same sources. Your milage may vary however so we recommend evaluating it -for yourself. To enable it, make sure it's on the path and configure with -`--enable-ccache`. - -#### Building on local disk - -If you are using network shares, e.g. via NFS, for your source code, make sure -the build directory is situated on local disk. The performance penalty is -extremely high for building on a network share, close to unusable. - -#### Building only one JVM - -The old build builds multiple JVMs on 32-bit systems (client and server; and on -Windows kernel as well). In the new build we have changed this default to only -build server when it's available. This improves build times for those not -interested in multiple JVMs. To mimic the old behavior on platforms that -support it, use `--with-jvm-variants=client,server`. - -#### Selecting the number of cores to build on - -By default, `configure` will analyze your machine and run the make process in -parallel with as many threads as you have cores. This behavior can be -overridden, either "permanently" (on a `configure` basis) using -`--with-num-cores=N` or for a single build only (on a make basis), using -`make JOBS=N`. - -If you want to make a slower build just this time, to save some CPU power for -other processes, you can run e.g. `make JOBS=2`. This will force the makefiles -to only run 2 parallel processes, or even `make JOBS=1` which will disable -parallelism. - -If you want to have it the other way round, namely having slow builds default -and override with fast if you're impatient, you should call `configure` with -`--with-num-cores=2`, making 2 the default. If you want to run with more cores, -run `make JOBS=8` - - -### Troubleshooting - -#### Solving build problems - -If the build fails (and it's not due to a compilation error in a source file -you've changed), the first thing you should do is to re-run the build with more -verbosity. Do this by adding `LOG=debug` to your make command line. - -The build log (with both stdout and stderr intermingled, basically the same as -you see on your console) can be found as `build.log` in your build directory. - -You can ask for help on build problems with the new build system on either the -[build-dev](http://mail.openjdk.java.net/mailman/listinfo/build-dev) or the -[build-infra-dev](http://mail.openjdk.java.net/mailman/listinfo/build-infra-dev) -mailing lists. Please include the relevant parts of the build log. - -A build can fail for any number of reasons. Most failures are a result of -trying to build in an environment in which all the pre-build requirements have -not been met. The first step in troubleshooting a build failure is to recheck -that you have satisfied all the pre-build requirements for your platform. -Scanning the `configure` log is a good first step, making sure that what it -found makes sense for your system. Look for strange error messages or any -difficulties that `configure` had in finding things. - -Some of the more common problems with builds are briefly described below, with -suggestions for remedies. - - * **Corrupted Bundles on Windows:** - Some virus scanning software has been known to corrupt the downloading of - zip bundles. It may be necessary to disable the 'on access' or 'real time' - virus scanning features to prevent this corruption. This type of 'real time' - virus scanning can also slow down the build process significantly. - Temporarily disabling the feature, or excluding the build output directory - may be necessary to get correct and faster builds. - - * **Slow Builds:** - If your build machine seems to be overloaded from too many simultaneous C++ - compiles, try setting the `JOBS=1` on the `make` command line. Then try - increasing the count slowly to an acceptable level for your system. Also: - - Creating the javadocs can be very slow, if you are running javadoc, consider - skipping that step. - - Faster CPUs, more RAM, and a faster DISK usually helps. The VM build tends - to be CPU intensive (many C++ compiles), and the rest of the JDK will often - be disk intensive. - - Faster compiles are possible using a tool called - [ccache](http://ccache.samba.org/). - - * **File time issues:** - If you see warnings that refer to file time stamps, e.g. - - > _Warning message:_ ` File 'xxx' has modification time in the future.` - > _Warning message:_ ` Clock skew detected. Your build may be incomplete.` - - These warnings can occur when the clock on the build machine is out of sync - with the timestamps on the source files. Other errors, apparently unrelated - but in fact caused by the clock skew, can occur along with the clock skew - warnings. These secondary errors may tend to obscure the fact that the true - root cause of the problem is an out-of-sync clock. - - If you see these warnings, reset the clock on the build machine, run - "`gmake clobber`" or delete the directory containing the build output, and - restart the build from the beginning. - - * **Error message: `Trouble writing out table to disk`** - Increase the amount of swap space on your build machine. This could be - caused by overloading the system and it may be necessary to use: - - > `make JOBS=1` - - to reduce the load on the system. - - * **Error Message: `libstdc++ not found`:** - This is caused by a missing libstdc++.a library. This is installed as part - of a specific package (e.g. libstdc++.so.devel.386). By default some 64-bit - Linux versions (e.g. Fedora) only install the 64-bit version of the - libstdc++ package. Various parts of the JDK build require a static link of - the C++ runtime libraries to allow for maximum portability of the built - images. - - * **Linux Error Message: `cannot restore segment prot after reloc`** - This is probably an issue with SELinux (See [SELinux on - Wikipedia](http://en.wikipedia.org/wiki/SELinux)). Parts of the VM is built - without the `-fPIC` for performance reasons. - - To completely disable SELinux: - - 1. `$ su root` - 2. `# system-config-securitylevel` - 3. `In the window that appears, select the SELinux tab` - 4. `Disable SELinux` - - Alternatively, instead of completely disabling it you could disable just - this one check. - - 1. Select System->Administration->SELinux Management - 2. In the SELinux Management Tool which appears, select "Boolean" from the - menu on the left - 3. Expand the "Memory Protection" group - 4. Check the first item, labeled "Allow all unconfined executables to use - libraries requiring text relocation ..." - - * **Windows Error Messages:** - `*** fatal error - couldn't allocate heap, ... ` - `rm fails with "Directory not empty"` - `unzip fails with "cannot create ... Permission denied"` - `unzip fails with "cannot create ... Error 50"` - - The CYGWIN software can conflict with other non-CYGWIN software. See the - CYGWIN FAQ section on [BLODA (applications that interfere with - CYGWIN)](http://cygwin.com/faq/faq.using.html#faq.using.bloda). - - * **Windows Error Message: `spawn failed`** - Try rebooting the system, or there could be some kind of issue with the disk - or disk partition being used. Sometimes it comes with a "Permission Denied" - message. - -***** - - -## Appendix B: GNU make - -The Makefiles in the OpenJDK are only valid when used with the GNU version of -the utility command `make` (usually called `gmake` on Solaris). A few notes -about using GNU make: - - * You need GNU make version 3.81 or newer. On Windows 4.0 or newer is - recommended. If the GNU make utility on your systems is not of a suitable - version, see "[Building GNU make](#buildgmake)". - * Place the location of the GNU make binary in the `PATH`. - * **Solaris:** Do NOT use `/usr/bin/make` on Solaris. If your Solaris system - has the software from the Solaris Developer Companion CD installed, you - should try and use `/usr/bin/gmake` or `/usr/gnu/bin/make`. - * **Windows:** Make sure you start your build inside a bash shell. - * **Mac OS X:** The XCode "command line tools" must be installed on your Mac. - -Information on GNU make, and access to ftp download sites, are available on the -[GNU make web site ](http://www.gnu.org/software/make/make.html). The latest -source to GNU make is available at -[ftp.gnu.org/pub/gnu/make/](http://ftp.gnu.org/pub/gnu/make/). - - -### Building GNU make - -First step is to get the GNU make 3.81 or newer source from -[ftp.gnu.org/pub/gnu/make/](http://ftp.gnu.org/pub/gnu/make/). Building is a -little different depending on the OS but is basically done with: - - bash ./configure - make - -***** - - -## Appendix C: Build Environments - -### Minimum Build Environments - -This file often describes specific requirements for what we call the "minimum -build environments" (MBE) for this specific release of the JDK. What is listed -below is what the Oracle Release Engineering Team will use to build the Oracle -JDK product. Building with the MBE will hopefully generate the most compatible -bits that install on, and run correctly on, the most variations of the same -base OS and hardware architecture. In some cases, these represent what is often -called the least common denominator, but each Operating System has different -aspects to it. - -In all cases, the Bootstrap JDK version minimum is critical, we cannot -guarantee builds will work with older Bootstrap JDK's. Also in all cases, more -RAM and more processors is better, the minimums listed below are simply -recommendations. - -With Solaris and Mac OS X, the version listed below is the oldest release we -can guarantee builds and works, and the specific version of the compilers used -could be critical. - -With Windows the critical aspect is the Visual Studio compiler used, which due -to it's runtime, generally dictates what Windows systems can do the builds and -where the resulting bits can be used. - -**NOTE: We expect a change here off these older Windows OS releases and to a -'less older' one, probably Windows 2008R2 X64.** - -With Linux, it was just a matter of picking a stable distribution that is a -good representative for Linux in general. - -It is understood that most developers will NOT be using these specific -versions, and in fact creating these specific versions may be difficult due to -the age of some of this software. It is expected that developers are more often -using the more recent releases and distributions of these operating systems. - -Compilation problems with newer or different C/C++ compilers is a common -problem. Similarly, compilation problems related to changes to the -`/usr/include` or system header files is also a common problem with older, -newer, or unreleased OS versions. Please report these types of problems as bugs -so that they can be dealt with accordingly. - -> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Base OS and ArchitectureOSC/C++ CompilerBootstrap JDKProcessorsRAM MinimumDISK Needs
Linux X86 (32-bit) and X64 (64-bit)Oracle Enterprise Linux 6.4gcc 4.9.2 JDK 82 or more1 GB6 GB
Solaris SPARCV9 (64-bit)Solaris 11 Update 1Studio 12 Update 4 + patchesJDK 84 or more4 GB8 GB
Solaris X64 (64-bit)Solaris 11 Update 1Studio 12 Update 4 + patchesJDK 84 or more4 GB8 GB
Windows X86 (32-bit)Windows Server 2012 R2 x64Microsoft Visual Studio C++ 2013 Professional EditionJDK 82 or more2 GB6 GB
Windows X64 (64-bit)Windows Server 2012 R2 x64Microsoft Visual Studio C++ 2013 Professional EditionJDK 82 or more2 GB6 GB
Mac OS X X64 (64-bit)Mac OS X 10.9 "Mavericks"Xcode 6.3 or newerJDK 82 or more4 GB6 GB
- -***** - - -### Specific Developer Build Environments - -We won't be listing all the possible environments, but we will try to provide -what information we have available to us. - -**NOTE: The community can help out by updating this part of the document.** - -#### Fedora - -After installing the latest [Fedora](http://fedoraproject.org) you need to -install several build dependencies. The simplest way to do it is to execute the -following commands as user `root`: - - yum-builddep java-1.7.0-openjdk - yum install gcc gcc-c++ - -In addition, it's necessary to set a few environment variables for the build: - - export LANG=C - export PATH="/usr/lib/jvm/java-openjdk/bin:${PATH}" - -#### CentOS 5.5 - -After installing [CentOS 5.5](http://www.centos.org/) you need to make sure you -have the following Development bundles installed: - - * Development Libraries - * Development Tools - * Java Development - * X Software Development (Including XFree86-devel) - -Plus the following packages: - - * cups devel: Cups Development Package - * alsa devel: Alsa Development Package - * Xi devel: libXi.so Development Package - -The freetype 2.3 packages don't seem to be available, but the freetype 2.3 -sources can be downloaded, built, and installed easily enough from [the -freetype site](http://downloads.sourceforge.net/freetype). Build and install -with something like: - - bash ./configure - make - sudo -u root make install - -Mercurial packages could not be found easily, but a Google search should find -ones, and they usually include Python if it's needed. - -#### Debian 5.0 (Lenny) - -After installing [Debian](http://debian.org) 5 you need to install several -build dependencies. The simplest way to install the build dependencies is to -execute the following commands as user `root`: - - aptitude build-dep openjdk-7 - aptitude install openjdk-7-jdk libmotif-dev - -In addition, it's necessary to set a few environment variables for the build: - - export LANG=C - export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}" - -#### Ubuntu 12.04 - -After installing [Ubuntu](http://ubuntu.org) 12.04 you need to install several -build dependencies. The simplest way to do it is to execute the following -commands: - - sudo aptitude build-dep openjdk-7 - sudo aptitude install openjdk-7-jdk - -In addition, it's necessary to set a few environment variables for the build: - - export LANG=C - export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}" - -#### OpenSUSE 11.1 - -After installing [OpenSUSE](http://opensuse.org) 11.1 you need to install -several build dependencies. The simplest way to install the build dependencies -is to execute the following commands: - - sudo zypper source-install -d java-1_7_0-openjdk - sudo zypper install make - -In addition, it is necessary to set a few environment variables for the build: - - export LANG=C - export PATH="/usr/lib/jvm/java-1.7.0-openjdk/bin:$[PATH}" - -Finally, you need to unset the `JAVA_HOME` environment variable: - - export -n JAVA_HOME` - -#### Mandriva Linux One 2009 Spring - -After installing [Mandriva](http://mandriva.org) Linux One 2009 Spring you need -to install several build dependencies. The simplest way to install the build -dependencies is to execute the following commands as user `root`: - - urpmi java-1.7.0-openjdk-devel make gcc gcc-c++ freetype-devel zip unzip - libcups2-devel libxrender1-devel libalsa2-devel libstc++-static-devel - libxtst6-devel libxi-devel - -In addition, it is necessary to set a few environment variables for the build: - - export LANG=C - export PATH="/usr/lib/jvm/java-1.7.0-openjdk/bin:${PATH}" - -#### OpenSolaris 2009.06 - -After installing [OpenSolaris](http://opensolaris.org) 2009.06 you need to -install several build dependencies. The simplest way to install the build -dependencies is to execute the following commands: - - pfexec pkg install SUNWgmake SUNWj7dev sunstudioexpress SUNWcups SUNWzip - SUNWunzip SUNWxwhl SUNWxorg-headers SUNWaudh SUNWfreetype2 - -In addition, it is necessary to set a few environment variables for the build: - - export LANG=C - export PATH="/opt/SunStudioExpress/bin:${PATH}" - -***** - -End of the OpenJDK build README document. - -Please come again! diff -r 830e16e5eef5 -r d9f6bc6ba599 common/autoconf/basics.m4 --- a/common/autoconf/basics.m4 Mon Jul 03 13:18:55 2017 -0700 +++ b/common/autoconf/basics.m4 Thu Aug 24 16:26:58 2017 +0200 @@ -530,6 +530,7 @@ BASIC_PATH_PROGS(DF, df) BASIC_PATH_PROGS(CPIO, [cpio bsdcpio]) BASIC_PATH_PROGS(NICE, nice) + BASIC_PATH_PROGS(PANDOC, pandoc) ]) # Setup basic configuration paths, and platform-specific stuff related to PATHs. @@ -1094,6 +1095,7 @@ OTOOL="true" fi BASIC_PATH_PROGS(READELF, [greadelf readelf]) + BASIC_PATH_PROGS(DOT, dot) BASIC_PATH_PROGS(HG, hg) BASIC_PATH_PROGS(STAT, stat) BASIC_PATH_PROGS(TIME, time) @@ -1202,6 +1204,18 @@ # Check for support for specific options in bash AC_DEFUN_ONCE([BASIC_CHECK_BASH_OPTIONS], [ + # Check bash version + # Extra [ ] to stop m4 mangling + [ BASH_VER=`$BASH --version | $SED -n -e 's/^.*bash.*ersion *\([0-9.]*\).*$/\1/ p'` ] + AC_MSG_CHECKING([bash version]) + AC_MSG_RESULT([$BASH_VER]) + + BASH_MAJOR=`$ECHO $BASH_VER | $CUT -d . -f 1` + BASH_MINOR=`$ECHO $BASH_VER | $CUT -d . -f 2` + if test $BASH_MAJOR -lt 3 || (test $BASH_MAJOR -eq 3 && test $BASH_MINOR -lt 2); then + AC_MSG_ERROR([bash version 3.2 or better is required]) + fi + # Test if bash supports pipefail. AC_MSG_CHECKING([if bash supports pipefail]) if ${BASH} -c 'set -o pipefail'; then diff -r 830e16e5eef5 -r d9f6bc6ba599 common/autoconf/basics_windows.m4 --- a/common/autoconf/basics_windows.m4 Mon Jul 03 13:18:55 2017 -0700 +++ b/common/autoconf/basics_windows.m4 Thu Aug 24 16:26:58 2017 +0200 @@ -329,8 +329,8 @@ AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path]) fi AC_MSG_CHECKING([cygwin root directory as unix-style path]) - # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away - cygwin_winpath_root=`cd / ; cmd /c cd | $GREP ".*"` + # The cmd output ends with Windows line endings (CR/LF) + cygwin_winpath_root=`cd / ; cmd /c cd | $TR -d '\r\n'` # Force cygpath to report the proper root by including a trailing space, and then stripping it off again. CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "` AC_MSG_RESULT([$CYGWIN_ROOT_PATH]) diff -r 830e16e5eef5 -r d9f6bc6ba599 common/autoconf/build-aux/install.sh --- a/common/autoconf/build-aux/install.sh Mon Jul 03 13:18:55 2017 -0700 +++ b/common/autoconf/build-aux/install.sh Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,28 @@ -#!/bin/sh -echo >&2 "No suitable 'install' command found.'" -echo >&2 "If automake is installed, running 'automake -fa'" -echo >&2 "(and ignoring the errors) might produce one." -exit 1 +#!/bin/bash +# +# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# This file is empty on purpose. It's a placeholder which is required by +# autoconf, but it serves no purpose for us. diff -r 830e16e5eef5 -r d9f6bc6ba599 common/autoconf/flags.m4 --- a/common/autoconf/flags.m4 Mon Jul 03 13:18:55 2017 -0700 +++ b/common/autoconf/flags.m4 Thu Aug 24 16:26:58 2017 +0200 @@ -355,7 +355,7 @@ SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG" JVM_CFLAGS="$JVM_CFLAGS $PICFLAG" fi - SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.' + SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path$(or [$]1,/.)' SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN" SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1' SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1' @@ -375,7 +375,7 @@ # Linking is different on MacOSX PICFLAG='' SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG" - SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.' + SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path$(or [$]1,/.)' SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN" SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1' SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1' diff -r 830e16e5eef5 -r d9f6bc6ba599 common/autoconf/generated-configure.sh --- a/common/autoconf/generated-configure.sh Mon Jul 03 13:18:55 2017 -0700 +++ b/common/autoconf/generated-configure.sh Thu Aug 24 16:26:58 2017 +0200 @@ -688,6 +688,7 @@ LIBFFI_CFLAGS ALSA_LIBS ALSA_CFLAGS +FREETYPE_LICENSE FREETYPE_BUNDLE_LIB_PATH FREETYPE_LIBS FREETYPE_CFLAGS @@ -918,6 +919,7 @@ INCLUDE_SA UNLIMITED_CRYPTO CACERTS_FILE +ENABLE_FULL_DOCS ENABLE_HEADLESS_ONLY DEFAULT_MAKE_TARGET OS_VERSION_MICRO @@ -935,6 +937,7 @@ TIME STAT HG +DOT READELF OTOOL LDD @@ -993,8 +996,9 @@ OPENJDK_TARGET_CPU_ISADIR OPENJDK_TARGET_CPU_LEGACY_LIB OPENJDK_TARGET_CPU_LEGACY -REQUIRED_OS_VERSION -REQUIRED_OS_NAME +RELEASE_FILE_OS_ARCH +RELEASE_FILE_OS_NAME +OPENJDK_MODULE_TARGET_PLATFORM COMPILE_TYPE OPENJDK_TARGET_CPU_ENDIAN OPENJDK_TARGET_CPU_BITS @@ -1024,6 +1028,7 @@ build_vendor build_cpu build +PANDOC NICE CPIO DF @@ -1136,6 +1141,7 @@ with_output_sync with_default_make_target enable_headless_only +enable_full_docs with_cacerts_file enable_unlimited_crypto with_copyright_year @@ -1194,6 +1200,7 @@ with_freetype_lib with_freetype_src enable_freetype_bundling +with_freetype_license with_alsa with_alsa_include with_alsa_lib @@ -1281,12 +1288,14 @@ DF CPIO NICE +PANDOC MAKE UNZIP ZIPEXE LDD OTOOL READELF +DOT HG STAT TIME @@ -1967,6 +1976,8 @@ --enable-debug set the debug level to fastdebug (shorthand for --with-debug-level=fastdebug) [disabled] --enable-headless-only only build headless (no GUI) support [disabled] + --enable-full-docs build complete documentation [enabled if all tools + found] --disable-unlimited-crypto Disable unlimited crypto policy [enabled] --disable-keep-packaged-modules @@ -2142,6 +2153,7 @@ --with-freetype-src specify directory with freetype sources to automatically build the library (experimental, Windows-only) + --with-freetype-license if bundling freetype, also bundle this license file --with-alsa specify prefix directory for the alsa package (expecting the libraries under PATH/lib and the headers under PATH/include) @@ -2244,12 +2256,14 @@ DF Override default value for DF CPIO Override default value for CPIO NICE Override default value for NICE + PANDOC Override default value for PANDOC MAKE Override default value for MAKE UNZIP Override default value for UNZIP ZIPEXE Override default value for ZIPEXE LDD Override default value for LDD OTOOL Override default value for OTOOL READELF Override default value for READELF + DOT Override default value for DOT HG Override default value for HG STAT Override default value for STAT TIME Override default value for TIME @@ -4887,6 +4901,8 @@ + + #%%% Build and target systems %%% @@ -5043,7 +5059,7 @@ # # $1 = compiler to test (CC or CXX) # $2 = human readable name of compiler (C or C++) -# $3 = list of compiler names to search for +# $3 = compiler name to search for # Detect the core components of the toolchain, i.e. the compilers (CC and CXX), @@ -5170,7 +5186,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1486175373 +DATE_WHEN_GENERATED=1496926402 ############################################################################### # @@ -15358,6 +15374,203 @@ + # Publish this variable in the help. + + + if [ -z "${PANDOC+x}" ]; then + # The variable is not set by user, try to locate tool using the code snippet + for ac_prog in pandoc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PANDOC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PANDOC in + [\\/]* | ?:[\\/]*) + ac_cv_path_PANDOC="$PANDOC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PANDOC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PANDOC=$ac_cv_path_PANDOC +if test -n "$PANDOC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PANDOC" >&5 +$as_echo "$PANDOC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$PANDOC" && break +done + + else + # The variable is set, but is it from the command line or the environment? + + # Try to remove the string !PANDOC! from our list. + try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!PANDOC!/} + if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then + # If it failed, the variable was not from the command line. Ignore it, + # but warn the user (except for BASH, which is always set by the calling BASH). + if test "xPANDOC" != xBASH; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of PANDOC from the environment. Use command line variables instead." >&5 +$as_echo "$as_me: WARNING: Ignoring value of PANDOC from the environment. Use command line variables instead." >&2;} + fi + # Try to locate tool using the code snippet + for ac_prog in pandoc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PANDOC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PANDOC in + [\\/]* | ?:[\\/]*) + ac_cv_path_PANDOC="$PANDOC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PANDOC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PANDOC=$ac_cv_path_PANDOC +if test -n "$PANDOC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PANDOC" >&5 +$as_echo "$PANDOC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$PANDOC" && break +done + + else + # If it succeeded, then it was overridden by the user. We will use it + # for the tool. + + # First remove it from the list of overridden variables, so we can test + # for unknown variables in the end. + CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var" + + # Check if we try to supply an empty value + if test "x$PANDOC" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool PANDOC= (no value)" >&5 +$as_echo "$as_me: Setting user supplied tool PANDOC= (no value)" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PANDOC" >&5 +$as_echo_n "checking for PANDOC... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +$as_echo "disabled" >&6; } + else + # Check if the provided tool contains a complete path. + tool_specified="$PANDOC" + tool_basename="${tool_specified##*/}" + if test "x$tool_basename" = "x$tool_specified"; then + # A command without a complete path is provided, search $PATH. + { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool PANDOC=$tool_basename" >&5 +$as_echo "$as_me: Will search for user supplied tool PANDOC=$tool_basename" >&6;} + # Extract the first word of "$tool_basename", so it can be a program name with args. +set dummy $tool_basename; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PANDOC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PANDOC in + [\\/]* | ?:[\\/]*) + ac_cv_path_PANDOC="$PANDOC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PANDOC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PANDOC=$ac_cv_path_PANDOC +if test -n "$PANDOC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PANDOC" >&5 +$as_echo "$PANDOC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$PANDOC" = x; then + as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5 + fi + else + # Otherwise we believe it is a complete path. Use it as it is. + { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool PANDOC=$tool_specified" >&5 +$as_echo "$as_me: Will use user supplied tool PANDOC=$tool_specified" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PANDOC" >&5 +$as_echo_n "checking for PANDOC... " >&6; } + if test ! -x "$tool_specified"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + as_fn_error $? "User supplied tool PANDOC=$tool_specified does not exist or is not executable" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5 +$as_echo "$tool_specified" >&6; } + fi + fi + fi + + fi + + + + # Now we can determine OpenJDK build and target platforms. This is required to # have early on. # Make sure we can run config.sub. @@ -15821,30 +16034,38 @@ $as_echo "$COMPILE_TYPE" >&6; } + if test "x$OPENJDK_TARGET_OS" = xmacosx; then + OPENJDK_MODULE_TARGET_OS_NAME="macos" + else + OPENJDK_MODULE_TARGET_OS_NAME="$OPENJDK_TARGET_OS" + fi + + if test "x$OPENJDK_TARGET_CPU" = xx86_64; then + OPENJDK_MODULE_TARGET_OS_ARCH="amd64" + else + OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU" + fi + + OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}" + + + if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then - REQUIRED_OS_NAME=SunOS - REQUIRED_OS_VERSION=5.10 + RELEASE_FILE_OS_NAME=SunOS fi if test "x$OPENJDK_TARGET_OS" = "xlinux"; then - REQUIRED_OS_NAME=Linux - REQUIRED_OS_VERSION=2.6 + RELEASE_FILE_OS_NAME=Linux fi if test "x$OPENJDK_TARGET_OS" = "xwindows"; then - REQUIRED_OS_NAME=Windows - if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then - REQUIRED_OS_VERSION=5.2 - else - REQUIRED_OS_VERSION=5.1 - fi - fi - if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then - REQUIRED_OS_NAME=Darwin - REQUIRED_OS_VERSION=11.2 + RELEASE_FILE_OS_NAME=Windows + fi + if test "x$OPENJDK_TARGET_OS" = xmacosx; then + RELEASE_FILE_OS_NAME="Darwin" fi if test "x$OPENJDK_TARGET_OS" = "xaix"; then - REQUIRED_OS_NAME=AIX - REQUIRED_OS_VERSION=7.1 - fi + RELEASE_FILE_OS_NAME="AIX" + fi + RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU} @@ -16200,8 +16421,8 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking cygwin root directory as unix-style path" >&5 $as_echo_n "checking cygwin root directory as unix-style path... " >&6; } - # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away - cygwin_winpath_root=`cd / ; cmd /c cd | $GREP ".*"` + # The cmd output ends with Windows line endings (CR/LF) + cygwin_winpath_root=`cd / ; cmd /c cd | $TR -d '\r\n'` # Force cygpath to report the proper root by including a trailing space, and then stripping it off again. CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGWIN_ROOT_PATH" >&5 @@ -22270,6 +22491,203 @@ # Publish this variable in the help. + if [ -z "${DOT+x}" ]; then + # The variable is not set by user, try to locate tool using the code snippet + for ac_prog in dot +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DOT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $DOT in + [\\/]* | ?:[\\/]*) + ac_cv_path_DOT="$DOT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_DOT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +DOT=$ac_cv_path_DOT +if test -n "$DOT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5 +$as_echo "$DOT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DOT" && break +done + + else + # The variable is set, but is it from the command line or the environment? + + # Try to remove the string !DOT! from our list. + try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!DOT!/} + if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then + # If it failed, the variable was not from the command line. Ignore it, + # but warn the user (except for BASH, which is always set by the calling BASH). + if test "xDOT" != xBASH; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of DOT from the environment. Use command line variables instead." >&5 +$as_echo "$as_me: WARNING: Ignoring value of DOT from the environment. Use command line variables instead." >&2;} + fi + # Try to locate tool using the code snippet + for ac_prog in dot +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DOT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $DOT in + [\\/]* | ?:[\\/]*) + ac_cv_path_DOT="$DOT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_DOT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +DOT=$ac_cv_path_DOT +if test -n "$DOT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5 +$as_echo "$DOT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DOT" && break +done + + else + # If it succeeded, then it was overridden by the user. We will use it + # for the tool. + + # First remove it from the list of overridden variables, so we can test + # for unknown variables in the end. + CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var" + + # Check if we try to supply an empty value + if test "x$DOT" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool DOT= (no value)" >&5 +$as_echo "$as_me: Setting user supplied tool DOT= (no value)" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DOT" >&5 +$as_echo_n "checking for DOT... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +$as_echo "disabled" >&6; } + else + # Check if the provided tool contains a complete path. + tool_specified="$DOT" + tool_basename="${tool_specified##*/}" + if test "x$tool_basename" = "x$tool_specified"; then + # A command without a complete path is provided, search $PATH. + { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool DOT=$tool_basename" >&5 +$as_echo "$as_me: Will search for user supplied tool DOT=$tool_basename" >&6;} + # Extract the first word of "$tool_basename", so it can be a program name with args. +set dummy $tool_basename; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DOT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $DOT in + [\\/]* | ?:[\\/]*) + ac_cv_path_DOT="$DOT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_DOT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +DOT=$ac_cv_path_DOT +if test -n "$DOT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5 +$as_echo "$DOT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$DOT" = x; then + as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5 + fi + else + # Otherwise we believe it is a complete path. Use it as it is. + { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool DOT=$tool_specified" >&5 +$as_echo "$as_me: Will use user supplied tool DOT=$tool_specified" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DOT" >&5 +$as_echo_n "checking for DOT... " >&6; } + if test ! -x "$tool_specified"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + as_fn_error $? "User supplied tool DOT=$tool_specified does not exist or is not executable" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5 +$as_echo "$tool_specified" >&6; } + fi + fi + fi + + fi + + + + + # Publish this variable in the help. + + if [ -z "${HG+x}" ]; then # The variable is not set by user, try to locate tool using the code snippet for ac_prog in hg @@ -24092,6 +24510,20 @@ fi + # Check bash version + # Extra [ ] to stop m4 mangling + BASH_VER=`$BASH --version | $SED -n -e 's/^.*bash.*ersion *\([0-9.]*\).*$/\1/ p'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking bash version" >&5 +$as_echo_n "checking bash version... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BASH_VER" >&5 +$as_echo "$BASH_VER" >&6; } + + BASH_MAJOR=`$ECHO $BASH_VER | $CUT -d . -f 1` + BASH_MINOR=`$ECHO $BASH_VER | $CUT -d . -f 2` + if test $BASH_MAJOR -lt 3 || (test $BASH_MAJOR -eq 3 && test $BASH_MINOR -lt 2); then + as_fn_error $? "bash version 3.2 or better is required" "$LINENO" 5 + fi + # Test if bash supports pipefail. { $as_echo "$as_me:${as_lineno-$LINENO}: checking if bash supports pipefail" >&5 $as_echo_n "checking if bash supports pipefail... " >&6; } @@ -24306,6 +24738,101 @@ + # Should we build the complete docs, or just a lightweight version? + # Check whether --enable-full-docs was given. +if test "${enable_full_docs+set}" = set; then : + enableval=$enable_full_docs; +fi + + + # Verify dependencies + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for graphviz dot" >&5 +$as_echo_n "checking for graphviz dot... " >&6; } + if test "x$DOT" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, cannot generate full docs" >&5 +$as_echo "no, cannot generate full docs" >&6; } + FULL_DOCS_DEP_MISSING=true + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pandoc" >&5 +$as_echo_n "checking for pandoc... " >&6; } + if test "x$PANDOC" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, cannot generate full docs" >&5 +$as_echo "no, cannot generate full docs" >&6; } + FULL_DOCS_DEP_MISSING=true + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking full docs" >&5 +$as_echo_n "checking full docs... " >&6; } + if test "x$enable_full_docs" = xyes; then + if test "x$FULL_DOCS_DEP_MISSING" = "xtrue"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, missing dependencies" >&5 +$as_echo "no, missing dependencies" >&6; } + + # Print a helpful message on how to acquire the necessary build dependency. + # dot is the help tag: freetype, cups, alsa etc + MISSING_DEPENDENCY=dot + + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + cygwin_help $MISSING_DEPENDENCY + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + msys_help $MISSING_DEPENDENCY + else + PKGHANDLER_COMMAND= + + case $PKGHANDLER in + apt-get) + apt_help $MISSING_DEPENDENCY ;; + yum) + yum_help $MISSING_DEPENDENCY ;; + brew) + brew_help $MISSING_DEPENDENCY ;; + port) + port_help $MISSING_DEPENDENCY ;; + pkgutil) + pkgutil_help $MISSING_DEPENDENCY ;; + pkgadd) + pkgadd_help $MISSING_DEPENDENCY ;; + esac + + if test "x$PKGHANDLER_COMMAND" != x; then + HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'." + fi + fi + + as_fn_error $? "Cannot enable full docs with missing dependencies. See above. $HELP_MSG" "$LINENO" 5 + else + ENABLE_FULL_DOCS=true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, forced" >&5 +$as_echo "yes, forced" >&6; } + fi + elif test "x$enable_full_docs" = xno; then + ENABLE_FULL_DOCS=false + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, forced" >&5 +$as_echo "no, forced" >&6; } + elif test "x$enable_full_docs" = x; then + # Check for prerequisites + if test "x$FULL_DOCS_DEP_MISSING" = xtrue; then + ENABLE_FULL_DOCS=false + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, missing dependencies" >&5 +$as_echo "no, missing dependencies" >&6; } + else + ENABLE_FULL_DOCS=true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, dependencies present" >&5 +$as_echo "yes, dependencies present" >&6; } + fi + else + as_fn_error $? "--enable-full-docs can only take yes or no" "$LINENO" 5 + fi + + + # Choose cacerts source file # Check whether --with-cacerts-file was given. @@ -33124,10 +33651,9 @@ if test -n "$TOOLCHAIN_PATH"; then PATH_save="$PATH" PATH="$TOOLCHAIN_PATH" - for ac_prog in $SEARCH_LIST -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}$SEARCH_LIST", so it can be a program name with args. +set dummy ${ac_tool_prefix}$SEARCH_LIST; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_TOOLCHAIN_PATH_CC+:} false; then : @@ -33166,20 +33692,73 @@ fi - test -n "$TOOLCHAIN_PATH_CC" && break -done +fi +if test -z "$ac_cv_path_TOOLCHAIN_PATH_CC"; then + ac_pt_TOOLCHAIN_PATH_CC=$TOOLCHAIN_PATH_CC + # Extract the first word of "$SEARCH_LIST", so it can be a program name with args. +set dummy $SEARCH_LIST; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_TOOLCHAIN_PATH_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_TOOLCHAIN_PATH_CC in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_TOOLCHAIN_PATH_CC="$ac_pt_TOOLCHAIN_PATH_CC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_TOOLCHAIN_PATH_CC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_TOOLCHAIN_PATH_CC=$ac_cv_path_ac_pt_TOOLCHAIN_PATH_CC +if test -n "$ac_pt_TOOLCHAIN_PATH_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_TOOLCHAIN_PATH_CC" >&5 +$as_echo "$ac_pt_TOOLCHAIN_PATH_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_TOOLCHAIN_PATH_CC" = x; then + TOOLCHAIN_PATH_CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + TOOLCHAIN_PATH_CC=$ac_pt_TOOLCHAIN_PATH_CC + fi +else + TOOLCHAIN_PATH_CC="$ac_cv_path_TOOLCHAIN_PATH_CC" +fi CC=$TOOLCHAIN_PATH_CC PATH="$PATH_save" fi - # AC_PATH_PROGS can't be run multiple times with the same variable, + # AC_PATH_TOOL can't be run multiple times with the same variable, # so create a new name for this run. if test "x$CC" = x; then - for ac_prog in $SEARCH_LIST -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}$SEARCH_LIST", so it can be a program name with args. +set dummy ${ac_tool_prefix}$SEARCH_LIST; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_POTENTIAL_CC+:} false; then : @@ -33218,8 +33797,62 @@ fi - test -n "$POTENTIAL_CC" && break -done +fi +if test -z "$ac_cv_path_POTENTIAL_CC"; then + ac_pt_POTENTIAL_CC=$POTENTIAL_CC + # Extract the first word of "$SEARCH_LIST", so it can be a program name with args. +set dummy $SEARCH_LIST; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_POTENTIAL_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_POTENTIAL_CC in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_POTENTIAL_CC="$ac_pt_POTENTIAL_CC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_POTENTIAL_CC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_POTENTIAL_CC=$ac_cv_path_ac_pt_POTENTIAL_CC +if test -n "$ac_pt_POTENTIAL_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_POTENTIAL_CC" >&5 +$as_echo "$ac_pt_POTENTIAL_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_POTENTIAL_CC" = x; then + POTENTIAL_CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + POTENTIAL_CC=$ac_pt_POTENTIAL_CC + fi +else + POTENTIAL_CC="$ac_cv_path_POTENTIAL_CC" +fi CC=$POTENTIAL_CC fi @@ -34425,10 +35058,9 @@ if test -n "$TOOLCHAIN_PATH"; then PATH_save="$PATH" PATH="$TOOLCHAIN_PATH" - for ac_prog in $SEARCH_LIST -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}$SEARCH_LIST", so it can be a program name with args. +set dummy ${ac_tool_prefix}$SEARCH_LIST; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_TOOLCHAIN_PATH_CXX+:} false; then : @@ -34467,20 +35099,73 @@ fi - test -n "$TOOLCHAIN_PATH_CXX" && break -done +fi +if test -z "$ac_cv_path_TOOLCHAIN_PATH_CXX"; then + ac_pt_TOOLCHAIN_PATH_CXX=$TOOLCHAIN_PATH_CXX + # Extract the first word of "$SEARCH_LIST", so it can be a program name with args. +set dummy $SEARCH_LIST; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_TOOLCHAIN_PATH_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_TOOLCHAIN_PATH_CXX in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_TOOLCHAIN_PATH_CXX="$ac_pt_TOOLCHAIN_PATH_CXX" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_TOOLCHAIN_PATH_CXX="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_TOOLCHAIN_PATH_CXX=$ac_cv_path_ac_pt_TOOLCHAIN_PATH_CXX +if test -n "$ac_pt_TOOLCHAIN_PATH_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_TOOLCHAIN_PATH_CXX" >&5 +$as_echo "$ac_pt_TOOLCHAIN_PATH_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_TOOLCHAIN_PATH_CXX" = x; then + TOOLCHAIN_PATH_CXX="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + TOOLCHAIN_PATH_CXX=$ac_pt_TOOLCHAIN_PATH_CXX + fi +else + TOOLCHAIN_PATH_CXX="$ac_cv_path_TOOLCHAIN_PATH_CXX" +fi CXX=$TOOLCHAIN_PATH_CXX PATH="$PATH_save" fi - # AC_PATH_PROGS can't be run multiple times with the same variable, + # AC_PATH_TOOL can't be run multiple times with the same variable, # so create a new name for this run. if test "x$CXX" = x; then - for ac_prog in $SEARCH_LIST -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}$SEARCH_LIST", so it can be a program name with args. +set dummy ${ac_tool_prefix}$SEARCH_LIST; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_POTENTIAL_CXX+:} false; then : @@ -34519,8 +35204,62 @@ fi - test -n "$POTENTIAL_CXX" && break -done +fi +if test -z "$ac_cv_path_POTENTIAL_CXX"; then + ac_pt_POTENTIAL_CXX=$POTENTIAL_CXX + # Extract the first word of "$SEARCH_LIST", so it can be a program name with args. +set dummy $SEARCH_LIST; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_POTENTIAL_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_POTENTIAL_CXX in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_POTENTIAL_CXX="$ac_pt_POTENTIAL_CXX" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_POTENTIAL_CXX="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_POTENTIAL_CXX=$ac_cv_path_ac_pt_POTENTIAL_CXX +if test -n "$ac_pt_POTENTIAL_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_POTENTIAL_CXX" >&5 +$as_echo "$ac_pt_POTENTIAL_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_POTENTIAL_CXX" = x; then + POTENTIAL_CXX="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + POTENTIAL_CXX=$ac_pt_POTENTIAL_CXX + fi +else + POTENTIAL_CXX="$ac_cv_path_POTENTIAL_CXX" +fi CXX=$POTENTIAL_CXX fi @@ -47875,173 +48614,63 @@ # Check whether --with-jtreg was given. if test "${with_jtreg+set}" = set; then : withval=$with_jtreg; -else - with_jtreg=no fi if test "x$with_jtreg" = xno; then # jtreg disabled - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg" >&5 -$as_echo_n "checking for jtreg... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - else - if test "x$with_jtreg" != xyes; then - # with path specified. - JT_HOME="$with_jtreg" - fi - + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg test harness" >&5 +$as_echo_n "checking for jtreg test harness... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, disabled" >&5 +$as_echo "no, disabled" >&6; } + elif test "x$with_jtreg" != xyes && test "x$with_jtreg" != x; then + # An explicit path is specified, use it. + JT_HOME="$with_jtreg" + if test ! -d "$JT_HOME"; then + as_fn_error $? "jtreg home directory from --with-jtreg=$with_jtreg does not exist" "$LINENO" 5 + fi + + if test ! -e "$JT_HOME/lib/jtreg.jar"; then + as_fn_error $? "jtreg home directory from --with-jtreg=$with_jtreg is not a valid jtreg home" "$LINENO" 5 + fi + + JTREGEXE="$JT_HOME/bin/jtreg" + if test ! -x "$JTREGEXE"; then + as_fn_error $? "jtreg home directory from --with-jtreg=$with_jtreg does not contain valid jtreg executable" "$LINENO" 5 + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg test harness" >&5 +$as_echo_n "checking for jtreg test harness... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JT_HOME" >&5 +$as_echo "$JT_HOME" >&6; } + else + # Try to locate jtreg if test "x$JT_HOME" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg" >&5 -$as_echo_n "checking for jtreg... " >&6; } - - # use JT_HOME enviroment var. - - # Only process if variable expands to non-empty - - if test "x$JT_HOME" != x; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - - # Input might be given as Windows format, start by converting to - # unix format. - path="$JT_HOME" - new_path=`$CYGPATH -u "$path"` - - # Cygwin tries to hide some aspects of the Windows file system, such that binaries are - # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered - # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then - # "foo.exe" is OK but "foo" is an error. - # - # This test is therefore slightly more accurate than "test -f" to check for file precense. - # It is also a way to make sure we got the proper file name for the real test later on. - test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` - if test "x$test_shortpath" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5 -$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Cannot locate the the path of JT_HOME" "$LINENO" 5 - fi - - # Call helper function which possibly converts this using DOS-style short mode. - # If so, the updated path is stored in $new_path. - - input_path="$new_path" - # Check if we need to convert this using DOS-style short mode. If the path - # contains just simple characters, use it. Otherwise (spaces, weird characters), - # take no chances and rewrite it. - # Note: m4 eats our [], so we need to use [ and ] instead. - has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` - if test "x$has_forbidden_chars" != x; then - # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) - shortmode_path=`$CYGPATH -s -m -a "$input_path"` - path_after_shortmode=`$CYGPATH -u "$shortmode_path"` - if test "x$path_after_shortmode" != "x$input_to_shortpath"; then - # Going to short mode and back again did indeed matter. Since short mode is - # case insensitive, let's make it lowercase to improve readability. - shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-style (cygpath) - input_path=`$CYGPATH -u "$shortmode_path"` - new_path="$input_path" - fi - fi - - test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` - if test "x$test_cygdrive_prefix" = x; then - # As a simple fix, exclude /usr/bin since it's not a real path. - if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then - # The path is in a Cygwin special directory (e.g. /home). We need this converted to - # a path prefixed by /cygdrive for fixpath to work. - new_path="$CYGWIN_ROOT_PATH$input_path" - fi - fi - - - if test "x$path" != "x$new_path"; then - JT_HOME="$new_path" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5 -$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;} - fi - - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - - path="$JT_HOME" - has_colon=`$ECHO $path | $GREP ^.:` - new_path="$path" - if test "x$has_colon" = x; then - # Not in mixed or Windows style, start by that. - new_path=`cmd //c echo $path` - fi - - - input_path="$new_path" - # Check if we need to convert this using DOS-style short mode. If the path - # contains just simple characters, use it. Otherwise (spaces, weird characters), - # take no chances and rewrite it. - # Note: m4 eats our [], so we need to use [ and ] instead. - has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` - if test "x$has_forbidden_chars" != x; then - # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) - new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - fi - - - windows_path="$new_path" - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - unix_path=`$CYGPATH -u "$windows_path"` - new_path="$unix_path" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` - new_path="$unix_path" - fi - - if test "x$path" != "x$new_path"; then - JT_HOME="$new_path" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5 -$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;} - fi - - # Save the first 10 bytes of this path to the storage, so fixpath can work. - all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - - else - # We're on a unix platform. Hooray! :) - path="$JT_HOME" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5 -$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of JT_HOME, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - if test -d "$path"; then - JT_HOME="`cd "$path"; $THEPWDCMD -L`" - else - dir="`$DIRNAME "$path"`" - base="`$BASENAME "$path"`" - JT_HOME="`cd "$dir"; $THEPWDCMD -L`/$base" - fi - fi - fi - - - # jtreg win32 script works for everybody - JTREGEXE="$JT_HOME/bin/jtreg" - - if test ! -f "$JTREGEXE"; then - as_fn_error $? "JTReg executable does not exist: $JTREGEXE" "$LINENO" 5 - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JTREGEXE" >&5 -$as_echo "$JTREGEXE" >&6; } - else - # try to find jtreg on path - + # JT_HOME set in environment, use it + if test ! -d "$JT_HOME"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring JT_HOME pointing to invalid directory: $JT_HOME" >&5 +$as_echo "$as_me: WARNING: Ignoring JT_HOME pointing to invalid directory: $JT_HOME" >&2;} + JT_HOME= + else + if test ! -e "$JT_HOME/lib/jtreg.jar"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring JT_HOME which is not a valid jtreg home: $JT_HOME" >&5 +$as_echo "$as_me: WARNING: Ignoring JT_HOME which is not a valid jtreg home: $JT_HOME" >&2;} + JT_HOME= + elif test ! -x "$JT_HOME/bin/jtreg"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring JT_HOME which does not contain valid jtreg executable: $JT_HOME" >&5 +$as_echo "$as_me: WARNING: Ignoring JT_HOME which does not contain valid jtreg executable: $JT_HOME" >&2;} + JT_HOME= + else + JTREGEXE="$JT_HOME/bin/jtreg" + { $as_echo "$as_me:${as_lineno-$LINENO}: Located jtreg using JT_HOME from environment" >&5 +$as_echo "$as_me: Located jtreg using JT_HOME from environment" >&6;} + fi + fi + fi + + if test "x$JT_HOME" = x; then + # JT_HOME is not set in environment, or was deemed invalid. + # Try to find jtreg on path # Publish this variable in the help. @@ -48239,13 +48868,451 @@ fi - - if test "x$JTREGEXE" = x; then - as_fn_error $? "Could not find required tool for JTREGEXE" "$LINENO" 5 - fi - - - JT_HOME="`$DIRNAME $JTREGEXE`" + if test "x$JTREGEXE" != x; then + # That's good, now try to derive JT_HOME + JT_HOME=`(cd $($DIRNAME $JTREGEXE)/.. && pwd)` + if test ! -e "$JT_HOME/lib/jtreg.jar"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring jtreg from path since a valid jtreg home cannot be found" >&5 +$as_echo "$as_me: WARNING: Ignoring jtreg from path since a valid jtreg home cannot be found" >&2;} + JT_HOME= + JTREGEXE= + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Located jtreg using jtreg executable in path" >&5 +$as_echo "$as_me: Located jtreg using jtreg executable in path" >&6;} + fi + fi + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg test harness" >&5 +$as_echo_n "checking for jtreg test harness... " >&6; } + if test "x$JT_HOME" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JT_HOME" >&5 +$as_echo "$JT_HOME" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, not found" >&5 +$as_echo "no, not found" >&6; } + + if test "x$with_jtreg" = xyes; then + as_fn_error $? "--with-jtreg was specified, but no jtreg found." "$LINENO" 5 + fi + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$JTREGEXE" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # First separate the path from the arguments. This will split at the first + # space. + complete="$JTREGEXE" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Input might be given as Windows format, start by converting to + # unix format. + new_path=`$CYGPATH -u "$path"` + + # Now try to locate executable using which + new_path=`$WHICH "$new_path" 2> /dev/null` + # bat and cmd files are not always considered executable in cygwin causing which + # to not find them + if test "x$new_path" = x \ + && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ + && test "x`$LS \"$path\" 2>/dev/null`" != x; then + new_path=`$CYGPATH -u "$path"` + fi + if test "x$new_path" = x; then + # Oops. Which didn't find the executable. + # The splitting of arguments from the executable at a space might have been incorrect, + # since paths with space are more likely in Windows. Give it another try with the whole + # argument. + path="$complete" + arguments="EOL" + new_path=`$CYGPATH -u "$path"` + new_path=`$WHICH "$new_path" 2> /dev/null` + # bat and cmd files are not always considered executable in cygwin causing which + # to not find them + if test "x$new_path" = x \ + && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ + && test "x`$LS \"$path\" 2>/dev/null`" != x; then + new_path=`$CYGPATH -u "$path"` + fi + if test "x$new_path" = x; then + # It's still not found. Now this is an unrecoverable error. + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&5 +$as_echo "$as_me: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&6;} + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5 +$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;} + fi + as_fn_error $? "Cannot locate the the path of JTREGEXE" "$LINENO" 5 + fi + fi + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file presence. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + # Short path failed, file does not exist as specified. + # Try adding .exe or .cmd + if test -f "${new_path}.exe"; then + input_to_shortpath="${new_path}.exe" + elif test -f "${new_path}.cmd"; then + input_to_shortpath="${new_path}.cmd" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JTREGEXE, which resolves as \"$new_path\", is invalid." >&5 +$as_echo "$as_me: The path of JTREGEXE, which resolves as \"$new_path\", is invalid." >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&5 +$as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&6;} + as_fn_error $? "Cannot locate the the path of JTREGEXE" "$LINENO" 5 + fi + else + input_to_shortpath="$new_path" + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + new_path="$input_to_shortpath" + + input_path="$input_to_shortpath" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $input_to_shortpath | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + # remove trailing .exe if any + new_path="${new_path/%.exe/}" + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + # First separate the path from the arguments. This will split at the first + # space. + complete="$JTREGEXE" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Input might be given as Windows format, start by converting to + # unix format. + new_path="$path" + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + + # Now try to locate executable using which + new_path=`$WHICH "$new_path" 2> /dev/null` + + if test "x$new_path" = x; then + # Oops. Which didn't find the executable. + # The splitting of arguments from the executable at a space might have been incorrect, + # since paths with space are more likely in Windows. Give it another try with the whole + # argument. + path="$complete" + arguments="EOL" + new_path="$path" + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + + new_path=`$WHICH "$new_path" 2> /dev/null` + # bat and cmd files are not always considered executable in MSYS causing which + # to not find them + if test "x$new_path" = x \ + && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ + && test "x`$LS \"$path\" 2>/dev/null`" != x; then + new_path="$path" + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + fi + + if test "x$new_path" = x; then + # It's still not found. Now this is an unrecoverable error. + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&5 +$as_echo "$as_me: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&6;} + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5 +$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;} + fi + as_fn_error $? "Cannot locate the the path of JTREGEXE" "$LINENO" 5 + fi + fi + + # Now new_path has a complete unix path to the binary + if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then + # Keep paths in /bin as-is, but remove trailing .exe if any + new_path="${new_path/%.exe/}" + # Do not save /bin paths to all_fixpath_prefixes! + else + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $new_path` + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + # Output is in $new_path + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + # remove trailing .exe if any + new_path="${new_path/%.exe/}" + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + fi + + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$JTREGEXE" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&5 +$as_echo "$as_me: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&6;} + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 +$as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} + fi + as_fn_error $? "Cannot locate the the path of JTREGEXE" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + JTREGEXE="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JTREGEXE to \"$new_complete\"" >&5 +$as_echo "$as_me: Rewriting JTREGEXE to \"$new_complete\"" >&6;} + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$JT_HOME" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$JT_HOME" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of JT_HOME" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + JT_HOME="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$JT_HOME" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + JT_HOME="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$JT_HOME" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of JT_HOME, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + if test -d "$path"; then + JT_HOME="`cd "$path"; $THEPWDCMD -L`" + else + dir="`$DIRNAME "$path"`" + base="`$BASENAME "$path"`" + JT_HOME="`cd "$dir"; $THEPWDCMD -L`/$base" + fi fi fi @@ -49060,7 +50127,7 @@ SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG" JVM_CFLAGS="$JVM_CFLAGS $PICFLAG" fi - SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.' + SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path$(or $1,/.)' SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN" SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/$1' SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,$1' @@ -49080,7 +50147,7 @@ # Linking is different on MacOSX PICFLAG='' SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG" - SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.' + SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path$(or $1,/.)' SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN" SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/$1' SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,$1' @@ -52629,12 +53696,12 @@ # Only enable AOT on linux-X64. if test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = "xlinux-x86_64"; then if test -e "$HOTSPOT_TOPDIR/src/jdk.aot"; then - if test -e "$HOTSPOT_TOPDIR/src/jdk.vm.compiler"; then + if test -e "$HOTSPOT_TOPDIR/src/jdk.internal.vm.compiler"; then ENABLE_AOT="true" else ENABLE_AOT="false" if test "x$enable_aot" = "xyes"; then - as_fn_error $? "Cannot build AOT without hotspot/src/jdk.vm.compiler sources. Remove --enable-aot." "$LINENO" 5 + as_fn_error $? "Cannot build AOT without hotspot/src/jdk.internal.vm.compiler sources. Remove --enable-aot." "$LINENO" 5 fi fi else @@ -56642,6 +57709,12 @@ fi +# Check whether --with-freetype-license was given. +if test "${with_freetype_license+set}" = set; then : + withval=$with_freetype_license; +fi + + # Need to specify explicitly since it needs to be overridden on some versions of macosx FREETYPE_BASE_NAME=freetype FREETYPE_CFLAGS= @@ -62588,6 +63661,153 @@ fi # end freetype needed + FREETYPE_LICENSE="" + if test "x$with_freetype_license" = "xyes"; then + as_fn_error $? "--with-freetype-license must have a value" "$LINENO" 5 + elif test "x$with_freetype_license" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype license" >&5 +$as_echo_n "checking for freetype license... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_freetype_license" >&5 +$as_echo "$with_freetype_license" >&6; } + FREETYPE_LICENSE="$with_freetype_license" + + # Only process if variable expands to non-empty + + if test "x$FREETYPE_LICENSE" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$FREETYPE_LICENSE" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of FREETYPE_LICENSE" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + FREETYPE_LICENSE="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$FREETYPE_LICENSE" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + FREETYPE_LICENSE="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$FREETYPE_LICENSE" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of FREETYPE_LICENSE, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + if test -d "$path"; then + FREETYPE_LICENSE="`cd "$path"; $THEPWDCMD -L`" + else + dir="`$DIRNAME "$path"`" + base="`$BASENAME "$path"`" + FREETYPE_LICENSE="`cd "$dir"; $THEPWDCMD -L`/$base" + fi + fi + fi + + if test ! -f "$FREETYPE_LICENSE"; then + as_fn_error $? "$FREETYPE_LICENSE cannot be found" "$LINENO" 5 + fi + fi + + @@ -64365,8 +65585,8 @@ JVM_FEATURES_jvmci="" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if jdk.vm.compiler should be built" >&5 -$as_echo_n "checking if jdk.vm.compiler should be built... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if jdk.internal.vm.compiler should be built" >&5 +$as_echo_n "checking if jdk.internal.vm.compiler should be built... " >&6; } if [[ " $JVM_FEATURES " =~ " graal " ]] ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, forced" >&5 $as_echo "yes, forced" >&6; } diff -r 830e16e5eef5 -r d9f6bc6ba599 common/autoconf/hotspot.m4 --- a/common/autoconf/hotspot.m4 Mon Jul 03 13:18:55 2017 -0700 +++ b/common/autoconf/hotspot.m4 Thu Aug 24 16:26:58 2017 +0200 @@ -215,12 +215,12 @@ # Only enable AOT on linux-X64. if test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = "xlinux-x86_64"; then if test -e "$HOTSPOT_TOPDIR/src/jdk.aot"; then - if test -e "$HOTSPOT_TOPDIR/src/jdk.vm.compiler"; then + if test -e "$HOTSPOT_TOPDIR/src/jdk.internal.vm.compiler"; then ENABLE_AOT="true" else ENABLE_AOT="false" if test "x$enable_aot" = "xyes"; then - AC_MSG_ERROR([Cannot build AOT without hotspot/src/jdk.vm.compiler sources. Remove --enable-aot.]) + AC_MSG_ERROR([Cannot build AOT without hotspot/src/jdk.internal.vm.compiler sources. Remove --enable-aot.]) fi fi else @@ -327,7 +327,7 @@ JVM_FEATURES_jvmci="" fi - AC_MSG_CHECKING([if jdk.vm.compiler should be built]) + AC_MSG_CHECKING([if jdk.internal.vm.compiler should be built]) if HOTSPOT_CHECK_JVM_FEATURE(graal); then AC_MSG_RESULT([yes, forced]) if test "x$JVM_FEATURES_jvmci" != "xjvmci" ; then diff -r 830e16e5eef5 -r d9f6bc6ba599 common/autoconf/jdk-options.m4 --- a/common/autoconf/jdk-options.m4 Mon Jul 03 13:18:55 2017 -0700 +++ b/common/autoconf/jdk-options.m4 Thu Aug 24 16:26:58 2017 +0200 @@ -154,6 +154,55 @@ AC_SUBST(ENABLE_HEADLESS_ONLY) + # Should we build the complete docs, or just a lightweight version? + AC_ARG_ENABLE([full-docs], [AS_HELP_STRING([--enable-full-docs], + [build complete documentation @<:@enabled if all tools found@:>@])]) + + # Verify dependencies + AC_MSG_CHECKING([for graphviz dot]) + if test "x$DOT" != "x"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no, cannot generate full docs]) + FULL_DOCS_DEP_MISSING=true + fi + + AC_MSG_CHECKING([for pandoc]) + if test "x$PANDOC" != "x"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no, cannot generate full docs]) + FULL_DOCS_DEP_MISSING=true + fi + + AC_MSG_CHECKING([full docs]) + if test "x$enable_full_docs" = xyes; then + if test "x$FULL_DOCS_DEP_MISSING" = "xtrue"; then + AC_MSG_RESULT([no, missing dependencies]) + HELP_MSG_MISSING_DEPENDENCY([dot]) + AC_MSG_ERROR([Cannot enable full docs with missing dependencies. See above. $HELP_MSG]) + else + ENABLE_FULL_DOCS=true + AC_MSG_RESULT([yes, forced]) + fi + elif test "x$enable_full_docs" = xno; then + ENABLE_FULL_DOCS=false + AC_MSG_RESULT([no, forced]) + elif test "x$enable_full_docs" = x; then + # Check for prerequisites + if test "x$FULL_DOCS_DEP_MISSING" = xtrue; then + ENABLE_FULL_DOCS=false + AC_MSG_RESULT([no, missing dependencies]) + else + ENABLE_FULL_DOCS=true + AC_MSG_RESULT([yes, dependencies present]) + fi + else + AC_MSG_ERROR([--enable-full-docs can only take yes or no]) + fi + + AC_SUBST(ENABLE_FULL_DOCS) + # Choose cacerts source file AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file], [specify alternative cacerts file])]) diff -r 830e16e5eef5 -r d9f6bc6ba599 common/autoconf/lib-freetype.m4 --- a/common/autoconf/lib-freetype.m4 Mon Jul 03 13:18:55 2017 -0700 +++ b/common/autoconf/lib-freetype.m4 Thu Aug 24 16:26:58 2017 +0200 @@ -194,6 +194,8 @@ [specify directory with freetype sources to automatically build the library (experimental, Windows-only)])]) AC_ARG_ENABLE(freetype-bundling, [AS_HELP_STRING([--disable-freetype-bundling], [disable bundling of the freetype library with the build result @<:@enabled on Windows or when using --with-freetype, disabled otherwise@:>@])]) + AC_ARG_WITH(freetype-license, [AS_HELP_STRING([--with-freetype-license], + [if bundling freetype, also bundle this license file])]) # Need to specify explicitly since it needs to be overridden on some versions of macosx FREETYPE_BASE_NAME=freetype @@ -443,7 +445,21 @@ fi # end freetype needed + FREETYPE_LICENSE="" + if test "x$with_freetype_license" = "xyes"; then + AC_MSG_ERROR([--with-freetype-license must have a value]) + elif test "x$with_freetype_license" != "x"; then + AC_MSG_CHECKING([for freetype license]) + AC_MSG_RESULT([$with_freetype_license]) + FREETYPE_LICENSE="$with_freetype_license" + BASIC_FIXUP_PATH(FREETYPE_LICENSE) + if test ! -f "$FREETYPE_LICENSE"; then + AC_MSG_ERROR([$FREETYPE_LICENSE cannot be found]) + fi + fi + AC_SUBST(FREETYPE_BUNDLE_LIB_PATH) AC_SUBST(FREETYPE_CFLAGS) AC_SUBST(FREETYPE_LIBS) + AC_SUBST(FREETYPE_LICENSE) ]) diff -r 830e16e5eef5 -r d9f6bc6ba599 common/autoconf/platform.m4 --- a/common/autoconf/platform.m4 Mon Jul 03 13:18:55 2017 -0700 +++ b/common/autoconf/platform.m4 Thu Aug 24 16:26:58 2017 +0200 @@ -436,32 +436,42 @@ AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES], [ if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then - REQUIRED_OS_NAME=SunOS - REQUIRED_OS_VERSION=5.10 + RELEASE_FILE_OS_NAME=SunOS fi if test "x$OPENJDK_TARGET_OS" = "xlinux"; then - REQUIRED_OS_NAME=Linux - REQUIRED_OS_VERSION=2.6 + RELEASE_FILE_OS_NAME=Linux fi if test "x$OPENJDK_TARGET_OS" = "xwindows"; then - REQUIRED_OS_NAME=Windows - if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then - REQUIRED_OS_VERSION=5.2 - else - REQUIRED_OS_VERSION=5.1 - fi + RELEASE_FILE_OS_NAME=Windows fi - if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then - REQUIRED_OS_NAME=Darwin - REQUIRED_OS_VERSION=11.2 + if test "x$OPENJDK_TARGET_OS" = xmacosx; then + RELEASE_FILE_OS_NAME="Darwin" fi if test "x$OPENJDK_TARGET_OS" = "xaix"; then - REQUIRED_OS_NAME=AIX - REQUIRED_OS_VERSION=7.1 + RELEASE_FILE_OS_NAME="AIX" + fi + RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU} + + AC_SUBST(RELEASE_FILE_OS_NAME) + AC_SUBST(RELEASE_FILE_OS_ARCH) +]) + +AC_DEFUN([PLATFORM_SET_MODULE_TARGET_OS_VALUES], +[ + if test "x$OPENJDK_TARGET_OS" = xmacosx; then + OPENJDK_MODULE_TARGET_OS_NAME="macos" + else + OPENJDK_MODULE_TARGET_OS_NAME="$OPENJDK_TARGET_OS" fi - AC_SUBST(REQUIRED_OS_NAME) - AC_SUBST(REQUIRED_OS_VERSION) + if test "x$OPENJDK_TARGET_CPU" = xx86_64; then + OPENJDK_MODULE_TARGET_OS_ARCH="amd64" + else + OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU" + fi + + OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}" + AC_SUBST(OPENJDK_MODULE_TARGET_PLATFORM) ]) #%%% Build and target systems %%% @@ -478,6 +488,7 @@ PLATFORM_EXTRACT_TARGET_AND_BUILD PLATFORM_SETUP_TARGET_CPU_BITS + PLATFORM_SET_MODULE_TARGET_OS_VALUES PLATFORM_SET_RELEASE_FILE_OS_VALUES PLATFORM_SETUP_LEGACY_VARS ]) diff -r 830e16e5eef5 -r d9f6bc6ba599 common/autoconf/spec.gmk.in --- a/common/autoconf/spec.gmk.in Mon Jul 03 13:18:55 2017 -0700 +++ b/common/autoconf/spec.gmk.in Thu Aug 24 16:26:58 2017 +0200 @@ -101,9 +101,12 @@ OPENJDK_BUILD_CPU_BITS:=@OPENJDK_BUILD_CPU_BITS@ OPENJDK_BUILD_CPU_ENDIAN:=@OPENJDK_BUILD_CPU_ENDIAN@ -# Legacy OS values for use in release file. -REQUIRED_OS_NAME:=@REQUIRED_OS_NAME@ -REQUIRED_OS_VERSION:=@REQUIRED_OS_VERSION@ +# Target platform value in ModuleTarget class file attribute. +OPENJDK_MODULE_TARGET_PLATFORM:=@OPENJDK_MODULE_TARGET_PLATFORM@ + +# OS_* properties in release file +RELEASE_FILE_OS_NAME:=@RELEASE_FILE_OS_NAME@ +RELEASE_FILE_OS_ARCH:=@RELEASE_FILE_OS_ARCH@ LIBM:=@LIBM@ LIBDL:=@LIBDL@ @@ -244,6 +247,8 @@ # Only build headless support or not ENABLE_HEADLESS_ONLY := @ENABLE_HEADLESS_ONLY@ +ENABLE_FULL_DOCS := @ENABLE_FULL_DOCS@ + # JDK_OUTPUTDIR specifies where a working jvm is built. # You can run $(JDK_OUTPUTDIR)/bin/java # Though the layout of the contents of $(JDK_OUTPUTDIR) is not @@ -266,9 +271,6 @@ TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/test-make MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support -# By default, output javadoc directly into image -JAVADOC_OUTPUTDIR = $(DOCS_IMAGE_DIR) - # This does not get overridden in a bootcycle build CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@ BUILDJDK_OUTPUTDIR=$(BUILD_OUTPUT)/buildjdk @@ -310,6 +312,7 @@ FREETYPE_LIBS:=@FREETYPE_LIBS@ FREETYPE_CFLAGS:=@FREETYPE_CFLAGS@ FREETYPE_BUNDLE_LIB_PATH=@FREETYPE_BUNDLE_LIB_PATH@ +FREETYPE_LICENSE=@FREETYPE_LICENSE@ CUPS_CFLAGS:=@CUPS_CFLAGS@ ALSA_LIBS:=@ALSA_LIBS@ ALSA_CFLAGS:=@ALSA_CFLAGS@ @@ -574,20 +577,31 @@ # Use ?= as this can be overridden from bootcycle-spec.gmk BOOT_JDK_MODULAR ?= @BOOT_JDK_MODULAR@ -INTERIM_OVERRIDE_MODULES := java.compiler jdk.compiler \ - jdk.jdeps jdk.javadoc jdk.rmic +INTERIM_LANGTOOLS_OVERRIDE_MODULES := java.compiler jdk.compiler \ + jdk.jdeps jdk.javadoc +INTERIM_RMIC_OVERRIDE_MODULES := jdk.rmic ifeq ($(BOOT_JDK_MODULAR), true) - INTERIM_OVERRIDE_MODULES_ARGS = $(foreach m, $(INTERIM_OVERRIDE_MODULES), \ + INTERIM_LANGTOOLS_OVERRIDE_MODULES_ARGS = $(foreach m, \ + $(INTERIM_LANGTOOLS_OVERRIDE_MODULES), \ --patch-module $m=$(BUILDTOOLS_OUTPUTDIR)/override_modules/$m) - INTERIM_LANGTOOLS_ARGS = $(INTERIM_OVERRIDE_MODULES_ARGS) + INTERIM_RMIC_OVERRIDE_MODULES_ARGS = $(foreach m, \ + $(INTERIM_LANGTOOLS_OVERRIDE_MODULES) \ + $(INTERIM_RMIC_OVERRIDE_MODULES), \ + --patch-module $m=$(BUILDTOOLS_OUTPUTDIR)/override_modules/$m) + INTERIM_LANGTOOLS_ARGS = $(INTERIM_LANGTOOLS_OVERRIDE_MODULES_ARGS) JAVAC_MAIN_CLASS = -m jdk.compiler/com.sun.tools.javac.Main JAVADOC_MAIN_CLASS = -m jdk.javadoc/jdk.javadoc.internal.tool.Main else - INTERIM_OVERRIDE_MODULES_ARGS = \ + INTERIM_LANGTOOLS_OVERRIDE_MODULES_ARGS = \ -Xbootclasspath/p:$(call PathList, \ $(addprefix $(BUILDTOOLS_OUTPUTDIR)/override_modules/, \ - $(INTERIM_OVERRIDE_MODULES))) - INTERIM_LANGTOOLS_ARGS = $(INTERIM_OVERRIDE_MODULES_ARGS) \ + $(INTERIM_LANGTOOLS_OVERRIDE_MODULES))) + INTERIM_RMIC_OVERRIDE_MODULES_ARGS = \ + -Xbootclasspath/p:$(call PathList, \ + $(addprefix $(BUILDTOOLS_OUTPUTDIR)/override_modules/, \ + $(INTERIM_LANGTOOLS_OVERRIDE_MODULES) \ + $(INTERIM_RMIC_OVERRIDE_MODULES))) + INTERIM_LANGTOOLS_ARGS = $(INTERIM_LANGTOOLS_OVERRIDE_MODULES_ARGS) \ -cp $(BUILDTOOLS_OUTPUTDIR)/override_modules/jdk.compiler JAVAC_MAIN_CLASS = com.sun.tools.javac.Main JAVADOC_MAIN_CLASS = jdk.javadoc.internal.tool.Main @@ -637,6 +651,7 @@ MV:=@MV@ NAWK:=@NAWK@ NICE:=@NICE@ +PANDOC:=@FIXPATH@ @PANDOC@ PATCH:=@PATCH@ PRINTF:=@PRINTF@ RM:=@RM@ @@ -665,6 +680,7 @@ READELF:=@READELF@ EXPR:=@EXPR@ FILE:=@FILE@ +DOT:=@DOT@ HG:=@HG@ OBJCOPY:=@OBJCOPY@ SETFILE:=@SETFILE@ @@ -800,6 +816,8 @@ # Docs image DOCS_IMAGE_SUBDIR := docs DOCS_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(DOCS_IMAGE_SUBDIR) +# Output docs directly into image +DOCS_OUTPUTDIR := $(DOCS_IMAGE_DIR) # Macosx bundles directory definitions JDK_MACOSX_BUNDLE_SUBDIR=jdk-bundle @@ -828,11 +846,6 @@ jre-$(VERSION_SHORT)+$(VERSION_BUILD)-compact3_$(OPENJDK_TARGET_BUNDLE_PLATFORM)_bin$(DEBUG_PART).tar.gz JDK_SYMBOLS_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz JRE_SYMBOLS_BUNDLE_NAME := jre-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz -ifeq ($(OPENJDK_TARGET_OS), windows) - DEMOS_BUNDLE_NAME := jdk-$(BASE_NAME)_demo$(DEBUG_PART).zip -else - DEMOS_BUNDLE_NAME := jdk-$(BASE_NAME)_demo$(DEBUG_PART).tar.gz -endif TEST_BUNDLE_NAME := jdk-$(BASE_NAME)_bin-tests$(DEBUG_PART).tar.gz DOCS_BUNDLE_NAME := jdk-$(BASE_NAME)_doc-api-spec$(DEBUG_PART).tar.gz @@ -840,7 +853,6 @@ JRE_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JRE_BUNDLE_NAME) JDK_SYMBOLS_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JDK_SYMBOLS_BUNDLE_NAME) JRE_SYMBOLS_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JRE_SYMBOLS_BUNDLE_NAME) -DEMOS_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(DEMOS_BUNDLE_NAME) TEST_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(TEST_BUNDLE_NAME) DOCS_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(DOCS_BUNDLE_NAME) diff -r 830e16e5eef5 -r d9f6bc6ba599 common/autoconf/toolchain.m4 --- a/common/autoconf/toolchain.m4 Mon Jul 03 13:18:55 2017 -0700 +++ b/common/autoconf/toolchain.m4 Thu Aug 24 16:26:58 2017 +0200 @@ -440,7 +440,7 @@ # # $1 = compiler to test (CC or CXX) # $2 = human readable name of compiler (C or C++) -# $3 = list of compiler names to search for +# $3 = compiler name to search for AC_DEFUN([TOOLCHAIN_FIND_COMPILER], [ COMPILER_NAME=$2 @@ -482,15 +482,15 @@ if test -n "$TOOLCHAIN_PATH"; then PATH_save="$PATH" PATH="$TOOLCHAIN_PATH" - AC_PATH_PROGS(TOOLCHAIN_PATH_$1, $SEARCH_LIST) + AC_PATH_TOOL(TOOLCHAIN_PATH_$1, $SEARCH_LIST) $1=$TOOLCHAIN_PATH_$1 PATH="$PATH_save" fi - # AC_PATH_PROGS can't be run multiple times with the same variable, + # AC_PATH_TOOL can't be run multiple times with the same variable, # so create a new name for this run. if test "x[$]$1" = x; then - AC_PATH_PROGS(POTENTIAL_$1, $SEARCH_LIST) + AC_PATH_TOOL(POTENTIAL_$1, $SEARCH_LIST) $1=$POTENTIAL_$1 fi @@ -926,41 +926,82 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG], [ AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg], - [Regression Test Harness @<:@probed@:>@])], - [], - [with_jtreg=no]) + [Regression Test Harness @<:@probed@:>@])]) if test "x$with_jtreg" = xno; then # jtreg disabled - AC_MSG_CHECKING([for jtreg]) - AC_MSG_RESULT(no) - else - if test "x$with_jtreg" != xyes; then - # with path specified. - JT_HOME="$with_jtreg" + AC_MSG_CHECKING([for jtreg test harness]) + AC_MSG_RESULT([no, disabled]) + elif test "x$with_jtreg" != xyes && test "x$with_jtreg" != x; then + # An explicit path is specified, use it. + JT_HOME="$with_jtreg" + if test ! -d "$JT_HOME"; then + AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg does not exist]) fi + if test ! -e "$JT_HOME/lib/jtreg.jar"; then + AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg is not a valid jtreg home]) + fi + + JTREGEXE="$JT_HOME/bin/jtreg" + if test ! -x "$JTREGEXE"; then + AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg does not contain valid jtreg executable]) + fi + + AC_MSG_CHECKING([for jtreg test harness]) + AC_MSG_RESULT([$JT_HOME]) + else + # Try to locate jtreg if test "x$JT_HOME" != x; then - AC_MSG_CHECKING([for jtreg]) + # JT_HOME set in environment, use it + if test ! -d "$JT_HOME"; then + AC_MSG_WARN([Ignoring JT_HOME pointing to invalid directory: $JT_HOME]) + JT_HOME= + else + if test ! -e "$JT_HOME/lib/jtreg.jar"; then + AC_MSG_WARN([Ignoring JT_HOME which is not a valid jtreg home: $JT_HOME]) + JT_HOME= + elif test ! -x "$JT_HOME/bin/jtreg"; then + AC_MSG_WARN([Ignoring JT_HOME which does not contain valid jtreg executable: $JT_HOME]) + JT_HOME= + else + JTREGEXE="$JT_HOME/bin/jtreg" + AC_MSG_NOTICE([Located jtreg using JT_HOME from environment]) + fi + fi + fi - # use JT_HOME enviroment var. - BASIC_FIXUP_PATH([JT_HOME]) + if test "x$JT_HOME" = x; then + # JT_HOME is not set in environment, or was deemed invalid. + # Try to find jtreg on path + BASIC_PATH_PROGS(JTREGEXE, jtreg) + if test "x$JTREGEXE" != x; then + # That's good, now try to derive JT_HOME + JT_HOME=`(cd $($DIRNAME $JTREGEXE)/.. && pwd)` + if test ! -e "$JT_HOME/lib/jtreg.jar"; then + AC_MSG_WARN([Ignoring jtreg from path since a valid jtreg home cannot be found]) + JT_HOME= + JTREGEXE= + else + AC_MSG_NOTICE([Located jtreg using jtreg executable in path]) + fi + fi + fi - # jtreg win32 script works for everybody - JTREGEXE="$JT_HOME/bin/jtreg" + AC_MSG_CHECKING([for jtreg test harness]) + if test "x$JT_HOME" != x; then + AC_MSG_RESULT([$JT_HOME]) + else + AC_MSG_RESULT([no, not found]) - if test ! -f "$JTREGEXE"; then - AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE]) + if test "x$with_jtreg" = xyes; then + AC_MSG_ERROR([--with-jtreg was specified, but no jtreg found.]) fi - - AC_MSG_RESULT($JTREGEXE) - else - # try to find jtreg on path - BASIC_REQUIRE_PROGS(JTREGEXE, jtreg) - JT_HOME="`$DIRNAME $JTREGEXE`" fi fi + BASIC_FIXUP_EXECUTABLE(JTREGEXE) + BASIC_FIXUP_PATH(JT_HOME) AC_SUBST(JT_HOME) AC_SUBST(JTREGEXE) ]) diff -r 830e16e5eef5 -r d9f6bc6ba599 common/bin/compare_exceptions.sh.incl --- a/common/bin/compare_exceptions.sh.incl Mon Jul 03 13:18:55 2017 -0700 +++ b/common/bin/compare_exceptions.sh.incl Thu Aug 24 16:26:58 2017 +0200 @@ -38,25 +38,9 @@ if [ "$OPENJDK_TARGET_OS" = "linux" ]; then STRIP_BEFORE_COMPARE=" - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so - ./demo/jvmti/gctest/lib/libgctest.so - ./demo/jvmti/heapTracker/lib/libheapTracker.so - ./demo/jvmti/heapViewer/lib/libheapViewer.so - ./demo/jvmti/minst/lib/libminst.so - ./demo/jvmti/mtrace/lib/libmtrace.so - ./demo/jvmti/versionCheck/lib/libversionCheck.so - ./demo/jvmti/waiters/lib/libwaiters.so " ACCEPTED_BIN_DIFF=" - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so - ./demo/jvmti/gctest/lib/libgctest.so - ./demo/jvmti/heapTracker/lib/libheapTracker.so - ./demo/jvmti/heapViewer/lib/libheapViewer.so - ./demo/jvmti/minst/lib/libminst.so - ./demo/jvmti/mtrace/lib/libmtrace.so - ./demo/jvmti/versionCheck/lib/libversionCheck.so - ./demo/jvmti/waiters/lib/libwaiters.so ./lib/client/libjsig.so ./lib/client/libjvm.so ./lib/libattach.so @@ -151,15 +135,6 @@ if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then STRIP_BEFORE_COMPARE=" - ./demo/jni/Poller/lib/libPoller.so - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so - ./demo/jvmti/gctest/lib/libgctest.so - ./demo/jvmti/heapTracker/lib/libheapTracker.so - ./demo/jvmti/heapViewer/lib/libheapViewer.so - ./demo/jvmti/minst/lib/libminst.so - ./demo/jvmti/mtrace/lib/libmtrace.so - ./demo/jvmti/versionCheck/lib/libversionCheck.so - ./demo/jvmti/waiters/lib/libwaiters.so " SORT_SYMBOLS=" @@ -174,15 +149,6 @@ SKIP_BIN_DIFF="true" ACCEPTED_SMALL_SIZE_DIFF=" - ./demo/jni/Poller/lib/libPoller.so - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so - ./demo/jvmti/gctest/lib/libgctest.so - ./demo/jvmti/heapTracker/lib/libheapTracker.so - ./demo/jvmti/heapViewer/lib/libheapViewer.so - ./demo/jvmti/minst/lib/libminst.so - ./demo/jvmti/mtrace/lib/libmtrace.so - ./demo/jvmti/versionCheck/lib/libversionCheck.so - ./demo/jvmti/waiters/lib/libwaiters.so ./lib/jli/libjli.so ./lib/jspawnhelper ./lib/libJdbcOdbc.so @@ -279,19 +245,9 @@ if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "sparcv9" ]; then STRIP_BEFORE_COMPARE=" - ./demo/jni/Poller/lib/libPoller.so - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so - ./demo/jvmti/gctest/lib/libgctest.so - ./demo/jvmti/heapTracker/lib/libheapTracker.so - ./demo/jvmti/heapViewer/lib/libheapViewer.so - ./demo/jvmti/minst/lib/libminst.so - ./demo/jvmti/mtrace/lib/libmtrace.so - ./demo/jvmti/versionCheck/lib/libversionCheck.so - ./demo/jvmti/waiters/lib/libwaiters.so " SORT_SYMBOLS=" - ./demo/jvmti/waiters/lib/libwaiters.so ./lib/libjsig.so ./lib/libfontmanager.so ./lib/libjimage.so @@ -305,15 +261,6 @@ SKIP_BIN_DIFF="true" ACCEPTED_SMALL_SIZE_DIFF=" - ./demo/jni/Poller/lib/libPoller.so - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so - ./demo/jvmti/gctest/lib/libgctest.so - ./demo/jvmti/heapTracker/lib/libheapTracker.so - ./demo/jvmti/heapViewer/lib/libheapViewer.so - ./demo/jvmti/minst/lib/libminst.so - ./demo/jvmti/mtrace/lib/libmtrace.so - ./demo/jvmti/versionCheck/lib/libversionCheck.so - ./demo/jvmti/waiters/lib/libwaiters.so ./lib/client/libjvm.so ./lib/jli/libjli.so ./lib/jspawnhelper @@ -438,9 +385,6 @@ # Probably should add all libs here ACCEPTED_SMALL_SIZE_DIFF=" - ./demo/jvmti/gctest/lib/gctest.dll - ./demo/jvmti/heapTracker/lib/heapTracker.dll - ./demo/jvmti/minst/lib/minst.dll ./bin/attach.dll ./bin/jsoundds.dll ./bin/client/jvm.dll @@ -579,14 +523,6 @@ ./bin/wsgen ./bin/wsimport ./bin/xjc - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.dylib - ./demo/jvmti/gctest/lib/libgctest.dylib - ./demo/jvmti/heapTracker/lib/libheapTracker.dylib - ./demo/jvmti/heapViewer/lib/libheapViewer.dylib - ./demo/jvmti/minst/lib/libminst.dylib - ./demo/jvmti/mtrace/lib/libmtrace.dylib - ./demo/jvmti/versionCheck/lib/libversionCheck.dylib - ./demo/jvmti/waiters/lib/libwaiters.dylib ./Contents/Home/bin/_javaws ./Contents/Home/bin/javaws ./Contents/Home/bin/idlj diff -r 830e16e5eef5 -r d9f6bc6ba599 common/bin/hgforest.sh --- a/common/bin/hgforest.sh Mon Jul 03 13:18:55 2017 -0700 +++ b/common/bin/hgforest.sh Thu Aug 24 16:26:58 2017 +0200 @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -183,7 +183,7 @@ subrepos="corba jaxp jaxws langtools jdk hotspot nashorn" jdk_subrepos_extra="closed jdk/src/closed jdk/make/closed jdk/test/closed hotspot/make/closed hotspot/src/closed hotspot/test/closed" -subrepos_extra="$jdk_subrepos_extra deploy install sponsors pubs" +subrepos_extra="$jdk_subrepos_extra deploy install sponsors" # Only look in specific locations for possible forests (avoids long searches) pull_default="" diff -r 830e16e5eef5 -r d9f6bc6ba599 common/bin/unshuffle_list.txt --- a/common/bin/unshuffle_list.txt Mon Jul 03 13:18:55 2017 -0700 +++ b/common/bin/unshuffle_list.txt Thu Aug 24 16:26:58 2017 +0200 @@ -361,8 +361,8 @@ jdk/src/java.base/share/native/libverify/check_format.c : jdk/src/share/native/common/check_format.c jdk/src/java.base/share/native/libverify/opcodes.in_out : jdk/src/share/native/common/opcodes.in_out jdk/src/java.base/share/native/libzip : jdk/src/share/native/java/util/zip -jdk/src/java.base/share/native/libzip/zlib-1.2.8 : jdk/src/share/native/java/util/zip/zlib-1.2.8 -jdk/src/java.base/share/native/libzip/zlib-1.2.8/patches/ChangeLog_java : jdk/src/share/native/java/util/zip/zlib-1.2.8/patches/ChangeLog_java +jdk/src/java.base/share/native/libzip/zlib : jdk/src/share/native/java/util/zip/zlib +jdk/src/java.base/share/native/libzip/zlib/patches/ChangeLog_java : jdk/src/share/native/java/util/zip/zlib/patches/ChangeLog_java jdk/src/java.base/unix/classes/java/io : jdk/src/solaris/classes/java/io jdk/src/java.base/unix/classes/java/lang : jdk/src/solaris/classes/java/lang jdk/src/java.base/unix/classes/java/net : jdk/src/solaris/classes/java/net diff -r 830e16e5eef5 -r d9f6bc6ba599 common/bin/update-build-readme.sh --- a/common/bin/update-build-readme.sh Mon Jul 03 13:18:55 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -#!/bin/bash - -# Get an absolute path to this script, since that determines the top-level -# directory. -this_script_dir=`dirname $0` -TOPDIR=`cd $this_script_dir/../.. > /dev/null && pwd` - -GREP=grep -MD_FILE=$TOPDIR/README-builds.md -HTML_FILE=$TOPDIR/README-builds.html - -# Locate the markdown processor tool and check that it is the correct version. -locate_markdown_processor() { - if [ -z "$MARKDOWN" ]; then - MARKDOWN=`which markdown 2> /dev/null` - if [ -z "$MARKDOWN" ]; then - echo "Error: Cannot locate markdown processor" 1>&2 - exit 1 - fi - fi - - # Test version - MARKDOWN_VERSION=`$MARKDOWN -version | $GREP version` - if [ "x$MARKDOWN_VERSION" != "xThis is Markdown, version 1.0.1." ]; then - echo "Error: Expected markdown version 1.0.1." 1>&2 - echo "Actual version found: $MARKDOWN_VERSION" 1>&2 - echo "Download markdown here: https://daringfireball.net/projects/markdown/" 1>&2 - exit 1 - fi - -} - -# Verify that the source markdown file looks sound. -verify_source_code() { - TOO_LONG_LINES=`$GREP -E -e '^.{80}.+$' $MD_FILE` - if [ "x$TOO_LONG_LINES" != x ]; then - echo "Warning: The following lines are longer than 80 characters:" - $GREP -E -e '^.{80}.+$' $MD_FILE - fi -} - -# Convert the markdown file to html format. -process_source() { - echo "Generating html file from markdown" - cat > $HTML_FILE << END - - - OpenJDK Build README - - -END - markdown $MD_FILE >> $HTML_FILE - cat >> $HTML_FILE < - -END - echo "Done" -} - -locate_markdown_processor -verify_source_code -process_source diff -r 830e16e5eef5 -r d9f6bc6ba599 common/conf/jib-profiles.js --- a/common/conf/jib-profiles.js Mon Jul 03 13:18:55 2017 -0700 +++ b/common/conf/jib-profiles.js Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -231,18 +231,16 @@ // List of the main profile names used for iteration common.main_profile_names = [ "linux-x64", "linux-x86", "macosx-x64", "solaris-x64", - "solaris-sparcv9", "windows-x64", "windows-x86" + "solaris-sparcv9", "windows-x64", "windows-x86", + "linux-arm64", "linux-arm-vfp-hflt", "linux-arm-vfp-hflt-dyn" ]; // These are the base setttings for all the main build profiles. common.main_profile_base = { dependencies: ["boot_jdk", "gnumake", "jtreg"], default_make_targets: ["product-bundles", "test-bundles"], - configure_args: [ - "--with-version-opt=" + common.build_id, - "--enable-jtreg-failure-handler", - "--with-version-build=" + common.build_number - ] + configure_args: concat(["--enable-jtreg-failure-handler"], + versionArgs(input, common)) }; // Extra settings for debug profiles common.debug_suffix = "-debug"; @@ -268,10 +266,12 @@ /** * Define common artifacts template for all main profiles - * @param pf - Name of platform in bundle names - * @param demo_ext - Type of extension for demo bundle + * @param o - Object containing data for artifacts */ - common.main_profile_artifacts = function (pf, demo_ext) { + common.main_profile_artifacts = function (o) { + var jdk_subdir = (o.jdk_subdir != null ? o.jdk_subdir : "jdk-" + data.version); + var jre_subdir = (o.jre_subdir != null ? o.jre_subdir : "jre-" + data.version); + var pf = o.platform return { artifacts: { jdk: { @@ -280,7 +280,7 @@ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre: { @@ -289,7 +289,7 @@ "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" }, test: { @@ -306,7 +306,7 @@ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre_symbols: { @@ -315,15 +315,8 @@ "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" - }, - demo: { - local: "bundles/\\(jdk.*demo." + demo_ext + "\\)", - remote: [ - "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_demo." + demo_ext, - "bundles/" + pf + "/\\1" - ], } } }; @@ -332,9 +325,12 @@ /** * Define common artifacts template for all debug profiles - * @param pf - Name of platform in bundle names + * @param o - Object containing data for artifacts */ - common.debug_profile_artifacts = function (pf) { + common.debug_profile_artifacts = function (o) { + var jdk_subdir = "jdk-" + data.version + "/fastdebug"; + var jre_subdir = "jre-" + data.version + "/fastdebug"; + var pf = o.platform return { artifacts: { jdk: { @@ -343,7 +339,7 @@ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre: { @@ -352,7 +348,7 @@ "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-debug.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" }, test: { @@ -369,7 +365,7 @@ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre_symbols: { @@ -378,7 +374,7 @@ "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" } } @@ -391,7 +387,7 @@ // on such hardware. if (input.build_cpu == "sparcv9") { var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\""); - if (cpu_brand.trim() == 'SPARC-M7') { + if (cpu_brand.trim().match('SPARC-.7')) { boot_jdk_revision = "8u20"; boot_jdk_subdirpart = "1.8.0_20"; } @@ -401,6 +397,8 @@ common.boot_jdk_home = input.get("boot_jdk", "home_path") + "/jdk" + common.boot_jdk_subdirpart + (input.build_os == "macosx" ? ".jdk/Contents/Home" : ""); + common.boot_jdk_platform = input.build_os + "-" + + (input.build_cpu == "x86" ? "i586" : input.build_cpu); return common; }; @@ -419,8 +417,9 @@ "linux-x64": { target_os: "linux", target_cpu: "x64", - dependencies: ["devkit"], - configure_args: concat(common.configure_args_64bit, "--with-zlib=system"), + dependencies: ["devkit", "graphviz", "pandoc"], + configure_args: concat(common.configure_args_64bit, + "--enable-full-docs", "--with-zlib=system"), default_make_targets: ["docs-bundles"], }, @@ -469,8 +468,43 @@ build_cpu: "x64", dependencies: ["devkit", "freetype"], configure_args: concat(common.configure_args_32bit), + }, + + "linux-arm64": { + target_os: "linux", + target_cpu: "aarch64", + build_cpu: "x64", + dependencies: ["devkit", "build_devkit", "cups", "headless_stubs"], + configure_args: [ + "--with-cpu-port=arm64", + "--with-jvm-variants=server", + "--openjdk-target=aarch64-linux-gnu", + "--enable-headless-only" + ], + }, + + "linux-arm-vfp-hflt": { + target_os: "linux", + target_cpu: "arm", + build_cpu: "x64", + dependencies: ["devkit", "build_devkit", "cups"], + configure_args: [ + "--with-jvm-variants=minimal1,client", + "--with-x=" + input.get("devkit", "install_path") + "/arm-linux-gnueabihf/libc/usr/X11R6-PI", + "--openjdk-target=arm-linux-gnueabihf", + "--with-abi-profile=arm-vfp-hflt" + ], + }, + + // Special version of the SE profile adjusted to be testable on arm64 hardware. + "linux-arm-vfp-hflt-dyn": { + configure_args: "--with-stdc++lib=dynamic" } }; + // Let linux-arm-vfp-hflt-dyn inherit everything from linux-arm-vfp-hflt + profiles["linux-arm-vfp-hflt-dyn"] = concatObjects( + profiles["linux-arm-vfp-hflt-dyn"], profiles["linux-arm-vfp-hflt"]); + // Add the base settings to all the main profiles common.main_profile_names.forEach(function (name) { profiles[name] = concatObjects(common.main_profile_base, profiles[name]); @@ -582,7 +616,7 @@ var testOnlyProfilesPrebuilt = { "run-test-prebuilt": { src: "src.conf", - dependencies: [ "jtreg", "gnumake", testedProfile + ".jdk", + dependencies: [ "jtreg", "gnumake", "boot_jdk", testedProfile + ".jdk", testedProfile + ".test", "src.full" ], work_dir: input.get("src.full", "install_path") + "/test", @@ -626,49 +660,53 @@ // // Define artifacts for profiles // - // Macosx bundles are named osx and Windows demo bundles use zip instead of + // Macosx bundles are named osx // tar.gz. var artifactData = { "linux-x64": { platform: "linux-x64", - demo_ext: "tar.gz" }, "linux-x86": { platform: "linux-x86", - demo_ext: "tar.gz" }, "macosx-x64": { platform: "osx-x64", - demo_ext: "tar.gz" + jdk_subdir: "jdk-" + data.version + ".jdk/Contents/Home", + jre_subdir: "jre-" + data.version + ".jre/Contents/Home" }, "solaris-x64": { platform: "solaris-x64", - demo_ext: "tar.gz" }, "solaris-sparcv9": { platform: "solaris-sparcv9", - demo_ext: "tar.gz" }, "windows-x64": { platform: "windows-x64", - demo_ext: "zip" }, "windows-x86": { platform: "windows-x86", - demo_ext: "zip" + }, + "linux-arm64": { + platform: "linux-arm64-vfp-hflt", + }, + "linux-arm-vfp-hflt": { + platform: "linux-arm32-vfp-hflt", + }, + "linux-arm-vfp-hflt-dyn": { + platform: "linux-arm32-vfp-hflt-dyn", } } // Generate common artifacts for all main profiles - common.main_profile_names.forEach(function (name) { + Object.keys(artifactData).forEach(function (name) { profiles[name] = concatObjects(profiles[name], - common.main_profile_artifacts(artifactData[name].platform, artifactData[name].demo_ext)); + common.main_profile_artifacts(artifactData[name])); }); // Generate common artifacts for all debug profiles - common.main_profile_names.forEach(function (name) { + Object.keys(artifactData).forEach(function (name) { var debugName = name + common.debug_suffix; profiles[debugName] = concatObjects(profiles[debugName], - common.debug_profile_artifacts(artifactData[name].platform)); + common.debug_profile_artifacts(artifactData[name])); }); // Extra profile specific artifacts @@ -689,7 +727,12 @@ artifacts: { jdk: { local: "bundles/\\(jdk.*bin.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x64/jdk-" + data.version + + "_linux-x64_bin.tar.gz", + "bundles/openjdk/GPL/linux-x64/\\1" + ], + subdir: "jdk-" + data.version }, jre: { local: "bundles/\\(jre.*bin.tar.gz\\)", @@ -697,20 +740,25 @@ }, test: { local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x64/jdk-" + data.version + + "_linux-x64_bin-tests.tar.gz", + "bundles/openjdk/GPL/linux-x64/\\1" + ] }, jdk_symbols: { local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x64/jdk-" + data.version + + "_linux-x64_bin-symbols.tar.gz", + "bundles/openjdk/GPL/linux-x64/\\1" + ], + subdir: "jdk-" + data.version }, jre_symbols: { local: "bundles/\\(jre.*bin-symbols.tar.gz\\)", remote: "bundles/openjdk/GPL/linux-x64/\\1", }, - demo: { - local: "bundles/\\(jdk.*demo.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", - }, doc_api_spec: { local: "bundles/\\(jdk.*doc-api-spec.tar.gz\\)", remote: "bundles/openjdk/GPL/linux-x64/\\1", @@ -722,11 +770,29 @@ artifacts: { jdk: { local: "bundles/\\(jdk.*bin.tar.gz\\)", - remote: "bundles/openjdk/GPL/profile/linux-x86/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x86/jdk-" + data.version + + "_linux-x86_bin.tar.gz", + "bundles/openjdk/GPL/linux-x86/\\1" + ], + subdir: "jdk-" + data.version }, jdk_symbols: { local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", - remote: "bundles/openjdk/GPL/profile/linux-x86/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x86/jdk-" + data.version + + "_linux-x86_bin-symbols.tar.gz", + "bundles/openjdk/GPL/linux-x86/\\1" + ], + subdir: "jdk-" + data.version + }, + test: { + local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", + remote: [ + "bundles/openjdk/GPL/linux-x86/jdk-" + data.version + + "_linux-x86_bin-tests.tar.gz", + "bundles/openjdk/GPL/linux-x86/\\1" + ] }, jre: { // This regexp needs to not match the compact* files below @@ -752,7 +818,12 @@ artifacts: { jdk: { local: "bundles/\\(jdk.*bin.tar.gz\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1", + remote: [ + "bundles/openjdk/GPL/windows-x86/jdk-" + data.version + + "_windows-x86_bin.tar.gz", + "bundles/openjdk/GPL/windows-x86/\\1" + ], + subdir: "jdk-" + data.version }, jre: { local: "bundles/\\(jre.*bin.tar.gz\\)", @@ -760,19 +831,24 @@ }, test: { local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1", + remote: [ + "bundles/openjdk/GPL/windows-x86/jdk-" + data.version + + "_windows-x86_bin-tests.tar.gz", + "bundles/openjdk/GPL/windows-x86/\\1" + ] }, jdk_symbols: { local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1" + remote: [ + "bundles/openjdk/GPL/windows-x86/jdk-" + data.version + + "_windows-x86_bin-symbols.tar.gz", + "bundles/openjdk/GPL/windows-x86/\\1" + ], + subdir: "jdk-" + data.version }, jre_symbols: { local: "bundles/\\(jre.*bin-symbols.tar.gz\\)", remote: "bundles/openjdk/GPL/windows-x86/\\1", - }, - demo: { - local: "bundles/\\(jdk.*demo.zip\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1", } } }, @@ -817,6 +893,16 @@ } }); + // The windows ri profile needs to add the freetype license file + profilesRiFreetype = { + "windows-x86-ri": { + configure_args: "--with-freetype-license=" + + input.get("freetype", "install_path") + + "/freetype-2.7.1-v120-x86/freetype.md" + } + }; + profiles = concatObjects(profiles, profilesRiFreetype); + // Generate the missing platform attributes profiles = generatePlatformAttributes(profiles); profiles = generateDefaultMakeTargetsConfigureArg(common, profiles); @@ -832,15 +918,16 @@ */ var getJibProfilesDependencies = function (input, common) { - var boot_jdk_platform = input.build_os + "-" - + (input.build_cpu == "x86" ? "i586" : input.build_cpu); - var devkit_platform_revisions = { linux_x64: "gcc4.9.2-OEL6.4+1.1", macosx_x64: "Xcode6.3-MacOSX10.9+1.0", solaris_x64: "SS12u4-Solaris11u1+1.0", solaris_sparcv9: "SS12u4-Solaris11u1+1.0", - windows_x64: "VS2013SP4+1.0" + windows_x64: "VS2013SP4+1.0", + linux_aarch64: "gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux+1.0", + linux_arm: (input.profile != null && input.profile.indexOf("hflt") >= 0 + ? "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0" + : "arm-linaro-4.7+1.0") }; var devkit_platform = (input.target_cpu == "x86" @@ -853,9 +940,9 @@ server: "javare", module: "jdk", revision: common.boot_jdk_revision, - checksum_file: boot_jdk_platform + "/MD5_VALUES", - file: boot_jdk_platform + "/jdk-" + common.boot_jdk_revision - + "-" + boot_jdk_platform + ".tar.gz", + checksum_file: common.boot_jdk_platform + "/MD5_VALUES", + file: common.boot_jdk_platform + "/jdk-" + common.boot_jdk_revision + + "-" + common.boot_jdk_platform + ".tar.gz", configure_args: "--with-boot-jdk=" + common.boot_jdk_home, environment_path: common.boot_jdk_home + "/bin" }, @@ -883,7 +970,7 @@ jtreg: { server: "javare", revision: "4.2", - build_number: "b05", + build_number: "b07", checksum_file: "MD5_VALUES", file: "jtreg_bin-4.2.zip", environment_name: "JT_HOME", @@ -911,9 +998,27 @@ freetype: { organization: common.organization, ext: "tar.gz", - revision: "2.3.4+1.0", + revision: "2.7.1-v120+1.0", module: "freetype-" + input.target_platform - } + }, + + graphviz: { + organization: common.organization, + ext: "tar.gz", + revision: "2.38.0-1+1.1", + module: "graphviz-" + input.target_platform, + configure_args: "DOT=" + input.get("graphviz", "install_path") + "/dot", + environment_path: input.get("graphviz", "install_path") + }, + + pandoc: { + organization: common.organization, + ext: "tar.gz", + revision: "1.17.2+1.0", + module: "pandoc-" + input.target_platform, + configure_args: "PANDOC=" + input.get("pandoc", "install_path") + "/pandoc/pandoc", + environment_path: input.get("pandoc", "install_path") + "/pandoc" + }, }; return dependencies; @@ -1080,12 +1185,29 @@ + "." + (minor != null ? minor : version_numbers.get("DEFAULT_VERSION_MINOR")) + "." + (security != null ? security : version_numbers.get("DEFAULT_VERSION_SECURITY")) + "." + (patch != null ? patch : version_numbers.get("DEFAULT_VERSION_PATCH")); - while (version.match(".*\.0$")) { + while (version.match(".*\\.0$")) { version = version.substring(0, version.length - 2); } return version; }; +/** + * Constructs the common version configure args based on build type and + * other version inputs + */ +var versionArgs = function(input, common) { + var args = ["--with-version-build=" + common.build_number]; + if (input.build_type == "promoted") { + args = concat(args, + // This needs to be changed when we start building release candidates + "--with-version-pre=ea", + "--without-version-opt"); + } else { + args = concat(args, "--with-version-opt=" + common.build_id); + } + return args; +} + // Properties representation of the common/autoconf/version-numbers file. Lazily // initiated by the function below. var version_numbers; diff -r 830e16e5eef5 -r d9f6bc6ba599 common/doc/building.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/doc/building.html Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,960 @@ + + + + + + + Building OpenJDK + + + + + + +
+

Building OpenJDK

+
+ +

TL;DR (Instructions for the Impatient)

+

If you are eager to try out building OpenJDK, these simple steps works most of the time. They assume that you have installed Mercurial (and Cygwin if running on Windows) and cloned the top-level OpenJDK repository that you want to build.

+
    +
  1. Get the complete source code:
    +bash get_source.sh

  2. +
  3. Run configure:
    +bash configure

    +

    If configure fails due to missing dependencies (to either the toolchain, external libraries or the boot JDK), most of the time it prints a suggestion on how to resolve the situation on your platform. Follow the instructions, and try running bash configure again.

  4. +
  5. Run make:
    +make images

  6. +
  7. Verify your newly built JDK:
    +./build/*/images/jdk/bin/java -version

  8. +
  9. Run basic tests:
    +make run-test-tier1

  10. +
+

If any of these steps failed, or if you want to know more about build requirements or build functionality, please continue reading this document.

+

Introduction

+

OpenJDK is a complex software project. Building it requires a certain amount of technical expertise, a fair number of dependencies on external software, and reasonably powerful hardware.

+

If you just want to use OpenJDK and not build it yourself, this document is not for you. See for instance OpenJDK installation for some methods of installing a prebuilt OpenJDK.

+

Getting the Source Code

+

OpenJDK uses Mercurial for source control. The source code is contained not in a single Mercurial repository, but in a tree ("forest") of interrelated repositories. You will need to check out all of the repositories to be able to build OpenJDK. To assist you in dealing with this somewhat unusual arrangement, there are multiple tools available, which are explained below.

+

In any case, make sure you are getting the correct version. At the OpenJDK Mercurial server you can see a list of all available forests. If you want to build an older version, e.g. JDK 8, it is recommended that you get the jdk8u forest, which contains incremental updates, instead of the jdk8 forest, which was frozen at JDK 8 GA.

+

If you are new to Mercurial, a good place to start is the Mercurial Beginner's Guide. The rest of this document assumes a working knowledge of Mercurial.

+

Special Considerations

+

For a smooth building experience, it is recommended that you follow these rules on where and how to check out the source code.

+
    +
  • Do not check out the source code in a path which contains spaces. Chances are the build will not work. This is most likely to be an issue on Windows systems.

  • +
  • Do not check out the source code in a path which has a very long name or is nested many levels deep. Chances are you will hit an OS limitation during the build.

  • +
  • Put the source code on a local disk, not a network share. If possible, use an SSD. The build process is very disk intensive, and having slow disk access will significantly increase build times. If you need to use a network share for the source code, see below for suggestions on how to keep the build artifacts on a local disk.

  • +
  • On Windows, extra care must be taken to make sure the Cygwin environment is consistent. It is recommended that you follow this procedure:

    +
      +
    • Create the directory that is going to contain the top directory of the OpenJDK clone by using the mkdir command in the Cygwin bash shell. That is, do not create it using Windows Explorer. This will ensure that it will have proper Cygwin attributes, and that it's children will inherit those attributes.

    • +
    • Do not put the OpenJDK clone in a path under your Cygwin home directory. This is especially important if your user name contains spaces and/or mixed upper and lower case letters.

    • +
    • Clone the OpenJDK repository using the Cygwin command line hg client as instructed in this document. That is, do not use another Mercurial client such as TortoiseHg.

    • +
    +

    Failure to follow this procedure might result in hard-to-debug build problems.

  • +
+

Using get_source.sh

+

The simplest way to get the entire forest is probably to clone the top-level repository and then run the get_source.sh script, like this:

+
hg clone http://hg.openjdk.java.net/jdk9/jdk9
+cd jdk9
+bash get_source.sh
+

The first time this is run, it will clone all the sub-repositories. Any subsequent execution of the script will update all sub-repositories to the latest revision.

+

Using hgforest.sh

+

The hgforest.sh script is more expressive than get_source.sh. It takes any number of arguments, and runs hg with those arguments on each sub-repository in the forest. The get_source.sh script is basically a simple wrapper that runs either hgforest.sh clone or hgforest.sh pull -u.

+
    +
  • Cloning the forest:

    +
    hg clone http://hg.openjdk.java.net/jdk9/jdk9
    +cd jdk9
    +bash common/bin/hgforest.sh clone
  • +
  • Pulling and updating the forest:

    +
    bash common/bin/hgforest.sh pull -u
  • +
  • Merging over the entire forest:

    +
    bash common/bin/hgforest.sh merge
  • +
+

Using the Trees Extension

+

The trees extension is a Mercurial add-on that helps you deal with the forest. More information is available on the Code Tools trees page.

+

Installing the Extension

+

Install the extension by cloning http://hg.openjdk.java.net/code-tools/trees and updating your .hgrc file. Here's one way to do this:

+
cd ~
+mkdir hg-ext
+cd hg-ext
+hg clone http://hg.openjdk.java.net/code-tools/trees
+cat << EOT >> ~/.hgrc
+[extensions]
+trees=~/hg-ext/trees/trees.py
+EOT
+

Initializing the Tree

+

The trees extension needs to know the structure of the forest. If you have already cloned the entire forest using another method, you can initialize the forest like this:

+
hg tconf --set --walk --depth
+

Or you can clone the entire forest at once, if you substitute clone with tclone when cloning the top-level repository, e.g. like this:

+
hg tclone http://hg.openjdk.java.net/jdk9/jdk9
+

In this case, the forest will be properly initialized from the start.

+

Other Operations

+

The trees extensions supplement many common operations with a trees version by prefixing a t to the normal Mercurial command, e.g. tcommit, tstatus or tmerge. For instance, to update the entire forest:

+
hg tpull -u
+

Build Hardware Requirements

+

OpenJDK is a massive project, and require machines ranging from decent to powerful to be able to build in a reasonable amount of time, or to be able to complete a build at all.

+

We strongly recommend usage of an SSD disk for the build, since disk speed is one of the limiting factors for build performance.

+

Building on x86

+

At a minimum, a machine with 2-4 cores is advisable, as well as 2-4 GB of RAM. (The more cores to use, the more memory you need.) At least 6 GB of free disk space is required (8 GB minimum for building on Solaris).

+

Even for 32-bit builds, it is recommended to use a 64-bit build machine, and instead create a 32-bit target using --with-target-bits=32.

+

Building on sparc

+

At a minimum, a machine with 4 cores is advisable, as well as 4 GB of RAM. (The more cores to use, the more memory you need.) At least 8 GB of free disk space is required.

+

Building on arm/aarch64

+

This is not recommended. Instead, see the section on Cross-compiling.

+

Operating System Requirements

+

The mainline OpenJDK project supports Linux, Solaris, macOS, AIX and Windows. Support for other operating system, e.g. BSD, exists in separate "port" projects.

+

In general, OpenJDK can be built on a wide range of versions of these operating systems, but the further you deviate from what is tested on a daily basis, the more likely you are to run into problems.

+

This table lists the OS versions used by Oracle when building JDK 9. Such information is always subject to change, but this table is up to date at the time of writing.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Operating systemVendor/version used
LinuxOracle Enterprise Linux 6.4 / 7.1 (using kernel 3.8.13)
SolarisSolaris 11.1 SRU 21.4.1 / 11.2 SRU 5.5
macOSMac OS X 10.9 (Mavericks) / 10.10 (Yosemite)
WindowsWindows Server 2012 R2
+

The double version numbers for Linux, Solaris and macOS is due to the hybrid model used at Oracle, where header files and external libraries from an older version is used when building on a more modern version of the OS.

+

The Build Group has a wiki page with Supported Build Platforms. From time to time, this is updated by the community to list successes or failures of building on different platforms.

+

Windows

+

Windows XP is not a supported platform, but all newer Windows should be able to build OpenJDK.

+

On Windows, it is important that you pay attention to the instructions in the Special Considerations.

+

Windows is the only non-POSIX OS supported by OpenJDK, and as such, requires some extra care. A POSIX support layer is required to build on Windows. For OpenJDK 9, the only supported such layer is Cygwin. (Msys is no longer supported due to a too old bash; msys2 and the new Windows Subsystem for Linux (WSL) would likely be possible to support in a future version but that would require a community effort to implement.)

+

Internally in the build system, all paths are represented as Unix-style paths, e.g. /cygdrive/c/hg/jdk9/Makefile rather than C:\hg\jdk9\Makefile. This rule also applies to input to the build system, e.g. in arguments to configure. So, use --with-freetype=/cygdrive/c/freetype rather than --with-freetype=c:\freetype. For details on this conversion, see the section on Fixpath.

+

Cygwin

+

A functioning Cygwin environment is thus required for building OpenJDK on Windows. If you have a 64-bit OS, we strongly recommend using the 64-bit version of Cygwin.

+

Note: Cygwin has a model of continuously updating all packages without any easy way to install or revert to a specific version of a package. This means that whenever you add or update a package in Cygwin, you might (inadvertently) update tools that are used by the OpenJDK build process, and that can cause unexpected build problems.

+

OpenJDK requires GNU Make 4.0 or greater on Windows. This is usually not a problem, since Cygwin currently only distributes GNU Make at a version above 4.0.

+

Apart from the basic Cygwin installation, the following packages must also be installed:

+
    +
  • make
  • +
  • zip
  • +
  • unzip
  • +
+

Often, you can install these packages using the following command line:

+
<path to Cygwin setup>/setup-x86_64 -q -P make -P unzip -P zip
+

Unfortunately, Cygwin can be unreliable in certain circumstances. If you experience build tool crashes or strange issues when building on Windows, please check the Cygwin FAQ on the "BLODA" list and the section on fork() failures.

+

Solaris

+

See make/devkit/solaris11.1-package-list.txt for a list of recommended packages to install when building on Solaris. The versions specified in this list is the versions used by the daily builds at Oracle, and is likely to work properly.

+

Older versions of Solaris shipped a broken version of objcopy. At least version 2.21.1 is needed, which is provided by Solaris 11 Update 1. Objcopy is needed if you want to have external debug symbols. Please make sure you are using at least version 2.21.1 of objcopy, or that you disable external debug symbols.

+

macOS

+

Apple is using a quite aggressive scheme of pushing OS updates, and coupling these updates with required updates of Xcode. Unfortunately, this makes it difficult for a project like OpenJDK to keep pace with a continuously updated machine running macOS. See the section on Apple Xcode on some strategies to deal with this.

+

It is recommended that you use at least Mac OS X 10.9 (Mavericks). At the time of writing, OpenJDK has been successfully compiled on macOS versions up to 10.12.5 (Sierra), using XCode 8.3.2 and --disable-warnings-as-errors.

+

The standard macOS environment contains the basic tooling needed to build, but for external libraries a package manager is recommended. OpenJDK uses homebrew in the examples, but feel free to use whatever manager you want (or none).

+

Linux

+

It is often not much problem to build OpenJDK on Linux. The only general advice is to try to use the compilers, external libraries and header files as provided by your distribution.

+

The basic tooling is provided as part of the core operating system, but you will most likely need to install developer packages.

+

For apt-based distributions (Debian, Ubuntu, etc), try this:

+
sudo apt-get install build-essential
+

For rpm-based distributions (Fedora, Red Hat, etc), try this:

+
sudo yum groupinstall "Development Tools"
+

AIX

+

The regular builds by SAP is using AIX version 7.1, but AIX 5.3 is also supported. See the OpenJDK PowerPC Port Status Page for details.

+

Native Compiler (Toolchain) Requirements

+

Large portions of OpenJDK consists of native code, that needs to be compiled to be able to run on the target platform. In theory, toolchain and operating system should be independent factors, but in practice there's more or less a one-to-one correlation between target operating system and toolchain.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Operating systemSupported toolchain
Linuxgcc, clang
macOSApple Xcode (using clang)
SolarisOracle Solaris Studio
AIXIBM XL C/C++
WindowsMicrosoft Visual Studio
+

Please see the individual sections on the toolchains for version recommendations. As a reference, these versions of the toolchains are used, at the time of writing, by Oracle for the daily builds of OpenJDK. It should be possible to compile OpenJDK with both older and newer versions, but the closer you stay to this list, the more likely you are to compile successfully without issues.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Operating systemToolchain version
Linuxgcc 4.9.2
macOSApple Xcode 6.3 (using clang 6.1.0)
SolarisOracle Solaris Studio 12.4 (with compiler version 5.13)
WindowsMicrosoft Visual Studio 2013 update 4
+

gcc

+

The minimum accepted version of gcc is 4.3. Older versions will not be accepted by configure.

+

However, gcc 4.3 is quite old and OpenJDK is not regularly tested on this version, so it is recommended to use a more modern gcc.

+

OpenJDK 9 includes patches that should allow gcc 6 to compile, but this should be considered experimental.

+

In general, any version between these two should be usable.

+

clang

+

The minimum accepted version of clang is 3.2. Older versions will not be accepted by configure.

+

To use clang instead of gcc on Linux, use --with-toolchain-type=clang.

+

Apple Xcode

+

The oldest supported version of Xcode is 5.

+

You will need the Xcode command lines developers tools to be able to build OpenJDK. (Actually, only the command lines tools are needed, not the IDE.) The simplest way to install these is to run:

+
xcode-select --install
+

It is advisable to keep an older version of Xcode for building OpenJDK when updating Xcode. This blog page has good suggestions on managing multiple Xcode versions. To use a specific version of Xcode, use xcode-select -s before running configure, or use --with-toolchain-path to point to the version of Xcode to use, e.g. configure --with-toolchain-path=/Applications/Xcode5.app/Contents/Developer/usr/bin

+

If you have recently (inadvertently) updated your OS and/or Xcode version, and OpenJDK can no longer be built, please see the section on Problems with the Build Environment, and Getting Help to find out if there are any recent, non-merged patches available for this update.

+

Oracle Solaris Studio

+

The minimum accepted version of the Solaris Studio compilers is 5.13 (corresponding to Solaris Studio 12.4). Older versions will not be accepted by configure.

+

The Solaris Studio installation should contain at least these packages:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PackageVersion
developer/solarisstudio-124/backend12.4-1.0.6.0
developer/solarisstudio-124/c++12.4-1.0.10.0
developer/solarisstudio-124/cc12.4-1.0.4.0
developer/solarisstudio-124/library/c++-libs12.4-1.0.10.0
developer/solarisstudio-124/library/math-libs12.4-1.0.0.1
developer/solarisstudio-124/library/studio-gccrt12.4-1.0.0.1
developer/solarisstudio-124/studio-common12.4-1.0.0.1
developer/solarisstudio-124/studio-ja12.4-1.0.0.1
developer/solarisstudio-124/studio-legal12.4-1.0.0.1
developer/solarisstudio-124/studio-zhCN12.4-1.0.0.1
+

Compiling with Solaris Studio can sometimes be finicky. This is the exact version used by Oracle, which worked correctly at the time of writing:

+
$ cc -V
+cc: Sun C 5.13 SunOS_i386 2014/10/20
+$ CC -V
+CC: Sun C++ 5.13 SunOS_i386 151846-10 2015/10/30
+

Microsoft Visual Studio

+

The minimum accepted version of Visual Studio is 2010. Older versions will not be accepted by configure. The maximum accepted version of Visual Studio is 2013.

+

If you have multiple versions of Visual Studio installed, configure will by default pick the latest. You can request a specific version to be used by setting --with-toolchain-version, e.g. --with-toolchain-version=2010.

+

If you get LINK: fatal error LNK1123: failure during conversion to COFF: file invalid when building using Visual Studio 2010, you have encountered KB2757355, a bug triggered by a specific installation order. However, the solution suggested by the KB article does not always resolve the problem. See this stackoverflow discussion for other suggestions.

+

IBM XL C/C++

+

The regular builds by SAP is using version 12.1, described as IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72) Version: 12.01.0000.0017.

+

See the OpenJDK PowerPC Port Status Page for details.

+

Boot JDK Requirements

+

Paradoxically, building OpenJDK requires a pre-existing JDK. This is called the "boot JDK". The boot JDK does not have to be OpenJDK, though. If you are porting OpenJDK to a new platform, chances are that there already exists another JDK for that platform that is usable as boot JDK.

+

The rule of thumb is that the boot JDK for building JDK major version N should be an JDK of major version N-1, so for building JDK 9 a JDK 8 would be suitable as boot JDK. However, OpenJDK should be able to "build itself", so an up-to-date build of the current OpenJDK source is an acceptable alternative. If you are following the N-1 rule, make sure you got the latest update version, since JDK 8 GA might not be able to build JDK 9 on all platforms.

+

If the Boot JDK is not automatically detected, or the wrong JDK is picked, use --with-boot-jdk to point to the JDK to use.

+

JDK 8 on Linux

+

On apt-based distros (like Debian and Ubuntu), sudo apt-get install openjdk-8-jdk is typically enough to install OpenJDK 8. On rpm-based distros (like Fedora and Red Hat), try sudo yum install java-1.8.0-openjdk-devel.

+

JDK 8 on Windows

+

No pre-compiled binaries of OpenJDK 8 are readily available for Windows at the time of writing. An alternative is to download the Oracle JDK. Another is the Adopt OpenJDK Project, which publishes experimental prebuilt binaries for Windows.

+

JDK 8 on macOS

+

No pre-compiled binaries of OpenJDK 8 are readily available for macOS at the time of writing. An alternative is to download the Oracle JDK, or to install it using brew cask install java. Another option is the Adopt OpenJDK Project, which publishes experimental prebuilt binaries for macOS.

+

JDK 8 on AIX

+

No pre-compiled binaries of OpenJDK 8 are readily available for AIX at the time of writing. A starting point for working with OpenJDK on AIX is the PowerPC/AIX Port Project.

+

External Library Requirements

+

Different platforms require different external libraries. In general, libraries are not optional - that is, they are either required or not used.

+

If a required library is not detected by configure, you need to provide the path to it. There are two forms of the configure arguments to point to an external library: --with-<LIB>=<path> or --with-<LIB>-include=<path to include> --with-<LIB>-lib=<path to lib>. The first variant is more concise, but require the include files an library files to reside in a default hierarchy under this directory. In most cases, it works fine.

+

As a fallback, the second version allows you to point to the include directory and the lib directory separately.

+

FreeType

+

FreeType2 from The FreeType Project is required on all platforms. At least version 2.3 is required.

+
    +
  • To install on an apt-based Linux, try running sudo apt-get install libcups2-dev.
  • +
  • To install on an rpm-based Linux, try running sudo yum install cups-devel.
  • +
  • To install on Solaris, try running pkg install system/library/freetype-2.
  • +
  • To install on macOS, try running brew install freetype.
  • +
  • To install on Windows, see below.
  • +
+

Use --with-freetype=<path> if configure does not properly locate your FreeType files.

+

Building FreeType on Windows

+

On Windows, there is no readily available compiled version of FreeType. OpenJDK can help you compile FreeType from source. Download the FreeType sources and unpack them into an arbitrary directory:

+
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz
+tar -xzf freetype-2.5.3.tar.gz
+

Then run configure with --with-freetype-src=<freetype_src>. This will automatically build the freetype library into <freetype_src>/lib64 for 64-bit builds or into <freetype_src>/lib32 for 32-bit builds. Afterwards you can always use --with-freetype-include=<freetype_src>/include and --with-freetype-lib=<freetype_src>/lib[32|64] for other builds.

+

Alternatively you can unpack the sources like this to use the default directory:

+
tar --one-top-level=$HOME/freetype --strip-components=1 -xzf freetype-2.5.3.tar.gz
+

CUPS

+

CUPS, Common UNIX Printing System header files are required on all platforms, except Windows. Often these files are provided by your operating system.

+
    +
  • To install on an apt-based Linux, try running sudo apt-get install libcups2-dev.
  • +
  • To install on an rpm-based Linux, try running sudo yum install cups-devel.
  • +
  • To install on Solaris, try running pkg install print/cups.
  • +
+

Use --with-cups=<path> if configure does not properly locate your CUPS files.

+

X11

+

Certain X11 libraries and include files are required on Linux and Solaris.

+
    +
  • To install on an apt-based Linux, try running sudo apt-get install libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev.
  • +
  • To install on an rpm-based Linux, try running sudo yum install libXtst-devel libXt-devel libXrender-devel libXi-devel.
  • +
  • To install on Solaris, try running pkg install x11/header/x11-protocols x11/library/libice x11/library/libpthread-stubs x11/library/libsm x11/library/libx11 x11/library/libxau x11/library/libxcb x11/library/libxdmcp x11/library/libxevie x11/library/libxext x11/library/libxrender x11/library/libxscrnsaver x11/library/libxtst x11/library/toolkit/libxt.
  • +
+

Use --with-x=<path> if configure does not properly locate your X11 files.

+

ALSA

+

ALSA, Advanced Linux Sound Architecture is required on Linux. At least version 0.9.1 of ALSA is required.

+
    +
  • To install on an apt-based Linux, try running sudo apt-get install libasound2-dev.
  • +
  • To install on an rpm-based Linux, try running sudo yum install alsa-lib-devel.
  • +
+

Use --with-alsa=<path> if configure does not properly locate your ALSA files.

+

libffi

+

libffi, the Portable Foreign Function Interface Library is required when building the Zero version of Hotspot.

+
    +
  • To install on an apt-based Linux, try running sudo apt-get install libffi-dev.
  • +
  • To install on an rpm-based Linux, try running sudo yum install libffi-devel.
  • +
+

Use --with-libffi=<path> if configure does not properly locate your libffi files.

+

libelf

+

libelf from the elfutils project is required when building the AOT feature of Hotspot.

+
    +
  • To install on an apt-based Linux, try running sudo apt-get install libelf-dev.
  • +
  • To install on an rpm-based Linux, try running sudo yum install elfutils-libelf-devel.
  • +
+

Use --with-libelf=<path> if configure does not properly locate your libelf files.

+

Other Tooling Requirements

+

GNU Make

+

OpenJDK requires GNU Make. No other flavors of make are supported.

+

At least version 3.81 of GNU Make must be used. For distributions supporting GNU Make 4.0 or above, we strongly recommend it. GNU Make 4.0 contains useful functionality to handle parallel building (supported by --with-output-sync) and speed and stability improvements.

+

Note that configure locates and verifies a properly functioning version of make and stores the path to this make binary in the configuration. If you start a build using make on the command line, you will be using the version of make found first in your PATH, and not necessarily the one stored in the configuration. This initial make will be used as "bootstrap make", and in a second stage, the make located by configure will be called. Normally, this will present no issues, but if you have a very old make, or a non-GNU Make make in your path, this might cause issues.

+

If you want to override the default make found by configure, use the MAKE configure variable, e.g. configure MAKE=/opt/gnu/make.

+

On Solaris, it is common to call the GNU version of make by using gmake.

+

GNU Bash

+

OpenJDK requires GNU Bash. No other shells are supported.

+

At least version 3.2 of GNU Bash must be used.

+

Autoconf

+

If you want to modify the build system itself, you need to install Autoconf.

+

However, if you only need to build OpenJDK or if you only edit the actual OpenJDK source files, there is no dependency on autoconf, since the source distribution includes a pre-generated configure shell script.

+

See the section on Autoconf Details for details on how OpenJDK uses autoconf. This is especially important if you plan to contribute changes to OpenJDK that modifies the build system.

+

Running Configure

+

To build OpenJDK, you need a "configuration", which consists of a directory where to store the build output, coupled with information about the platform, the specific build machine, and choices that affect how OpenJDK is built.

+

The configuration is created by the configure script. The basic invocation of the configure script looks like this:

+
bash configure [options]
+

This will create an output directory containing the configuration and setup an area for the build result. This directory typically looks like build/linux-x64-normal-server-release, but the actual name depends on your specific configuration. (It can also be set directly, see Using Multiple Configurations). This directory is referred to as $BUILD in this documentation.

+

configure will try to figure out what system you are running on and where all necessary build components are. If you have all prerequisites for building installed, it should find everything. If it fails to detect any component automatically, it will exit and inform you about the problem.

+

Some command line examples:

+
    +
  • Create a 32-bit build for Windows with FreeType2 in C:\freetype-i586:

    +
    bash configure --with-freetype=/cygdrive/c/freetype-i586 --with-target-bits=32
  • +
  • Create a debug build with the server JVM and DTrace enabled:

    +
    bash configure --enable-debug --with-jvm-variants=server --enable-dtrace
  • +
+

Common Configure Arguments

+

Here follows some of the most common and important configure argument.

+

To get up-to-date information on all available configure argument, please run:

+
bash configure --help
+

(Note that this help text also include general autoconf options, like --dvidir, that is not relevant to OpenJDK. To list only OpenJDK specific features, use bash configure --help=short instead.)

+

Configure Arguments for Tailoring the Build

+
    +
  • --enable-debug - Set the debug level to fastdebug (this is a shorthand for --with-debug-level=fastdebug)
  • +
  • --with-debug-level=<level> - Set the debug level, which can be release, fastdebug, slowdebug or optimized. Default is release. optimized is variant of release with additional Hotspot debug code.
  • +
  • --with-native-debug-symbols=<method> - Specify if and how native debug symbols should be built. Available methods are none, internal, external, zipped. Default behavior depends on platform. See Native Debug Symbols for more details.
  • +
  • --with-version-string=<string> - Specify the version string this build will be identified with.
  • +
  • --with-version-<part>=<value> - A group of options, where <part> can be any of pre, opt, build, major, minor, security or patch. Use these options to modify just the corresponding part of the version string from the default, or the value provided by --with-version-string.
  • +
  • --with-jvm-variants=<variant>[,<variant>...] - Build the specified variant (or variants) of Hotspot. Valid variants are: server, client, minimal, core, zero, zeroshark, custom. Note that not all variants are possible to combine in a single build.
  • +
  • --with-jvm-features=<feature>[,<feature>...] - Use the specified JVM features when building Hotspot. The list of features will be enabled on top of the default list. For the custom JVM variant, this default list is empty. A complete list of available JVM features can be found using bash configure --help.
  • +
  • --with-target-bits=<bits> - Create a target binary suitable for running on a <bits> platform. Use this to create 32-bit output on a 64-bit build platform, instead of doing a full cross-compile. (This is known as a reduced build.)
  • +
+

Configure Arguments for Native Compilation

+
    +
  • --with-devkit=<path> - Use this devkit for compilers, tools and resources
  • +
  • --with-sysroot=<path> - Use this directory as sysroot
  • +
  • --with-extra-path=<path>[;<path>] - Prepend these directories to the default path when searching for all kinds of binaries
  • +
  • --with-toolchain-path=<path>[;<path>] - Prepend these directories when searching for toolchain binaries (compilers etc)
  • +
  • --with-extra-cflags=<flags> - Append these flags when compiling JDK C files
  • +
  • --with-extra-cxxflags=<flags> - Append these flags when compiling JDK C++ files
  • +
  • --with-extra-ldflags=<flags> - Append these flags when linking JDK libraries
  • +
+

Configure Arguments for External Dependencies

+
    +
  • --with-boot-jdk=<path> - Set the path to the Boot JDK
  • +
  • --with-freetype=<path> - Set the path to FreeType
  • +
  • --with-cups=<path> - Set the path to CUPS
  • +
  • --with-x=<path> - Set the path to X11
  • +
  • --with-alsa=<path> - Set the path to ALSA
  • +
  • --with-libffi=<path> - Set the path to libffi
  • +
  • --with-libelf=<path> - Set the path to libelf
  • +
  • --with-jtreg=<path> - Set the path to JTReg. See Running Tests
  • +
+

Certain third-party libraries used by OpenJDK (libjpeg, giflib, libpng, lcms and zlib) are included in the OpenJDK repository. The default behavior of the OpenJDK build is to use this version of these libraries, but they might be replaced by an external version. To do so, specify system as the <source> option in these arguments. (The default is bundled).

+
    +
  • --with-libjpeg=<source> - Use the specified source for libjpeg
  • +
  • --with-giflib=<source> - Use the specified source for giflib
  • +
  • --with-libpng=<source> - Use the specified source for libpng
  • +
  • --with-lcms=<source> - Use the specified source for lcms
  • +
  • --with-zlib=<source> - Use the specified source for zlib
  • +
+

On Linux, it is possible to select either static or dynamic linking of the C++ runtime. The default is static linking, with dynamic linking as fallback if the static library is not found.

+
    +
  • --with-stdc++lib=<method> - Use the specified method (static, dynamic or default) for linking the C++ runtime.
  • +
+

Configure Control Variables

+

It is possible to control certain aspects of configure by overriding the value of configure variables, either on the command line or in the environment.

+

Normally, this is not recommended. If used improperly, it can lead to a broken configuration. Unless you're well versed in the build system, this is hard to use properly. Therefore, configure will print a warning if this is detected.

+

However, there are a few configure variables, known as control variables that are supposed to be overriden on the command line. These are variables that describe the location of tools needed by the build, like MAKE or GREP. If any such variable is specified, configure will use that value instead of trying to autodetect the tool. For instance, bash configure MAKE=/opt/gnumake4.0/bin/make.

+

If a configure argument exists, use that instead, e.g. use --with-jtreg instead of setting JTREGEXE.

+

Also note that, despite what autoconf claims, setting CFLAGS will not accomplish anything. Instead use --with-extra-cflags (and similar for cxxflags and ldflags).

+

Running Make

+

When you have a proper configuration, all you need to do to build OpenJDK is to run make. (But see the warning at GNU Make about running the correct version of make.)

+

When running make without any arguments, the default target is used, which is the same as running make default or make jdk. This will build a minimal (or roughly minimal) set of compiled output (known as an "exploded image") needed for a developer to actually execute the newly built JDK. The idea is that in an incremental development fashion, when doing a normal make, you should only spend time recompiling what's changed (making it purely incremental) and only do the work that's needed to actually run and test your code.

+

The output of the exploded image resides in $BUILD/jdk. You can test the newly built JDK like this: $BUILD/jdk/bin/java -version.

+

Common Make Targets

+

Apart from the default target, here are some common make targets:

+
    +
  • hotspot - Build all of hotspot (but only hotspot)
  • +
  • hotspot-<variant> - Build just the specified jvm variant
  • +
  • images or product-images - Build the JRE and JDK images
  • +
  • docs or docs-image - Build the documentation image
  • +
  • test-image - Build the test image
  • +
  • all or all-images - Build all images (product, docs and test)
  • +
  • bootcycle-images - Build images twice, second time with newly built JDK (good for testing)
  • +
  • clean - Remove all files generated by make, but not those generated by configure
  • +
  • dist-clean - Remove all files, including configuration
  • +
+

Run make help to get an up-to-date list of important make targets and make control variables.

+

It is possible to build just a single module, a single phase, or a single phase of a single module, by creating make targets according to these followin patterns. A phase can be either of gensrc, gendata, copy, java, launchers, libs or rmic. See Using Fine-Grained Make Targets for more details about this functionality.

+
    +
  • <phase> - Build the specified phase and everything it depends on
  • +
  • <module> - Build the specified module and everything it depends on
  • +
  • <module>-<phase> - Compile the specified phase for the specified module and everything it depends on
  • +
+

Similarly, it is possible to clean just a part of the build by creating make targets according to these patterns:

+
    +
  • clean-<outputdir> - Remove the subdir in the output dir with the name
  • +
  • clean-<phase> - Remove all build results related to a certain build phase
  • +
  • clean-<module> - Remove all build results related to a certain module
  • +
  • clean-<module>-<phase> - Remove all build results related to a certain module and phase
  • +
+

Make Control Variables

+

It is possible to control make behavior by overriding the value of make variables, either on the command line or in the environment.

+

Normally, this is not recommended. If used improperly, it can lead to a broken build. Unless you're well versed in the build system, this is hard to use properly. Therefore, make will print a warning if this is detected.

+

However, there are a few make variables, known as control variables that are supposed to be overriden on the command line. These make up the "make time" configuration, as opposed to the "configure time" configuration.

+

General Make Control Variables

+ +

Test Make Control Variables

+

These make control variables only make sense when running tests. Please see Testing OpenJDK for details.

+
    +
  • TEST
  • +
  • TEST_JOBS
  • +
  • JTREG
  • +
  • GTEST
  • +
+

Advanced Make Control Variables

+

These advanced make control variables can be potentially unsafe. See Hints and Suggestions for Advanced Users and Understanding the Build System for details.

+
    +
  • SPEC
  • +
  • CONF_CHECK
  • +
  • COMPARE_BUILD
  • +
  • JDK_FILTER
  • +
+

Running Tests

+

Most of the OpenJDK tests are using the JTReg test framework. Make sure that your configuration knows where to find your installation of JTReg. If this is not picked up automatically, use the --with-jtreg=<path to jtreg home> option to point to the JTReg framework. Note that this option should point to the JTReg home, i.e. the top directory, containing lib/jtreg.jar etc.

+

To execute the most basic tests (tier 1), use:

+
make run-test-tier1
+

For more details on how to run tests, please see the Testing OpenJDK document.

+

Cross-compiling

+

Cross-compiling means using one platform (the build platform) to generate output that can ran on another platform (the target platform).

+

The typical reason for cross-compiling is that the build is performed on a more powerful desktop computer, but the resulting binaries will be able to run on a different, typically low-performing system. Most of the complications that arise when building for embedded is due to this separation of build and target systems.

+

This requires a more complex setup and build procedure. This section assumes you are familiar with cross-compiling in general, and will only deal with the particularities of cross-compiling OpenJDK. If you are new to cross-compiling, please see the external links at Wikipedia for a good start on reading materials.

+

Cross-compiling OpenJDK requires you to be able to build both for the build platform and for the target platform. The reason for the former is that we need to build and execute tools during the build process, both native tools and Java tools.

+

If all you want to do is to compile a 32-bit version, for the same OS, on a 64-bit machine, consider using --with-target-bits=32 instead of doing a full-blown cross-compilation. (While this surely is possible, it's a lot more work and will take much longer to build.)

+

Boot JDK and Build JDK

+

When cross-compiling, make sure you use a boot JDK that runs on the build system, and not on the target system.

+

To be able to build, we need a "Build JDK", which is a JDK built from the current sources (that is, the same as the end result of the entire build process), but able to run on the build system, and not the target system. (In contrast, the Boot JDK should be from an older release, e.g. JDK 8 when building JDK 9.)

+

The build process will create a minimal Build JDK for you, as part of building. To speed up the build, you can use --with-build-jdk to configure to point to a pre-built Build JDK. Please note that the build result is unpredictable, and can possibly break in subtle ways, if the Build JDK does not exactly match the current sources.

+

Specifying the Target Platform

+

You must specify the target platform when cross-compiling. Doing so will also automatically turn the build into a cross-compiling mode. The simplest way to do this is to use the --openjdk-target argument, e.g. --openjdk-target=arm-linux-gnueabihf. or --openjdk-target=aarch64-oe-linux. This will automatically set the --build, --host and --target options for autoconf, which can otherwise be confusing. (In autoconf terminology, the "target" is known as "host", and "target" is used for building a Canadian cross-compiler.)

+

Toolchain Considerations

+

You will need two copies of your toolchain, one which generates output that can run on the target system (the normal, or target, toolchain), and one that generates output that can run on the build system (the build toolchain). Note that cross-compiling is only supported for gcc at the time being. The gcc standard is to prefix cross-compiling toolchains with the target denominator. If you follow this standard, configure is likely to pick up the toolchain correctly.

+

The build toolchain will be autodetected just the same way the normal build/target toolchain will be autodetected when not cross-compiling. If this is not what you want, or if the autodetection fails, you can specify a devkit containing the build toolchain using --with-build-devkit to configure, or by giving BUILD_CC and BUILD_CXX arguments.

+

It is often helpful to locate the cross-compilation tools, headers and libraries in a separate directory, outside the normal path, and point out that directory to configure. Do this by setting the sysroot (--with-sysroot) and appending the directory when searching for cross-compilations tools (--with-toolchain-path). As a compact form, you can also use --with-devkit to point to a single directory, if it is correctly setup. (See basics.m4 for details.)

+

If you are unsure what toolchain and versions to use, these have been proved working at the time of writing:

+ +

Native Libraries

+

You will need copies of external native libraries for the target system, present on the build machine while building.

+

Take care not to replace the build system's version of these libraries by mistake, since that can render the build machine unusable.

+

Make sure that the libraries you point to (ALSA, X11, etc) are for the target, not the build, platform.

+

ALSA

+

You will need alsa libraries suitable for your target system. For most cases, using Debian's pre-built libraries work fine.

+

Note that alsa is needed even if you only want to build a headless JDK.

+
    +
  • Go to Debian Package Search and search for the libasound2 and libasound2-dev packages for your target system. Download them to /tmp.

  • +
  • Install the libraries into the cross-compilation toolchain. For instance:

    +
    cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc
    +dpkg-deb -x /tmp/libasound2_1.0.25-4_armhf.deb .
    +dpkg-deb -x /tmp/libasound2-dev_1.0.25-4_armhf.deb .
  • +
  • If alsa is not properly detected by configure, you can point it out by --with-alsa.

  • +
+

X11

+

You will need X11 libraries suitable for your target system. For most cases, using Debian's pre-built libraries work fine.

+

Note that X11 is needed even if you only want to build a headless JDK.

+
    +
  • Go to Debian Package Search, search for the following packages for your target system, and download them to /tmp/target-x11: +
      +
    • libxi
    • +
    • libxi-dev
    • +
    • x11proto-core-dev
    • +
    • x11proto-input-dev
    • +
    • x11proto-kb-dev
    • +
    • x11proto-render-dev
    • +
    • x11proto-xext-dev
    • +
    • libice-dev
    • +
    • libxrender
    • +
    • libxrender-dev
    • +
    • libsm-dev
    • +
    • libxt-dev
    • +
    • libx11
    • +
    • libx11-dev
    • +
    • libxtst
    • +
    • libxtst-dev
    • +
    • libxext
    • +
    • libxext-dev
    • +
  • +
  • Install the libraries into the cross-compilation toolchain. For instance:

    +
    cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc/usr
    +mkdir X11R6
    +cd X11R6
    +for deb in /tmp/target-x11/*.deb ; do dpkg-deb -x $deb . ; done
    +mv usr/* .
    +cd lib
    +cp arm-linux-gnueabihf/* .
    +

    You can ignore the following messages. These libraries are not needed to successfully complete a full JDK build.

    +
    cp: cannot stat `arm-linux-gnueabihf/libICE.so': No such file or directory
    +cp: cannot stat `arm-linux-gnueabihf/libSM.so': No such file or directory
    +cp: cannot stat `arm-linux-gnueabihf/libXt.so': No such file or directory
  • +
  • If the X11 libraries are not properly detected by configure, you can point them out by --with-x.

  • +
+

Building for ARM/aarch64

+

A common cross-compilation target is the ARM CPU. When building for ARM, it is useful to set the ABI profile. A number of pre-defined ABI profiles are available using --with-abi-profile: arm-vfp-sflt, arm-vfp-hflt, arm-sflt, armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer properly supported on OpenJDK.

+

OpenJDK contains two different ports for the aarch64 platform, one is the original aarch64 port from the AArch64 Port Project and one is a 64-bit version of the Oracle contributed ARM port. When targeting aarch64, by the default the original aarch64 port is used. To select the Oracle ARM 64 port, use --with-cpu-port=arm64. Also set the corresponding value (aarch64 or arm64) to --with-abi-profile, to ensure a consistent build.

+

Verifying the Build

+

The build will end up in a directory named like build/linux-arm-normal-server-release.

+

Inside this build output directory, the images/jdk and images/jre will contain the newly built JDK and JRE, respectively, for your target system.

+

Copy these folders to your target system. Then you can run e.g. images/jdk/bin/java -version.

+

Build Performance

+

Building OpenJDK requires a lot of horsepower. Some of the build tools can be adjusted to utilize more or less of resources such as parallel threads and memory. The configure script analyzes your system and selects reasonable values for such options based on your hardware. If you encounter resource problems, such as out of memory conditions, you can modify the detected values with:

+
    +
  • --with-num-cores -- number of cores in the build system, e.g. --with-num-cores=8.

  • +
  • --with-memory-size -- memory (in MB) available in the build system, e.g. --with-memory-size=1024

  • +
+

You can also specify directly the number of build jobs to use with --with-jobs=N to configure, or JOBS=N to make. Do not use the -j flag to make. In most cases it will be ignored by the makefiles, but it can cause problems for some make targets.

+

It might also be necessary to specify the JVM arguments passed to the Boot JDK, using e.g. --with-boot-jdk-jvmargs="-Xmx8G". Doing so will override the default JVM arguments passed to the Boot JDK.

+

At the end of a successful execution of configure, you will get a performance summary, indicating how well the build will perform. Here you will also get performance hints. If you want to build fast, pay attention to those!

+

If you want to tweak build performance, run with make LOG=info to get a build time summary at the end of the build process.

+

Disk Speed

+

If you are using network shares, e.g. via NFS, for your source code, make sure the build directory is situated on local disk (e.g. by ln -s /localdisk/jdk-build $JDK-SHARE/build). The performance penalty is extremely high for building on a network share; close to unusable.

+

Also, make sure that your build tools (including Boot JDK and toolchain) is located on a local disk and not a network share.

+

As has been stressed elsewhere, do use SSD for source code and build directory, as well as (if possible) the build tools.

+

Virus Checking

+

The use of virus checking software, especially on Windows, can significantly slow down building of OpenJDK. If possible, turn off such software, or exclude the directory containing the OpenJDK source code from on-the-fly checking.

+

Ccache

+

The OpenJDK build supports building with ccache when using gcc or clang. Using ccache can radically speed up compilation of native code if you often rebuild the same sources. Your milage may vary however, so we recommend evaluating it for yourself. To enable it, make sure it's on the path and configure with --enable-ccache.

+

Precompiled Headers

+

By default, the Hotspot build uses preccompiled headers (PCH) on the toolchains were it is properly supported (clang, gcc, and Visual Studio). Normally, this speeds up the build process, but in some circumstances, it can actually slow things down.

+

You can experiment by disabling precompiled headers using --disable-precompiled-headers.

+

Icecc / icecream

+

icecc/icecream is a simple way to setup a distributed compiler network. If you have multiple machines available for building OpenJDK, you can drastically cut individual build times by utilizing it.

+

To use, setup an icecc network, and install icecc on the build machine. Then run configure using --enable-icecc.

+

Using sjavac

+

To speed up Java compilation, especially incremental compilations, you can try the experimental sjavac compiler by using --enable-sjavac.

+

Building the Right Target

+

Selecting the proper target to build can have dramatic impact on build time. For normal usage, jdk or the default target is just fine. You only need to build images for shipping, or if your tests require it.

+

See also Using Fine-Grained Make Targets on how to build an even smaller subset of the product.

+

Troubleshooting

+

If your build fails, it can sometimes be difficult to pinpoint the problem or find a proper solution.

+

Locating the Source of the Error

+

When a build fails, it can be hard to pinpoint the actual cause of the error. In a typical build process, different parts of the product build in parallel, with the output interlaced.

+

Build Failure Summary

+

To help you, the build system will print a failure summary at the end. It looks like this:

+
ERROR: Build failed for target 'hotspot' in configuration 'linux-x64' (exit code 2)
+
+=== Output from failing command(s) repeated here ===
+* For target hotspot_variant-server_libjvm_objs_psMemoryPool.o:
+/localhome/hg/jdk9-sandbox/hotspot/src/share/vm/services/psMemoryPool.cpp:1:1: error: 'failhere' does not name a type
+   ... (rest of output omitted)
+
+* All command lines available in /localhome/hg/jdk9-sandbox/build/linux-x64/make-support/failure-logs.
+=== End of repeated output ===
+
+=== Make failed targets repeated here ===
+lib/CompileJvm.gmk:207: recipe for target '/localhome/hg/jdk9-sandbox/build/linux-x64/hotspot/variant-server/libjvm/objs/psMemoryPool.o' failed
+make/Main.gmk:263: recipe for target 'hotspot-server-libs' failed
+=== End of repeated output ===
+
+Hint: Try searching the build log for the name of the first failed target.
+Hint: If caused by a warning, try configure --disable-warnings-as-errors.
+

Let's break it down! First, the selected configuration, and the top-level target you entered on the command line that caused the failure is printed.

+

Then, between the Output from failing command(s) repeated here and End of repeated output the first lines of output (stdout and stderr) from the actual failing command is repeated. In most cases, this is the error message that caused the build to fail. If multiple commands were failing (this can happen in a parallel build), output from all failed commands will be printed here.

+

The path to the failure-logs directory is printed. In this file you will find a <target>.log file that contains the output from this command in its entirety, and also a <target>.cmd, which contain the complete command line used for running this command. You can re-run the failing command by executing . <path to failure-logs>/<target>.cmd in your shell.

+

Another way to trace the failure is to follow the chain of make targets, from top-level targets to individual file targets. Between Make failed targets repeated here and End of repeated output the output from make showing this chain is repeated. The first failed recipe will typically contain the full path to the file in question that failed to compile. Following lines will show a trace of make targets why we ended up trying to compile that file.

+

Finally, some hints are given on how to locate the error in the complete log. In this example, we would try searching the log file for "psMemoryPool.o". Another way to quickly locate make errors in the log is to search for "] Error" or "***".

+

Note that the build failure summary will only help you if the issue was a compilation failure or similar. If the problem is more esoteric, or is due to errors in the build machinery, you will likely get empty output logs, and No indication of failed target found instead of the make target chain.

+

Checking the Build Log File

+

The output (stdout and stderr) from the latest build is always stored in $BUILD/build.log. The previous build log is stored as build.log.old. This means that it is not necessary to redirect the build output yourself if you want to process it.

+

You can increase the verbosity of the log file, by the LOG control variable to make. If you want to see the command lines used in compilations, use LOG=cmdlines. To increase the general verbosity, use LOG=info, LOG=debug or LOG=trace. Both of these can be combined with cmdlines, e.g. LOG=info,cmdlines. The debug log level will show most shell commands executed by make, and trace will show all. Beware that both these log levels will produce a massive build log!

+

Fixing Unexpected Build Failures

+

Most of the time, the build will fail due to incorrect changes in the source code.

+

Sometimes the build can fail with no apparent changes that have caused the failure. If this is the first time you are building OpenJDK on this particular computer, and the build fails, the problem is likely with your build environment. But even if you have previously built OpenJDK with success, and it now fails, your build environment might have changed (perhaps due to OS upgrades or similar). But most likely, such failures are due to problems with the incremental rebuild.

+

Problems with the Build Environment

+

Make sure your configuration is correct. Re-run configure, and look for any warnings. Warnings that appear in the middle of the configure output is also repeated at the end, after the summary. The entire log is stored in $BUILD/configure.log.

+

Verify that the summary at the end looks correct. Are you indeed using the Boot JDK and native toolchain that you expect?

+

By default, OpenJDK has a strict approach where warnings from the compiler is considered errors which fail the build. For very new or very old compiler versions, this can trigger new classes of warnings, which thus fails the build. Run configure with --disable-warnings-as-errors to turn of this behavior. (The warnings will still show, but not make the build fail.)

+

Problems with Incremental Rebuilds

+

Incremental rebuilds mean that when you modify part of the product, only the affected parts get rebuilt. While this works great in most cases, and significantly speed up the development process, from time to time complex interdependencies will result in an incorrect build result. This is the most common cause for unexpected build problems, together with inconsistencies between the different Mercurial repositories in the forest.

+

Here are a suggested list of things to try if you are having unexpected build problems. Each step requires more time than the one before, so try them in order. Most issues will be solved at step 1 or 2.

+
    +
  1. Make sure your forest is up-to-date

    +

    Run bash get_source.sh to make sure you have the latest version of all repositories.

  2. +
  3. Clean build results

    +

    The simplest way to fix incremental rebuild issues is to run make clean. This will remove all build results, but not the configuration or any build system support artifacts. In most cases, this will solve build errors resulting from incremental build mismatches.

  4. +
  5. Completely clean the build directory.

    +

    If this does not work, the next step is to run make dist-clean, or removing the build output directory ($BUILD). This will clean all generated output, including your configuration. You will need to re-run configure after this step. A good idea is to run make print-configuration before running make dist-clean, as this will print your current configure command line. Here's a way to do this:

    +
    make print-configuration > current-configuration
    +make dist-clean
    +bash configure $(cat current-configuration)
    +make
  6. +
  7. Re-clone the Mercurial forest

    +

    Sometimes the Mercurial repositories themselves gets in a state that causes the product to be un-buildable. In such a case, the simplest solution is often the "sledgehammer approach": delete the entire forest, and re-clone it. If you have local changes, save them first to a different location using hg export.

  8. +
+

Specific Build Issues

+

Clock Skew

+

If you get an error message like this:

+
File 'xxx' has modification time in the future.
+Clock skew detected. Your build may be incomplete.
+

then the clock on your build machine is out of sync with the timestamps on the source files. Other errors, apparently unrelated but in fact caused by the clock skew, can occur along with the clock skew warnings. These secondary errors may tend to obscure the fact that the true root cause of the problem is an out-of-sync clock.

+

If you see these warnings, reset the clock on the build machine, run make clean and restart the build.

+

Out of Memory Errors

+

On Solaris, you might get an error message like this:

+
Trouble writing out table to disk
+

To solve this, increase the amount of swap space on your build machine.

+

On Windows, you might get error messages like this:

+
fatal error - couldn't allocate heap
+cannot create ... Permission denied
+spawn failed
+

This can be a sign of a Cygwin problem. See the information about solving problems in the Cygwin section. Rebooting the computer might help temporarily.

+

Getting Help

+

If none of the suggestions in this document helps you, or if you find what you believe is a bug in the build system, please contact the Build Group by sending a mail to build-dev@openjdk.java.net. Please include the relevant parts of the configure and/or build log.

+

If you need general help or advice about developing for OpenJDK, you can also contact the Adoption Group. See the section on Contributing to OpenJDK for more information.

+

Hints and Suggestions for Advanced Users

+

Setting Up a Forest for Pushing Changes (defpath)

+

To help you prepare a proper push path for a Mercurial repository, there exists a useful tool known as defpath. It will help you setup a proper push path for pushing changes to OpenJDK.

+

Install the extension by cloning http://hg.openjdk.java.net/code-tools/defpath and updating your .hgrc file. Here's one way to do this:

+
cd ~
+mkdir hg-ext
+cd hg-ext
+hg clone http://hg.openjdk.java.net/code-tools/defpath
+cat << EOT >> ~/.hgrc
+[extensions]
+defpath=~/hg-ext/defpath/defpath.py
+EOT
+

You can now setup a proper push path using:

+
hg defpath -d -u <your OpenJDK username>
+

If you also have the trees extension installed in Mercurial, you will automatically get a tdefpath command, which is even more useful. By running hg tdefpath -du <username> in the top repository of your forest, all repos will get setup automatically. This is the recommended usage.

+

Bash Completion

+

The configure and make commands tries to play nice with bash command-line completion (using <tab> or <tab><tab>). To use this functionality, make sure you enable completion in your ~/.bashrc (see instructions for bash in your operating system).

+

Make completion will work out of the box, and will complete valid make targets. For instance, typing make jdk-i<tab> will complete to make jdk-image.

+

The configure script can get completion for options, but for this to work you need to help bash on the way. The standard way of running the script, bash configure, will not be understood by bash completion. You need configure to be the command to run. One way to achieve this is to add a simple helper script to your path:

+
cat << EOT > /tmp/configure
+#!/bin/bash
+if [ \$(pwd) = \$(cd \$(dirname \$0); pwd) ] ; then
+  echo >&2 "Abort: Trying to call configure helper recursively"
+  exit 1
+fi
+
+bash \$PWD/configure "\$@"
+EOT
+chmod +x /tmp/configure
+sudo mv /tmp/configure /usr/local/bin
+

Now configure --en<tab>-dt<tab> will result in configure --enable-dtrace.

+

Using Multiple Configurations

+

You can have multiple configurations for a single source forest. When you create a new configuration, run configure --with-conf-name=<name> to create a configuration with the name <name>. Alternatively, you can create a directory under build and run configure from there, e.g. mkdir build/<name> && cd build/<name> && bash ../../configure.

+

Then you can build that configuration using make CONF_NAME=<name> or make CONF=<pattern>, where <pattern> is a substring matching one or several configurations, e.g. CONF=debug. The special empty pattern (CONF=) will match all available configuration, so make CONF= hotspot will build the hotspot target for all configurations. Alternatively, you can execute make in the configuration directory, e.g. cd build/<name> && make.

+

Handling Reconfigurations

+

If you update the forest and part of the configure script has changed, the build system will force you to re-run configure.

+

Most of the time, you will be fine by running configure again with the same arguments as the last time, which can easily be performed by make reconfigure. To simplify this, you can use the CONF_CHECK make control variable, either as make CONF_CHECK=auto, or by setting an environment variable. For instance, if you add export CONF_CHECK=auto to your .bashrc file, make will always run reconfigure automatically whenever the configure script has changed.

+

You can also use CONF_CHECK=ignore to skip the check for a needed configure update. This might speed up the build, but comes at the risk of an incorrect build result. This is only recommended if you know what you're doing.

+

From time to time, you will also need to modify the command line to configure due to changes. Use make print-configure to show the command line used for your current configuration.

+

Using Fine-Grained Make Targets

+

The default behavior for make is to create consistent and correct output, at the expense of build speed, if necessary.

+

If you are prepared to take some risk of an incorrect build, and know enough of the system to understand how things build and interact, you can speed up the build process considerably by instructing make to only build a portion of the product.

+

Building Individual Modules

+

The safe way to use fine-grained make targets is to use the module specific make targets. All source code in JDK 9 is organized so it belongs to a module, e.g. java.base or jdk.jdwp.agent. You can build only a specific module, by giving it as make target: make jdk.jdwp.agent. If the specified module depends on other modules (e.g. java.base), those modules will be built first.

+

You can also specify a set of modules, just as you can always specify a set of make targets: make jdk.crypto.cryptoki jdk.crypto.ec jdk.crypto.mscapi jdk.crypto.ucrypto

+

Building Individual Module Phases

+

The build process for each module is divided into separate phases. Not all modules need all phases. Which are needed depends on what kind of source code and other artifact the module consists of. The phases are:

+
    +
  • gensrc (Generate source code to compile)
  • +
  • gendata (Generate non-source code artifacts)
  • +
  • copy (Copy resource artifacts)
  • +
  • java (Compile Java code)
  • +
  • launchers (Compile native executables)
  • +
  • libs (Compile native libraries)
  • +
  • rmic (Run the rmic tool)
  • +
+

You can build only a single phase for a module by using the notation $MODULE-$PHASE. For instance, to build the gensrc phase for java.base, use make java.base-gensrc.

+

Note that some phases may depend on others, e.g. java depends on gensrc (if present). Make will build all needed prerequisites before building the requested phase.

+

Skipping the Dependency Check

+

When using an iterative development style with frequent quick rebuilds, the dependency check made by make can take up a significant portion of the time spent on the rebuild. In such cases, it can be useful to bypass the dependency check in make.

+
+

Note that if used incorrectly, this can lead to a broken build!

+
+

To achieve this, append -only to the build target. For instance, make jdk.jdwp.agent-java-only will only build the java phase of the jdk.jdwp.agent module. If the required dependencies are not present, the build can fail. On the other hand, the execution time measures in milliseconds.

+

A useful pattern is to build the first time normally (e.g. make jdk.jdwp.agent) and then on subsequent builds, use the -only make target.

+

Rebuilding Part of java.base (JDK_FILTER)

+

If you are modifying files in java.base, which is the by far largest module in OpenJDK, then you need to rebuild all those files whenever a single file has changed. (This inefficiency will hopefully be addressed in JDK 10.)

+

As a hack, you can use the make control variable JDK_FILTER to specify a pattern that will be used to limit the set of files being recompiled. For instance, make java.base JDK_FILTER=javax/crypto (or, to combine methods, make java.base-java-only JDK_FILTER=javax/crypto) will limit the compilation to files in the javax.crypto package.

+

Learn About Mercurial

+

To become an efficient OpenJDK developer, it is recommended that you invest in learning Mercurial properly. Here are some links that can get you started:

+ +

Understanding the Build System

+

This section will give you a more technical description on the details of the build system.

+

Configurations

+

The build system expects to find one or more configuration. These are technically defined by the spec.gmk in a subdirectory to the build subdirectory. The spec.gmk file is generated by configure, and contains in principle the configuration (directly or by files included by spec.gmk).

+

You can, in fact, select a configuration to build by pointing to the spec.gmk file with the SPEC make control variable, e.g. make SPEC=$BUILD/spec.gmk. While this is not the recommended way to call make as a user, it is what is used under the hood by the build system.

+

Build Output Structure

+

The build output for a configuration will end up in build/<configuration name>, which we refer to as $BUILD in this document. The $BUILD directory contains the following important directories:

+
buildtools/
+configure-support/
+hotspot/
+images/
+jdk/
+make-support/
+support/
+test-results/
+test-support/
+

This is what they are used for:

+
    +
  • images: This is the directory were the output of the *-image make targets end up. For instance, make jdk-image ends up in images/jdk.

  • +
  • jdk: This is the "exploded image". After make jdk, you will be able to launch the newly built JDK by running $BUILD/jdk/bin/java.

  • +
  • test-results: This directory contains the results from running tests.

  • +
  • support: This is an area for intermediate files needed during the build, e.g. generated source code, object files and class files. Some noteworthy directories in support is gensrc, which contains the generated source code, and the modules_* directories, which contains the files in a per-module hierarchy that will later be collapsed into the jdk directory of the exploded image.

  • +
  • buildtools: This is an area for tools compiled for the build platform that are used during the rest of the build.

  • +
  • hotspot: This is an area for intermediate files needed when building hotspot.

  • +
  • configure-support, make-support and test-support: These directories contain files that are needed by the build system for configure, make and for running tests.

  • +
+

Fixpath

+

Windows path typically look like C:\User\foo, while Unix paths look like /home/foo. Tools with roots from Unix often experience issues related to this mismatch when running on Windows.

+

In the OpenJDK build, we always use Unix paths internally, and only just before calling a tool that does not understand Unix paths do we convert them to Windows paths.

+

This conversion is done by the fixpath tool, which is a small wrapper that modifies unix-style paths to Windows-style paths in command lines. Fixpath is compiled automatically by configure.

+

Native Debug Symbols

+

Native libraries and executables can have debug symbol (and other debug information) associated with them. How this works is very much platform dependent, but a common problem is that debug symbol information takes a lot of disk space, but is rarely needed by the end user.

+

The OpenJDK supports different methods on how to handle debug symbols. The method used is selected by --with-native-debug-symbols, and available methods are none, internal, external, zipped.

+
    +
  • none means that no debug symbols will be generated during the build.

  • +
  • internal means that debug symbols will be generated during the build, and they will be stored in the generated binary.

  • +
  • external means that debug symbols will be generated during the build, and after the compilation, they will be moved into a separate .debuginfo file. (This was previously known as FDS, Full Debug Symbols).

  • +
  • zipped is like external, but the .debuginfo file will also be zipped into a .diz file.

  • +
+

When building for distribution, zipped is a good solution. Binaries built with internal is suitable for use by developers, since they facilitate debugging, but should be stripped before distributed to end users.

+

Autoconf Details

+

The configure script is based on the autoconf framework, but in some details deviate from a normal autoconf configure script.

+

The configure script in the top level directory of OpenJDK is just a thin wrapper that calls common/autoconf/configure. This in turn provides functionality that is not easily expressed in the normal Autoconf framework, and then calls into the core of the configure script, which is the common/autoconf/generated-configure.sh file.

+

As the name implies, this file is generated by Autoconf. It is checked in after regeneration, to alleviate the common user to have to install Autoconf.

+

The build system will detect if the Autoconf source files have changed, and will trigger a regeneration of common/autoconf/generated-configure.sh if needed. You can also manually request such an update by bash common/autoconf/autogen.sh.

+

If you make changes to the build system that requires a re-generation, note the following:

+
    +
  • You must use exactly version 2.69 of autoconf for your patch to be accepted. This is to avoid spurious changes in the generated file. Note that Ubuntu 16.04 ships a patched version of autoconf which claims to be 2.69, but is not.

  • +
  • You do not need to include the generated file in reviews.

  • +
  • If the generated file needs updating, the Oracle JDK closed counter-part will also need to be updated. It is very much appreciated if you ask for an Oracle engineer to sponsor your push so this can be made in tandem.

  • +
+

Developing the Build System Itself

+

This section contains a few remarks about how to develop for the build system itself. It is not relevant if you are only making changes in the product source code.

+

While technically using make, the make source files of the OpenJDK does not resemble most other Makefiles. Instead of listing specific targets and actions (perhaps using patterns), the basic modus operandi is to call a high-level function (or properly, macro) from the API in make/common. For instance, to compile all classes in the jdk.internal.foo package in the jdk.foo module, a call like this would be made:

+
$(eval $(call SetupJavaCompilation, BUILD_FOO_CLASSES, \
+    SETUP := GENERATE_OLDBYTECODE, \
+    SRC := $(JDK_TOPDIR)/src/jkd.foo/share/classes, \
+    INCLUDES := jdk/internal/foo, \
+    BIN := $(SUPPORT_OUTPUTDIR)/foo_classes, \
+))
+

By encapsulating and expressing the high-level knowledge of what should be done, rather than how it should be done (as is normal in Makefiles), we can build a much more powerful and flexible build system.

+

Correct dependency tracking is paramount. Sloppy dependency tracking will lead to improper parallelization, or worse, race conditions.

+

To test for/debug race conditions, try running make JOBS=1 and make JOBS=100 and see if it makes any difference. (It shouldn't).

+

To compare the output of two different builds and see if, and how, they differ, run $BUILD1/compare.sh -o $BUILD2, where $BUILD1 and $BUILD2 are the two builds you want to compare.

+

To automatically build two consecutive versions and compare them, use COMPARE_BUILD. The value of COMPARE_BUILD is a set of variable=value assignments, like this:

+
make COMPARE_BUILD=CONF=--enable-new-hotspot-feature:MAKE=hotspot
+

See make/InitSupport.gmk for details on how to use COMPARE_BUILD.

+

To analyze build performance, run with LOG=trace and check $BUILD/build-trace-time.log. Use JOBS=1 to avoid parallelism.

+

Please check that you adhere to the Code Conventions for the Build System before submitting patches. Also see the section in Autoconf Details about the generated configure script.

+

Contributing to OpenJDK

+

So, now you've build your OpenJDK, and made your first patch, and want to contribute it back to the OpenJDK community.

+

First of all: Thank you! We gladly welcome your contribution to the OpenJDK. However, please bear in mind that OpenJDK is a massive project, and we must ask you to follow our rules and guidelines to be able to accept your contribution.

+

The official place to start is the 'How to contribute' page. There is also an official (but somewhat outdated and skimpy on details) Developer's Guide.

+

If this seems overwhelming to you, the Adoption Group is there to help you! A good place to start is their 'New Contributor' page, or start reading the comprehensive Getting Started Kit. The Adoption Group will also happily answer any questions you have about contributing. Contact them by mail or IRC.

+ + diff -r 830e16e5eef5 -r d9f6bc6ba599 common/doc/building.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/doc/building.md Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,1883 @@ +% Building OpenJDK + +## TL;DR (Instructions for the Impatient) + +If you are eager to try out building OpenJDK, these simple steps works most of +the time. They assume that you have installed Mercurial (and Cygwin if running +on Windows) and cloned the top-level OpenJDK repository that you want to build. + + 1. [Get the complete source code](#getting-the-source-code): \ + `bash get_source.sh` + + 2. [Run configure](#running-configure): \ + `bash configure` + + If `configure` fails due to missing dependencies (to either the + [toolchain](#native-compiler-toolchain-requirements), [external libraries]( + #external-library-requirements) or the [boot JDK](#boot-jdk-requirements)), + most of the time it prints a suggestion on how to resolve the situation on + your platform. Follow the instructions, and try running `bash configure` + again. + + 3. [Run make](#running-make): \ + `make images` + + 4. Verify your newly built JDK: \ + `./build/*/images/jdk/bin/java -version` + + 5. [Run basic tests](##running-tests): \ + `make run-test-tier1` + +If any of these steps failed, or if you want to know more about build +requirements or build functionality, please continue reading this document. + +## Introduction + +OpenJDK is a complex software project. Building it requires a certain amount of +technical expertise, a fair number of dependencies on external software, and +reasonably powerful hardware. + +If you just want to use OpenJDK and not build it yourself, this document is not +for you. See for instance [OpenJDK installation]( +http://openjdk.java.net/install) for some methods of installing a prebuilt +OpenJDK. + +## Getting the Source Code + +OpenJDK uses [Mercurial](http://www.mercurial-scm.org) for source control. The +source code is contained not in a single Mercurial repository, but in a tree +("forest") of interrelated repositories. You will need to check out all of the +repositories to be able to build OpenJDK. To assist you in dealing with this +somewhat unusual arrangement, there are multiple tools available, which are +explained below. + +In any case, make sure you are getting the correct version. At the [OpenJDK +Mercurial server](http://hg.openjdk.java.net/) you can see a list of all +available forests. If you want to build an older version, e.g. JDK 8, it is +recommended that you get the `jdk8u` forest, which contains incremental +updates, instead of the `jdk8` forest, which was frozen at JDK 8 GA. + +If you are new to Mercurial, a good place to start is the [Mercurial Beginner's +Guide](http://www.mercurial-scm.org/guide). The rest of this document assumes a +working knowledge of Mercurial. + +### Special Considerations + +For a smooth building experience, it is recommended that you follow these rules +on where and how to check out the source code. + + * Do not check out the source code in a path which contains spaces. Chances + are the build will not work. This is most likely to be an issue on Windows + systems. + + * Do not check out the source code in a path which has a very long name or is + nested many levels deep. Chances are you will hit an OS limitation during + the build. + + * Put the source code on a local disk, not a network share. If possible, use + an SSD. The build process is very disk intensive, and having slow disk + access will significantly increase build times. If you need to use a + network share for the source code, see below for suggestions on how to keep + the build artifacts on a local disk. + + * On Windows, extra care must be taken to make sure the [Cygwin](#cygwin) + environment is consistent. It is recommended that you follow this + procedure: + + * Create the directory that is going to contain the top directory of the + OpenJDK clone by using the `mkdir` command in the Cygwin bash shell. + That is, do *not* create it using Windows Explorer. This will ensure + that it will have proper Cygwin attributes, and that it's children will + inherit those attributes. + + * Do not put the OpenJDK clone in a path under your Cygwin home + directory. This is especially important if your user name contains + spaces and/or mixed upper and lower case letters. + + * Clone the OpenJDK repository using the Cygwin command line `hg` client + as instructed in this document. That is, do *not* use another Mercurial + client such as TortoiseHg. + + Failure to follow this procedure might result in hard-to-debug build + problems. + +### Using get\_source.sh + +The simplest way to get the entire forest is probably to clone the top-level +repository and then run the `get_source.sh` script, like this: + +``` +hg clone http://hg.openjdk.java.net/jdk9/jdk9 +cd jdk9 +bash get_source.sh +``` + +The first time this is run, it will clone all the sub-repositories. Any +subsequent execution of the script will update all sub-repositories to the +latest revision. + +### Using hgforest.sh + +The `hgforest.sh` script is more expressive than `get_source.sh`. It takes any +number of arguments, and runs `hg` with those arguments on each sub-repository +in the forest. The `get_source.sh` script is basically a simple wrapper that +runs either `hgforest.sh clone` or `hgforest.sh pull -u`. + + * Cloning the forest: + ``` + hg clone http://hg.openjdk.java.net/jdk9/jdk9 + cd jdk9 + bash common/bin/hgforest.sh clone + ``` + + * Pulling and updating the forest: + ``` + bash common/bin/hgforest.sh pull -u + ``` + + * Merging over the entire forest: + ``` + bash common/bin/hgforest.sh merge + ``` + +### Using the Trees Extension + +The trees extension is a Mercurial add-on that helps you deal with the forest. +More information is available on the [Code Tools trees page]( +http://openjdk.java.net/projects/code-tools/trees). + +#### Installing the Extension + +Install the extension by cloning `http://hg.openjdk.java.net/code-tools/trees` +and updating your `.hgrc` file. Here's one way to do this: + +``` +cd ~ +mkdir hg-ext +cd hg-ext +hg clone http://hg.openjdk.java.net/code-tools/trees +cat << EOT >> ~/.hgrc +[extensions] +trees=~/hg-ext/trees/trees.py +EOT +``` + +#### Initializing the Tree + +The trees extension needs to know the structure of the forest. If you have +already cloned the entire forest using another method, you can initialize the +forest like this: + +``` +hg tconf --set --walk --depth +``` + +Or you can clone the entire forest at once, if you substitute `clone` with +`tclone` when cloning the top-level repository, e.g. like this: + +``` +hg tclone http://hg.openjdk.java.net/jdk9/jdk9 +``` + +In this case, the forest will be properly initialized from the start. + +#### Other Operations + +The trees extensions supplement many common operations with a trees version by +prefixing a `t` to the normal Mercurial command, e.g. `tcommit`, `tstatus` or +`tmerge`. For instance, to update the entire forest: + +``` +hg tpull -u +``` + +## Build Hardware Requirements + +OpenJDK is a massive project, and require machines ranging from decent to +powerful to be able to build in a reasonable amount of time, or to be able to +complete a build at all. + +We *strongly* recommend usage of an SSD disk for the build, since disk speed is +one of the limiting factors for build performance. + +### Building on x86 + +At a minimum, a machine with 2-4 cores is advisable, as well as 2-4 GB of RAM. +(The more cores to use, the more memory you need.) At least 6 GB of free disk +space is required (8 GB minimum for building on Solaris). + +Even for 32-bit builds, it is recommended to use a 64-bit build machine, and +instead create a 32-bit target using `--with-target-bits=32`. + +### Building on sparc + +At a minimum, a machine with 4 cores is advisable, as well as 4 GB of RAM. (The +more cores to use, the more memory you need.) At least 8 GB of free disk space +is required. + +### Building on arm/aarch64 + +This is not recommended. Instead, see the section on [Cross-compiling]( +#cross-compiling). + +## Operating System Requirements + +The mainline OpenJDK project supports Linux, Solaris, macOS, AIX and Windows. +Support for other operating system, e.g. BSD, exists in separate "port" +projects. + +In general, OpenJDK can be built on a wide range of versions of these operating +systems, but the further you deviate from what is tested on a daily basis, the +more likely you are to run into problems. + +This table lists the OS versions used by Oracle when building JDK 9. Such +information is always subject to change, but this table is up to date at the +time of writing. + + Operating system Vendor/version used + ----------------- ------------------------------------------------------- + Linux Oracle Enterprise Linux 6.4 / 7.1 (using kernel 3.8.13) + Solaris Solaris 11.1 SRU 21.4.1 / 11.2 SRU 5.5 + macOS Mac OS X 10.9 (Mavericks) / 10.10 (Yosemite) + Windows Windows Server 2012 R2 + +The double version numbers for Linux, Solaris and macOS is due to the hybrid +model used at Oracle, where header files and external libraries from an older +version is used when building on a more modern version of the OS. + +The Build Group has a wiki page with [Supported Build Platforms]( +https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms). From +time to time, this is updated by the community to list successes or failures of +building on different platforms. + +### Windows + +Windows XP is not a supported platform, but all newer Windows should be able to +build OpenJDK. + +On Windows, it is important that you pay attention to the instructions in the +[Special Considerations](#special-considerations). + +Windows is the only non-POSIX OS supported by OpenJDK, and as such, requires +some extra care. A POSIX support layer is required to build on Windows. For +OpenJDK 9, the only supported such layer is Cygwin. (Msys is no longer +supported due to a too old bash; msys2 and the new Windows Subsystem for Linux +(WSL) would likely be possible to support in a future version but that would +require a community effort to implement.) + +Internally in the build system, all paths are represented as Unix-style paths, +e.g. `/cygdrive/c/hg/jdk9/Makefile` rather than `C:\hg\jdk9\Makefile`. This +rule also applies to input to the build system, e.g. in arguments to +`configure`. So, use `--with-freetype=/cygdrive/c/freetype` rather than +`--with-freetype=c:\freetype`. For details on this conversion, see the section +on [Fixpath](#fixpath). + +#### Cygwin + +A functioning [Cygwin](http://www.cygwin.com/) environment is thus required for +building OpenJDK on Windows. If you have a 64-bit OS, we strongly recommend +using the 64-bit version of Cygwin. + +**Note:** Cygwin has a model of continuously updating all packages without any +easy way to install or revert to a specific version of a package. This means +that whenever you add or update a package in Cygwin, you might (inadvertently) +update tools that are used by the OpenJDK build process, and that can cause +unexpected build problems. + +OpenJDK requires GNU Make 4.0 or greater on Windows. This is usually not a +problem, since Cygwin currently only distributes GNU Make at a version above +4.0. + +Apart from the basic Cygwin installation, the following packages must also be +installed: + + * `make` + * `zip` + * `unzip` + +Often, you can install these packages using the following command line: +``` +/setup-x86_64 -q -P make -P unzip -P zip +``` + +Unfortunately, Cygwin can be unreliable in certain circumstances. If you +experience build tool crashes or strange issues when building on Windows, +please check the Cygwin FAQ on the ["BLODA" list]( +https://cygwin.com/faq/faq.html#faq.using.bloda) and the section on [fork() +failures](https://cygwin.com/faq/faq.html#faq.using.fixing-fork-failures). + +### Solaris + +See `make/devkit/solaris11.1-package-list.txt` for a list of recommended +packages to install when building on Solaris. The versions specified in this +list is the versions used by the daily builds at Oracle, and is likely to work +properly. + +Older versions of Solaris shipped a broken version of `objcopy`. At least +version 2.21.1 is needed, which is provided by Solaris 11 Update 1. Objcopy is +needed if you want to have external debug symbols. Please make sure you are +using at least version 2.21.1 of objcopy, or that you disable external debug +symbols. + +### macOS + +Apple is using a quite aggressive scheme of pushing OS updates, and coupling +these updates with required updates of Xcode. Unfortunately, this makes it +difficult for a project like OpenJDK to keep pace with a continuously updated +machine running macOS. See the section on [Apple Xcode](#apple-xcode) on some +strategies to deal with this. + +It is recommended that you use at least Mac OS X 10.9 (Mavericks). At the time +of writing, OpenJDK has been successfully compiled on macOS versions up to +10.12.5 (Sierra), using XCode 8.3.2 and `--disable-warnings-as-errors`. + +The standard macOS environment contains the basic tooling needed to build, but +for external libraries a package manager is recommended. OpenJDK uses +[homebrew](https://brew.sh/) in the examples, but feel free to use whatever +manager you want (or none). + +### Linux + +It is often not much problem to build OpenJDK on Linux. The only general advice +is to try to use the compilers, external libraries and header files as provided +by your distribution. + +The basic tooling is provided as part of the core operating system, but you +will most likely need to install developer packages. + +For apt-based distributions (Debian, Ubuntu, etc), try this: +``` +sudo apt-get install build-essential +``` + +For rpm-based distributions (Fedora, Red Hat, etc), try this: +``` +sudo yum groupinstall "Development Tools" +``` + +### AIX + +The regular builds by SAP is using AIX version 7.1, but AIX 5.3 is also +supported. See the [OpenJDK PowerPC Port Status Page]( +http://cr.openjdk.java.net/~simonis/ppc-aix-port) for details. + +## Native Compiler (Toolchain) Requirements + +Large portions of OpenJDK consists of native code, that needs to be compiled to +be able to run on the target platform. In theory, toolchain and operating +system should be independent factors, but in practice there's more or less a +one-to-one correlation between target operating system and toolchain. + + Operating system Supported toolchain + ------------------ ------------------------- + Linux gcc, clang + macOS Apple Xcode (using clang) + Solaris Oracle Solaris Studio + AIX IBM XL C/C++ + Windows Microsoft Visual Studio + +Please see the individual sections on the toolchains for version +recommendations. As a reference, these versions of the toolchains are used, at +the time of writing, by Oracle for the daily builds of OpenJDK. It should be +possible to compile OpenJDK with both older and newer versions, but the closer +you stay to this list, the more likely you are to compile successfully without +issues. + + Operating system Toolchain version + ------------------ ------------------------------------------------------- + Linux gcc 4.9.2 + macOS Apple Xcode 6.3 (using clang 6.1.0) + Solaris Oracle Solaris Studio 12.4 (with compiler version 5.13) + Windows Microsoft Visual Studio 2013 update 4 + +### gcc + +The minimum accepted version of gcc is 4.3. Older versions will not be accepted +by `configure`. + +However, gcc 4.3 is quite old and OpenJDK is not regularly tested on this +version, so it is recommended to use a more modern gcc. + +OpenJDK 9 includes patches that should allow gcc 6 to compile, but this should +be considered experimental. + +In general, any version between these two should be usable. + +### clang + +The minimum accepted version of clang is 3.2. Older versions will not be +accepted by `configure`. + +To use clang instead of gcc on Linux, use `--with-toolchain-type=clang`. + +### Apple Xcode + +The oldest supported version of Xcode is 5. + +You will need the Xcode command lines developers tools to be able to build +OpenJDK. (Actually, *only* the command lines tools are needed, not the IDE.) +The simplest way to install these is to run: +``` +xcode-select --install +``` + +It is advisable to keep an older version of Xcode for building OpenJDK when +updating Xcode. This [blog page]( +http://iosdevelopertips.com/xcode/install-multiple-versions-of-xcode.html) has +good suggestions on managing multiple Xcode versions. To use a specific version +of Xcode, use `xcode-select -s` before running `configure`, or use +`--with-toolchain-path` to point to the version of Xcode to use, e.g. +`configure --with-toolchain-path=/Applications/Xcode5.app/Contents/Developer/usr/bin` + +If you have recently (inadvertently) updated your OS and/or Xcode version, and +OpenJDK can no longer be built, please see the section on [Problems with the +Build Environment](#problems-with-the-build-environment), and [Getting +Help](#getting-help) to find out if there are any recent, non-merged patches +available for this update. + +### Oracle Solaris Studio + +The minimum accepted version of the Solaris Studio compilers is 5.13 +(corresponding to Solaris Studio 12.4). Older versions will not be accepted by +configure. + +The Solaris Studio installation should contain at least these packages: + + Package Version + -------------------------------------------------- ------------- + developer/solarisstudio-124/backend 12.4-1.0.6.0 + developer/solarisstudio-124/c++ 12.4-1.0.10.0 + developer/solarisstudio-124/cc 12.4-1.0.4.0 + developer/solarisstudio-124/library/c++-libs 12.4-1.0.10.0 + developer/solarisstudio-124/library/math-libs 12.4-1.0.0.1 + developer/solarisstudio-124/library/studio-gccrt 12.4-1.0.0.1 + developer/solarisstudio-124/studio-common 12.4-1.0.0.1 + developer/solarisstudio-124/studio-ja 12.4-1.0.0.1 + developer/solarisstudio-124/studio-legal 12.4-1.0.0.1 + developer/solarisstudio-124/studio-zhCN 12.4-1.0.0.1 + +Compiling with Solaris Studio can sometimes be finicky. This is the exact +version used by Oracle, which worked correctly at the time of writing: +``` +$ cc -V +cc: Sun C 5.13 SunOS_i386 2014/10/20 +$ CC -V +CC: Sun C++ 5.13 SunOS_i386 151846-10 2015/10/30 +``` + +### Microsoft Visual Studio + +The minimum accepted version of Visual Studio is 2010. Older versions will not +be accepted by `configure`. The maximum accepted version of Visual Studio is +2013. + +If you have multiple versions of Visual Studio installed, `configure` will by +default pick the latest. You can request a specific version to be used by +setting `--with-toolchain-version`, e.g. `--with-toolchain-version=2010`. + +If you get `LINK: fatal error LNK1123: failure during conversion to COFF: file +invalid` when building using Visual Studio 2010, you have encountered +[KB2757355](http://support.microsoft.com/kb/2757355), a bug triggered by a +specific installation order. However, the solution suggested by the KB article +does not always resolve the problem. See [this stackoverflow discussion]( +https://stackoverflow.com/questions/10888391) for other suggestions. + +### IBM XL C/C++ + +The regular builds by SAP is using version 12.1, described as `IBM XL C/C++ for +AIX, V12.1 (5765-J02, 5725-C72) Version: 12.01.0000.0017`. + +See the [OpenJDK PowerPC Port Status Page]( +http://cr.openjdk.java.net/~simonis/ppc-aix-port) for details. + +## Boot JDK Requirements + +Paradoxically, building OpenJDK requires a pre-existing JDK. This is called the +"boot JDK". The boot JDK does not have to be OpenJDK, though. If you are +porting OpenJDK to a new platform, chances are that there already exists +another JDK for that platform that is usable as boot JDK. + +The rule of thumb is that the boot JDK for building JDK major version *N* +should be an JDK of major version *N-1*, so for building JDK 9 a JDK 8 would be +suitable as boot JDK. However, OpenJDK should be able to "build itself", so an +up-to-date build of the current OpenJDK source is an acceptable alternative. If +you are following the *N-1* rule, make sure you got the latest update version, +since JDK 8 GA might not be able to build JDK 9 on all platforms. + +If the Boot JDK is not automatically detected, or the wrong JDK is picked, use +`--with-boot-jdk` to point to the JDK to use. + +### JDK 8 on Linux + +On apt-based distros (like Debian and Ubuntu), `sudo apt-get install +openjdk-8-jdk` is typically enough to install OpenJDK 8. On rpm-based distros +(like Fedora and Red Hat), try `sudo yum install java-1.8.0-openjdk-devel`. + +### JDK 8 on Windows + +No pre-compiled binaries of OpenJDK 8 are readily available for Windows at the +time of writing. An alternative is to download the [Oracle JDK]( +http://www.oracle.com/technetwork/java/javase/downloads). Another is the [Adopt +OpenJDK Project](https://adoptopenjdk.net/), which publishes experimental +prebuilt binaries for Windows. + +### JDK 8 on macOS + +No pre-compiled binaries of OpenJDK 8 are readily available for macOS at the +time of writing. An alternative is to download the [Oracle JDK]( +http://www.oracle.com/technetwork/java/javase/downloads), or to install it +using `brew cask install java`. Another option is the [Adopt OpenJDK Project]( +https://adoptopenjdk.net/), which publishes experimental prebuilt binaries for +macOS. + +### JDK 8 on AIX + +No pre-compiled binaries of OpenJDK 8 are readily available for AIX at the +time of writing. A starting point for working with OpenJDK on AIX is +the [PowerPC/AIX Port Project](http://openjdk.java.net/projects/ppc-aix-port/). + +## External Library Requirements + +Different platforms require different external libraries. In general, libraries +are not optional - that is, they are either required or not used. + +If a required library is not detected by `configure`, you need to provide the +path to it. There are two forms of the `configure` arguments to point to an +external library: `--with-=` or `--with--include= --with--lib=`. The first variant is more concise, +but require the include files an library files to reside in a default hierarchy +under this directory. In most cases, it works fine. + +As a fallback, the second version allows you to point to the include directory +and the lib directory separately. + +### FreeType + +FreeType2 from [The FreeType Project](http://www.freetype.org/) is required on +all platforms. At least version 2.3 is required. + + * To install on an apt-based Linux, try running `sudo apt-get install + libcups2-dev`. + * To install on an rpm-based Linux, try running `sudo yum install + cups-devel`. + * To install on Solaris, try running `pkg install system/library/freetype-2`. + * To install on macOS, try running `brew install freetype`. + * To install on Windows, see [below](#building-freetype-on-windows). + +Use `--with-freetype=` if `configure` does not properly locate your +FreeType files. + +#### Building FreeType on Windows + +On Windows, there is no readily available compiled version of FreeType. OpenJDK +can help you compile FreeType from source. Download the FreeType sources and +unpack them into an arbitrary directory: + +``` +wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz +tar -xzf freetype-2.5.3.tar.gz +``` + +Then run `configure` with `--with-freetype-src=`. This will +automatically build the freetype library into `/lib64` for 64-bit +builds or into `/lib32` for 32-bit builds. Afterwards you can +always use `--with-freetype-include=/include` and +`--with-freetype-lib=/lib[32|64]` for other builds. + +Alternatively you can unpack the sources like this to use the default +directory: + +``` +tar --one-top-level=$HOME/freetype --strip-components=1 -xzf freetype-2.5.3.tar.gz +``` + +### CUPS + +CUPS, [Common UNIX Printing System](http://www.cups.org) header files are +required on all platforms, except Windows. Often these files are provided by +your operating system. + + * To install on an apt-based Linux, try running `sudo apt-get install + libcups2-dev`. + * To install on an rpm-based Linux, try running `sudo yum install + cups-devel`. + * To install on Solaris, try running `pkg install print/cups`. + +Use `--with-cups=` if `configure` does not properly locate your CUPS +files. + +### X11 + +Certain [X11](http://www.x.org/) libraries and include files are required on +Linux and Solaris. + + * To install on an apt-based Linux, try running `sudo apt-get install + libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev`. + * To install on an rpm-based Linux, try running `sudo yum install + libXtst-devel libXt-devel libXrender-devel libXi-devel`. + * To install on Solaris, try running `pkg install x11/header/x11-protocols + x11/library/libice x11/library/libpthread-stubs x11/library/libsm + x11/library/libx11 x11/library/libxau x11/library/libxcb + x11/library/libxdmcp x11/library/libxevie x11/library/libxext + x11/library/libxrender x11/library/libxscrnsaver x11/library/libxtst + x11/library/toolkit/libxt`. + +Use `--with-x=` if `configure` does not properly locate your X11 files. + +### ALSA + +ALSA, [Advanced Linux Sound Architecture](https://www.alsa-project.org/) is +required on Linux. At least version 0.9.1 of ALSA is required. + + * To install on an apt-based Linux, try running `sudo apt-get install + libasound2-dev`. + * To install on an rpm-based Linux, try running `sudo yum install + alsa-lib-devel`. + +Use `--with-alsa=` if `configure` does not properly locate your ALSA +files. + +### libffi + +libffi, the [Portable Foreign Function Interface Library]( +http://sourceware.org/libffi) is required when building the Zero version of +Hotspot. + + * To install on an apt-based Linux, try running `sudo apt-get install + libffi-dev`. + * To install on an rpm-based Linux, try running `sudo yum install + libffi-devel`. + +Use `--with-libffi=` if `configure` does not properly locate your libffi +files. + +### libelf + +libelf from the [elfutils project](http://sourceware.org/elfutils) is required +when building the AOT feature of Hotspot. + + * To install on an apt-based Linux, try running `sudo apt-get install + libelf-dev`. + * To install on an rpm-based Linux, try running `sudo yum install + elfutils-libelf-devel`. + +Use `--with-libelf=` if `configure` does not properly locate your libelf +files. + +## Other Tooling Requirements + +### GNU Make + +OpenJDK requires [GNU Make](http://www.gnu.org/software/make). No other flavors +of make are supported. + +At least version 3.81 of GNU Make must be used. For distributions supporting +GNU Make 4.0 or above, we strongly recommend it. GNU Make 4.0 contains useful +functionality to handle parallel building (supported by `--with-output-sync`) +and speed and stability improvements. + +Note that `configure` locates and verifies a properly functioning version of +`make` and stores the path to this `make` binary in the configuration. If you +start a build using `make` on the command line, you will be using the version +of make found first in your `PATH`, and not necessarily the one stored in the +configuration. This initial make will be used as "bootstrap make", and in a +second stage, the make located by `configure` will be called. Normally, this +will present no issues, but if you have a very old `make`, or a non-GNU Make +`make` in your path, this might cause issues. + +If you want to override the default make found by `configure`, use the `MAKE` +configure variable, e.g. `configure MAKE=/opt/gnu/make`. + +On Solaris, it is common to call the GNU version of make by using `gmake`. + +### GNU Bash + +OpenJDK requires [GNU Bash](http://www.gnu.org/software/bash). No other shells +are supported. + +At least version 3.2 of GNU Bash must be used. + +### Autoconf + +If you want to modify the build system itself, you need to install [Autoconf]( +http://www.gnu.org/software/autoconf). + +However, if you only need to build OpenJDK or if you only edit the actual +OpenJDK source files, there is no dependency on autoconf, since the source +distribution includes a pre-generated `configure` shell script. + +See the section on [Autoconf Details](#autoconf-details) for details on how +OpenJDK uses autoconf. This is especially important if you plan to contribute +changes to OpenJDK that modifies the build system. + +## Running Configure + +To build OpenJDK, you need a "configuration", which consists of a directory +where to store the build output, coupled with information about the platform, +the specific build machine, and choices that affect how OpenJDK is built. + +The configuration is created by the `configure` script. The basic invocation of +the `configure` script looks like this: + +``` +bash configure [options] +``` + +This will create an output directory containing the configuration and setup an +area for the build result. This directory typically looks like +`build/linux-x64-normal-server-release`, but the actual name depends on your +specific configuration. (It can also be set directly, see [Using Multiple +Configurations](#using-multiple-configurations)). This directory is referred to +as `$BUILD` in this documentation. + +`configure` will try to figure out what system you are running on and where all +necessary build components are. If you have all prerequisites for building +installed, it should find everything. If it fails to detect any component +automatically, it will exit and inform you about the problem. + +Some command line examples: + + * Create a 32-bit build for Windows with FreeType2 in `C:\freetype-i586`: + ``` + bash configure --with-freetype=/cygdrive/c/freetype-i586 --with-target-bits=32 + ``` + + * Create a debug build with the `server` JVM and DTrace enabled: + ``` + bash configure --enable-debug --with-jvm-variants=server --enable-dtrace + ``` + +### Common Configure Arguments + +Here follows some of the most common and important `configure` argument. + +To get up-to-date information on *all* available `configure` argument, please +run: +``` +bash configure --help +``` + +(Note that this help text also include general autoconf options, like +`--dvidir`, that is not relevant to OpenJDK. To list only OpenJDK specific +features, use `bash configure --help=short` instead.) + +#### Configure Arguments for Tailoring the Build + + * `--enable-debug` - Set the debug level to `fastdebug` (this is a shorthand + for `--with-debug-level=fastdebug`) + * `--with-debug-level=` - Set the debug level, which can be `release`, + `fastdebug`, `slowdebug` or `optimized`. Default is `release`. `optimized` + is variant of `release` with additional Hotspot debug code. + * `--with-native-debug-symbols=` - Specify if and how native debug + symbols should be built. Available methods are `none`, `internal`, + `external`, `zipped`. Default behavior depends on platform. See [Native + Debug Symbols](#native-debug-symbols) for more details. + * `--with-version-string=` - Specify the version string this build + will be identified with. + * `--with-version-=` - A group of options, where `` can be + any of `pre`, `opt`, `build`, `major`, `minor`, `security` or `patch`. Use + these options to modify just the corresponding part of the version string + from the default, or the value provided by `--with-version-string`. + * `--with-jvm-variants=[,...]` - Build the specified variant + (or variants) of Hotspot. Valid variants are: `server`, `client`, + `minimal`, `core`, `zero`, `zeroshark`, `custom`. Note that not all + variants are possible to combine in a single build. + * `--with-jvm-features=[,...]` - Use the specified JVM + features when building Hotspot. The list of features will be enabled on top + of the default list. For the `custom` JVM variant, this default list is + empty. A complete list of available JVM features can be found using `bash + configure --help`. + * `--with-target-bits=` - Create a target binary suitable for running + on a `` platform. Use this to create 32-bit output on a 64-bit build + platform, instead of doing a full cross-compile. (This is known as a + *reduced* build.) + +#### Configure Arguments for Native Compilation + + * `--with-devkit=` - Use this devkit for compilers, tools and resources + * `--with-sysroot=` - Use this directory as sysroot + * `--with-extra-path=[;]` - Prepend these directories to the + default path when searching for all kinds of binaries + * `--with-toolchain-path=[;]` - Prepend these directories when + searching for toolchain binaries (compilers etc) + * `--with-extra-cflags=` - Append these flags when compiling JDK C + files + * `--with-extra-cxxflags=` - Append these flags when compiling JDK C++ + files + * `--with-extra-ldflags=` - Append these flags when linking JDK + libraries + +#### Configure Arguments for External Dependencies + + * `--with-boot-jdk=` - Set the path to the [Boot JDK]( + #boot-jdk-requirements) + * `--with-freetype=` - Set the path to [FreeType](#freetype) + * `--with-cups=` - Set the path to [CUPS](#cups) + * `--with-x=` - Set the path to [X11](#x11) + * `--with-alsa=` - Set the path to [ALSA](#alsa) + * `--with-libffi=` - Set the path to [libffi](#libffi) + * `--with-libelf=` - Set the path to [libelf](#libelf) + * `--with-jtreg=` - Set the path to JTReg. See [Running Tests]( + #running-tests) + +Certain third-party libraries used by OpenJDK (libjpeg, giflib, libpng, lcms +and zlib) are included in the OpenJDK repository. The default behavior of the +OpenJDK build is to use this version of these libraries, but they might be +replaced by an external version. To do so, specify `system` as the `` +option in these arguments. (The default is `bundled`). + + * `--with-libjpeg=` - Use the specified source for libjpeg + * `--with-giflib=` - Use the specified source for giflib + * `--with-libpng=` - Use the specified source for libpng + * `--with-lcms=` - Use the specified source for lcms + * `--with-zlib=` - Use the specified source for zlib + +On Linux, it is possible to select either static or dynamic linking of the C++ +runtime. The default is static linking, with dynamic linking as fallback if the +static library is not found. + + * `--with-stdc++lib=` - Use the specified method (`static`, `dynamic` + or `default`) for linking the C++ runtime. + +### Configure Control Variables + +It is possible to control certain aspects of `configure` by overriding the +value of `configure` variables, either on the command line or in the +environment. + +Normally, this is **not recommended**. If used improperly, it can lead to a +broken configuration. Unless you're well versed in the build system, this is +hard to use properly. Therefore, `configure` will print a warning if this is +detected. + +However, there are a few `configure` variables, known as *control variables* +that are supposed to be overriden on the command line. These are variables that +describe the location of tools needed by the build, like `MAKE` or `GREP`. If +any such variable is specified, `configure` will use that value instead of +trying to autodetect the tool. For instance, `bash configure +MAKE=/opt/gnumake4.0/bin/make`. + +If a configure argument exists, use that instead, e.g. use `--with-jtreg` +instead of setting `JTREGEXE`. + +Also note that, despite what autoconf claims, setting `CFLAGS` will not +accomplish anything. Instead use `--with-extra-cflags` (and similar for +`cxxflags` and `ldflags`). + +## Running Make + +When you have a proper configuration, all you need to do to build OpenJDK is to +run `make`. (But see the warning at [GNU Make](#gnu-make) about running the +correct version of make.) + +When running `make` without any arguments, the default target is used, which is +the same as running `make default` or `make jdk`. This will build a minimal (or +roughly minimal) set of compiled output (known as an "exploded image") needed +for a developer to actually execute the newly built JDK. The idea is that in an +incremental development fashion, when doing a normal make, you should only +spend time recompiling what's changed (making it purely incremental) and only +do the work that's needed to actually run and test your code. + +The output of the exploded image resides in `$BUILD/jdk`. You can test the +newly built JDK like this: `$BUILD/jdk/bin/java -version`. + +### Common Make Targets + +Apart from the default target, here are some common make targets: + + * `hotspot` - Build all of hotspot (but only hotspot) + * `hotspot-` - Build just the specified jvm variant + * `images` or `product-images` - Build the JRE and JDK images + * `docs` or `docs-image` - Build the documentation image + * `test-image` - Build the test image + * `all` or `all-images` - Build all images (product, docs and test) + * `bootcycle-images` - Build images twice, second time with newly built JDK + (good for testing) + * `clean` - Remove all files generated by make, but not those generated by + configure + * `dist-clean` - Remove all files, including configuration + +Run `make help` to get an up-to-date list of important make targets and make +control variables. + +It is possible to build just a single module, a single phase, or a single phase +of a single module, by creating make targets according to these followin +patterns. A phase can be either of `gensrc`, `gendata`, `copy`, `java`, +`launchers`, `libs` or `rmic`. See [Using Fine-Grained Make Targets]( +#using-fine-grained-make-targets) for more details about this functionality. + + * `` - Build the specified phase and everything it depends on + * `` - Build the specified module and everything it depends on + * `-` - Compile the specified phase for the specified module + and everything it depends on + +Similarly, it is possible to clean just a part of the build by creating make +targets according to these patterns: + + * `clean-` - Remove the subdir in the output dir with the name + * `clean-` - Remove all build results related to a certain build + phase + * `clean-` - Remove all build results related to a certain module + * `clean--` - Remove all build results related to a certain + module and phase + +### Make Control Variables + +It is possible to control `make` behavior by overriding the value of `make` +variables, either on the command line or in the environment. + +Normally, this is **not recommended**. If used improperly, it can lead to a +broken build. Unless you're well versed in the build system, this is hard to +use properly. Therefore, `make` will print a warning if this is detected. + +However, there are a few `make` variables, known as *control variables* that +are supposed to be overriden on the command line. These make up the "make time" +configuration, as opposed to the "configure time" configuration. + +#### General Make Control Variables + + * `JOBS` - Specify the number of jobs to build with. See [Build + Performance](#build-performance). + * `LOG` - Specify the logging level and functionality. See [Checking the + Build Log File](#checking-the-build-log-file) + * `CONF` and `CONF_NAME` - Selecting the configuration(s) to use. See [Using + Multiple Configurations](#using-multiple-configurations) + +#### Test Make Control Variables + +These make control variables only make sense when running tests. Please see +[Testing OpenJDK](testing.html) for details. + + * `TEST` + * `TEST_JOBS` + * `JTREG` + * `GTEST` + +#### Advanced Make Control Variables + +These advanced make control variables can be potentially unsafe. See [Hints and +Suggestions for Advanced Users](#hints-and-suggestions-for-advanced-users) and +[Understanding the Build System](#understanding-the-build-system) for details. + + * `SPEC` + * `CONF_CHECK` + * `COMPARE_BUILD` + * `JDK_FILTER` + +## Running Tests + +Most of the OpenJDK tests are using the [JTReg](http://openjdk.java.net/jtreg) +test framework. Make sure that your configuration knows where to find your +installation of JTReg. If this is not picked up automatically, use the +`--with-jtreg=` option to point to the JTReg framework. +Note that this option should point to the JTReg home, i.e. the top directory, +containing `lib/jtreg.jar` etc. + +To execute the most basic tests (tier 1), use: +``` +make run-test-tier1 +``` + +For more details on how to run tests, please see the [Testing +OpenJDK](testing.html) document. + +## Cross-compiling + +Cross-compiling means using one platform (the *build* platform) to generate +output that can ran on another platform (the *target* platform). + +The typical reason for cross-compiling is that the build is performed on a more +powerful desktop computer, but the resulting binaries will be able to run on a +different, typically low-performing system. Most of the complications that +arise when building for embedded is due to this separation of *build* and +*target* systems. + +This requires a more complex setup and build procedure. This section assumes +you are familiar with cross-compiling in general, and will only deal with the +particularities of cross-compiling OpenJDK. If you are new to cross-compiling, +please see the [external links at Wikipedia]( +https://en.wikipedia.org/wiki/Cross_compiler#External_links) for a good start +on reading materials. + +Cross-compiling OpenJDK requires you to be able to build both for the build +platform and for the target platform. The reason for the former is that we need +to build and execute tools during the build process, both native tools and Java +tools. + +If all you want to do is to compile a 32-bit version, for the same OS, on a +64-bit machine, consider using `--with-target-bits=32` instead of doing a +full-blown cross-compilation. (While this surely is possible, it's a lot more +work and will take much longer to build.) + +### Boot JDK and Build JDK + +When cross-compiling, make sure you use a boot JDK that runs on the *build* +system, and not on the *target* system. + +To be able to build, we need a "Build JDK", which is a JDK built from the +current sources (that is, the same as the end result of the entire build +process), but able to run on the *build* system, and not the *target* system. +(In contrast, the Boot JDK should be from an older release, e.g. JDK 8 when +building JDK 9.) + +The build process will create a minimal Build JDK for you, as part of building. +To speed up the build, you can use `--with-build-jdk` to `configure` to point +to a pre-built Build JDK. Please note that the build result is unpredictable, +and can possibly break in subtle ways, if the Build JDK does not **exactly** +match the current sources. + +### Specifying the Target Platform + +You *must* specify the target platform when cross-compiling. Doing so will also +automatically turn the build into a cross-compiling mode. The simplest way to +do this is to use the `--openjdk-target` argument, e.g. +`--openjdk-target=arm-linux-gnueabihf`. or `--openjdk-target=aarch64-oe-linux`. +This will automatically set the `--build`, `--host` and `--target` options for +autoconf, which can otherwise be confusing. (In autoconf terminology, the +"target" is known as "host", and "target" is used for building a Canadian +cross-compiler.) + +### Toolchain Considerations + +You will need two copies of your toolchain, one which generates output that can +run on the target system (the normal, or *target*, toolchain), and one that +generates output that can run on the build system (the *build* toolchain). Note +that cross-compiling is only supported for gcc at the time being. The gcc +standard is to prefix cross-compiling toolchains with the target denominator. +If you follow this standard, `configure` is likely to pick up the toolchain +correctly. + +The *build* toolchain will be autodetected just the same way the normal +*build*/*target* toolchain will be autodetected when not cross-compiling. If +this is not what you want, or if the autodetection fails, you can specify a +devkit containing the *build* toolchain using `--with-build-devkit` to +`configure`, or by giving `BUILD_CC` and `BUILD_CXX` arguments. + +It is often helpful to locate the cross-compilation tools, headers and +libraries in a separate directory, outside the normal path, and point out that +directory to `configure`. Do this by setting the sysroot (`--with-sysroot`) and +appending the directory when searching for cross-compilations tools +(`--with-toolchain-path`). As a compact form, you can also use `--with-devkit` +to point to a single directory, if it is correctly setup. (See `basics.m4` for +details.) + +If you are unsure what toolchain and versions to use, these have been proved +working at the time of writing: + + * [aarch64]( +https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux.tar.xz) + * [arm 32-bit hardware floating point]( +https://launchpad.net/linaro-toolchain-unsupported/trunk/2012.09/+download/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux.tar.bz2) + +### Native Libraries + +You will need copies of external native libraries for the *target* system, +present on the *build* machine while building. + +Take care not to replace the *build* system's version of these libraries by +mistake, since that can render the *build* machine unusable. + +Make sure that the libraries you point to (ALSA, X11, etc) are for the +*target*, not the *build*, platform. + +#### ALSA + +You will need alsa libraries suitable for your *target* system. For most cases, +using Debian's pre-built libraries work fine. + +Note that alsa is needed even if you only want to build a headless JDK. + + * Go to [Debian Package Search](https://www.debian.org/distrib/packages) and + search for the `libasound2` and `libasound2-dev` packages for your *target* + system. Download them to /tmp. + + * Install the libraries into the cross-compilation toolchain. For instance: +``` +cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc +dpkg-deb -x /tmp/libasound2_1.0.25-4_armhf.deb . +dpkg-deb -x /tmp/libasound2-dev_1.0.25-4_armhf.deb . +``` + + * If alsa is not properly detected by `configure`, you can point it out by + `--with-alsa`. + +#### X11 + +You will need X11 libraries suitable for your *target* system. For most cases, +using Debian's pre-built libraries work fine. + +Note that X11 is needed even if you only want to build a headless JDK. + + * Go to [Debian Package Search](https://www.debian.org/distrib/packages), + search for the following packages for your *target* system, and download them + to /tmp/target-x11: + * libxi + * libxi-dev + * x11proto-core-dev + * x11proto-input-dev + * x11proto-kb-dev + * x11proto-render-dev + * x11proto-xext-dev + * libice-dev + * libxrender + * libxrender-dev + * libsm-dev + * libxt-dev + * libx11 + * libx11-dev + * libxtst + * libxtst-dev + * libxext + * libxext-dev + + * Install the libraries into the cross-compilation toolchain. For instance: + ``` + cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc/usr + mkdir X11R6 + cd X11R6 + for deb in /tmp/target-x11/*.deb ; do dpkg-deb -x $deb . ; done + mv usr/* . + cd lib + cp arm-linux-gnueabihf/* . + ``` + + You can ignore the following messages. These libraries are not needed to + successfully complete a full JDK build. + ``` + cp: cannot stat `arm-linux-gnueabihf/libICE.so': No such file or directory + cp: cannot stat `arm-linux-gnueabihf/libSM.so': No such file or directory + cp: cannot stat `arm-linux-gnueabihf/libXt.so': No such file or directory + ``` + + * If the X11 libraries are not properly detected by `configure`, you can + point them out by `--with-x`. + +### Building for ARM/aarch64 + +A common cross-compilation target is the ARM CPU. When building for ARM, it is +useful to set the ABI profile. A number of pre-defined ABI profiles are +available using `--with-abi-profile`: arm-vfp-sflt, arm-vfp-hflt, arm-sflt, +armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer +properly supported on OpenJDK. + +OpenJDK contains two different ports for the aarch64 platform, one is the +original aarch64 port from the [AArch64 Port Project]( +http://openjdk.java.net/projects/aarch64-port) and one is a 64-bit version of +the Oracle contributed ARM port. When targeting aarch64, by the default the +original aarch64 port is used. To select the Oracle ARM 64 port, use +`--with-cpu-port=arm64`. Also set the corresponding value (`aarch64` or +`arm64`) to --with-abi-profile, to ensure a consistent build. + +### Verifying the Build + +The build will end up in a directory named like +`build/linux-arm-normal-server-release`. + +Inside this build output directory, the `images/jdk` and `images/jre` will +contain the newly built JDK and JRE, respectively, for your *target* system. + +Copy these folders to your *target* system. Then you can run e.g. +`images/jdk/bin/java -version`. + +## Build Performance + +Building OpenJDK requires a lot of horsepower. Some of the build tools can be +adjusted to utilize more or less of resources such as parallel threads and +memory. The `configure` script analyzes your system and selects reasonable +values for such options based on your hardware. If you encounter resource +problems, such as out of memory conditions, you can modify the detected values +with: + + * `--with-num-cores` -- number of cores in the build system, e.g. + `--with-num-cores=8`. + + * `--with-memory-size` -- memory (in MB) available in the build system, e.g. + `--with-memory-size=1024` + +You can also specify directly the number of build jobs to use with +`--with-jobs=N` to `configure`, or `JOBS=N` to `make`. Do not use the `-j` flag +to `make`. In most cases it will be ignored by the makefiles, but it can cause +problems for some make targets. + +It might also be necessary to specify the JVM arguments passed to the Boot JDK, +using e.g. `--with-boot-jdk-jvmargs="-Xmx8G"`. Doing so will override the +default JVM arguments passed to the Boot JDK. + +At the end of a successful execution of `configure`, you will get a performance +summary, indicating how well the build will perform. Here you will also get +performance hints. If you want to build fast, pay attention to those! + +If you want to tweak build performance, run with `make LOG=info` to get a build +time summary at the end of the build process. + +### Disk Speed + +If you are using network shares, e.g. via NFS, for your source code, make sure +the build directory is situated on local disk (e.g. by `ln -s +/localdisk/jdk-build $JDK-SHARE/build`). The performance penalty is extremely +high for building on a network share; close to unusable. + +Also, make sure that your build tools (including Boot JDK and toolchain) is +located on a local disk and not a network share. + +As has been stressed elsewhere, do use SSD for source code and build directory, +as well as (if possible) the build tools. + +### Virus Checking + +The use of virus checking software, especially on Windows, can *significantly* +slow down building of OpenJDK. If possible, turn off such software, or exclude +the directory containing the OpenJDK source code from on-the-fly checking. + +### Ccache + +The OpenJDK build supports building with ccache when using gcc or clang. Using +ccache can radically speed up compilation of native code if you often rebuild +the same sources. Your milage may vary however, so we recommend evaluating it +for yourself. To enable it, make sure it's on the path and configure with +`--enable-ccache`. + +### Precompiled Headers + +By default, the Hotspot build uses preccompiled headers (PCH) on the toolchains +were it is properly supported (clang, gcc, and Visual Studio). Normally, this +speeds up the build process, but in some circumstances, it can actually slow +things down. + +You can experiment by disabling precompiled headers using +`--disable-precompiled-headers`. + +### Icecc / icecream + +[icecc/icecream](http://github.com/icecc/icecream) is a simple way to setup a +distributed compiler network. If you have multiple machines available for +building OpenJDK, you can drastically cut individual build times by utilizing +it. + +To use, setup an icecc network, and install icecc on the build machine. Then +run `configure` using `--enable-icecc`. + +### Using sjavac + +To speed up Java compilation, especially incremental compilations, you can try +the experimental sjavac compiler by using `--enable-sjavac`. + +### Building the Right Target + +Selecting the proper target to build can have dramatic impact on build time. +For normal usage, `jdk` or the default target is just fine. You only need to +build `images` for shipping, or if your tests require it. + +See also [Using Fine-Grained Make Targets](#using-fine-grained-make-targets) on +how to build an even smaller subset of the product. + +## Troubleshooting + +If your build fails, it can sometimes be difficult to pinpoint the problem or +find a proper solution. + +### Locating the Source of the Error + +When a build fails, it can be hard to pinpoint the actual cause of the error. +In a typical build process, different parts of the product build in parallel, +with the output interlaced. + +#### Build Failure Summary + +To help you, the build system will print a failure summary at the end. It looks +like this: + +``` +ERROR: Build failed for target 'hotspot' in configuration 'linux-x64' (exit code 2) + +=== Output from failing command(s) repeated here === +* For target hotspot_variant-server_libjvm_objs_psMemoryPool.o: +/localhome/hg/jdk9-sandbox/hotspot/src/share/vm/services/psMemoryPool.cpp:1:1: error: 'failhere' does not name a type + ... (rest of output omitted) + +* All command lines available in /localhome/hg/jdk9-sandbox/build/linux-x64/make-support/failure-logs. +=== End of repeated output === + +=== Make failed targets repeated here === +lib/CompileJvm.gmk:207: recipe for target '/localhome/hg/jdk9-sandbox/build/linux-x64/hotspot/variant-server/libjvm/objs/psMemoryPool.o' failed +make/Main.gmk:263: recipe for target 'hotspot-server-libs' failed +=== End of repeated output === + +Hint: Try searching the build log for the name of the first failed target. +Hint: If caused by a warning, try configure --disable-warnings-as-errors. +``` + +Let's break it down! First, the selected configuration, and the top-level +target you entered on the command line that caused the failure is printed. + +Then, between the `Output from failing command(s) repeated here` and `End of +repeated output` the first lines of output (stdout and stderr) from the actual +failing command is repeated. In most cases, this is the error message that +caused the build to fail. If multiple commands were failing (this can happen in +a parallel build), output from all failed commands will be printed here. + +The path to the `failure-logs` directory is printed. In this file you will find +a `.log` file that contains the output from this command in its +entirety, and also a `.cmd`, which contain the complete command line +used for running this command. You can re-run the failing command by executing +`. /.cmd` in your shell. + +Another way to trace the failure is to follow the chain of make targets, from +top-level targets to individual file targets. Between `Make failed targets +repeated here` and `End of repeated output` the output from make showing this +chain is repeated. The first failed recipe will typically contain the full path +to the file in question that failed to compile. Following lines will show a +trace of make targets why we ended up trying to compile that file. + +Finally, some hints are given on how to locate the error in the complete log. +In this example, we would try searching the log file for "`psMemoryPool.o`". +Another way to quickly locate make errors in the log is to search for "`] +Error`" or "`***`". + +Note that the build failure summary will only help you if the issue was a +compilation failure or similar. If the problem is more esoteric, or is due to +errors in the build machinery, you will likely get empty output logs, and `No +indication of failed target found` instead of the make target chain. + +#### Checking the Build Log File + +The output (stdout and stderr) from the latest build is always stored in +`$BUILD/build.log`. The previous build log is stored as `build.log.old`. This +means that it is not necessary to redirect the build output yourself if you +want to process it. + +You can increase the verbosity of the log file, by the `LOG` control variable +to `make`. If you want to see the command lines used in compilations, use +`LOG=cmdlines`. To increase the general verbosity, use `LOG=info`, `LOG=debug` +or `LOG=trace`. Both of these can be combined with `cmdlines`, e.g. +`LOG=info,cmdlines`. The `debug` log level will show most shell commands +executed by make, and `trace` will show all. Beware that both these log levels +will produce a massive build log! + +### Fixing Unexpected Build Failures + +Most of the time, the build will fail due to incorrect changes in the source +code. + +Sometimes the build can fail with no apparent changes that have caused the +failure. If this is the first time you are building OpenJDK on this particular +computer, and the build fails, the problem is likely with your build +environment. But even if you have previously built OpenJDK with success, and it +now fails, your build environment might have changed (perhaps due to OS +upgrades or similar). But most likely, such failures are due to problems with +the incremental rebuild. + +#### Problems with the Build Environment + +Make sure your configuration is correct. Re-run `configure`, and look for any +warnings. Warnings that appear in the middle of the `configure` output is also +repeated at the end, after the summary. The entire log is stored in +`$BUILD/configure.log`. + +Verify that the summary at the end looks correct. Are you indeed using the Boot +JDK and native toolchain that you expect? + +By default, OpenJDK has a strict approach where warnings from the compiler is +considered errors which fail the build. For very new or very old compiler +versions, this can trigger new classes of warnings, which thus fails the build. +Run `configure` with `--disable-warnings-as-errors` to turn of this behavior. +(The warnings will still show, but not make the build fail.) + +#### Problems with Incremental Rebuilds + +Incremental rebuilds mean that when you modify part of the product, only the +affected parts get rebuilt. While this works great in most cases, and +significantly speed up the development process, from time to time complex +interdependencies will result in an incorrect build result. This is the most +common cause for unexpected build problems, together with inconsistencies +between the different Mercurial repositories in the forest. + +Here are a suggested list of things to try if you are having unexpected build +problems. Each step requires more time than the one before, so try them in +order. Most issues will be solved at step 1 or 2. + + 1. Make sure your forest is up-to-date + + Run `bash get_source.sh` to make sure you have the latest version of all + repositories. + + 2. Clean build results + + The simplest way to fix incremental rebuild issues is to run `make clean`. + This will remove all build results, but not the configuration or any build + system support artifacts. In most cases, this will solve build errors + resulting from incremental build mismatches. + + 3. Completely clean the build directory. + + If this does not work, the next step is to run `make dist-clean`, or + removing the build output directory (`$BUILD`). This will clean all + generated output, including your configuration. You will need to re-run + `configure` after this step. A good idea is to run `make + print-configuration` before running `make dist-clean`, as this will print + your current `configure` command line. Here's a way to do this: + + ``` + make print-configuration > current-configuration + make dist-clean + bash configure $(cat current-configuration) + make + ``` + + 4. Re-clone the Mercurial forest + + Sometimes the Mercurial repositories themselves gets in a state that causes + the product to be un-buildable. In such a case, the simplest solution is + often the "sledgehammer approach": delete the entire forest, and re-clone + it. If you have local changes, save them first to a different location + using `hg export`. + +### Specific Build Issues + +#### Clock Skew + +If you get an error message like this: +``` +File 'xxx' has modification time in the future. +Clock skew detected. Your build may be incomplete. +``` +then the clock on your build machine is out of sync with the timestamps on the +source files. Other errors, apparently unrelated but in fact caused by the +clock skew, can occur along with the clock skew warnings. These secondary +errors may tend to obscure the fact that the true root cause of the problem is +an out-of-sync clock. + +If you see these warnings, reset the clock on the build machine, run `make +clean` and restart the build. + +#### Out of Memory Errors + +On Solaris, you might get an error message like this: +``` +Trouble writing out table to disk +``` +To solve this, increase the amount of swap space on your build machine. + +On Windows, you might get error messages like this: +``` +fatal error - couldn't allocate heap +cannot create ... Permission denied +spawn failed +``` +This can be a sign of a Cygwin problem. See the information about solving +problems in the [Cygwin](#cygwin) section. Rebooting the computer might help +temporarily. + +### Getting Help + +If none of the suggestions in this document helps you, or if you find what you +believe is a bug in the build system, please contact the Build Group by sending +a mail to [build-dev@openjdk.java.net](mailto:build-dev@openjdk.java.net). +Please include the relevant parts of the configure and/or build log. + +If you need general help or advice about developing for OpenJDK, you can also +contact the Adoption Group. See the section on [Contributing to OpenJDK]( +#contributing-to-openjdk) for more information. + +## Hints and Suggestions for Advanced Users + +### Setting Up a Forest for Pushing Changes (defpath) + +To help you prepare a proper push path for a Mercurial repository, there exists +a useful tool known as [defpath]( +http://openjdk.java.net/projects/code-tools/defpath). It will help you setup a +proper push path for pushing changes to OpenJDK. + +Install the extension by cloning +`http://hg.openjdk.java.net/code-tools/defpath` and updating your `.hgrc` file. +Here's one way to do this: + +``` +cd ~ +mkdir hg-ext +cd hg-ext +hg clone http://hg.openjdk.java.net/code-tools/defpath +cat << EOT >> ~/.hgrc +[extensions] +defpath=~/hg-ext/defpath/defpath.py +EOT +``` + +You can now setup a proper push path using: +``` +hg defpath -d -u +``` + +If you also have the `trees` extension installed in Mercurial, you will +automatically get a `tdefpath` command, which is even more useful. By running +`hg tdefpath -du ` in the top repository of your forest, all repos +will get setup automatically. This is the recommended usage. + +### Bash Completion + +The `configure` and `make` commands tries to play nice with bash command-line +completion (using `` or ``). To use this functionality, make +sure you enable completion in your `~/.bashrc` (see instructions for bash in +your operating system). + +Make completion will work out of the box, and will complete valid make targets. +For instance, typing `make jdk-i` will complete to `make jdk-image`. + +The `configure` script can get completion for options, but for this to work you +need to help `bash` on the way. The standard way of running the script, `bash +configure`, will not be understood by bash completion. You need `configure` to +be the command to run. One way to achieve this is to add a simple helper script +to your path: + +``` +cat << EOT > /tmp/configure +#!/bin/bash +if [ \$(pwd) = \$(cd \$(dirname \$0); pwd) ] ; then + echo >&2 "Abort: Trying to call configure helper recursively" + exit 1 +fi + +bash \$PWD/configure "\$@" +EOT +chmod +x /tmp/configure +sudo mv /tmp/configure /usr/local/bin +``` + +Now `configure --en-dt` will result in `configure --enable-dtrace`. + +### Using Multiple Configurations + +You can have multiple configurations for a single source forest. When you +create a new configuration, run `configure --with-conf-name=` to create a +configuration with the name ``. Alternatively, you can create a directory +under `build` and run `configure` from there, e.g. `mkdir build/ && cd +build/ && bash ../../configure`. + +Then you can build that configuration using `make CONF_NAME=` or `make +CONF=`, where `` is a substring matching one or several +configurations, e.g. `CONF=debug`. The special empty pattern (`CONF=`) will +match *all* available configuration, so `make CONF= hotspot` will build the +`hotspot` target for all configurations. Alternatively, you can execute `make` +in the configuration directory, e.g. `cd build/ && make`. + +### Handling Reconfigurations + +If you update the forest and part of the configure script has changed, the +build system will force you to re-run `configure`. + +Most of the time, you will be fine by running `configure` again with the same +arguments as the last time, which can easily be performed by `make +reconfigure`. To simplify this, you can use the `CONF_CHECK` make control +variable, either as `make CONF_CHECK=auto`, or by setting an environment +variable. For instance, if you add `export CONF_CHECK=auto` to your `.bashrc` +file, `make` will always run `reconfigure` automatically whenever the configure +script has changed. + +You can also use `CONF_CHECK=ignore` to skip the check for a needed configure +update. This might speed up the build, but comes at the risk of an incorrect +build result. This is only recommended if you know what you're doing. + +From time to time, you will also need to modify the command line to `configure` +due to changes. Use `make print-configure` to show the command line used for +your current configuration. + +### Using Fine-Grained Make Targets + +The default behavior for make is to create consistent and correct output, at +the expense of build speed, if necessary. + +If you are prepared to take some risk of an incorrect build, and know enough of +the system to understand how things build and interact, you can speed up the +build process considerably by instructing make to only build a portion of the +product. + +#### Building Individual Modules + +The safe way to use fine-grained make targets is to use the module specific +make targets. All source code in JDK 9 is organized so it belongs to a module, +e.g. `java.base` or `jdk.jdwp.agent`. You can build only a specific module, by +giving it as make target: `make jdk.jdwp.agent`. If the specified module +depends on other modules (e.g. `java.base`), those modules will be built first. + +You can also specify a set of modules, just as you can always specify a set of +make targets: `make jdk.crypto.cryptoki jdk.crypto.ec jdk.crypto.mscapi +jdk.crypto.ucrypto` + +#### Building Individual Module Phases + +The build process for each module is divided into separate phases. Not all +modules need all phases. Which are needed depends on what kind of source code +and other artifact the module consists of. The phases are: + + * `gensrc` (Generate source code to compile) + * `gendata` (Generate non-source code artifacts) + * `copy` (Copy resource artifacts) + * `java` (Compile Java code) + * `launchers` (Compile native executables) + * `libs` (Compile native libraries) + * `rmic` (Run the `rmic` tool) + +You can build only a single phase for a module by using the notation +`$MODULE-$PHASE`. For instance, to build the `gensrc` phase for `java.base`, +use `make java.base-gensrc`. + +Note that some phases may depend on others, e.g. `java` depends on `gensrc` (if +present). Make will build all needed prerequisites before building the +requested phase. + +#### Skipping the Dependency Check + +When using an iterative development style with frequent quick rebuilds, the +dependency check made by make can take up a significant portion of the time +spent on the rebuild. In such cases, it can be useful to bypass the dependency +check in make. + +> **Note that if used incorrectly, this can lead to a broken build!** + +To achieve this, append `-only` to the build target. For instance, `make +jdk.jdwp.agent-java-only` will *only* build the `java` phase of the +`jdk.jdwp.agent` module. If the required dependencies are not present, the +build can fail. On the other hand, the execution time measures in milliseconds. + +A useful pattern is to build the first time normally (e.g. `make +jdk.jdwp.agent`) and then on subsequent builds, use the `-only` make target. + +#### Rebuilding Part of java.base (JDK\_FILTER) + +If you are modifying files in `java.base`, which is the by far largest module +in OpenJDK, then you need to rebuild all those files whenever a single file has +changed. (This inefficiency will hopefully be addressed in JDK 10.) + +As a hack, you can use the make control variable `JDK_FILTER` to specify a +pattern that will be used to limit the set of files being recompiled. For +instance, `make java.base JDK_FILTER=javax/crypto` (or, to combine methods, +`make java.base-java-only JDK_FILTER=javax/crypto`) will limit the compilation +to files in the `javax.crypto` package. + +### Learn About Mercurial + +To become an efficient OpenJDK developer, it is recommended that you invest in +learning Mercurial properly. Here are some links that can get you started: + + * [Mercurial for git users](http://www.mercurial-scm.org/wiki/GitConcepts) + * [The official Mercurial tutorial](http://www.mercurial-scm.org/wiki/Tutorial) + * [hg init](http://hginit.com/) + * [Mercurial: The Definitive Guide](http://hgbook.red-bean.com/read/) + +## Understanding the Build System + +This section will give you a more technical description on the details of the +build system. + +### Configurations + +The build system expects to find one or more configuration. These are +technically defined by the `spec.gmk` in a subdirectory to the `build` +subdirectory. The `spec.gmk` file is generated by `configure`, and contains in +principle the configuration (directly or by files included by `spec.gmk`). + +You can, in fact, select a configuration to build by pointing to the `spec.gmk` +file with the `SPEC` make control variable, e.g. `make SPEC=$BUILD/spec.gmk`. +While this is not the recommended way to call `make` as a user, it is what is +used under the hood by the build system. + +### Build Output Structure + +The build output for a configuration will end up in `build/`, which we refer to as `$BUILD` in this document. The `$BUILD` directory +contains the following important directories: + +``` +buildtools/ +configure-support/ +hotspot/ +images/ +jdk/ +make-support/ +support/ +test-results/ +test-support/ +``` + +This is what they are used for: + + * `images`: This is the directory were the output of the `*-image` make + targets end up. For instance, `make jdk-image` ends up in `images/jdk`. + + * `jdk`: This is the "exploded image". After `make jdk`, you will be able to + launch the newly built JDK by running `$BUILD/jdk/bin/java`. + + * `test-results`: This directory contains the results from running tests. + + * `support`: This is an area for intermediate files needed during the build, + e.g. generated source code, object files and class files. Some noteworthy + directories in `support` is `gensrc`, which contains the generated source + code, and the `modules_*` directories, which contains the files in a + per-module hierarchy that will later be collapsed into the `jdk` directory + of the exploded image. + + * `buildtools`: This is an area for tools compiled for the build platform + that are used during the rest of the build. + + * `hotspot`: This is an area for intermediate files needed when building + hotspot. + + * `configure-support`, `make-support` and `test-support`: These directories + contain files that are needed by the build system for `configure`, `make` + and for running tests. + +### Fixpath + +Windows path typically look like `C:\User\foo`, while Unix paths look like +`/home/foo`. Tools with roots from Unix often experience issues related to this +mismatch when running on Windows. + +In the OpenJDK build, we always use Unix paths internally, and only just before +calling a tool that does not understand Unix paths do we convert them to +Windows paths. + +This conversion is done by the `fixpath` tool, which is a small wrapper that +modifies unix-style paths to Windows-style paths in command lines. Fixpath is +compiled automatically by `configure`. + +### Native Debug Symbols + +Native libraries and executables can have debug symbol (and other debug +information) associated with them. How this works is very much platform +dependent, but a common problem is that debug symbol information takes a lot of +disk space, but is rarely needed by the end user. + +The OpenJDK supports different methods on how to handle debug symbols. The +method used is selected by `--with-native-debug-symbols`, and available methods +are `none`, `internal`, `external`, `zipped`. + + * `none` means that no debug symbols will be generated during the build. + + * `internal` means that debug symbols will be generated during the build, and + they will be stored in the generated binary. + + * `external` means that debug symbols will be generated during the build, and + after the compilation, they will be moved into a separate `.debuginfo` file. + (This was previously known as FDS, Full Debug Symbols). + + * `zipped` is like `external`, but the .debuginfo file will also be zipped + into a `.diz` file. + +When building for distribution, `zipped` is a good solution. Binaries built +with `internal` is suitable for use by developers, since they facilitate +debugging, but should be stripped before distributed to end users. + +### Autoconf Details + +The `configure` script is based on the autoconf framework, but in some details +deviate from a normal autoconf `configure` script. + +The `configure` script in the top level directory of OpenJDK is just a thin +wrapper that calls `common/autoconf/configure`. This in turn provides +functionality that is not easily expressed in the normal Autoconf framework, +and then calls into the core of the `configure` script, which is the +`common/autoconf/generated-configure.sh` file. + +As the name implies, this file is generated by Autoconf. It is checked in after +regeneration, to alleviate the common user to have to install Autoconf. + +The build system will detect if the Autoconf source files have changed, and +will trigger a regeneration of `common/autoconf/generated-configure.sh` if +needed. You can also manually request such an update by `bash +common/autoconf/autogen.sh`. + +If you make changes to the build system that requires a re-generation, note the +following: + + * You must use *exactly* version 2.69 of autoconf for your patch to be + accepted. This is to avoid spurious changes in the generated file. Note + that Ubuntu 16.04 ships a patched version of autoconf which claims to be + 2.69, but is not. + + * You do not need to include the generated file in reviews. + + * If the generated file needs updating, the Oracle JDK closed counter-part + will also need to be updated. It is very much appreciated if you ask for an + Oracle engineer to sponsor your push so this can be made in tandem. + +### Developing the Build System Itself + +This section contains a few remarks about how to develop for the build system +itself. It is not relevant if you are only making changes in the product source +code. + +While technically using `make`, the make source files of the OpenJDK does not +resemble most other Makefiles. Instead of listing specific targets and actions +(perhaps using patterns), the basic modus operandi is to call a high-level +function (or properly, macro) from the API in `make/common`. For instance, to +compile all classes in the `jdk.internal.foo` package in the `jdk.foo` module, +a call like this would be made: + +``` +$(eval $(call SetupJavaCompilation, BUILD_FOO_CLASSES, \ + SETUP := GENERATE_OLDBYTECODE, \ + SRC := $(JDK_TOPDIR)/src/jkd.foo/share/classes, \ + INCLUDES := jdk/internal/foo, \ + BIN := $(SUPPORT_OUTPUTDIR)/foo_classes, \ +)) +``` + +By encapsulating and expressing the high-level knowledge of *what* should be +done, rather than *how* it should be done (as is normal in Makefiles), we can +build a much more powerful and flexible build system. + +Correct dependency tracking is paramount. Sloppy dependency tracking will lead +to improper parallelization, or worse, race conditions. + +To test for/debug race conditions, try running `make JOBS=1` and `make +JOBS=100` and see if it makes any difference. (It shouldn't). + +To compare the output of two different builds and see if, and how, they differ, +run `$BUILD1/compare.sh -o $BUILD2`, where `$BUILD1` and `$BUILD2` are the two +builds you want to compare. + +To automatically build two consecutive versions and compare them, use +`COMPARE_BUILD`. The value of `COMPARE_BUILD` is a set of variable=value +assignments, like this: +``` +make COMPARE_BUILD=CONF=--enable-new-hotspot-feature:MAKE=hotspot +``` +See `make/InitSupport.gmk` for details on how to use `COMPARE_BUILD`. + +To analyze build performance, run with `LOG=trace` and check `$BUILD/build-trace-time.log`. +Use `JOBS=1` to avoid parallelism. + +Please check that you adhere to the [Code Conventions for the Build System]( +http://openjdk.java.net/groups/build/doc/code-conventions.html) before +submitting patches. Also see the section in [Autoconf Details]( +#autoconf-details) about the generated configure script. + +## Contributing to OpenJDK + +So, now you've build your OpenJDK, and made your first patch, and want to +contribute it back to the OpenJDK community. + +First of all: Thank you! We gladly welcome your contribution to the OpenJDK. +However, please bear in mind that OpenJDK is a massive project, and we must ask +you to follow our rules and guidelines to be able to accept your contribution. + +The official place to start is the ['How to contribute' page]( +http://openjdk.java.net/contribute/). There is also an official (but somewhat +outdated and skimpy on details) [Developer's Guide]( +http://openjdk.java.net/guide/). + +If this seems overwhelming to you, the Adoption Group is there to help you! A +good place to start is their ['New Contributor' page]( +https://wiki.openjdk.java.net/display/Adoption/New+Contributor), or start +reading the comprehensive [Getting Started Kit]( +https://adoptopenjdk.gitbooks.io/adoptopenjdk-getting-started-kit/en/). The +Adoption Group will also happily answer any questions you have about +contributing. Contact them by [mail]( +http://mail.openjdk.java.net/mailman/listinfo/adoption-discuss) or [IRC]( +http://openjdk.java.net/irc/). + +--- +# Override styles from the base CSS file that are not ideal for this document. +header-includes: + - '' +--- diff -r 830e16e5eef5 -r d9f6bc6ba599 common/doc/testing.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/doc/testing.html Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,118 @@ + + + + + + + Testing OpenJDK + + + + + + +
+

Testing OpenJDK

+
+ +

Using the run-test framework

+

This new way of running tests is developer-centric. It assumes that you have built a jdk locally and want to test it. Running common test targets is simple, and more complex ad-hoc combination of tests is possible. The user interface is forgiving, and clearly report errors it cannot resolve.

+

Some example command-lines:

+
$ make run-test-tier1
+$ make run-test-jdk_lang JTREG="JOBS=8"
+$ make run-test TEST=jdk_lang
+$ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1"
+$ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"
+$ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java"
+

Configuration

+

To be able to run JTReg tests, configure needs to know where to find the JTReg test framework. If it is not picked up automatically by configure, use the --with-jtreg=<path to jtreg home> option to point to the JTReg framework. Note that this option should point to the JTReg home, i.e. the top directory, containing lib/jtreg.jar etc. (An alternative is to set the JT_HOME environment variable to point to the JTReg home before running configure.)

+

Test selection

+

All functionality is available using the run-test make target. In this use case, the test or tests to be executed is controlled using the TEST variable. To speed up subsequent test runs with no source code changes, run-test-only can be used instead, which do not depend on the source and test image build.

+

For some common top-level tests, direct make targets have been generated. This includes all JTReg test groups, the hotspot gtest, and custom tests (if present). This means that make run-test-tier1 is equivalent to make run-test TEST="tier1", but the latter is more tab-completion friendly. For more complex test runs, the run-test TEST="x" solution needs to be used.

+

The test specifications given in TEST is parsed into fully qualified test descriptors, which clearly and unambigously show which tests will be run. As an example, :tier1 will expand to jtreg:jdk/test:tier1 jtreg:langtools/test:tier1 jtreg:nashorn/test:tier1 jtreg:jaxp/test:tier1. You can always submit a list of fully qualified test descriptors in the TEST variable if you want to shortcut the parser.

+

JTReg

+

JTReg test groups can be specified either without a test root, e.g. :tier1 (or tier1, the initial colon is optional), or with, e.g. hotspot/test:tier1, jdk/test:jdk_util.

+

When specified without a test root, all matching groups from all tests roots will be added. Otherwise, only the group from the specified test root will be added.

+

Individual JTReg tests or directories containing JTReg tests can also be specified, like hotspot/test/native_sanity/JniVersion.java or hotspot/test/native_sanity. You can also specify an absolute path, to point to a JTReg test outside the source tree.

+

As long as the test groups or test paths can be uniquely resolved, you do not need to enter the jtreg: prefix. If this is not possible, or if you want to use a fully qualified test descriptor, add jtreg:, e.g. jtreg:hotspot/test/native_sanity.

+

Gtest

+

Since the Hotspot Gtest suite is so quick, the default is to run all tests. This is specified by just gtest, or as a fully qualified test descriptor gtest:all.

+

If you want, you can single out an individual test or a group of tests, for instance gtest:LogDecorations or gtest:LogDecorations.level_test_vm. This can be particularly useful if you want to run a shaky test repeatedly.

+

Test results and summary

+

At the end of the test run, a summary of all tests run will be presented. This will have a consistent look, regardless of what test suites were used. This is a sample summary:

+
==============================
+Test summary
+==============================
+   TEST                                          TOTAL  PASS  FAIL ERROR
+>> jtreg:jdk/test:tier1                           1867  1865     2     0 <<
+   jtreg:langtools/test:tier1                     4711  4711     0     0
+   jtreg:nashorn/test:tier1                        133   133     0     0
+==============================
+TEST FAILURE
+

Tests where the number of TOTAL tests does not equal the number of PASSed tests will be considered a test failure. These are marked with the >> ... << marker for easy identification.

+

The classification of non-passed tests differs a bit between test suites. In the summary, ERROR is used as a catch-all for tests that neither passed nor are classified as failed by the framework. This might indicate test framework error, timeout or other problems.

+

In case of test failures, make run-test will exit with a non-zero exit value.

+

All tests have their result stored in build/$BUILD/test-results/$TEST_ID, where TEST_ID is a path-safe conversion from the fully qualified test descriptor, e.g. for jtreg:jdk/test:tier1 the TEST_ID is jtreg_jdk_test_tier1. This path is also printed in the log at the end of the test run.

+

Additional work data is stored in build/$BUILD/test-support/$TEST_ID. For some frameworks, this directory might contain information that is useful in determining the cause of a failed test.

+

Test suite control

+

It is possible to control various aspects of the test suites using make control variables.

+

These variables use a keyword=value approach to allow multiple values to be set. So, for instance, JTREG="JOBS=1;TIMEOUT=8" will set the JTReg concurrency level to 1 and the timeout factor to 8. This is equivalent to setting JTREG_JOBS=1 JTREG_TIMEOUT=8, but using the keyword format means that the JTREG variable is parsed and verified for correctness, so JTREG="TMIEOUT=8" would give an error, while JTREG_TMIEOUT=8 would just pass unnoticed.

+

To separate multiple keyword=value pairs, use ; (semicolon). Since the shell normally eats ;, the recommended usage is to write the assignment inside qoutes, e.g. JTREG="...;...". This will also make sure spaces are preserved, as in JTREG="VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug".

+

(Other ways are possible, e.g. using backslash: JTREG=JOBS=1\;TIMEOUT=8. Also, as a special technique, the string %20 will be replaced with space for certain options, e.g. JTREG=VM_OTIONS=-XshowSettings%20-Xlog:gc+ref=debug. This can be useful if you have layers of scripts and have trouble getting proper quoting of command line arguments through.)

+

As far as possible, the names of the keywords have been standardized between test suites.

+

JTReg keywords

+

JOBS

+

The test concurrency (-concurrency).

+

Defaults to TEST_JOBS (if set by --with-test-jobs=), otherwise it defaults to JOBS, except for Hotspot, where the default is number of CPU cores/2, but never more than 12.

+

TIMEOUT

+

The timeout factor (-timeoutFactor).

+

Defaults to 4.

+

TEST_MODE

+

The test mode (-agentvm, -samevm or -othervm).

+

Defaults to -agentvm.

+

ASSERT

+

Enable asserts (-ea -esa, or none).

+

Set to true or false. If true, adds -ea -esa. Defaults to true, except for hotspot.

+

VERBOSE

+

The verbosity level (-verbose).

+

Defaults to fail,error,summary.

+

RETAIN

+

What test data to retain (-retain).

+

Defaults to fail,error.

+

MAX_MEM

+

Limit memory consumption (-Xmx and -vmoption:-Xmx, or none).

+

Limit memory consumption for JTReg test framework and VM under test. Set to 0 to disable the limits.

+

Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).

+

OPTIONS

+

Additional options to the JTReg test framework.

+

Use JTREG="OPTIONS=--help all" to see all available JTReg options.

+

JAVA_OPTIONS

+

Additional Java options to JTReg (-javaoption).

+

VM_OPTIONS

+

Additional VM options to JTReg (-vmoption).

+

Gtest keywords

+

REPEAT

+

The number of times to repeat the tests (--gtest_repeat).

+

Default is 1. Set to -1 to repeat indefinitely. This can be especially useful combined with OPTIONS=--gtest_break_on_failure to reproduce an intermittent problem.

+

OPTIONS

+

Additional options to the Gtest test framework.

+

Use GTEST="OPTIONS=--help" to see all available Gtest options.

+ + diff -r 830e16e5eef5 -r d9f6bc6ba599 common/doc/testing.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/doc/testing.md Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,215 @@ +% Testing OpenJDK + +## Using the run-test framework + +This new way of running tests is developer-centric. It assumes that you have +built a jdk locally and want to test it. Running common test targets is simple, +and more complex ad-hoc combination of tests is possible. The user interface is +forgiving, and clearly report errors it cannot resolve. + +Some example command-lines: + + $ make run-test-tier1 + $ make run-test-jdk_lang JTREG="JOBS=8" + $ make run-test TEST=jdk_lang + $ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1" + $ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug" + $ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java" + +### Configuration + +To be able to run JTReg tests, `configure` needs to know where to find the +JTReg test framework. If it is not picked up automatically by configure, use +the `--with-jtreg=` option to point to the JTReg framework. +Note that this option should point to the JTReg home, i.e. the top directory, +containing `lib/jtreg.jar` etc. (An alternative is to set the `JT_HOME` +environment variable to point to the JTReg home before running `configure`.) + +## Test selection + +All functionality is available using the run-test make target. In this use +case, the test or tests to be executed is controlled using the `TEST` variable. +To speed up subsequent test runs with no source code changes, run-test-only can +be used instead, which do not depend on the source and test image build. + +For some common top-level tests, direct make targets have been generated. This +includes all JTReg test groups, the hotspot gtest, and custom tests (if +present). This means that `make run-test-tier1` is equivalent to `make run-test +TEST="tier1"`, but the latter is more tab-completion friendly. For more complex +test runs, the `run-test TEST="x"` solution needs to be used. + +The test specifications given in `TEST` is parsed into fully qualified test +descriptors, which clearly and unambigously show which tests will be run. As an +example, `:tier1` will expand to `jtreg:jdk/test:tier1 +jtreg:langtools/test:tier1 jtreg:nashorn/test:tier1 jtreg:jaxp/test:tier1`. You +can always submit a list of fully qualified test descriptors in the `TEST` +variable if you want to shortcut the parser. + +### JTReg + +JTReg test groups can be specified either without a test root, e.g. `:tier1` +(or `tier1`, the initial colon is optional), or with, e.g. +`hotspot/test:tier1`, `jdk/test:jdk_util`. + +When specified without a test root, all matching groups from all tests roots +will be added. Otherwise, only the group from the specified test root will be +added. + +Individual JTReg tests or directories containing JTReg tests can also be +specified, like `hotspot/test/native_sanity/JniVersion.java` or +`hotspot/test/native_sanity`. You can also specify an absolute path, to point +to a JTReg test outside the source tree. + +As long as the test groups or test paths can be uniquely resolved, you do not +need to enter the `jtreg:` prefix. If this is not possible, or if you want to +use a fully qualified test descriptor, add `jtreg:`, e.g. +`jtreg:hotspot/test/native_sanity`. + +### Gtest + +Since the Hotspot Gtest suite is so quick, the default is to run all tests. +This is specified by just `gtest`, or as a fully qualified test descriptor +`gtest:all`. + +If you want, you can single out an individual test or a group of tests, for +instance `gtest:LogDecorations` or `gtest:LogDecorations.level_test_vm`. This +can be particularly useful if you want to run a shaky test repeatedly. + +## Test results and summary + +At the end of the test run, a summary of all tests run will be presented. This +will have a consistent look, regardless of what test suites were used. This is +a sample summary: + + ============================== + Test summary + ============================== + TEST TOTAL PASS FAIL ERROR + >> jtreg:jdk/test:tier1 1867 1865 2 0 << + jtreg:langtools/test:tier1 4711 4711 0 0 + jtreg:nashorn/test:tier1 133 133 0 0 + ============================== + TEST FAILURE + +Tests where the number of TOTAL tests does not equal the number of PASSed tests +will be considered a test failure. These are marked with the `>> ... <<` marker +for easy identification. + +The classification of non-passed tests differs a bit between test suites. In +the summary, ERROR is used as a catch-all for tests that neither passed nor are +classified as failed by the framework. This might indicate test framework +error, timeout or other problems. + +In case of test failures, `make run-test` will exit with a non-zero exit value. + +All tests have their result stored in `build/$BUILD/test-results/$TEST_ID`, +where TEST_ID is a path-safe conversion from the fully qualified test +descriptor, e.g. for `jtreg:jdk/test:tier1` the TEST_ID is +`jtreg_jdk_test_tier1`. This path is also printed in the log at the end of the +test run. + +Additional work data is stored in `build/$BUILD/test-support/$TEST_ID`. For +some frameworks, this directory might contain information that is useful in +determining the cause of a failed test. + +## Test suite control + +It is possible to control various aspects of the test suites using make control +variables. + +These variables use a keyword=value approach to allow multiple values to be +set. So, for instance, `JTREG="JOBS=1;TIMEOUT=8"` will set the JTReg +concurrency level to 1 and the timeout factor to 8. This is equivalent to +setting `JTREG_JOBS=1 JTREG_TIMEOUT=8`, but using the keyword format means that +the `JTREG` variable is parsed and verified for correctness, so +`JTREG="TMIEOUT=8"` would give an error, while `JTREG_TMIEOUT=8` would just +pass unnoticed. + +To separate multiple keyword=value pairs, use `;` (semicolon). Since the shell +normally eats `;`, the recommended usage is to write the assignment inside +qoutes, e.g. `JTREG="...;..."`. This will also make sure spaces are preserved, +as in `JTREG="VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"`. + +(Other ways are possible, e.g. using backslash: `JTREG=JOBS=1\;TIMEOUT=8`. +Also, as a special technique, the string `%20` will be replaced with space for +certain options, e.g. `JTREG=VM_OTIONS=-XshowSettings%20-Xlog:gc+ref=debug`. +This can be useful if you have layers of scripts and have trouble getting +proper quoting of command line arguments through.) + +As far as possible, the names of the keywords have been standardized between +test suites. + +### JTReg keywords + +#### JOBS +The test concurrency (`-concurrency`). + +Defaults to TEST_JOBS (if set by `--with-test-jobs=`), otherwise it defaults to +JOBS, except for Hotspot, where the default is *number of CPU cores/2*, but +never more than 12. + +#### TIMEOUT +The timeout factor (`-timeoutFactor`). + +Defaults to 4. + +#### TEST_MODE +The test mode (`-agentvm`, `-samevm` or `-othervm`). + +Defaults to `-agentvm`. + +#### ASSERT +Enable asserts (`-ea -esa`, or none). + +Set to `true` or `false`. If true, adds `-ea -esa`. Defaults to true, except +for hotspot. + +#### VERBOSE +The verbosity level (`-verbose`). + +Defaults to `fail,error,summary`. + +#### RETAIN +What test data to retain (`-retain`). + +Defaults to `fail,error`. + +#### MAX_MEM +Limit memory consumption (`-Xmx` and `-vmoption:-Xmx`, or none). + +Limit memory consumption for JTReg test framework and VM under test. Set to 0 +to disable the limits. + +Defaults to 512m, except for hotspot, where it defaults to 0 (no limit). + +#### OPTIONS +Additional options to the JTReg test framework. + +Use `JTREG="OPTIONS=--help all"` to see all available JTReg options. + +#### JAVA_OPTIONS +Additional Java options to JTReg (`-javaoption`). + +#### VM_OPTIONS +Additional VM options to JTReg (`-vmoption`). + +### Gtest keywords + +#### REPEAT +The number of times to repeat the tests (`--gtest_repeat`). + +Default is 1. Set to -1 to repeat indefinitely. This can be especially useful +combined with `OPTIONS=--gtest_break_on_failure` to reproduce an intermittent +problem. + +#### OPTIONS +Additional options to the Gtest test framework. + +Use `GTEST="OPTIONS=--help"` to see all available Gtest options. + +--- +# Override some definitions in the global css file that are not optimal for +# this document. +header-includes: + - '' +--- diff -r 830e16e5eef5 -r d9f6bc6ba599 common/nb_native/nbproject/configurations.xml --- a/common/nb_native/nbproject/configurations.xml Mon Jul 03 13:18:55 2017 -0700 +++ b/common/nb_native/nbproject/configurations.xml Thu Aug 24 16:26:58 2017 +0200 @@ -982,52 +982,6 @@ - - - - - agent_util.c - - - compiledMethodLoad.c - - - gctest.c - - - heapTracker.c - - - heapViewer.c - - - java_crw_demo.c - - - minst.c - - - mtrace.c - - - versionCheck.c - - - Agent.cpp - Monitor.cpp - Thread.cpp - waiters.cpp - - - - - - - Poller.c - - - - @@ -1223,7 +1177,7 @@ check_format.c - + compress.c deflate.c gzclose.c @@ -21533,89 +21487,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DEBUG - - - - - ../../jdk/src/java.base/share/native/include - ../../jdk/src/demo/share/jvmti/waiters - ../../jdk/src/java.base/macosx/native/include - ../../jdk/make - - - DEBUG - - - - - - - ../../jdk/src/java.base/share/native/include - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/java.base/macosx/native/include - ../../jdk/make - - - - - - - ../../jdk/src/demo/share/jvmti/compiledMethodLoad - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/macosx/native/include - ../../jdk/make - - - - - - - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/macosx/native/include - ../../jdk/src/demo/share/jvmti/gctest - ../../jdk/make - - - - - - - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/macosx/native/include - ../../jdk/src/demo/share/jvmti/heapTracker - ../../jdk/make - - - - - - - ../../jdk/src/java.base/share/native/include - ../../jdk/src/demo/share/jvmti/heapViewer - ../../jdk/src/java.base/macosx/native/include - ../../jdk/make - - - - - - - ../../jdk/src/demo/share/jvmti/java_crw_demo - ../../jdk/src/java.base/share/native/include - ../../jdk/make - - - - - - - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/macosx/native/include - ../../jdk/src/demo/share/jvmti/minst - ../../jdk/make - - - - - - - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/macosx/native/include - ../../jdk/src/demo/share/jvmti/mtrace - ../../jdk/make - - - - - - - ../../jdk/src/java.base/share/native/include - ../../jdk/src/demo/share/jvmti/versionCheck - ../../jdk/src/java.base/macosx/native/include - ../../jdk/make - - - @@ -36906,106 +36670,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - THIS_FILE="Monitor.cpp" - - - - - - - THIS_FILE="Thread.cpp" - - - - - - - THIS_FILE="waiters.cpp" - - - ../../jdk/src/java.base/unix/native/include ../../jdk/src/java.base/share/native/libjava ../../jdk/src/java.base/unix/native/libjava - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../build/support/headers/java.base ../../make @@ -38304,7 +37968,7 @@ ../../jdk/src/java.base/unix/native/include ../../jdk/src/java.base/share/native/libjava ../../jdk/src/java.base/unix/native/libjava - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../build/support/headers/java.base ../../make @@ -38325,7 +37989,7 @@ ../../jdk/src/java.base/unix/native/include ../../jdk/src/java.base/share/native/libjava ../../jdk/src/java.base/unix/native/libjava - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../build/support/headers/java.base ../../make @@ -38346,7 +38010,7 @@ ../../jdk/src/java.base/unix/native/include ../../jdk/src/java.base/share/native/libjava ../../jdk/src/java.base/unix/native/libjava - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../build/support/headers/java.base ../../make @@ -38367,7 +38031,7 @@ ../../jdk/src/java.base/unix/native/include ../../jdk/src/java.base/share/native/libjava ../../jdk/src/java.base/unix/native/libjava - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../build/support/headers/java.base ../../make @@ -38377,14 +38041,14 @@ - - - - - + + + + @@ -38394,7 +38058,7 @@ - @@ -38404,7 +38068,7 @@ - @@ -38414,7 +38078,7 @@ - @@ -38424,7 +38088,7 @@ - @@ -38434,7 +38098,7 @@ - @@ -38444,7 +38108,7 @@ - @@ -38454,7 +38118,7 @@ - @@ -38464,7 +38128,7 @@ - @@ -38474,7 +38138,7 @@ - @@ -38484,7 +38148,7 @@ - @@ -38494,7 +38158,7 @@ - @@ -38504,7 +38168,7 @@ - @@ -38514,7 +38178,7 @@ - @@ -41203,7 +40867,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41232,7 +40896,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41261,7 +40925,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41290,7 +40954,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41319,7 +40983,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41348,7 +41012,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41377,7 +41041,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41406,7 +41070,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41435,7 +41099,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41464,7 +41128,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41493,7 +41157,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41522,7 +41186,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41551,7 +41215,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41580,7 +41244,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41609,7 +41273,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41638,7 +41302,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41667,7 +41331,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41696,7 +41360,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41725,7 +41389,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41754,7 +41418,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41783,7 +41447,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41812,7 +41476,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41841,7 +41505,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41870,7 +41534,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41899,7 +41563,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41928,7 +41592,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41957,7 +41621,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -41986,7 +41650,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42015,7 +41679,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42044,7 +41708,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42073,7 +41737,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42102,7 +41766,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42131,7 +41795,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42160,7 +41824,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42189,7 +41853,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42218,7 +41882,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42247,7 +41911,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42276,7 +41940,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42305,7 +41969,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42334,7 +41998,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42363,7 +42027,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42413,7 +42077,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42442,7 +42106,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -42471,7 +42135,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -46197,183 +45861,6 @@ - - - - DEBUG - - - - - ../../jdk/src/demo/share/jvmti/waiters - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/linux/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - DEBUG - - - - - - - ../../jdk/src/demo/share/jvmti/heapTracker - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/demo/share/jvmti/java_crw_demo - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/linux/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - - - - - ../../jdk/src/demo/share/jvmti/compiledMethodLoad - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/linux/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="compiledMethodLoad.c" - - - - - - - ../../jdk/src/demo/share/jvmti/gctest - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/linux/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="gctest.c" - - - - - - - ../../jdk/src/demo/share/jvmti/heapTracker - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/demo/share/jvmti/java_crw_demo - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/linux/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="heapTracker.c" - - - - - - - ../../jdk/src/demo/share/jvmti/heapViewer - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/linux/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="heapViewer.c" - - - - - - - ../../jdk/src/demo/share/jvmti/heapTracker - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/demo/share/jvmti/java_crw_demo - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/linux/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="java_crw_demo.c" - - - - - - - ../../jdk/src/demo/share/jvmti/minst - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/demo/share/jvmti/java_crw_demo - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/linux/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="minst.c" - - - - - - - ../../jdk/src/demo/share/jvmti/mtrace - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/demo/share/jvmti/java_crw_demo - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/linux/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="mtrace.c" - - - - - - - ../../jdk/src/demo/share/jvmti/versionCheck - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/linux/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="versionCheck.c" - - - @@ -46557,7 +46044,7 @@ ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/unix/native/libjli ../../jdk/src/java.base/share/native/libjli - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../make @@ -46639,15 +46126,15 @@ - - - - ../../jdk/src/java.desktop/share/native/libsplashscreen/giflib - ../../jdk/src/java.desktop/share/native/libjavajpeg - ../../jdk/src/java.desktop/share/native/libsplashscreen - ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng - ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + + + + ../../jdk/src/java.desktop/share/native/libsplashscreen/giflib + ../../jdk/src/java.desktop/share/native/libjavajpeg + ../../jdk/src/java.desktop/share/native/libsplashscreen + ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng + ../../jdk/src/java.desktop/unix/native/libsplashscreen + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -46712,7 +46199,7 @@ ../../jdk/src/java.base/unix/native/libjli ../../jdk/src/java.base/share/native/libjli - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../make @@ -47250,7 +46737,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -47598,7 +47085,7 @@ ../../jdk/src/java.desktop/share/native/libsplashscreen ../../jdk/src/java.desktop/share/native/libsplashscreen/libpng ../../jdk/src/java.desktop/unix/native/libsplashscreen - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/linux/native/libjava ../../jdk/src/java.base/unix/native/libjava ../../jdk/src/java.base/share/native/libjava @@ -47996,7 +47483,7 @@ ../../jdk/src/jdk.pack/share/native/common-unpack ../../jdk/src/java.base/share/native/libjava ../../jdk/src/java.base/unix/native/libjava - ../../jdk/src/java.base/share/native/libzip/zlib-1.2.8 + ../../jdk/src/java.base/share/native/libzip/zlib ../../jdk/src/java.base/share/native/include ../../jdk/src/java.base/linux/native/include ../../jdk/src/java.base/unix/native/include @@ -55235,113 +54722,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - THIS_FILE="Monitor.cpp" - - - - - - - THIS_FILE="Thread.cpp" - - - - - - - THIS_FILE="waiters.cpp" - - - - - - - - ../../jdk/src/demo/share/jvmti/waiters - ../../jdk/src/demo/share/jvmti/agent_util ../../jdk/src/java.base/share/native/include ../../jdk/src/java.base/solaris/native/include ../../jdk/src/java.base/unix/native/include @@ -64699,189 +64077,6 @@ - - - - DEBUG - - - - - DEBUG - - - - - - - ../../jdk/src/demo/share/jvmti/heapTracker - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/demo/share/jvmti/java_crw_demo - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/solaris/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - - - - - ../../jdk/src/demo/share/jvmti/compiledMethodLoad - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/solaris/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="compiledMethodLoad.c" - - - - - - - ../../jdk/src/demo/share/jvmti/gctest - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/solaris/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="gctest.c" - - - - - - - ../../jdk/src/demo/share/jvmti/heapTracker - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/demo/share/jvmti/java_crw_demo - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/solaris/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="heapTracker.c" - - - - - - - ../../jdk/src/demo/share/jvmti/heapViewer - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/solaris/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="heapViewer.c" - - - - - - - ../../jdk/src/demo/share/jvmti/heapTracker - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/demo/share/jvmti/java_crw_demo - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/solaris/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="java_crw_demo.c" - - - - - - - ../../jdk/src/demo/share/jvmti/minst - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/demo/share/jvmti/java_crw_demo - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/solaris/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="minst.c" - - - - - - - ../../jdk/src/demo/share/jvmti/mtrace - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/demo/share/jvmti/java_crw_demo - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/solaris/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="mtrace.c" - - - - - - - ../../jdk/src/demo/share/jvmti/versionCheck - ../../jdk/src/demo/share/jvmti/agent_util - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/solaris/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../jdk/make - - - THIS_FILE="versionCheck.c" - - - - - - - ../../jdk/src/java.base/share/native/include - ../../jdk/src/java.base/solaris/native/include - ../../jdk/src/java.base/unix/native/include - ../../jdk/src/java.base/share/native/libjava - ../../jdk/src/java.base/unix/native/libjava - ../../build/support/demos/classes/jni/Poller - ../../jdk/make - - - THIS_FILE="Poller.c" - - - diff -r 830e16e5eef5 -r d9f6bc6ba599 corba/.hgtags --- a/corba/.hgtags Mon Jul 03 13:18:55 2017 -0700 +++ b/corba/.hgtags Thu Aug 24 16:26:58 2017 +0200 @@ -398,3 +398,24 @@ 68a8e8658511093b322a46ed04b2a321e1da2a43 jdk-9+153 078ebe23b584466dc8346e620d7821d91751e5a9 jdk-9+154 a545f54babfa31aa7eb611f36031609acd617cbc jdk-9+155 +907c26240cd481579e919bfd23740797ff8ce1c8 jdk-9+156 +9383da04b385cca46b7ca67f3a39ac1b673e09fe jdk-9+157 +de6bdf38935fa753183ca288bed5c06a23c0bb12 jdk-9+158 +6feea77d2083c99e44aa3e272d07b7fb3b801683 jdk-9+159 +c7688f2fa07936b089ca0e9a0a0eff68ff37a542 jdk-9+160 +18f02bc43fe96aef36791d0df7aca748485210cc jdk-9+161 +18ffcf99a3b4a10457853d94190e825bdf07e39b jdk-9+162 +493011dee80e51c2a2b064d049183c047df36d80 jdk-9+163 +965bbae3072702f7c0d95c240523b65e6bb19261 jdk-9+164 +a510b2201154abdd12ede42788086b5283bfb9a6 jdk-9+165 +934c18145915b06d3fcc0de1a30f91f5aab8a192 jdk-9+166 +43de67f51801b9e16507865fcb7e8344f4ca4aa9 jdk-9+167 +03a2cc9c8a1e8f87924c9863e917bc8b91770d5f jdk-9+168 +b2218d41edef02ee8f94bb438f885b2ba79bfa08 jdk-9+169 +8a4ab3b0ab9a86df73d9a1e337134f2dbe006725 jdk-9+170 +c62e5964cfcf144d8f72e9ba69757897785349a9 jdk-9+171 +95ed14547ca9246baed34f90ef3ca13217538a8c jdk-9+172 +534ba4f8cfcf12accc5b9adb943103f2ff79fe16 jdk-9+173 +3615768c12904e29bb2ec1b506cd4633cd8a9ced jdk-9+174 +dc78a3dd6b3a4f11cdae8a3e3d160e6a78bc7838 jdk-9+175 +40fb9f229471ef357d493813d34b15afcce9f32b jdk-9+176 diff -r 830e16e5eef5 -r d9f6bc6ba599 corba/README --- a/corba/README Mon Jul 03 13:18:55 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -README: - This file should be located at the top of the corba Mercurial repository. - - See http://openjdk.java.net/ for more information about the OpenJDK. - - See ../README-builds.html for complete details on build machine requirements. - -Simple Build Instructions: - - cd make && gnumake - - The files that will be imported into the jdk build will be in the "dist" - directory. - diff -r 830e16e5eef5 -r d9f6bc6ba599 corba/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/package.html --- a/corba/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/package.html Mon Jul 03 13:18:55 2017 -0700 +++ b/corba/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/package.html Thu Aug 24 16:26:58 2017 +0200 @@ -1,4 +1,4 @@ - + @@ -6,7 +6,7 @@ package - -Provides the mapping of the OMG CORBA APIs to the JavaTM + +Provides the mapping of the OMG CORBA APIs to the Java™ programming language, including the class ORB, which is implemented so that a programmer can use it as a fully-functional Object Request Broker (ORB). @@ -147,9 +147,7 @@ register_initial_reference(String id, org.omg.CORBA.Object obj) -

An example that uses some of these methods is -Getting Started with Java IDL. +

An example that uses some of these methods is {@extLink idl_getting_started Getting Started with Java IDL}.

Exceptions

@@ -158,9 +156,8 @@ then any code using that method must have a try/catch block and handle that exception when it is thrown. -

The documentation on Java -IDL exceptions has more information and explains the difference between +

The documentation on {@extLink jidlexception Java IDL exceptions } +has more information and explains the difference between system exceptions and user-defined exceptions.

The following is a list of the system exceptions (which are unchecked @@ -427,7 +424,7 @@ in this case, Account objects. - +

The narrow Method

When an object is the return value for a method, it is returned in the form of a generic object, either an org.omg.CORBA.Object object @@ -447,8 +444,8 @@ will take an object in the Java programming language. The helper class for a non-abstract interface that has at least one abstract base interface will provide both versions of the narrow method. -

The Hello World -tutorial uses a narrow method that looks like this: +

The {@extLink idl_guides Hello World tutorial} +uses a narrow method that looks like this:

         // create and initialize the ORB
         ORB orb = ORB.init(args, null);
@@ -465,7 +462,7 @@
         helloImpl = HelloHelper.narrow(ncRef.resolve_str(name));
 
- +

Example of a Basic Helper Class

A basic helper class, for purposes of this explanation, is one with the methods that are provided by every helper class, plus a narrow @@ -548,6 +545,7 @@ } +

Value Type Helper Classes

A helper class for a value type includes different renderings of the same methods generated for non-value type methods. The main difference @@ -671,7 +669,7 @@      WStringSeqHelper      WStringValueHelper - +

Other Classes

The other classes and interfaces in the CORBA package, which are @@ -861,24 +859,24 @@ Related Documentation For overviews, guides, and a tutorial, please see:
    -
  • -Java IDL home page +
  • {@extLink idl_guides Java IDL tutorial page}.
  • +
  • {@extLink rmi_iiop_guides RMI-IIOP developer's guide}.
-

+

CORBA Features Not Implemented in Java IDL

Some of the API included in org.omg subpackages is provided for conformance with the current OMG CORBA specification but is not implemented -in Sun's release of the JDKTM. This enables +in Sun's release of the JDK™. This enables other JDK licensees to provide implementations of this API in standard extensions and products. -

+

Features That Throw NO_IMPLEMENT

Some of the API included in org.omg subpackages throw diff -r 830e16e5eef5 -r d9f6bc6ba599 corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html --- a/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html Mon Jul 03 13:18:55 2017 -0700 +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html Thu Aug 24 16:26:58 2017 +0200 @@ -1,8 +1,8 @@ - + - + Provides a portability layer, that is, a set of ORB APIs that makes it possible for code generated @@ -38,7 +38,7 @@

- +


CORBA Features Throwing NO_IMPLEMENT() Exceptions


diff -r 830e16e5eef5 -r d9f6bc6ba599 corba/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html --- a/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html Mon Jul 03 13:18:55 2017 -0700 +++ b/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html Thu Aug 24 16:26:58 2017 +0200 @@ -1,4 +1,4 @@ - + @@ -6,7 +6,7 @@ package - + The CORBA_2_3 package defines additions to existing CORBA interfaces in the Java[tm] Standard Edition 6.   These changes occurred in recent revisions to the CORBA API defined by the OMG.  The new methods were @@ -46,7 +46,7 @@ HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA support in Java[tm] SE 6.

- + The following methods in the abstract class org.omg.CORBA_2_3.ORB are unimplemented:

    diff -r 830e16e5eef5 -r d9f6bc6ba599 corba/src/java.corba/share/classes/org/omg/CosNaming/package.html --- a/corba/src/java.corba/share/classes/org/omg/CosNaming/package.html Mon Jul 03 13:18:55 2017 -0700 +++ b/corba/src/java.corba/share/classes/org/omg/CosNaming/package.html Thu Aug 24 16:26:58 2017 +0200 @@ -3,7 +3,7 @@ - + Provides a mechanism to register ORB hooks through which ORB services can intercept the normal flow of execution of the ORB. @@ -52,7 +52,7 @@ {@link org.omg.PortableInterceptor.ORBInitializer ORBInitializer} for how to go about registering interceptors. - +

    Known limitations / unimplemented methods in package org.omg.PortableInterceptor

    diff -r 830e16e5eef5 -r d9f6bc6ba599 corba/src/java.corba/share/classes/org/omg/PortableServer/package.html --- a/corba/src/java.corba/share/classes/org/omg/PortableServer/package.html Mon Jul 03 13:18:55 2017 -0700 +++ b/corba/src/java.corba/share/classes/org/omg/PortableServer/package.html Thu Aug 24 16:26:58 2017 +0200 @@ -1,9 +1,9 @@ - + - + Provides classes and interfaces for making the server side of your applications portable across multivendor ORBs. @@ -157,10 +157,10 @@

    Related Documentation

    For an overview of Java IDL, please see: -Java IDL home page. +{@extLink idl_guides Java IDL home page}.

    Example Code

    - +

    Example Server Code

     import javax.naming.InitialContext;
    diff -r 830e16e5eef5 -r d9f6bc6ba599 corba/src/java.corba/share/classes/sun/corba/Bridge.java
    --- a/corba/src/java.corba/share/classes/sun/corba/Bridge.java	Mon Jul 03 13:18:55 2017 -0700
    +++ b/corba/src/java.corba/share/classes/sun/corba/Bridge.java	Thu Aug 24 16:26:58 2017 +0200
    @@ -59,10 +59,10 @@
      * 
* The code that calls Bridge.get() must have the following Permissions: *
    - *
  • RuntimePermission "reflectionFactoryAccess"
  • *
  • BridgePermission "getBridge"
  • *
  • ReflectPermission "suppressAccessChecks"
  • - *
  • StackFramePermission "retainClassReference"
  • + *
  • RuntimePermission "getStackWalkerWithClassReference"
  • + *
  • RuntimePermission "reflectionFactoryAccess"
  • *
*

* All of these permissions are required to obtain and correctly initialize @@ -105,10 +105,10 @@ /** Fetch the Bridge singleton. This requires the following * permissions: *

    - *
  • RuntimePermission "reflectionFactoryAccess"
  • *
  • BridgePermission "getBridge"
  • *
  • ReflectPermission "suppressAccessChecks"
  • - *
  • StackFramePermission "retainClassReference"
  • + *
  • RuntimePermission "getStackWalkerWithClassReference"
  • + *
  • RuntimePermission "reflectionFactoryAccess"
  • *
* @return The singleton instance of the Bridge class * @throws SecurityException if the caller does not have the diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/.hgignore --- a/hotspot/.hgignore Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/.hgignore Thu Aug 24 16:26:58 2017 +0200 @@ -15,10 +15,10 @@ ^\.mx.jvmci/hotspot/eclipse/.* ^\.idea/ ^workingsets.xml -^src/jdk.vm.ci/share/classes/\w[\w\.]*/.*\.xml -^src/jdk.vm.ci/share/classes/\w[\w\.]*/.*\.iml -^src/jdk.vm.ci/share/classes/\w[\w\.]*/nbproject -^src/jdk.vm.ci/share/classes/\w[\w\.]*/\..* +^src/jdk.internal.vm.ci/share/classes/\w[\w\.]*/.*\.xml +^src/jdk.internal.vm.ci/share/classes/\w[\w\.]*/.*\.iml +^src/jdk.internal.vm.ci/share/classes/\w[\w\.]*/nbproject +^src/jdk.internal.vm.ci/share/classes/\w[\w\.]*/\..* ^test/compiler/jvmci/\w[\w\.]*/.*\.xml ^test/compiler/jvmci/\w[\w\.]*/.*\.iml ^test/compiler/jvmci/\w[\w\.]*/nbproject @@ -27,15 +27,15 @@ ^test/compiler/aot/\w[\w\.]*/.*\.iml ^test/compiler/aot/\w[\w\.]*/nbproject ^test/compiler/aot/\w[\w\.]*/\..* -^src/jdk.vm.compiler/\.mx.graal/env -^src/jdk.vm.compiler/\.mx.graal/.*\.pyc -^src/jdk.vm.compiler/\.mx.graal/eclipse-launches/.* +^src/jdk.internal.vm.compiler/\.mx.graal/env +^src/jdk.internal.vm.compiler/\.mx.graal/.*\.pyc +^src/jdk.internal.vm.compiler/\.mx.graal/eclipse-launches/.* ^src/jdk.aot/share/classes/\w[\w\.]*/.*\.xml ^src/jdk.aot/share/classes/\w[\w\.]*/.*\.iml ^src/jdk.aot/share/classes/\w[\w\.]*/nbproject ^src/jdk.aot/share/classes/\w[\w\.]*/\..* -^src/jdk.vm.compiler/share/classes/\w[\w\.]*/.*\.xml -^src/jdk.vm.compiler/share/classes/\w[\w\.]*/.*\.iml -^src/jdk.vm.compiler/share/classes/\w[\w\.]*/nbproject -^src/jdk.vm.compiler/share/classes/\w[\w\.]*/\..* +^src/jdk.internal.vm.compiler/share/classes/\w[\w\.]*/.*\.xml +^src/jdk.internal.vm.compiler/share/classes/\w[\w\.]*/.*\.iml +^src/jdk.internal.vm.compiler/share/classes/\w[\w\.]*/nbproject +^src/jdk.internal.vm.compiler/share/classes/\w[\w\.]*/\..* diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/.hgtags --- a/hotspot/.hgtags Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/.hgtags Thu Aug 24 16:26:58 2017 +0200 @@ -558,3 +558,24 @@ 217ba81b9a4ce8698200370175aa2db86a39f66c jdk-9+153 a9fdfd55835ef9dccb7f317b07249bd66653b874 jdk-9+154 f3b3d77a1751897413aae43ac340a130b6fa2ae1 jdk-9+155 +43139c588ea48b6504e52b6c3dec530b17b1fdb4 jdk-9+156 +b2d0a906afd73dcf27f572217eb1be0f196ec16c jdk-9+157 +4e78f30935229f13ce7c43089621cf7169f5abac jdk-9+158 +9211c2e89c1cd11ec2d5752b0f97131a7d7525c7 jdk-9+159 +94b4e2e5331d38eab6a3639c3511b2e0715df0e9 jdk-9+160 +191ffbdb3d7b734288daa7fb76b37a0a85dfe7eb jdk-9+161 +b01c519b715ef6f785d0631adee0a6537cf6c12e jdk-9+162 +983fe207555724d98f4876991e1cbafbcf2733e8 jdk-9+163 +0af429be8bbaeaaf0cb838e9af28c953dda6a9c8 jdk-9+164 +c92c6416ca03b1464d5ed99cf6201e52b5ba0a70 jdk-9+165 +560d7aa083a24b6a56443feb8de0f40435d33aa9 jdk-9+166 +1ca7ed1b17b5776930d641d1379834f3140a74e4 jdk-9+167 +fbb9c802649585d19f6d7e81b4a519d44806225a jdk-9+168 +16d692be099c5c38eb48cc9aca78b0c900910d5b jdk-9+169 +38a240fd58a287acb1963920b92ed4d9c2fd39e3 jdk-9+170 +d53171650a2cc6c6f699c966c533b914ca9c0602 jdk-9+171 +1ae9e84f68b359420d2d153ecfe5ee2903e33a2e jdk-9+172 +e64b1cb48d6e7703928a9d1da106fc27f8cb65fd jdk-9+173 +944791f8160185bffa13fbb821fc09b6198f1f25 jdk-9+174 +8f04d457168b9f1f4a1b2c37f49e0513ca9d33a7 jdk-9+175 +2ab74e5dbdc2b6a962c865500cafd23cf387dc60 jdk-9+176 diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/.mx.jvmci/.pydevproject --- a/hotspot/.mx.jvmci/.pydevproject Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/.mx.jvmci/.pydevproject Thu Aug 24 16:26:58 2017 +0200 @@ -3,7 +3,7 @@ Default python 2.7 -/.mx.jvmci +/mx.jvmci /mx diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/.mx.jvmci/mx_jvmci.py --- a/hotspot/.mx.jvmci/mx_jvmci.py Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/.mx.jvmci/mx_jvmci.py Thu Aug 24 16:26:58 2017 +0200 @@ -158,8 +158,8 @@ # JDK9 must be bootstrapped with a JDK8 compliance = mx.JavaCompliance('8') jdk8 = mx.get_jdk(compliance.exactMatch, versionDescription=compliance.value) - cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--with-native-debug-symbols=external', '--disable-precompiled-headers', - '--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk8.home] + cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--with-native-debug-symbols=external', '--disable-precompiled-headers', '--with-jvm-features=graal', + '--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk8.home, '--with-jvm-features=graal'] mx.run(cmd, cwd=_jdkSourceRoot) cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel] if mx.get_opts().verbose: @@ -176,66 +176,6 @@ mx.run(cmd, cwd=_jdkSourceRoot) - if 'images' in cmd: - jdkImageDir = join(jdkBuildDir, 'images', 'jdk') - - # The OpenJDK build creates an empty cacerts file so copy one from - # the default JDK (which is assumed to be an OracleJDK) - srcCerts = join(mx.get_jdk(tag='default').home, 'lib', 'security', 'cacerts') - if not exists(srcCerts): - # Might be building with JDK8 which has cacerts under jre/ - srcCerts = join(mx.get_jdk(tag='default').home, 'jre', 'lib', 'security', 'cacerts') - dstCerts = join(jdkImageDir, 'lib', 'security', 'cacerts') - if srcCerts != dstCerts: - shutil.copyfile(srcCerts, dstCerts) - - _create_jdk_bundle(jdkBuildDir, _vm.debugLevel, jdkImageDir) - -def _get_jdk_bundle_arches(): - """ - Gets a list of names that will be the part of a JDK bundle's file name denoting the architecture. - The first element in the list is the canonical name. Symlinks should be created for the - remaining names. - """ - cpu = mx.get_arch() - if cpu == 'amd64': - return ['x64', 'x86_64', 'amd64'] - elif cpu == 'sparcv9': - return ['sparcv9'] - mx.abort('Unsupported JDK bundle arch: ' + cpu) - -def _create_jdk_bundle(jdkBuildDir, debugLevel, jdkImageDir): - """ - Creates a tar.gz JDK archive, an accompanying tar.gz.sha1 file with its - SHA1 signature plus symlinks to the archive for non-canonical architecture names. - """ - - arches = _get_jdk_bundle_arches() - jdkTgzPath = join(_suite.get_output_root(), 'jdk-bundles', 'jdk9-{}-{}-{}.tar.gz'.format(debugLevel, _get_openjdk_os(), arches[0])) - with mx.Archiver(jdkTgzPath, kind='tgz') as arc: - mx.log('Creating ' + jdkTgzPath) - for root, _, filenames in os.walk(jdkImageDir): - for name in filenames: - f = join(root, name) - arcname = 'jdk1.9.0/' + os.path.relpath(f, jdkImageDir) - arc.zf.add(name=f, arcname=arcname, recursive=False) - - with open(jdkTgzPath + '.sha1', 'w') as fp: - mx.log('Creating ' + jdkTgzPath + '.sha1') - fp.write(mx.sha1OfFile(jdkTgzPath)) - - def _create_link(source, link_name): - if exists(link_name): - os.remove(link_name) - mx.log('Creating ' + link_name + ' -> ' + source) - os.symlink(source, link_name) - - for arch in arches[1:]: - link_name = join(_suite.get_output_root(), 'jdk-bundles', 'jdk9-{}-{}-{}.tar.gz'.format(debugLevel, _get_openjdk_os(), arch)) - jdkTgzName = os.path.basename(jdkTgzPath) - _create_link(jdkTgzName, link_name) - _create_link(jdkTgzName + '.sha1', link_name + '.sha1') - def _runmultimake(args): """run the JDK make process for one or more configurations""" @@ -363,9 +303,9 @@ out.close('link') out.open('link') - out.element('name', data='generated') + out.element('name', data='gensrc') out.element('type', data='2') - generated = join(_get_hotspot_build_dir(jvmVariant, debugLevel), 'generated') + generated = join(_get_hotspot_build_dir(jvmVariant, debugLevel), 'gensrc') out.element('locationURI', data=mx.get_eclipse_project_rel_locationURI(generated, eclProjectDir)) out.close('link') @@ -680,18 +620,12 @@ def _get_hotspot_build_dir(jvmVariant=None, debugLevel=None): """ Gets the directory in which a particular HotSpot configuration is built - (e.g., /build/macosx-x86_64-normal-server-release/hotspot/bsd_amd64_compiler2) + (e.g., /build/macosx-x86_64-normal-server-release/hotspot/variant-) """ if jvmVariant is None: jvmVariant = _vm.jvmVariant - os = mx.get_os() - if os == 'darwin': - os = 'bsd' - arch = mx.get_arch() - buildname = {'client': 'compiler1', 'server': 'compiler2'}.get(jvmVariant, jvmVariant) - - name = '{}_{}_{}'.format(os, arch, buildname) + name = 'variant-{}'.format(jvmVariant) return join(_get_jdk_build_dir(debugLevel=debugLevel), 'hotspot', name) class JVMCI9JDKConfig(mx.JDKConfig): diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/.mx.jvmci/suite.py --- a/hotspot/.mx.jvmci/suite.py Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/.mx.jvmci/suite.py Thu Aug 24 16:26:58 2017 +0200 @@ -43,7 +43,7 @@ # ------------- JVMCI:Service ------------- "jdk.vm.ci.services" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "javaCompliance" : "9", "workingSets" : "API,JVMCI", @@ -52,7 +52,7 @@ # ------------- JVMCI:API ------------- "jdk.vm.ci.common" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "checkstyle" : "jdk.vm.ci.services", "javaCompliance" : "9", @@ -60,7 +60,7 @@ }, "jdk.vm.ci.meta" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "checkstyle" : "jdk.vm.ci.services", "javaCompliance" : "9", @@ -68,7 +68,7 @@ }, "jdk.vm.ci.code" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "dependencies" : ["jdk.vm.ci.meta"], "checkstyle" : "jdk.vm.ci.services", @@ -92,7 +92,7 @@ }, "jdk.vm.ci.runtime" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "dependencies" : [ "jdk.vm.ci.code", @@ -119,7 +119,7 @@ # ------------- JVMCI:HotSpot ------------- "jdk.vm.ci.aarch64" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "dependencies" : ["jdk.vm.ci.code"], "checkstyle" : "jdk.vm.ci.services", @@ -128,7 +128,7 @@ }, "jdk.vm.ci.amd64" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "dependencies" : ["jdk.vm.ci.code"], "checkstyle" : "jdk.vm.ci.services", @@ -137,7 +137,7 @@ }, "jdk.vm.ci.sparc" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "dependencies" : ["jdk.vm.ci.code"], "checkstyle" : "jdk.vm.ci.services", @@ -146,7 +146,7 @@ }, "jdk.vm.ci.hotspot" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "dependencies" : [ "jdk.vm.ci.common", @@ -175,7 +175,7 @@ }, "jdk.vm.ci.hotspot.aarch64" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "dependencies" : [ "jdk.vm.ci.aarch64", @@ -187,7 +187,7 @@ }, "jdk.vm.ci.hotspot.amd64" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "dependencies" : [ "jdk.vm.ci.amd64", @@ -199,7 +199,7 @@ }, "jdk.vm.ci.hotspot.sparc" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "dependencies" : [ "jdk.vm.ci.sparc", @@ -221,12 +221,12 @@ # ------------- Distributions ------------- "JVMCI_SERVICES" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "dependencies" : ["jdk.vm.ci.services"], }, "JVMCI_API" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "dependencies" : [ "jdk.vm.ci.runtime", "jdk.vm.ci.common", @@ -240,7 +240,7 @@ }, "JVMCI_HOTSPOT" : { - "subDir" : "src/jdk.vm.ci/share/classes", + "subDir" : "src/jdk.internal.vm.ci/share/classes", "dependencies" : [ "jdk.vm.ci.hotspot.aarch64", "jdk.vm.ci.hotspot.amd64", diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/README --- a/hotspot/README Mon Jul 03 13:18:55 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -README: - This file should be located at the top of the hotspot Mercurial repository. - - See http://openjdk.java.net/ for more information about the OpenJDK. - - See ../README-builds.html for complete details on build machine requirements. - -Simple Build Instructions: - - cd make && gnumake - - The files that will be imported into the jdk build will be in the "build" - directory. - diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/make/CompileTools.gmk --- a/hotspot/make/CompileTools.gmk Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/make/CompileTools.gmk Thu Aug 24 16:26:58 2017 +0200 @@ -38,9 +38,9 @@ $(eval $(call IncludeCustomExtension, hotspot, CompileTools.gmk)) ifeq ($(INCLUDE_GRAAL), true) - VM_CI_SRC_DIR := $(HOTSPOT_TOPDIR)/src/jdk.vm.ci/share/classes + VM_CI_SRC_DIR := $(HOTSPOT_TOPDIR)/src/jdk.internal.vm.ci/share/classes - SRC_DIR := $(HOTSPOT_TOPDIR)/src/jdk.vm.compiler/share/classes + SRC_DIR := $(HOTSPOT_TOPDIR)/src/jdk.internal.vm.compiler/share/classes ############################################################################## # Compile the annotation processors diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,153 @@ +# +# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +default: all + +include $(SPEC) +include MakeBase.gmk + +$(eval $(call IncludeCustomExtension, hotspot, gensrc/Gensrc-jdk.internal.vm.compiler.gmk)) + +GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE) +SRC_DIR := $(HOTSPOT_TOPDIR)/src/$(MODULE)/share/classes + +################################################################################ + +PROC_SRC_SUBDIRS := \ + org.graalvm.compiler.code \ + org.graalvm.compiler.common \ + org.graalvm.compiler.core \ + org.graalvm.compiler.core.aarch64 \ + org.graalvm.compiler.core.amd64 \ + org.graalvm.compiler.core.common \ + org.graalvm.compiler.core.sparc \ + org.graalvm.compiler.debug \ + org.graalvm.compiler.hotspot \ + org.graalvm.compiler.hotspot.aarch64 \ + org.graalvm.compiler.hotspot.amd64 \ + org.graalvm.compiler.hotspot.sparc \ + org.graalvm.compiler.graph \ + org.graalvm.compiler.java \ + org.graalvm.compiler.lir \ + org.graalvm.compiler.lir.amd64 \ + org.graalvm.compiler.loop \ + org.graalvm.compiler.loop.phases \ + org.graalvm.compiler.nodes \ + org.graalvm.compiler.replacements \ + org.graalvm.compiler.replacements.aarch64 \ + org.graalvm.compiler.replacements.amd64 \ + org.graalvm.compiler.phases \ + org.graalvm.compiler.phases.common \ + org.graalvm.compiler.printer \ + org.graalvm.compiler.virtual \ + # + +PROC_SRC_DIRS := $(patsubst %, $(SRC_DIR)/%/src, $(PROC_SRC_SUBDIRS)) + +PROC_SRCS := $(filter %.java, $(call CacheFind, $(PROC_SRC_DIRS))) + +ALL_SRC_DIRS := $(wildcard $(SRC_DIR)/*/src) +SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS)) + +PROCESSOR_JARS := \ + $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.match.processor.jar \ + $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.nodeinfo.processor.jar \ + $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.options.processor.jar \ + $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.replacements.verifier.jar \ + $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.serviceprovider.processor.jar \ + # +PROCESSOR_PATH := $(call PathList, $(PROCESSOR_JARS)) + +ADD_EXPORTS := \ + --add-modules jdk.internal.vm.ci \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.aarch64=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.amd64=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.code=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.code.site=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.code.stack=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.common=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.aarch64=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.amd64=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.events=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.sparc=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspotvmconfig=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.inittimer=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.meta=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.runtime=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.services=ALL-UNNAMED \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.sparc=ALL-UNNAMED \ + # + +$(GENSRC_DIR)/_gensrc_proc_done: $(PROC_SRCS) $(PROCESSOR_JARS) + $(call MakeDir, $(@D)) + $(eval $(call ListPathsSafely,PROC_SRCS,$(@D)/_gensrc_proc_files)) + $(JAVA_SMALL) $(NEW_JAVAC) \ + -XDignore.symbol.file \ + --upgrade-module-path $(JDK_OUTPUTDIR)/modules --system none \ + $(ADD_EXPORTS) \ + -sourcepath $(SOURCEPATH) \ + -implicit:none \ + -proc:only \ + -processorpath $(PROCESSOR_PATH) \ + -d $(GENSRC_DIR) \ + -s $(GENSRC_DIR) \ + @$(@D)/_gensrc_proc_files + $(TOUCH) $@ + +TARGETS += $(GENSRC_DIR)/_gensrc_proc_done + +################################################################################ + +$(GENSRC_DIR)/module-info.java.extra: $(GENSRC_DIR)/_gensrc_proc_done + ($(CD) $(GENSRC_DIR)/META-INF/providers && \ + p=""; \ + for i in $$($(LS)); do \ + c=$$($(CAT) $$i | $(TR) -d '\n\r'); \ + if test x$$p != x$$c; then \ + if test x$$p != x; then \ + $(ECHO) " ;" >> $@; \ + fi; \ + $(ECHO) "provides $$c with" >> $@; \ + p=$$c; \ + fi; \ + $(ECHO) " $$i," >> $@; \ + done); \ + $(ECHO) " ;" >> $@; \ + $(ECHO) "uses org.graalvm.compiler.options.OptionDescriptors;" >> $@; \ + $(ECHO) "provides org.graalvm.compiler.options.OptionDescriptors with" >> $@; \ + for i in $$($(FIND) $(GENSRC_DIR) -name '*_OptionDescriptors.java'); do \ + c=$$($(ECHO) $$i | $(SED) 's:.*/jdk\.internal\.vm\.compiler/\(.*\)\.java:\1:' | $(TR) '/' '.'); \ + $(ECHO) " $$c," >> $@; \ + done; \ + $(ECHO) " ;" >> $@; + +TARGETS += $(GENSRC_DIR)/module-info.java.extra + +################################################################################ + +all: $(TARGETS) + +.PHONY: default all diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/make/gensrc/Gensrc-jdk.vm.compiler.gmk --- a/hotspot/make/gensrc/Gensrc-jdk.vm.compiler.gmk Mon Jul 03 13:18:55 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -# -# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -default: all - -include $(SPEC) -include MakeBase.gmk - -$(eval $(call IncludeCustomExtension, hotspot, gensrc/Gensrc-jdk.vm.compiler.gmk)) - -GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE) -SRC_DIR := $(HOTSPOT_TOPDIR)/src/$(MODULE)/share/classes - -################################################################################ - -PROC_SRC_SUBDIRS := \ - org.graalvm.compiler.code \ - org.graalvm.compiler.common \ - org.graalvm.compiler.core \ - org.graalvm.compiler.core.aarch64 \ - org.graalvm.compiler.core.amd64 \ - org.graalvm.compiler.core.common \ - org.graalvm.compiler.core.sparc \ - org.graalvm.compiler.debug \ - org.graalvm.compiler.hotspot \ - org.graalvm.compiler.hotspot.aarch64 \ - org.graalvm.compiler.hotspot.amd64 \ - org.graalvm.compiler.hotspot.sparc \ - org.graalvm.compiler.graph \ - org.graalvm.compiler.java \ - org.graalvm.compiler.lir \ - org.graalvm.compiler.lir.amd64 \ - org.graalvm.compiler.loop \ - org.graalvm.compiler.loop.phases \ - org.graalvm.compiler.nodes \ - org.graalvm.compiler.replacements \ - org.graalvm.compiler.replacements.aarch64 \ - org.graalvm.compiler.replacements.amd64 \ - org.graalvm.compiler.phases \ - org.graalvm.compiler.phases.common \ - org.graalvm.compiler.printer \ - org.graalvm.compiler.virtual \ - # - -PROC_SRC_DIRS := $(patsubst %, $(SRC_DIR)/%/src, $(PROC_SRC_SUBDIRS)) - -PROC_SRCS := $(filter %.java, $(call CacheFind, $(PROC_SRC_DIRS))) - -ALL_SRC_DIRS := $(wildcard $(SRC_DIR)/*/src) -SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS)) - -PROCESSOR_JARS := \ - $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.match.processor.jar \ - $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.nodeinfo.processor.jar \ - $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.options.processor.jar \ - $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.replacements.verifier.jar \ - $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.serviceprovider.processor.jar \ - # -PROCESSOR_PATH := $(call PathList, $(PROCESSOR_JARS)) - -ADD_EXPORTS := \ - --add-exports jdk.vm.ci/jdk.vm.ci.aarch64=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.amd64=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.code=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.code.site=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.code.stack=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.common=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.hotspot.aarch64=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.hotspot.amd64=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.hotspot.events=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.hotspot.sparc=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.hotspotvmconfig=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.inittimer=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.meta=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.runtime=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.services=ALL-UNNAMED \ - --add-exports jdk.vm.ci/jdk.vm.ci.sparc=ALL-UNNAMED \ - # - -$(GENSRC_DIR)/_gensrc_proc_done: $(PROC_SRCS) $(PROCESSOR_JARS) - $(call MakeDir, $(@D)) - $(eval $(call ListPathsSafely,PROC_SRCS,$(@D)/_gensrc_proc_files)) - $(JAVA_SMALL) $(NEW_JAVAC) \ - -XDignore.symbol.file \ - --upgrade-module-path $(JDK_OUTPUTDIR)/modules --system none \ - $(ADD_EXPORTS) \ - -sourcepath $(SOURCEPATH) \ - -implicit:none \ - -proc:only \ - -processorpath $(PROCESSOR_PATH) \ - -d $(GENSRC_DIR) \ - -s $(GENSRC_DIR) \ - @$(@D)/_gensrc_proc_files - $(TOUCH) $@ - -TARGETS += $(GENSRC_DIR)/_gensrc_proc_done - -################################################################################ - -$(GENSRC_DIR)/module-info.java.extra: $(GENSRC_DIR)/_gensrc_proc_done - ($(CD) $(GENSRC_DIR)/META-INF/providers && \ - p=""; \ - for i in $$($(LS)); do \ - c=$$($(CAT) $$i | $(TR) -d '\n\r'); \ - if test x$$p != x$$c; then \ - if test x$$p != x; then \ - $(ECHO) " ;" >> $@; \ - fi; \ - $(ECHO) "provides $$c with" >> $@; \ - p=$$c; \ - fi; \ - $(ECHO) " $$i," >> $@; \ - done); \ - $(ECHO) " ;" >> $@; \ - $(ECHO) "uses org.graalvm.compiler.options.OptionDescriptors;" >> $@; \ - $(ECHO) "provides org.graalvm.compiler.options.OptionDescriptors with" >> $@; \ - for i in $$($(FIND) $(GENSRC_DIR) -name '*_OptionDescriptors.java'); do \ - c=$$($(ECHO) $$i | $(SED) 's:.*/jdk\.vm\.compiler/\(.*\)\.java:\1:' | $(TR) '/' '.'); \ - $(ECHO) " $$c," >> $@; \ - done; \ - $(ECHO) " ;" >> $@; - -TARGETS += $(GENSRC_DIR)/module-info.java.extra - -################################################################################ - -all: $(TARGETS) - -.PHONY: default all diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/make/ide/CreateVSProject.gmk --- a/hotspot/make/ide/CreateVSProject.gmk Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/make/ide/CreateVSProject.gmk Thu Aug 24 16:26:58 2017 +0200 @@ -112,8 +112,10 @@ -relativeSrcInclude src \ -hidePath .hg \ -hidePath .jcheck \ + -hidePath jdk.aot \ -hidePath jdk.hotspot.agent \ - -hidePath jdk.vm.ci \ + -hidePath jdk.internal.vm.ci \ + -hidePath jdk.internal.vm.compiler \ -hidePath jdk.jfr \ -compiler VC10 \ -jdkTargetRoot $(call FixPath, $(JDK_OUTPUTDIR)) \ diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/make/lib/CompileJvm.gmk --- a/hotspot/make/lib/CompileJvm.gmk Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/make/lib/CompileJvm.gmk Thu Aug 24 16:26:58 2017 +0200 @@ -118,6 +118,12 @@ OPENJDK_TARGET_CPU_VM_VERSION := amd64 else ifeq ($(OPENJDK_TARGET_CPU), sparcv9) OPENJDK_TARGET_CPU_VM_VERSION := sparc +else ifeq ($(HOTSPOT_TARGET_CPU_ARCH), arm) + ifeq ($(OPENJDK_TARGET_CPU), aarch64) + # This sets the Oracle Aarch64 port to use arm64 + # while the original Aarch64 port uses aarch64 + OPENJDK_TARGET_CPU_VM_VERSION := arm64 + endif else OPENJDK_TARGET_CPU_VM_VERSION := $(OPENJDK_TARGET_CPU) endif diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/make/symbols/symbols-unix --- a/hotspot/make/symbols/symbols-unix Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/make/symbols/symbols-unix Thu Aug 24 16:26:58 2017 +0200 @@ -188,7 +188,6 @@ JVM_AddModuleExports JVM_AddModuleExportsToAll JVM_AddModuleExportsToAllUnnamed -JVM_AddModulePackage JVM_AddReadsModule JVM_DefineModule JVM_SetBootLoaderUnnamedModule diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/make/templates/gpl-cp-header --- a/hotspot/make/templates/gpl-cp-header Mon Jul 03 13:18:55 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -Copyright (c) %YEARS%, Oracle and/or its affiliates. All rights reserved. -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - -This code is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License version 2 only, as -published by the Free Software Foundation. Oracle designates this -particular file as subject to the "Classpath" exception as provided -by Oracle in the LICENSE file that accompanied this code. - -This code is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -version 2 for more details (a copy is included in the LICENSE file that -accompanied this code). - -You should have received a copy of the GNU General Public License version -2 along with this work; if not, write to the Free Software Foundation, -Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -or visit www.oracle.com if you need additional information or have any -questions. diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/make/templates/gpl-header --- a/hotspot/make/templates/gpl-header Mon Jul 03 13:18:55 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -Copyright (c) %YEARS%, Oracle and/or its affiliates. All rights reserved. -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - -This code is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License version 2 only, as -published by the Free Software Foundation. - -This code is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -version 2 for more details (a copy is included in the LICENSE file that -accompanied this code). - -You should have received a copy of the GNU General Public License version -2 along with this work; if not, write to the Free Software Foundation, -Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -or visit www.oracle.com if you need additional information or have any -questions. diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/make/test/JtregNative.gmk --- a/hotspot/make/test/JtregNative.gmk Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/make/test/JtregNative.gmk Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -48,12 +48,15 @@ $(HOTSPOT_TOPDIR)/test/runtime/jni/PrivateInterfaceMethods \ $(HOTSPOT_TOPDIR)/test/runtime/jni/ToStringInInterfaceTest \ $(HOTSPOT_TOPDIR)/test/runtime/jni/CalleeSavedRegisters \ + $(HOTSPOT_TOPDIR)/test/runtime/jni/CallWithJNIWeak \ + $(HOTSPOT_TOPDIR)/test/runtime/jni/ReturnJNIWeak \ $(HOTSPOT_TOPDIR)/test/runtime/modules/getModuleJNI \ $(HOTSPOT_TOPDIR)/test/runtime/SameObject \ $(HOTSPOT_TOPDIR)/test/runtime/BoolReturn \ $(HOTSPOT_TOPDIR)/test/compiler/floatingpoint/ \ $(HOTSPOT_TOPDIR)/test/compiler/calls \ $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/GetNamedModule \ + $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/IsModifiableModule \ $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/AddModuleReads \ $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/AddModuleExportsAndOpens \ $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/AddModuleUsesAndProvides \ @@ -83,6 +86,7 @@ BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_liboverflow := -lc BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libSimpleClassFileLoadHook := -lc BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libGetNamedModuleTest := -lc + BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libIsModifiableModuleTest := -lc BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libAddModuleReadsTest := -lc BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libAddModuleExportsAndOpensTest := -lc BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libAddModuleUsesAndProvidesTest := -lc diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/aarch64/vm/aarch64.ad --- a/hotspot/src/cpu/aarch64/vm/aarch64.ad Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad Thu Aug 24 16:26:58 2017 +0200 @@ -15501,7 +15501,7 @@ %} instruct string_indexofUU(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, iRegI_R2 cnt2, - iRegI_R0 result, iRegI tmp1, iRegI tmp2, iRegI tmp3, iRegI tmp4, rFlagsReg cr) + iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr) %{ predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2))); @@ -15520,7 +15520,7 @@ %} instruct string_indexofLL(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, iRegI_R2 cnt2, - iRegI_R0 result, iRegI tmp1, iRegI tmp2, iRegI tmp3, iRegI tmp4, rFlagsReg cr) + iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr) %{ predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2))); @@ -15539,7 +15539,7 @@ %} instruct string_indexofUL(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, iRegI_R2 cnt2, - iRegI_R0 result, iRegI tmp1, iRegI tmp2, iRegI tmp3, iRegI tmp4, rFlagsReg cr) + iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr) %{ predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2))); @@ -15558,7 +15558,7 @@ %} instruct string_indexofLU(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, iRegI_R2 cnt2, - iRegI_R0 result, iRegI tmp1, iRegI tmp2, iRegI tmp3, iRegI tmp4, rFlagsReg cr) + iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr) %{ predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LU); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2))); @@ -15577,8 +15577,8 @@ %} instruct string_indexof_conUU(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, - immI_le_4 int_cnt2, iRegI_R0 result, iRegI tmp1, iRegI tmp2, - iRegI tmp3, iRegI tmp4, rFlagsReg cr) + immI_le_4 int_cnt2, iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, + iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr) %{ predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 int_cnt2))); @@ -15598,8 +15598,8 @@ %} instruct string_indexof_conLL(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, - immI_le_4 int_cnt2, iRegI_R0 result, iRegI tmp1, iRegI tmp2, - iRegI tmp3, iRegI tmp4, rFlagsReg cr) + immI_le_4 int_cnt2, iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, + iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr) %{ predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 int_cnt2))); @@ -15619,8 +15619,8 @@ %} instruct string_indexof_conUL(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, - immI_1 int_cnt2, iRegI_R0 result, iRegI tmp1, iRegI tmp2, - iRegI tmp3, iRegI tmp4, rFlagsReg cr) + immI_1 int_cnt2, iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, + iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr) %{ predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 int_cnt2))); @@ -15640,8 +15640,8 @@ %} instruct string_indexof_conLU(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, - immI_1 int_cnt2, iRegI_R0 result, iRegI tmp1, iRegI tmp2, - iRegI tmp3, iRegI tmp4, rFlagsReg cr) + immI_1 int_cnt2, iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, + iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr) %{ predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LU); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 int_cnt2))); @@ -15661,8 +15661,8 @@ %} instruct string_indexofU_char(iRegP_R1 str1, iRegI_R2 cnt1, iRegI_R3 ch, - iRegI_R0 result, iRegI tmp1, iRegI tmp2, - iRegI tmp3, rFlagsReg cr) + iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, + iRegINoSp tmp3, rFlagsReg cr) %{ match(Set result (StrIndexOfChar (Binary str1 cnt1) ch)); effect(USE_KILL str1, USE_KILL cnt1, USE_KILL ch, @@ -16101,7 +16101,7 @@ // ====================REDUCTION ARITHMETIC==================================== -instruct reduce_add2I(iRegINoSp dst, iRegIorL2I src1, vecD src2, iRegI tmp, iRegI tmp2) +instruct reduce_add2I(iRegINoSp dst, iRegIorL2I src1, vecD src2, iRegINoSp tmp, iRegINoSp tmp2) %{ match(Set dst (AddReductionVI src1 src2)); ins_cost(INSN_COST); @@ -16120,7 +16120,7 @@ ins_pipe(pipe_class_default); %} -instruct reduce_add4I(iRegINoSp dst, iRegIorL2I src1, vecX src2, vecX tmp, iRegI tmp2) +instruct reduce_add4I(iRegINoSp dst, iRegIorL2I src1, vecX src2, vecX tmp, iRegINoSp tmp2) %{ match(Set dst (AddReductionVI src1 src2)); ins_cost(INSN_COST); @@ -16138,7 +16138,7 @@ ins_pipe(pipe_class_default); %} -instruct reduce_mul2I(iRegINoSp dst, iRegIorL2I src1, vecD src2, iRegI tmp) +instruct reduce_mul2I(iRegINoSp dst, iRegIorL2I src1, vecD src2, iRegINoSp tmp) %{ match(Set dst (MulReductionVI src1 src2)); ins_cost(INSN_COST); @@ -16157,7 +16157,7 @@ ins_pipe(pipe_class_default); %} -instruct reduce_mul4I(iRegINoSp dst, iRegIorL2I src1, vecX src2, vecX tmp, iRegI tmp2) +instruct reduce_mul4I(iRegINoSp dst, iRegIorL2I src1, vecX src2, vecX tmp, iRegINoSp tmp2) %{ match(Set dst (MulReductionVI src1 src2)); ins_cost(INSN_COST); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -109,9 +109,15 @@ // for the callee's params we only need to account for the extra // locals. int size = overhead + - (callee_locals - callee_params)*Interpreter::stackElementWords + + (callee_locals - callee_params) + monitors * frame::interpreter_frame_monitor_size() + - temps* Interpreter::stackElementWords + extra_args; + // On the top frame, at all times SP <= ESP, and SP is + // 16-aligned. We ensure this by adjusting SP on method + // entry and re-entry to allow room for the maximum size of + // the expression stack. When we call another method we bump + // SP so that no stack space is wasted. So, only on the top + // frame do we need to allow max_stack words. + (is_top_frame ? max_stack : temps + extra_args); // On AArch64 we always keep the stack pointer 16-aligned, so we // must round up here. diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,8 +1,7 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. - * reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE - * HEADER. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as @@ -21,7 +20,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ #include diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1922,12 +1922,17 @@ } if (opr2->is_constant()) { + bool is_32bit = false; // width of register operand jlong imm; + switch(opr2->type()) { + case T_INT: + imm = opr2->as_constant_ptr()->as_jint(); + is_32bit = true; + break; case T_LONG: imm = opr2->as_constant_ptr()->as_jlong(); break; - case T_INT: case T_ADDRESS: imm = opr2->as_constant_ptr()->as_jint(); break; @@ -1942,14 +1947,14 @@ } if (Assembler::operand_valid_for_add_sub_immediate(imm)) { - if (type2aelembytes(opr1->type()) <= 4) + if (is_32bit) __ cmpw(reg1, imm); else __ cmp(reg1, imm); return; } else { __ mov(rscratch1, imm); - if (type2aelembytes(opr1->type()) <= 4) + if (is_32bit) __ cmpw(reg1, rscratch1); else __ cmp(reg1, rscratch1); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -598,12 +598,12 @@ } else { assert (x->op() == Bytecodes::_imul, "expect imul"); if (right.is_constant()) { - int c = right.get_jint_constant(); - if (! is_power_of_2(c) && ! is_power_of_2(c + 1) && ! is_power_of_2(c - 1)) { + jint c = right.get_jint_constant(); + if (c > 0 && c < max_jint && (is_power_of_2(c) || is_power_of_2(c - 1) || is_power_of_2(c + 1))) { + right_arg->dont_load_item(); + } else { // Cannot use constant op. - right.load_item(); - } else { - right.dont_load_item(); + right_arg->load_item(); } } else { right.load_item(); @@ -1221,12 +1221,19 @@ obj.load_item(); // info for exceptions - CodeEmitInfo* info_for_exception = state_for(x); + CodeEmitInfo* info_for_exception = + (x->needs_exception_state() ? state_for(x) : + state_for(x, x->state_before(), true /*ignore_xhandler*/)); CodeStub* stub; if (x->is_incompatible_class_change_check()) { assert(patching_info == NULL, "can't patch this"); stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); + } else if (x->is_invokespecial_receiver_check()) { + assert(patching_info == NULL, "can't patch this"); + stub = new DeoptimizeStub(info_for_exception, + Deoptimization::Reason_class_check, + Deoptimization::Action_none); } else { stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception); } @@ -1340,6 +1347,16 @@ void LIRGenerator::volatile_field_load(LIR_Address* address, LIR_Opr result, CodeEmitInfo* info) { + // 8179954: We need to make sure that the code generated for + // volatile accesses forms a sequentially-consistent set of + // operations when combined with STLR and LDAR. Without a leading + // membar it's possible for a simple Dekker test to fail if loads + // use LD;DMB but stores use STLR. This can happen if C2 compiles + // the stores in one method and C1 compiles the loads in another. + if (! UseBarriersForVolatile) { + __ membar(); + } + __ volatile_load_mem_reg(address, result, info); } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/aarch64/vm/jniFastGetField_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/jniFastGetField_aarch64.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/jniFastGetField_aarch64.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -82,6 +82,11 @@ __ eor(robj, robj, rcounter); // obj, since // robj ^ rcounter ^ rcounter == robj // robj is address dependent on rcounter. + + // If mask changes we need to ensure that the inverse is still encodable as an immediate + STATIC_ASSERT(JNIHandles::weak_tag_mask == 1); + __ andr(robj, robj, ~JNIHandles::weak_tag_mask); + __ ldr(robj, Address(robj, 0)); // *obj __ lsr(roffset, c_rarg2, 2); // offset diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2015, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -2052,13 +2052,31 @@ __ reset_last_Java_frame(false); - // Unpack oop result + // Unbox oop result, e.g. JNIHandles::resolve result. if (ret_type == T_OBJECT || ret_type == T_ARRAY) { - Label L; - __ cbz(r0, L); - __ ldr(r0, Address(r0, 0)); - __ bind(L); - __ verify_oop(r0); + Label done, not_weak; + __ cbz(r0, done); // Use NULL as-is. + STATIC_ASSERT(JNIHandles::weak_tag_mask == 1u); + __ tbz(r0, 0, not_weak); // Test for jweak tag. + // Resolve jweak. + __ ldr(r0, Address(r0, -JNIHandles::weak_tag_value)); + __ verify_oop(r0); +#if INCLUDE_ALL_GCS + if (UseG1GC) { + __ g1_write_barrier_pre(noreg /* obj */, + r0 /* pre_val */, + rthread /* thread */, + rscratch1 /* tmp */, + true /* tosca_live */, + true /* expand_call */); + } +#endif // INCLUDE_ALL_GCS + __ b(done); + __ bind(not_weak); + // Resolve (untagged) jobject. + __ ldr(r0, Address(r0, 0)); + __ verify_oop(r0); + __ bind(done); } if (CheckJNICalls) { diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -1399,13 +1399,32 @@ // and result handler will pick it up { - Label no_oop, store_result; + Label no_oop, not_weak, store_result; __ adr(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT))); __ cmp(t, result_handler); __ br(Assembler::NE, no_oop); - // retrieve result + // Unbox oop result, e.g. JNIHandles::resolve result. __ pop(ltos); - __ cbz(r0, store_result); + __ cbz(r0, store_result); // Use NULL as-is. + STATIC_ASSERT(JNIHandles::weak_tag_mask == 1u); + __ tbz(r0, 0, not_weak); // Test for jweak tag. + // Resolve jweak. + __ ldr(r0, Address(r0, -JNIHandles::weak_tag_value)); +#if INCLUDE_ALL_GCS + if (UseG1GC) { + __ enter(); // Barrier may call runtime. + __ g1_write_barrier_pre(noreg /* obj */, + r0 /* pre_val */, + rthread /* thread */, + t /* tmp */, + true /* tosca_live */, + true /* expand_call */); + __ leave(); + } +#endif // INCLUDE_ALL_GCS + __ b(store_result); + __ bind(not_weak); + // Resolve (untagged) jobject. __ ldr(r0, Address(r0, 0)); __ bind(store_result); __ str(r0, Address(rfp, frame::interpreter_frame_oop_temp_offset*wordSize)); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -2389,17 +2389,31 @@ const Register obj = r4; const Register off = r19; const Register flags = r0; + const Register raw_flags = r6; const Register bc = r4; // uses same reg as obj, so don't mix them resolve_cache_and_index(byte_no, cache, index, sizeof(u2)); jvmti_post_field_access(cache, index, is_static, false); - load_field_cp_cache_entry(obj, cache, index, off, flags, is_static); + load_field_cp_cache_entry(obj, cache, index, off, raw_flags, is_static); if (!is_static) { // obj is on the stack pop_and_check_object(obj); } + // 8179954: We need to make sure that the code generated for + // volatile accesses forms a sequentially-consistent set of + // operations when combined with STLR and LDAR. Without a leading + // membar it's possible for a simple Dekker test to fail if loads + // use LDR;DMB but stores use STLR. This can happen if C2 compiles + // the stores in one method and we interpret the loads in another. + if (! UseBarriersForVolatile) { + Label notVolatile; + __ tbz(raw_flags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile); + __ membar(MacroAssembler::AnyAny); + __ bind(notVolatile); + } + const Address field(obj, off); Label Done, notByte, notBool, notInt, notShort, notChar, @@ -2407,7 +2421,8 @@ // x86 uses a shift and mask or wings it with a shift plus assert // the mask is not needed. aarch64 just uses bitfield extract - __ ubfxw(flags, flags, ConstantPoolCacheEntry::tos_state_shift, ConstantPoolCacheEntry::tos_state_bits); + __ ubfxw(flags, raw_flags, ConstantPoolCacheEntry::tos_state_shift, + ConstantPoolCacheEntry::tos_state_bits); assert(btos == 0, "change code, btos != 0"); __ cbnz(flags, notByte); @@ -2529,9 +2544,11 @@ #endif __ bind(Done); - // It's really not worth bothering to check whether this field - // really is volatile in the slow case. + + Label notVolatile; + __ tbz(raw_flags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile); __ membar(MacroAssembler::LoadLoad | MacroAssembler::LoadStore); + __ bind(notVolatile); } @@ -2979,6 +2996,19 @@ __ null_check(r0); const Address field(r0, r1); + // 8179954: We need to make sure that the code generated for + // volatile accesses forms a sequentially-consistent set of + // operations when combined with STLR and LDAR. Without a leading + // membar it's possible for a simple Dekker test to fail if loads + // use LDR;DMB but stores use STLR. This can happen if C2 compiles + // the stores in one method and we interpret the loads in another. + if (! UseBarriersForVolatile) { + Label notVolatile; + __ tbz(r3, ConstantPoolCacheEntry::is_volatile_shift, notVolatile); + __ membar(MacroAssembler::AnyAny); + __ bind(notVolatile); + } + // access field switch (bytecode()) { case Bytecodes::_fast_agetfield: @@ -3027,6 +3057,22 @@ __ get_cache_and_index_at_bcp(r2, r3, 2); __ ldr(r1, Address(r2, in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::f2_offset()))); + + // 8179954: We need to make sure that the code generated for + // volatile accesses forms a sequentially-consistent set of + // operations when combined with STLR and LDAR. Without a leading + // membar it's possible for a simple Dekker test to fail if loads + // use LDR;DMB but stores use STLR. This can happen if C2 compiles + // the stores in one method and we interpret the loads in another. + if (! UseBarriersForVolatile) { + Label notVolatile; + __ ldrw(r3, Address(r2, in_bytes(ConstantPoolCache::base_offset() + + ConstantPoolCacheEntry::flags_offset()))); + __ tbz(r3, ConstantPoolCacheEntry::is_volatile_shift, notVolatile); + __ membar(MacroAssembler::AnyAny); + __ bind(notVolatile); + } + // make sure exception is reported in correct bcp range (getfield is // next instruction) __ increment(rbcp); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -51,6 +51,11 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { const int aarch64_code_length = VtableStub::pd_code_size_limit(true); VtableStub* s = new(aarch64_code_length) VtableStub(true, vtable_index); + // Can be NULL if there is no free space in the code cache. + if (s == NULL) { + return NULL; + } + ResourceMark rm; CodeBuffer cb(s->entry_point(), aarch64_code_length); MacroAssembler* masm = new MacroAssembler(&cb); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/arm/vm/c1_LIRAssembler_arm.cpp --- a/hotspot/src/cpu/arm/vm/c1_LIRAssembler_arm.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/arm/vm/c1_LIRAssembler_arm.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1453,10 +1453,11 @@ ciKlass* k = op->klass(); assert_different_registers(res, k_RInfo, klass_RInfo, Rtemp); + if (stub->is_simple_exception_stub()) { // TODO: ARM - Late binding is used to prevent confusion of register allocator assert(stub->is_exception_throw_stub(), "must be"); ((SimpleExceptionStub*)stub)->set_obj(op->result_opr()); - + } ciMethodData* md; ciProfileData* data; int mdo_offset_bias = 0; diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/arm/vm/c1_LIRGenerator_arm.cpp --- a/hotspot/src/cpu/arm/vm/c1_LIRGenerator_arm.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/arm/vm/c1_LIRGenerator_arm.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -923,8 +923,8 @@ } else { left_arg->load_item(); if (x->op() == Bytecodes::_imul && right_arg->is_constant()) { - int c = right_arg->get_jint_constant(); - if (c > 0 && (is_power_of_2(c) || is_power_of_2(c - 1) || is_power_of_2(c + 1))) { + jint c = right_arg->get_jint_constant(); + if (c > 0 && c < max_jint && (is_power_of_2(c) || is_power_of_2(c - 1) || is_power_of_2(c + 1))) { right_arg->dont_load_item(); } else { right_arg->load_item(); @@ -1412,12 +1412,20 @@ obj.load_item(); - CodeEmitInfo* info_for_exception = state_for(x); + CodeEmitInfo* info_for_exception = + (x->needs_exception_state() ? state_for(x) : + state_for(x, x->state_before(), true /*ignore_xhandler*/)); + CodeStub* stub; if (x->is_incompatible_class_change_check()) { assert(patching_info == NULL, "can't patch this"); stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); + } else if (x->is_invokespecial_receiver_check()) { + assert(patching_info == NULL, "can't patch this"); + stub = new DeoptimizeStub(info_for_exception, + Deoptimization::Reason_class_check, + Deoptimization::Action_none); } else { stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, LIR_OprFact::illegalOpr, info_for_exception); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/arm/vm/c1_Runtime1_arm.cpp --- a/hotspot/src/cpu/arm/vm/c1_Runtime1_arm.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/arm/vm/c1_Runtime1_arm.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -618,7 +618,7 @@ Address buffer(Rthread, in_bytes(JavaThread::dirty_card_queue_offset() + DirtyCardQueue::byte_offset_of_buf())); - AddressLiteral cardtable((address)ct->byte_map_base); + AddressLiteral cardtable((address)ct->byte_map_base, relocInfo::none); assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); // save at least the registers that need saving if the runtime is called @@ -645,7 +645,7 @@ // Note: there is a comment in x86 code about not using // ExternalAddress / lea, due to relocation not working // properly for that address. Should be OK for arm, where we - // explicitly specify that 'cartable' has a relocInfo::none + // explicitly specify that 'cardtable' has a relocInfo::none // type. __ lea(r_card_base_1, cardtable); __ add(r_card_addr_0, r_card_base_1, AsmOperand(r_obj_0, lsr, CardTableModRefBS::card_shift)); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/arm/vm/compiledIC_arm.cpp --- a/hotspot/src/cpu/arm/vm/compiledIC_arm.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/arm/vm/compiledIC_arm.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -85,17 +85,17 @@ } #undef __ -// size of C2 call stub, compiled java to interpretor -int CompiledStaticCall::to_interp_stub_size() { - return 8 * NativeInstruction::instruction_size; -} - // Relocation entries for call stub, compiled java to interpreter. int CompiledStaticCall::reloc_to_interp_stub() { return 10; // 4 in emit_to_interp_stub + 1 in Java_Static_Call } #endif // COMPILER2 || JVMCI +// size of C2 call stub, compiled java to interpretor +int CompiledStaticCall::to_interp_stub_size() { + return 8 * NativeInstruction::instruction_size; +} + void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) { address stub = find_stub(/*is_aot*/ false); guarantee(stub != NULL, "stub not found"); @@ -125,6 +125,8 @@ method_holder->set_data((intptr_t)callee()); jump->set_jump_destination(entry); + ICache::invalidate_range(stub, to_interp_stub_size()); + // Update jump to call. set_destination_mt_safe(stub); } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/arm/vm/interp_masm_arm.cpp --- a/hotspot/src/cpu/arm/vm/interp_masm_arm.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/arm/vm/interp_masm_arm.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -476,185 +476,6 @@ } ////////////////////////////////////////////////////////////////////////////////// -#if INCLUDE_ALL_GCS - -// G1 pre-barrier. -// Blows all volatile registers (R0-R3 on 32-bit ARM, R0-R18 on AArch64, Rtemp, LR). -// If store_addr != noreg, then previous value is loaded from [store_addr]; -// in such case store_addr and new_val registers are preserved; -// otherwise pre_val register is preserved. -void InterpreterMacroAssembler::g1_write_barrier_pre(Register store_addr, - Register new_val, - Register pre_val, - Register tmp1, - Register tmp2) { - Label done; - Label runtime; - - if (store_addr != noreg) { - assert_different_registers(store_addr, new_val, pre_val, tmp1, tmp2, noreg); - } else { - assert (new_val == noreg, "should be"); - assert_different_registers(pre_val, tmp1, tmp2, noreg); - } - - Address in_progress(Rthread, in_bytes(JavaThread::satb_mark_queue_offset() + - SATBMarkQueue::byte_offset_of_active())); - Address index(Rthread, in_bytes(JavaThread::satb_mark_queue_offset() + - SATBMarkQueue::byte_offset_of_index())); - Address buffer(Rthread, in_bytes(JavaThread::satb_mark_queue_offset() + - SATBMarkQueue::byte_offset_of_buf())); - - // Is marking active? - assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "adjust this code"); - ldrb(tmp1, in_progress); - cbz(tmp1, done); - - // Do we need to load the previous value? - if (store_addr != noreg) { - load_heap_oop(pre_val, Address(store_addr, 0)); - } - - // Is the previous value null? - cbz(pre_val, done); - - // Can we store original value in the thread's buffer? - // Is index == 0? - // (The index field is typed as size_t.) - - ldr(tmp1, index); // tmp1 := *index_adr - ldr(tmp2, buffer); - - subs(tmp1, tmp1, wordSize); // tmp1 := tmp1 - wordSize - b(runtime, lt); // If negative, goto runtime - - str(tmp1, index); // *index_adr := tmp1 - - // Record the previous value - str(pre_val, Address(tmp2, tmp1)); - b(done); - - bind(runtime); - - // save the live input values -#ifdef AARCH64 - if (store_addr != noreg) { - raw_push(store_addr, new_val); - } else { - raw_push(pre_val, ZR); - } -#else - if (store_addr != noreg) { - // avoid raw_push to support any ordering of store_addr and new_val - push(RegisterSet(store_addr) | RegisterSet(new_val)); - } else { - push(pre_val); - } -#endif // AARCH64 - - if (pre_val != R0) { - mov(R0, pre_val); - } - mov(R1, Rthread); - - call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), R0, R1); - -#ifdef AARCH64 - if (store_addr != noreg) { - raw_pop(store_addr, new_val); - } else { - raw_pop(pre_val, ZR); - } -#else - if (store_addr != noreg) { - pop(RegisterSet(store_addr) | RegisterSet(new_val)); - } else { - pop(pre_val); - } -#endif // AARCH64 - - bind(done); -} - -// G1 post-barrier. -// Blows all volatile registers (R0-R3 on 32-bit ARM, R0-R18 on AArch64, Rtemp, LR). -void InterpreterMacroAssembler::g1_write_barrier_post(Register store_addr, - Register new_val, - Register tmp1, - Register tmp2, - Register tmp3) { - - Address queue_index(Rthread, in_bytes(JavaThread::dirty_card_queue_offset() + - DirtyCardQueue::byte_offset_of_index())); - Address buffer(Rthread, in_bytes(JavaThread::dirty_card_queue_offset() + - DirtyCardQueue::byte_offset_of_buf())); - - BarrierSet* bs = Universe::heap()->barrier_set(); - CardTableModRefBS* ct = (CardTableModRefBS*)bs; - Label done; - Label runtime; - - // Does store cross heap regions? - - eor(tmp1, store_addr, new_val); -#ifdef AARCH64 - logical_shift_right(tmp1, tmp1, HeapRegion::LogOfHRGrainBytes); - cbz(tmp1, done); -#else - movs(tmp1, AsmOperand(tmp1, lsr, HeapRegion::LogOfHRGrainBytes)); - b(done, eq); -#endif - - // crosses regions, storing NULL? - - cbz(new_val, done); - - // storing region crossing non-NULL, is card already dirty? - const Register card_addr = tmp1; - assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); - - mov_address(tmp2, (address)ct->byte_map_base, symbolic_Relocation::card_table_reference); - add(card_addr, tmp2, AsmOperand(store_addr, lsr, CardTableModRefBS::card_shift)); - - ldrb(tmp2, Address(card_addr)); - cmp(tmp2, (int)G1SATBCardTableModRefBS::g1_young_card_val()); - b(done, eq); - - membar(MacroAssembler::Membar_mask_bits(MacroAssembler::StoreLoad), tmp2); - - assert(CardTableModRefBS::dirty_card_val() == 0, "adjust this code"); - ldrb(tmp2, Address(card_addr)); - cbz(tmp2, done); - - // storing a region crossing, non-NULL oop, card is clean. - // dirty card and log. - - strb(zero_register(tmp2), Address(card_addr)); - - ldr(tmp2, queue_index); - ldr(tmp3, buffer); - - subs(tmp2, tmp2, wordSize); - b(runtime, lt); // go to runtime if now negative - - str(tmp2, queue_index); - - str(card_addr, Address(tmp3, tmp2)); - b(done); - - bind(runtime); - - if (card_addr != R0) { - mov(R0, card_addr); - } - mov(R1, Rthread); - call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), R0, R1); - - bind(done); -} - -#endif // INCLUDE_ALL_GCS -////////////////////////////////////////////////////////////////////////////////// // Java Expression Stack diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/arm/vm/interp_masm_arm.hpp --- a/hotspot/src/cpu/arm/vm/interp_masm_arm.hpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/arm/vm/interp_masm_arm.hpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -146,27 +146,6 @@ void set_card(Register card_table_base, Address card_table_addr, Register tmp); -#if INCLUDE_ALL_GCS - // G1 pre-barrier. - // Blows all volatile registers (R0-R3 on 32-bit ARM, R0-R18 on AArch64, Rtemp, LR). - // If store_addr != noreg, then previous value is loaded from [store_addr]; - // in such case store_addr and new_val registers are preserved; - // otherwise pre_val register is preserved. - void g1_write_barrier_pre(Register store_addr, - Register new_val, - Register pre_val, - Register tmp1, - Register tmp2); - - // G1 post-barrier. - // Blows all volatile registers (R0-R3 on 32-bit ARM, R0-R18 on AArch64, Rtemp, LR). - void g1_write_barrier_post(Register store_addr, - Register new_val, - Register tmp1, - Register tmp2, - Register tmp3); -#endif // INCLUDE_ALL_GCS - void pop_ptr(Register r); void pop_i(Register r = R0_tos); #ifdef AARCH64 diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/arm/vm/jniFastGetField_arm.cpp --- a/hotspot/src/cpu/arm/vm/jniFastGetField_arm.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/arm/vm/jniFastGetField_arm.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -119,6 +119,14 @@ __ ldr_s32(Rsafept_cnt, Address(Rsafepoint_counter_addr)); __ tbnz(Rsafept_cnt, 0, slow_case); +#ifdef AARCH64 + // If mask changes we need to ensure that the inverse is still encodable as an immediate + STATIC_ASSERT(JNIHandles::weak_tag_mask == 1); + __ andr(R1, R1, ~JNIHandles::weak_tag_mask); +#else + __ bic(R1, R1, JNIHandles::weak_tag_mask); +#endif + if (os::is_MP()) { // Address dependency restricts memory access ordering. It's cheaper than explicit LoadLoad barrier __ andr(Rtmp1, Rsafept_cnt, (unsigned)1); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/arm/vm/macroAssembler_arm.cpp --- a/hotspot/src/cpu/arm/vm/macroAssembler_arm.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/arm/vm/macroAssembler_arm.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2211,6 +2211,219 @@ b(done, eq); } + +void MacroAssembler::resolve_jobject(Register value, + Register tmp1, + Register tmp2) { + assert_different_registers(value, tmp1, tmp2); + Label done, not_weak; + cbz(value, done); // Use NULL as-is. + STATIC_ASSERT(JNIHandles::weak_tag_mask == 1u); + tbz(value, 0, not_weak); // Test for jweak tag. + // Resolve jweak. + ldr(value, Address(value, -JNIHandles::weak_tag_value)); + verify_oop(value); +#if INCLUDE_ALL_GCS + if (UseG1GC) { + g1_write_barrier_pre(noreg, // store_addr + noreg, // new_val + value, // pre_val + tmp1, // tmp1 + tmp2); // tmp2 + } +#endif // INCLUDE_ALL_GCS + b(done); + bind(not_weak); + // Resolve (untagged) jobject. + ldr(value, Address(value)); + verify_oop(value); + bind(done); +} + + +////////////////////////////////////////////////////////////////////////////////// + +#if INCLUDE_ALL_GCS + +// G1 pre-barrier. +// Blows all volatile registers (R0-R3 on 32-bit ARM, R0-R18 on AArch64, Rtemp, LR). +// If store_addr != noreg, then previous value is loaded from [store_addr]; +// in such case store_addr and new_val registers are preserved; +// otherwise pre_val register is preserved. +void MacroAssembler::g1_write_barrier_pre(Register store_addr, + Register new_val, + Register pre_val, + Register tmp1, + Register tmp2) { + Label done; + Label runtime; + + if (store_addr != noreg) { + assert_different_registers(store_addr, new_val, pre_val, tmp1, tmp2, noreg); + } else { + assert (new_val == noreg, "should be"); + assert_different_registers(pre_val, tmp1, tmp2, noreg); + } + + Address in_progress(Rthread, in_bytes(JavaThread::satb_mark_queue_offset() + + SATBMarkQueue::byte_offset_of_active())); + Address index(Rthread, in_bytes(JavaThread::satb_mark_queue_offset() + + SATBMarkQueue::byte_offset_of_index())); + Address buffer(Rthread, in_bytes(JavaThread::satb_mark_queue_offset() + + SATBMarkQueue::byte_offset_of_buf())); + + // Is marking active? + assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "adjust this code"); + ldrb(tmp1, in_progress); + cbz(tmp1, done); + + // Do we need to load the previous value? + if (store_addr != noreg) { + load_heap_oop(pre_val, Address(store_addr, 0)); + } + + // Is the previous value null? + cbz(pre_val, done); + + // Can we store original value in the thread's buffer? + // Is index == 0? + // (The index field is typed as size_t.) + + ldr(tmp1, index); // tmp1 := *index_adr + ldr(tmp2, buffer); + + subs(tmp1, tmp1, wordSize); // tmp1 := tmp1 - wordSize + b(runtime, lt); // If negative, goto runtime + + str(tmp1, index); // *index_adr := tmp1 + + // Record the previous value + str(pre_val, Address(tmp2, tmp1)); + b(done); + + bind(runtime); + + // save the live input values +#ifdef AARCH64 + if (store_addr != noreg) { + raw_push(store_addr, new_val); + } else { + raw_push(pre_val, ZR); + } +#else + if (store_addr != noreg) { + // avoid raw_push to support any ordering of store_addr and new_val + push(RegisterSet(store_addr) | RegisterSet(new_val)); + } else { + push(pre_val); + } +#endif // AARCH64 + + if (pre_val != R0) { + mov(R0, pre_val); + } + mov(R1, Rthread); + + call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), R0, R1); + +#ifdef AARCH64 + if (store_addr != noreg) { + raw_pop(store_addr, new_val); + } else { + raw_pop(pre_val, ZR); + } +#else + if (store_addr != noreg) { + pop(RegisterSet(store_addr) | RegisterSet(new_val)); + } else { + pop(pre_val); + } +#endif // AARCH64 + + bind(done); +} + +// G1 post-barrier. +// Blows all volatile registers (R0-R3 on 32-bit ARM, R0-R18 on AArch64, Rtemp, LR). +void MacroAssembler::g1_write_barrier_post(Register store_addr, + Register new_val, + Register tmp1, + Register tmp2, + Register tmp3) { + + Address queue_index(Rthread, in_bytes(JavaThread::dirty_card_queue_offset() + + DirtyCardQueue::byte_offset_of_index())); + Address buffer(Rthread, in_bytes(JavaThread::dirty_card_queue_offset() + + DirtyCardQueue::byte_offset_of_buf())); + + BarrierSet* bs = Universe::heap()->barrier_set(); + CardTableModRefBS* ct = (CardTableModRefBS*)bs; + Label done; + Label runtime; + + // Does store cross heap regions? + + eor(tmp1, store_addr, new_val); +#ifdef AARCH64 + logical_shift_right(tmp1, tmp1, HeapRegion::LogOfHRGrainBytes); + cbz(tmp1, done); +#else + movs(tmp1, AsmOperand(tmp1, lsr, HeapRegion::LogOfHRGrainBytes)); + b(done, eq); +#endif + + // crosses regions, storing NULL? + + cbz(new_val, done); + + // storing region crossing non-NULL, is card already dirty? + const Register card_addr = tmp1; + assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); + + mov_address(tmp2, (address)ct->byte_map_base, symbolic_Relocation::card_table_reference); + add(card_addr, tmp2, AsmOperand(store_addr, lsr, CardTableModRefBS::card_shift)); + + ldrb(tmp2, Address(card_addr)); + cmp(tmp2, (int)G1SATBCardTableModRefBS::g1_young_card_val()); + b(done, eq); + + membar(MacroAssembler::Membar_mask_bits(MacroAssembler::StoreLoad), tmp2); + + assert(CardTableModRefBS::dirty_card_val() == 0, "adjust this code"); + ldrb(tmp2, Address(card_addr)); + cbz(tmp2, done); + + // storing a region crossing, non-NULL oop, card is clean. + // dirty card and log. + + strb(zero_register(tmp2), Address(card_addr)); + + ldr(tmp2, queue_index); + ldr(tmp3, buffer); + + subs(tmp2, tmp2, wordSize); + b(runtime, lt); // go to runtime if now negative + + str(tmp2, queue_index); + + str(card_addr, Address(tmp3, tmp2)); + b(done); + + bind(runtime); + + if (card_addr != R0) { + mov(R0, card_addr); + } + mov(R1, Rthread); + call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), R0, R1); + + bind(done); +} + +#endif // INCLUDE_ALL_GCS + +////////////////////////////////////////////////////////////////////////////////// + #ifdef AARCH64 void MacroAssembler::load_sized_value(Register dst, Address src, size_t size_in_bytes, bool is_signed) { diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/arm/vm/macroAssembler_arm.hpp --- a/hotspot/src/cpu/arm/vm/macroAssembler_arm.hpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/arm/vm/macroAssembler_arm.hpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -402,6 +402,29 @@ void biased_locking_enter_with_cas(Register obj_reg, Register old_mark_reg, Register new_mark_reg, Register tmp, Label& slow_case, int* counter_addr); + void resolve_jobject(Register value, Register tmp1, Register tmp2); + +#if INCLUDE_ALL_GCS + // G1 pre-barrier. + // Blows all volatile registers (R0-R3 on 32-bit ARM, R0-R18 on AArch64, Rtemp, LR). + // If store_addr != noreg, then previous value is loaded from [store_addr]; + // in such case store_addr and new_val registers are preserved; + // otherwise pre_val register is preserved. + void g1_write_barrier_pre(Register store_addr, + Register new_val, + Register pre_val, + Register tmp1, + Register tmp2); + + // G1 post-barrier. + // Blows all volatile registers (R0-R3 on 32-bit ARM, R0-R18 on AArch64, Rtemp, LR). + void g1_write_barrier_post(Register store_addr, + Register new_val, + Register tmp1, + Register tmp2, + Register tmp3); +#endif // INCLUDE_ALL_GCS + #ifndef AARCH64 void nop() { mov(R0, R0); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/arm/vm/relocInfo_arm.cpp --- a/hotspot/src/cpu/arm/vm/relocInfo_arm.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/arm/vm/relocInfo_arm.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -139,7 +139,7 @@ #ifdef AARCH64 #ifdef COMPILER2 NativeMovConstReg* ni = nativeMovConstReg_at(addr()); - if (ni->is_movz()) { + if (ni->is_mov_slow()) { return; } #endif diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/arm/vm/sharedRuntime_arm.cpp --- a/hotspot/src/cpu/arm/vm/sharedRuntime_arm.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/arm/vm/sharedRuntime_arm.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1732,14 +1732,7 @@ case T_FLOAT : // fall through case T_DOUBLE : /* nothing to do */ break; case T_OBJECT : // fall through - case T_ARRAY : { - Label L; - __ cbz(R0, L); - __ ldr(R0, Address(R0)); - __ verify_oop(R0); - __ bind(L); - break; - } + case T_ARRAY : break; // See JNIHandles::resolve below default: ShouldNotReachHere(); } @@ -1748,13 +1741,14 @@ if (CheckJNICalls) { __ str(__ zero_register(Rtemp), Address(Rthread, JavaThread::pending_jni_exception_check_fn_offset())); } +#endif // AARCH64 - // Unhandle the result + // Unbox oop result, e.g. JNIHandles::resolve value in R0. if (ret_type == T_OBJECT || ret_type == T_ARRAY) { - __ cmp(R0, 0); - __ ldr(R0, Address(R0), ne); + __ resolve_jobject(R0, // value + Rtemp, // tmp1 + R1_tmp); // tmp2 } -#endif // AARCH64 // Any exception pending? __ ldr(Rtemp, Address(Rthread, Thread::pending_exception_offset())); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/arm/vm/templateInterpreterGenerator_arm.cpp --- a/hotspot/src/cpu/arm/vm/templateInterpreterGenerator_arm.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/arm/vm/templateInterpreterGenerator_arm.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1240,28 +1240,25 @@ __ str(__ zero_register(Rtemp), Address(Rthread, JavaThread::pending_jni_exception_check_fn_offset())); } - // Unbox if the result is non-zero object + // Unbox oop result, e.g. JNIHandles::resolve result if it's an oop. + { + Label Lnot_oop; #ifdef AARCH64 - { - Label L, Lnull; __ mov_slow(Rtemp, AbstractInterpreter::result_handler(T_OBJECT)); __ cmp(Rresult_handler, Rtemp); - __ b(L, ne); - __ cbz(Rsaved_result, Lnull); - __ ldr(Rsaved_result, Address(Rsaved_result)); - __ bind(Lnull); - // Store oop on the stack for GC - __ str(Rsaved_result, Address(FP, frame::interpreter_frame_oop_temp_offset * wordSize)); - __ bind(L); + __ b(Lnot_oop, ne); +#else // !AARCH64 + // For ARM32, Rresult_handler is -1 for oop result, 0 otherwise. + __ cbz(Rresult_handler, Lnot_oop); +#endif // !AARCH64 + Register value = AARCH64_ONLY(Rsaved_result) NOT_AARCH64(Rsaved_result_lo); + __ resolve_jobject(value, // value + Rtemp, // tmp1 + R1_tmp); // tmp2 + // Store resolved result in frame for GC visibility. + __ str(value, Address(FP, frame::interpreter_frame_oop_temp_offset * wordSize)); + __ bind(Lnot_oop); } -#else - __ tst(Rsaved_result_lo, Rresult_handler); - __ ldr(Rsaved_result_lo, Address(Rsaved_result_lo), ne); - - // Store oop on the stack for GC - __ cmp(Rresult_handler, 0); - __ str(Rsaved_result_lo, Address(FP, frame::interpreter_frame_oop_temp_offset * wordSize), ne); -#endif // AARCH64 #ifdef AARCH64 // Restore SP (drop native parameters area), to keep SP in sync with extended_sp in frame diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp --- a/hotspot/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1131,12 +1131,19 @@ obj.load_item(); LIR_Opr out_reg = rlock_result(x); CodeStub* stub; - CodeEmitInfo* info_for_exception = state_for(x); + CodeEmitInfo* info_for_exception = + (x->needs_exception_state() ? state_for(x) : + state_for(x, x->state_before(), true /*ignore_xhandler*/)); if (x->is_incompatible_class_change_check()) { assert(patching_info == NULL, "can't patch this"); stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); + } else if (x->is_invokespecial_receiver_check()) { + assert(patching_info == NULL, "can't patch this"); + stub = new DeoptimizeStub(info_for_exception, + Deoptimization::Reason_class_check, + Deoptimization::Action_none); } else { stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception); } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/ppc/vm/frame_ppc.cpp --- a/hotspot/src/cpu/ppc/vm/frame_ppc.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/ppc/vm/frame_ppc.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 SAP SE. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -171,10 +171,7 @@ switch (method->result_type()) { case T_OBJECT: case T_ARRAY: { - oop* obj_p = *(oop**)lresult; - oop obj = (obj_p == NULL) ? (oop)NULL : *obj_p; - assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check"); - *oop_result = obj; + *oop_result = JNIHandles::resolve(*(jobject*)lresult); break; } // We use std/stfd to store the values. diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp --- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,6 +1,6 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 SAP SE. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3033,6 +3033,34 @@ stbx(R0, Rtmp, Robj); } +// Kills R31 if value is a volatile register. +void MacroAssembler::resolve_jobject(Register value, Register tmp1, Register tmp2, bool needs_frame) { + Label done; + cmpdi(CCR0, value, 0); + beq(CCR0, done); // Use NULL as-is. + + clrrdi(tmp1, value, JNIHandles::weak_tag_size); +#if INCLUDE_ALL_GCS + if (UseG1GC) { andi_(tmp2, value, JNIHandles::weak_tag_mask); } +#endif + ld(value, 0, tmp1); // Resolve (untagged) jobject. + +#if INCLUDE_ALL_GCS + if (UseG1GC) { + Label not_weak; + beq(CCR0, not_weak); // Test for jweak tag. + verify_oop(value); + g1_write_barrier_pre(noreg, // obj + noreg, // offset + value, // pre_val + tmp1, tmp2, needs_frame); + bind(not_weak); + } +#endif // INCLUDE_ALL_GCS + verify_oop(value); + bind(done); +} + #if INCLUDE_ALL_GCS // General G1 pre-barrier generator. // Goal: record the previous value if it is not null. @@ -3094,7 +3122,7 @@ bind(runtime); - // VM call need frame to access(write) O register. + // May need to preserve LR. Also needed if current frame is not compatible with C calling convention. if (needs_frame) { save_LR_CR(Rtmp1); push_frame_reg_args(0, Rtmp2); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp --- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 SAP SE. All rights reserved. + * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -649,6 +649,8 @@ void card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp); void card_table_write(jbyte* byte_map_base, Register Rtmp, Register Robj); + void resolve_jobject(Register value, Register tmp1, Register tmp2, bool needs_frame); + #if INCLUDE_ALL_GCS // General G1 pre-barrier generator. void g1_write_barrier_pre(Register Robj, RegisterOrConstant offset, Register Rpre_val, diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp --- a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,6 +1,6 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 SAP SE. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2477,16 +2477,11 @@ __ reset_last_Java_frame(); - // Unpack oop result. + // Unbox oop result, e.g. JNIHandles::resolve value. // -------------------------------------------------------------------------- if (ret_type == T_OBJECT || ret_type == T_ARRAY) { - Label skip_unboxing; - __ cmpdi(CCR0, R3_RET, 0); - __ beq(CCR0, skip_unboxing); - __ ld(R3_RET, 0, R3_RET); - __ bind(skip_unboxing); - __ verify_oop(R3_RET); + __ resolve_jobject(R3_RET, r_temp_1, r_temp_2, /* needs_frame */ false); // kills R31 } if (CheckJNICalls) { diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp --- a/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015, 2016 SAP SE. All rights reserved. + * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -401,11 +401,8 @@ case T_LONG: break; case T_OBJECT: - // unbox result if not null - __ cmpdi(CCR0, R3_RET, 0); - __ beq(CCR0, done); - __ ld(R3_RET, 0, R3_RET); - __ verify_oop(R3_RET); + // JNIHandles::resolve result. + __ resolve_jobject(R3_RET, R11_scratch1, R12_scratch2, /* needs_frame */ true); // kills R31 break; case T_FLOAT: break; diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/s390/vm/c1_LIRGenerator_s390.cpp --- a/hotspot/src/cpu/s390/vm/c1_LIRGenerator_s390.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/s390/vm/c1_LIRGenerator_s390.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -993,12 +993,19 @@ obj.load_item(); // info for exceptions - CodeEmitInfo* info_for_exception = state_for (x); + CodeEmitInfo* info_for_exception = + (x->needs_exception_state() ? state_for(x) : + state_for(x, x->state_before(), true /*ignore_xhandler*/)); CodeStub* stub; if (x->is_incompatible_class_change_check()) { assert(patching_info == NULL, "can't patch this"); stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); + } else if (x->is_invokespecial_receiver_check()) { + assert(patching_info == NULL, "can't patch this"); + stub = new DeoptimizeStub(info_for_exception, + Deoptimization::Reason_class_check, + Deoptimization::Action_none); } else { stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception); } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/s390/vm/c1_Runtime1_s390.cpp --- a/hotspot/src/cpu/s390/vm/c1_Runtime1_s390.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/s390/vm/c1_Runtime1_s390.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/s390/vm/macroAssembler_s390.cpp --- a/hotspot/src/cpu/s390/vm/macroAssembler_s390.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/s390/vm/macroAssembler_s390.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -3439,6 +3439,34 @@ z_mvi(0, store_addr, 0); // Store byte 0. } +void MacroAssembler::resolve_jobject(Register value, Register tmp1, Register tmp2) { + NearLabel Ldone; + z_ltgr(tmp1, value); + z_bre(Ldone); // Use NULL result as-is. + + z_nill(value, ~JNIHandles::weak_tag_mask); + z_lg(value, 0, value); // Resolve (untagged) jobject. + +#if INCLUDE_ALL_GCS + if (UseG1GC) { + NearLabel Lnot_weak; + z_tmll(tmp1, JNIHandles::weak_tag_mask); // Test for jweak tag. + z_braz(Lnot_weak); + verify_oop(value); + g1_write_barrier_pre(noreg /* obj */, + noreg /* offset */, + value /* pre_val */, + noreg /* val */, + tmp1 /* tmp1 */, + tmp2 /* tmp2 */, + true /* pre_val_needed */); + bind(Lnot_weak); + } +#endif // INCLUDE_ALL_GCS + verify_oop(value); + bind(Ldone); +} + #if INCLUDE_ALL_GCS //------------------------------------------------------ diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/s390/vm/macroAssembler_s390.hpp --- a/hotspot/src/cpu/s390/vm/macroAssembler_s390.hpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/s390/vm/macroAssembler_s390.hpp Thu Aug 24 16:26:58 2017 +0200 @@ -726,6 +726,8 @@ // Write to card table for modification at store_addr - register is destroyed afterwards. void card_write_barrier_post(Register store_addr, Register tmp); + void resolve_jobject(Register value, Register tmp1, Register tmp2); + #if INCLUDE_ALL_GCS // General G1 pre-barrier generator. // Purpose: record the previous value if it is not null. diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/s390/vm/sharedRuntime_s390.cpp --- a/hotspot/src/cpu/s390/vm/sharedRuntime_s390.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/s390/vm/sharedRuntime_s390.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016 SAP SE. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2272,13 +2272,9 @@ __ reset_last_Java_frame(); - // Unpack oop result + // Unpack oop result, e.g. JNIHandles::resolve result. if (ret_type == T_OBJECT || ret_type == T_ARRAY) { - NearLabel L; - __ compare64_and_branch(Z_RET, (RegisterOrConstant)0L, Assembler::bcondEqual, L); - __ z_lg(Z_RET, 0, Z_RET); - __ bind(L); - __ verify_oop(Z_RET); + __ resolve_jobject(Z_RET, /* tmp1 */ Z_R13, /* tmp2 */ Z_R7); } if (CheckJNICalls) { diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/s390/vm/templateInterpreterGenerator_s390.cpp --- a/hotspot/src/cpu/s390/vm/templateInterpreterGenerator_s390.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/s390/vm/templateInterpreterGenerator_s390.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016 SAP SE. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1695,14 +1695,11 @@ // from the jni handle to z_ijava_state.oop_temp. This is // necessary, because we reset the jni handle block below. // NOTE: frame::interpreter_frame_result() depends on this, too. - { NearLabel no_oop_result, store_oop_result; + { NearLabel no_oop_result; __ load_absolute_address(Z_R1, AbstractInterpreter::result_handler(T_OBJECT)); __ compareU64_and_branch(Z_R1, Rresult_handler, Assembler::bcondNotEqual, no_oop_result); - __ compareU64_and_branch(Rlresult, (intptr_t)0L, Assembler::bcondEqual, store_oop_result); - __ z_lg(Rlresult, 0, Rlresult); // unbox - __ bind(store_oop_result); + __ resolve_jobject(Rlresult, /* tmp1 */ Rmethod, /* tmp2 */ Z_R1); __ z_stg(Rlresult, oop_tmp_offset, Z_fp); - __ verify_oop(Rlresult); __ bind(no_oop_result); } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1196,11 +1196,18 @@ obj.load_item(); LIR_Opr out_reg = rlock_result(x); CodeStub* stub; - CodeEmitInfo* info_for_exception = state_for(x); + CodeEmitInfo* info_for_exception = + (x->needs_exception_state() ? state_for(x) : + state_for(x, x->state_before(), true /*ignore_xhandler*/)); if (x->is_incompatible_class_change_check()) { assert(patching_info == NULL, "can't patch this"); stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); + } else if (x->is_invokespecial_receiver_check()) { + assert(patching_info == NULL, "can't patch this"); + stub = new DeoptimizeStub(info_for_exception, + Deoptimization::Reason_class_check, + Deoptimization::Action_none); } else { stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception); } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/sparc/vm/jniFastGetField_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/jniFastGetField_sparc.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/sparc/vm/jniFastGetField_sparc.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,6 +68,7 @@ __ andcc (G4, 1, G0); __ br (Assembler::notZero, false, Assembler::pn, label1); __ delayed()->srl (O2, 2, O4); + __ andn (O1, JNIHandles::weak_tag_mask, O1); __ ld_ptr (O1, 0, O5); assert(count < LIST_CAPACITY, "LIST_CAPACITY too small"); @@ -147,6 +148,7 @@ __ andcc (G4, 1, G0); __ br (Assembler::notZero, false, Assembler::pn, label1); __ delayed()->srl (O2, 2, O4); + __ andn (O1, JNIHandles::weak_tag_mask, O1); __ ld_ptr (O1, 0, O5); __ add (O5, O4, O5); @@ -219,6 +221,7 @@ __ andcc (G4, 1, G0); __ br (Assembler::notZero, false, Assembler::pn, label1); __ delayed()->srl (O2, 2, O4); + __ andn (O1, JNIHandles::weak_tag_mask, O1); __ ld_ptr (O1, 0, O5); assert(count < LIST_CAPACITY, "LIST_CAPACITY too small"); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2754,15 +2754,30 @@ __ verify_thread(); // G2_thread must be correct __ reset_last_Java_frame(); - // Unpack oop result + // Unbox oop result, e.g. JNIHandles::resolve value in I0. if (ret_type == T_OBJECT || ret_type == T_ARRAY) { - Label L; - __ addcc(G0, I0, G0); - __ brx(Assembler::notZero, true, Assembler::pt, L); - __ delayed()->ld_ptr(I0, 0, I0); - __ mov(G0, I0); - __ bind(L); - __ verify_oop(I0); + Label done, not_weak; + __ br_null(I0, false, Assembler::pn, done); // Use NULL as-is. + __ delayed()->andcc(I0, JNIHandles::weak_tag_mask, G0); // Test for jweak + __ brx(Assembler::zero, true, Assembler::pt, not_weak); + __ delayed()->ld_ptr(I0, 0, I0); // Maybe resolve (untagged) jobject. + // Resolve jweak. + __ ld_ptr(I0, -JNIHandles::weak_tag_value, I0); +#if INCLUDE_ALL_GCS + if (UseG1GC) { + // Copy to O0 because macro doesn't allow pre_val in input reg. + __ mov(I0, O0); + __ g1_write_barrier_pre(noreg /* obj */, + noreg /* index */, + 0 /* offset */, + O0 /* pre_val */, + G3_scratch /* tmp */, + true /* preserve_o_regs */); + } +#endif // INCLUDE_ALL_GCS + __ bind(not_weak); + __ verify_oop(I0); + __ bind(done); } if (CheckJNICalls) { diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1516,11 +1516,23 @@ __ set((intptr_t)AbstractInterpreter::result_handler(T_OBJECT), G3_scratch); __ cmp_and_brx_short(G3_scratch, Lscratch, Assembler::notEqual, Assembler::pt, no_oop); - __ addcc(G0, O0, O0); - __ brx(Assembler::notZero, true, Assembler::pt, store_result); // if result is not NULL: - __ delayed()->ld_ptr(O0, 0, O0); // unbox it - __ mov(G0, O0); - + // Unbox oop result, e.g. JNIHandles::resolve value in O0. + __ br_null(O0, false, Assembler::pn, store_result); // Use NULL as-is. + __ delayed()->andcc(O0, JNIHandles::weak_tag_mask, G0); // Test for jweak + __ brx(Assembler::zero, true, Assembler::pt, store_result); + __ delayed()->ld_ptr(O0, 0, O0); // Maybe resolve (untagged) jobject. + // Resolve jweak. + __ ld_ptr(O0, -JNIHandles::weak_tag_value, O0); +#if INCLUDE_ALL_GCS + if (UseG1GC) { + __ g1_write_barrier_pre(noreg /* obj */, + noreg /* index */, + 0 /* offset */, + O0 /* pre_val */, + G3_scratch /* tmp */, + true /* preserve_o_regs */); + } +#endif // INCLUDE_ALL_GCS __ bind(store_result); // Store it where gc will look for it and result handler expects it. __ st_ptr(O0, FP, (frame::interpreter_frame_oop_temp_offset*wordSize) + STACK_BIAS); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/x86/vm/assembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -917,7 +917,7 @@ break; case 0x62: // EVEX_4bytes - assert((UseAVX > 0), "shouldn't have EVEX prefix"); + assert(VM_Version::supports_evex(), "shouldn't have EVEX prefix"); assert(ip == inst+1, "no prefixes allowed"); // no EVEX collisions, all instructions that have 0x62 opcodes // have EVEX versions and are subopcodes of 0x66 diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp --- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -234,8 +234,8 @@ } -bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, int c, LIR_Opr result, LIR_Opr tmp) { - if (tmp->is_valid()) { +bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) { + if (tmp->is_valid() && c > 0 && c < max_jint) { if (is_power_of_2(c + 1)) { __ move(left, tmp); __ shift_left(left, log2_intptr(c + 1), left); @@ -603,8 +603,8 @@ bool use_constant = false; bool use_tmp = false; if (right_arg->is_constant()) { - int iconst = right_arg->get_jint_constant(); - if (iconst > 0) { + jint iconst = right_arg->get_jint_constant(); + if (iconst > 0 && iconst < max_jint) { if (is_power_of_2(iconst)) { use_constant = true; } else if (is_power_of_2(iconst - 1) || is_power_of_2(iconst + 1)) { @@ -1429,12 +1429,17 @@ obj.load_item(); // info for exceptions - CodeEmitInfo* info_for_exception = state_for(x); + CodeEmitInfo* info_for_exception = + (x->needs_exception_state() ? state_for(x) : + state_for(x, x->state_before(), true /*ignore_xhandler*/)); CodeStub* stub; if (x->is_incompatible_class_change_check()) { assert(patching_info == NULL, "can't patch this"); stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); + } else if (x->is_invokespecial_receiver_check()) { + assert(patching_info == NULL, "can't patch this"); + stub = new DeoptimizeStub(info_for_exception, Deoptimization::Reason_class_check, Deoptimization::Action_none); } else { stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception); } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,6 +85,9 @@ __ movptr (rdx, Address(rsp, 2*wordSize)); // obj } __ movptr(rax, Address(rsp, 3*wordSize)); // jfieldID + + __ clear_jweak_tag(rdx); + __ movptr(rdx, Address(rdx, 0)); // *obj __ shrptr (rax, 2); // offset @@ -202,6 +205,9 @@ __ movptr(rdx, Address(rsp, 3*wordSize)); // obj } __ movptr(rsi, Address(rsp, 4*wordSize)); // jfieldID + + __ clear_jweak_tag(rdx); + __ movptr(rdx, Address(rdx, 0)); // *obj __ shrptr(rsi, 2); // offset @@ -291,6 +297,9 @@ __ movptr(rdx, Address(rsp, 2*wordSize)); // obj } __ movptr(rax, Address(rsp, 3*wordSize)); // jfieldID + + __ clear_jweak_tag(rdx); + __ movptr(rdx, Address(rdx, 0)); // *obj __ shrptr(rax, 2); // offset diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -80,6 +80,9 @@ // robj ^ rcounter ^ rcounter == robj // robj is data dependent on rcounter. } + + __ clear_jweak_tag(robj); + __ movptr(robj, Address(robj, 0)); // *obj __ mov (roffset, c_rarg2); __ shrptr(roffset, 2); // offset @@ -178,6 +181,9 @@ // robj ^ rcounter ^ rcounter == robj // robj is data dependent on rcounter. } + + __ clear_jweak_tag(robj); + __ movptr(robj, Address(robj, 0)); // *obj __ mov (roffset, c_rarg2); __ shrptr(roffset, 2); // offset diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -4134,28 +4134,33 @@ if ((dst_enc < 16) && (nds_enc < 16)) { vandps(dst, nds, negate_field, vector_len); } else if ((src_enc < 16) && (dst_enc < 16)) { - movss(src, nds); + evmovdqul(src, nds, Assembler::AVX_512bit); vandps(dst, src, negate_field, vector_len); } else if (src_enc < 16) { - movss(src, nds); + evmovdqul(src, nds, Assembler::AVX_512bit); vandps(src, src, negate_field, vector_len); - movss(dst, src); + evmovdqul(dst, src, Assembler::AVX_512bit); } else if (dst_enc < 16) { - movdqu(src, xmm0); - movss(xmm0, nds); + evmovdqul(src, xmm0, Assembler::AVX_512bit); + evmovdqul(xmm0, nds, Assembler::AVX_512bit); vandps(dst, xmm0, negate_field, vector_len); - movdqu(xmm0, src); - } else if (nds_enc < 16) { - movdqu(src, xmm0); - vandps(xmm0, nds, negate_field, vector_len); - movss(dst, xmm0); - movdqu(xmm0, src); - } else { - movdqu(src, xmm0); - movss(xmm0, nds); - vandps(xmm0, xmm0, negate_field, vector_len); - movss(dst, xmm0); - movdqu(xmm0, src); + evmovdqul(xmm0, src, Assembler::AVX_512bit); + } else { + if (src_enc != dst_enc) { + evmovdqul(src, xmm0, Assembler::AVX_512bit); + evmovdqul(xmm0, nds, Assembler::AVX_512bit); + vandps(xmm0, xmm0, negate_field, vector_len); + evmovdqul(dst, xmm0, Assembler::AVX_512bit); + evmovdqul(xmm0, src, Assembler::AVX_512bit); + } else { + subptr(rsp, 64); + evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit); + evmovdqul(xmm0, nds, Assembler::AVX_512bit); + vandps(xmm0, xmm0, negate_field, vector_len); + evmovdqul(dst, xmm0, Assembler::AVX_512bit); + evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit); + addptr(rsp, 64); + } } } @@ -4166,28 +4171,33 @@ if ((dst_enc < 16) && (nds_enc < 16)) { vandpd(dst, nds, negate_field, vector_len); } else if ((src_enc < 16) && (dst_enc < 16)) { - movsd(src, nds); + evmovdqul(src, nds, Assembler::AVX_512bit); vandpd(dst, src, negate_field, vector_len); } else if (src_enc < 16) { - movsd(src, nds); + evmovdqul(src, nds, Assembler::AVX_512bit); vandpd(src, src, negate_field, vector_len); - movsd(dst, src); + evmovdqul(dst, src, Assembler::AVX_512bit); } else if (dst_enc < 16) { - movdqu(src, xmm0); - movsd(xmm0, nds); + evmovdqul(src, xmm0, Assembler::AVX_512bit); + evmovdqul(xmm0, nds, Assembler::AVX_512bit); vandpd(dst, xmm0, negate_field, vector_len); - movdqu(xmm0, src); - } else if (nds_enc < 16) { - movdqu(src, xmm0); - vandpd(xmm0, nds, negate_field, vector_len); - movsd(dst, xmm0); - movdqu(xmm0, src); - } else { - movdqu(src, xmm0); - movsd(xmm0, nds); - vandpd(xmm0, xmm0, negate_field, vector_len); - movsd(dst, xmm0); - movdqu(xmm0, src); + evmovdqul(xmm0, src, Assembler::AVX_512bit); + } else { + if (src_enc != dst_enc) { + evmovdqul(src, xmm0, Assembler::AVX_512bit); + evmovdqul(xmm0, nds, Assembler::AVX_512bit); + vandpd(xmm0, xmm0, negate_field, vector_len); + evmovdqul(dst, xmm0, Assembler::AVX_512bit); + evmovdqul(xmm0, src, Assembler::AVX_512bit); + } else { + subptr(rsp, 64); + evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit); + evmovdqul(xmm0, nds, Assembler::AVX_512bit); + vandpd(xmm0, xmm0, negate_field, vector_len); + evmovdqul(dst, xmm0, Assembler::AVX_512bit); + evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit); + addptr(rsp, 64); + } } } @@ -4934,6 +4944,24 @@ } } +void MacroAssembler::pshufd(XMMRegister dst, Address src, int mode) { + if (VM_Version::supports_avx512vl()) { + Assembler::pshufd(dst, src, mode); + } else { + int dst_enc = dst->encoding(); + if (dst_enc < 16) { + Assembler::pshufd(dst, src, mode); + } else { + subptr(rsp, 64); + evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit); + Assembler::pshufd(xmm0, src, mode); + evmovdqul(dst, xmm0, Assembler::AVX_512bit); + evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit); + addptr(rsp, 64); + } + } +} + // This instruction exists within macros, ergo we cannot control its input // when emitted through those patterns. void MacroAssembler::pshuflw(XMMRegister dst, XMMRegister src, int mode) { @@ -5129,6 +5157,43 @@ } +void MacroAssembler::resolve_jobject(Register value, + Register thread, + Register tmp) { + assert_different_registers(value, thread, tmp); + Label done, not_weak; + testptr(value, value); + jcc(Assembler::zero, done); // Use NULL as-is. + testptr(value, JNIHandles::weak_tag_mask); // Test for jweak tag. + jcc(Assembler::zero, not_weak); + // Resolve jweak. + movptr(value, Address(value, -JNIHandles::weak_tag_value)); + verify_oop(value); +#if INCLUDE_ALL_GCS + if (UseG1GC) { + g1_write_barrier_pre(noreg /* obj */, + value /* pre_val */, + thread /* thread */, + tmp /* tmp */, + true /* tosca_live */, + true /* expand_call */); + } +#endif // INCLUDE_ALL_GCS + jmp(done); + bind(not_weak); + // Resolve (untagged) jobject. + movptr(value, Address(value, 0)); + verify_oop(value); + bind(done); +} + +void MacroAssembler::clear_jweak_tag(Register possibly_jweak) { + const int32_t inverted_jweak_mask = ~static_cast(JNIHandles::weak_tag_mask); + STATIC_ASSERT(inverted_jweak_mask == -2); // otherwise check this code + // The inverted mask is sign-extended + andptr(possibly_jweak, inverted_jweak_mask); +} + ////////////////////////////////////////////////////////////////////////////////// #if INCLUDE_ALL_GCS diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -297,6 +297,9 @@ void store_check(Register obj); // store check for obj - register is destroyed afterwards void store_check(Register obj, Address dst); // same as above, dst is exact store location (reg. is destroyed) + void resolve_jobject(Register value, Register thread, Register tmp); + void clear_jweak_tag(Register possibly_jweak); + #if INCLUDE_ALL_GCS void g1_write_barrier_pre(Register obj, @@ -1229,6 +1232,9 @@ void punpcklbw(XMMRegister dst, XMMRegister src); void punpcklbw(XMMRegister dst, Address src) { Assembler::punpcklbw(dst, src); } + void pshufd(XMMRegister dst, Address src, int mode); + void pshufd(XMMRegister dst, XMMRegister src, int mode) { Assembler::pshufd(dst, src, mode); } + void pshuflw(XMMRegister dst, XMMRegister src, int mode); void pshuflw(XMMRegister dst, Address src, int mode) { Assembler::pshuflw(dst, src, mode); } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/x86/vm/nativeInst_x86.cpp --- a/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -365,6 +365,10 @@ NOT_LP64(assert((0xC0 & ubyte_at(1)) == 0xC0, "shouldn't have LDS and LES instructions")); return 3; } + if (instr_0 == instruction_EVEX_prefix_4bytes) { + assert(VM_Version::supports_evex(), "shouldn't have EVEX prefix"); + return 4; + } // First check to see if we have a (prefixed or not) xor if (instr_0 >= instruction_prefix_wide_lo && // 0x40 diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/x86/vm/nativeInst_x86.hpp --- a/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp Thu Aug 24 16:26:58 2017 +0200 @@ -356,6 +356,7 @@ instruction_VEX_prefix_2bytes = Assembler::VEX_2bytes, instruction_VEX_prefix_3bytes = Assembler::VEX_3bytes, + instruction_EVEX_prefix_4bytes = Assembler::EVEX_4bytes, instruction_size = 4, instruction_offset = 0, diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2226,14 +2226,11 @@ __ reset_last_Java_frame(thread, false); - // Unpack oop result + // Unbox oop result, e.g. JNIHandles::resolve value. if (ret_type == T_OBJECT || ret_type == T_ARRAY) { - Label L; - __ cmpptr(rax, (int32_t)NULL_WORD); - __ jcc(Assembler::equal, L); - __ movptr(rax, Address(rax, 0)); - __ bind(L); - __ verify_oop(rax); + __ resolve_jobject(rax /* value */, + thread /* thread */, + rcx /* tmp */); } if (CheckJNICalls) { diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2579,14 +2579,11 @@ __ reset_last_Java_frame(false); - // Unpack oop result + // Unbox oop result, e.g. JNIHandles::resolve value. if (ret_type == T_OBJECT || ret_type == T_ARRAY) { - Label L; - __ testptr(rax, rax); - __ jcc(Assembler::zero, L); - __ movptr(rax, Address(rax, 0)); - __ bind(L); - __ verify_oop(rax); + __ resolve_jobject(rax /* value */, + r15_thread /* thread */, + rcx /* tmp */); } if (CheckJNICalls) { diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp --- a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1193,16 +1193,16 @@ // and result handler will pick it up { - Label no_oop, store_result; + Label no_oop, not_weak, store_result; __ lea(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT))); __ cmpptr(t, Address(rbp, frame::interpreter_frame_result_handler_offset*wordSize)); __ jcc(Assembler::notEqual, no_oop); // retrieve result __ pop(ltos); - __ testptr(rax, rax); - __ jcc(Assembler::zero, store_result); - __ movptr(rax, Address(rax, 0)); - __ bind(store_result); + // Unbox oop result, e.g. JNIHandles::resolve value. + __ resolve_jobject(rax /* value */, + thread /* thread */, + t /* tmp */); __ movptr(Address(rbp, frame::interpreter_frame_oop_temp_offset*wordSize), rax); // keep stack depth as expected by pushing oop which will eventually be discarded __ push(ltos); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/x86/vm/templateTable_x86.cpp --- a/hotspot/src/cpu/x86/vm/templateTable_x86.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/x86/vm/templateTable_x86.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2210,7 +2210,6 @@ // Out-of-line code to allocate method data oop. __ bind(profile_method); __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method)); - __ load_unsigned_byte(rbx, Address(rbcp, 0)); // restore target bytecode __ set_method_data_pointer_for_bcp(); __ jmp(dispatch); } @@ -2225,10 +2224,8 @@ CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), rdx); - __ load_unsigned_byte(rbx, Address(rbcp, 0)); // restore target bytecode // rax: osr nmethod (osr ok) or NULL (osr not possible) - // rbx: target bytecode // rdx: scratch // r14: locals pointer // r13: bcp @@ -2238,12 +2235,13 @@ __ cmpb(Address(rax, nmethod::state_offset()), nmethod::in_use); __ jcc(Assembler::notEqual, dispatch); - // We have the address of an on stack replacement routine in rax - // We need to prepare to execute the OSR method. First we must - // migrate the locals and monitors off of the stack. - - LP64_ONLY(__ mov(r13, rax)); // save the nmethod - NOT_LP64(__ mov(rbx, rax)); // save the nmethod + // We have the address of an on stack replacement routine in rax. + // In preparation of invoking it, first we must migrate the locals + // and monitors from off the interpreter frame on the stack. + // Ensure to save the osr nmethod over the migration call, + // it will be preserved in rbx. + __ mov(rbx, rax); + NOT_LP64(__ get_thread(rcx)); call_VM(noreg, CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_begin)); @@ -2258,7 +2256,6 @@ const Register retaddr = LP64_ONLY(j_rarg2) NOT_LP64(rdi); const Register sender_sp = LP64_ONLY(j_rarg1) NOT_LP64(rdx); - // pop the interpreter frame __ movptr(sender_sp, Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize)); // get sender sp __ leave(); // remove frame anchor @@ -2274,8 +2271,7 @@ __ push(retaddr); // and begin the OSR nmethod - LP64_ONLY(__ jmp(Address(r13, nmethod::osr_entry_point_offset()))); - NOT_LP64(__ jmp(Address(rbx, nmethod::osr_entry_point_offset()))); + __ jmp(Address(rbx, nmethod::osr_entry_point_offset())); } } } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/x86/vm/vm_version_x86.cpp --- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -763,12 +763,11 @@ FLAG_SET_DEFAULT(UseCRC32Intrinsics, false); } - if (supports_sse4_2()) { + if (supports_sse4_2() && supports_clmul()) { if (FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) { UseCRC32CIntrinsics = true; } - } - else if (UseCRC32CIntrinsics) { + } else if (UseCRC32CIntrinsics) { if (!FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) { warning("CRC32C intrinsics are not available on this CPU"); } @@ -850,6 +849,12 @@ #if INCLUDE_RTM_OPT if (UseRTMLocking) { + if (is_client_compilation_mode_vm()) { + // Only C2 does RTM locking optimization. + // Can't continue because UseRTMLocking affects UseBiasedLocking flag + // setting during arguments processing. See use_biased_locking(). + vm_exit_during_initialization("RTM locking optimization is not supported in emulated client VM"); + } if (is_intel_family_core()) { if ((_model == CPU_MODEL_HASWELL_E3) || (_model == CPU_MODEL_HASWELL_E7 && _stepping < 3) || diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp --- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -406,10 +406,12 @@ // oop_temp where the garbage collector can see it before // we release the handle it might be protected by. if (handler->result_type() == &ffi_type_pointer) { - if (result[0]) - istate->set_oop_temp(*(oop *) result[0]); - else + if (result[0] == 0) { istate->set_oop_temp(NULL); + } else { + jobject handle = reinterpret_cast(result[0]); + istate->set_oop_temp(JNIHandles::resolve(handle)); + } } // Reset handle block diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTStub.java --- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTStub.java Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTStub.java Thu Aug 24 16:26:58 2017 +0200 @@ -25,6 +25,7 @@ import org.graalvm.compiler.code.CompilationResult; import org.graalvm.compiler.core.target.Backend; +import org.graalvm.compiler.hotspot.HotSpotCompiledCodeBuilder; import org.graalvm.compiler.hotspot.stubs.Stub; import jdk.vm.ci.hotspot.HotSpotCompiledCode; @@ -48,7 +49,7 @@ } public HotSpotCompiledCode compiledCode(CompilationResult result) { - return stub.getCompiledCode(backend); + return HotSpotCompiledCodeBuilder.createCompiledCode(null, null, result); } } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/CallSiteRelocationSymbol.java --- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/CallSiteRelocationSymbol.java Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/CallSiteRelocationSymbol.java Thu Aug 24 16:26:58 2017 +0200 @@ -59,12 +59,6 @@ addExternalPltToGotRelocation(binaryContainer, symbol, relocationOffset); } - protected static void addMetaspaceGotRelocation(BinaryContainer binaryContainer, String symbolName, int symbolOffset, int relocationOffset) { - ByteContainer container = binaryContainer.getMetaspaceGotContainer(); - Symbol symbol = container.createGotSymbol(symbolOffset, symbolName); - addExternalPltToGotRelocation(binaryContainer, symbol, relocationOffset); - } - /** * Add an {@link RelocType#EXTERNAL_GOT_TO_PLT} relocation to the * {@link BinaryContainer#getExtLinkageGOTContainer()}. diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/DataBuilder.java --- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/DataBuilder.java Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/DataBuilder.java Thu Aug 24 16:26:58 2017 +0200 @@ -70,8 +70,8 @@ */ private void fillVMAddresses(HotSpotVMConfigStore config) { for (VMField vmField : config.getFields().values()) { - if (vmField.value != null) { - final long address = vmField.value; + if (vmField.value != null && vmField.value instanceof Long) { + final long address = (Long) vmField.value; String value = vmField.name; /* * Some fields don't contain addresses but integer values. At least don't add zero diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/JavaCallSiteRelocationSymbol.java --- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/JavaCallSiteRelocationSymbol.java Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/JavaCallSiteRelocationSymbol.java Thu Aug 24 16:26:58 2017 +0200 @@ -37,6 +37,7 @@ final class JavaCallSiteRelocationSymbol extends CallSiteRelocationSymbol { private static final byte[] zeroSlot = new byte[8]; + // -1 represents Universe::non_oop_word() value private static final byte[] minusOneSlot = {-1, -1, -1, -1, -1, -1, -1, -1}; public JavaCallSiteRelocationSymbol(CompiledMethodInfo mi, Call call, CallSiteRelocationInfo callSiteRelocation, BinaryContainer binaryContainer) { @@ -79,30 +80,39 @@ } // Add relocation to GOT cell for call resolution jump. + // This GOT cell will be initialized during JVM startup with address + // of JVM runtime call resolution function. String gotSymbolName = "got." + getResolveSymbolName(binaryContainer, mi, call); Symbol gotSymbol = binaryContainer.getGotSymbol(gotSymbolName); addExternalPltToGotRelocation(binaryContainer, gotSymbol, stub.getResolveJumpOffset()); // Add relocation to resolve call jump instruction address for GOT cell. + // This GOT cell will be initialized with address of resolution jump instruction and + // will be updated with call destination address by JVM runtime call resolution code. String pltJmpSymbolName = relocationSymbolName("plt.jmp", mi, call, callSiteRelocation); addCodeContainerRelocation(binaryContainer, pltJmpSymbolName, stub.getResolveJumpStart(), gotStartOffset); // Add relocation to GOT cell for dispatch jump. + // The dispatch jump loads destination address from this GOT cell. String gotEntrySymbolName = relocationSymbolName("got.entry", mi, call, callSiteRelocation); addExtLinkageGotContainerRelocation(binaryContainer, gotEntrySymbolName, gotStartOffset, stub.getDispatchJumpOffset()); - // Virtual call needs initial -1 value. + // Virtual call needs initial -1 value for Klass pointer. + // Non virtual call needs initial 0 value for Method pointer to call c2i adapter. byte[] slot = isVirtualCall ? minusOneSlot : zeroSlot; - final int gotMetaOffset = binaryContainer.appendMetaspaceGotBytes(slot, 0, slot.length); + final int gotMetaOffset = binaryContainer.appendExtLinkageGotBytes(slot, 0, slot.length); // Add relocation to GOT cell for move instruction (Klass* for virtual, Method* otherwise). String gotMoveSymbolName = relocationSymbolName("got.move", mi, call, callSiteRelocation); - addMetaspaceGotRelocation(binaryContainer, gotMoveSymbolName, gotMetaOffset, stub.getMovOffset()); + addExtLinkageGotContainerRelocation(binaryContainer, gotMoveSymbolName, gotMetaOffset, stub.getMovOffset()); if (isVirtualCall) { // Nothing. } else { // Add relocation to GOT cell for c2i adapter jump. + // The c2i jump instruction loads destination address from this GOT cell. + // This GOT cell is initialized with -1 and will be updated + // by JVM runtime call resolution code. String gotC2ISymbolName = relocationSymbolName("got.c2i", mi, call, callSiteRelocation); addExtLinkageGotContainerRelocation(binaryContainer, gotC2ISymbolName, gotStartOffset + 8, stub.getC2IJumpOffset()); } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Main.java --- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Main.java Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Main.java Thu Aug 24 16:26:58 2017 +0200 @@ -625,7 +625,9 @@ private void reportError(Throwable e) { log.println("Error: " + e.getMessage()); - e.printStackTrace(log); + if (options.info) { + e.printStackTrace(log); + } log.flush(); } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/ClassSearch.java --- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/ClassSearch.java Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/ClassSearch.java Thu Aug 24 16:26:58 2017 +0200 @@ -77,7 +77,7 @@ } if (found == null) { - throw new InternalError("Failed to find: " + searchFor.toString()); + throw new InternalError("Failed to find " + searchFor.getType() + " file: " + searchFor.getName()); } return found; } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/SearchFor.java --- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/SearchFor.java Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/SearchFor.java Thu Aug 24 16:26:58 2017 +0200 @@ -27,7 +27,7 @@ private final String type; public SearchFor(String name) { - this(name, "unknown"); + this(name, ""); } public SearchFor(String name, String type) { @@ -36,7 +36,7 @@ } public boolean isUnknown() { - return "unknown".equals(type); + return "".equals(type); } public String getType() { @@ -49,6 +49,6 @@ @Override public String toString() { - return type + ":" + name; + return type + ": " + name; } } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/classname/ClassNameSourceProvider.java --- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/classname/ClassNameSourceProvider.java Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/classname/ClassNameSourceProvider.java Thu Aug 24 16:26:58 2017 +0200 @@ -31,7 +31,7 @@ import java.nio.file.Paths; public class ClassNameSourceProvider implements SourceProvider { - public final static String TYPE = "classname"; + public final static String TYPE = "class"; private final ClassLoader classLoader; public ClassNameSourceProvider(FileSupport fileSupport) { @@ -47,6 +47,10 @@ @Override public ClassSource findSource(String name, SearchPath searchPath) { + Path path = Paths.get(name); + if (ClassSource.pathIsClassFile(path)) { + name = ClassSource.makeClassName(path); + } try { classLoader.loadClass(name); return new ClassNameSource(name, classLoader); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.aot/share/classes/module-info.java --- a/hotspot/src/jdk.aot/share/classes/module-info.java Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.aot/share/classes/module-info.java Thu Aug 24 16:26:58 2017 +0200 @@ -23,8 +23,15 @@ * questions. */ +/** + * Defines the Ahead-of-Time (AOT) compiler, {@index jaotc jaotc tool}, + * for compiling Java classes into AOT library. + * + * @moduleGraph + * @since 9 + */ module jdk.aot { + requires jdk.internal.vm.ci; + requires jdk.internal.vm.compiler; requires jdk.management; - requires jdk.vm.ci; - requires jdk.vm.compiler; } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.aot/unix/native/libjelfshim/jdk_tools_jaotc_jnilibelf_JNILibELFAPI.c --- a/hotspot/src/jdk.aot/unix/native/libjelfshim/jdk_tools_jaotc_jnilibelf_JNILibELFAPI.c Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.aot/unix/native/libjelfshim/jdk_tools_jaotc_jnilibelf_JNILibELFAPI.c Thu Aug 24 16:26:58 2017 +0200 @@ -70,18 +70,17 @@ */ static jlong getNativeAddress(JNIEnv* env, jobject ptrObj) { - jclass ptrClass; - jfieldID fidNumber; jlong nativeAddress = -1; - assert (ptrObj != NULL); + assert (ptrObj != NULL); // Get a reference to ptr object's class - ptrClass = (*env)->GetObjectClass(env, ptrObj); - - // Get the Field ID of the instance variables "address" - fidNumber = (*env)->GetFieldID(env, ptrClass, "address", "J"); - if (fidNumber != NULL) { - // Get the long given the Field ID - nativeAddress = (*env)->GetLongField(env, ptrObj, fidNumber); + jclass ptrClass = (*env)->GetObjectClass(env, ptrObj); + if (ptrClass != NULL) { + // Get the Field ID of the instance variables "address" + jfieldID fidNumber = (*env)->GetFieldID(env, ptrClass, "address", "J"); + if (fidNumber != NULL) { + // Get the long given the Field ID + nativeAddress = (*env)->GetLongField(env, ptrObj, fidNumber); + } } // fprintf(stderr, "Native address : %lx\n", nativeAddress); return nativeAddress; @@ -91,10 +90,15 @@ * Box the nativeAddress as a Pointer object. */ static jobject makePointerObject(JNIEnv* env, jlong nativeAddr) { + jobject retObj = NULL; jclass ptrClass = (*env)->FindClass(env, "jdk/tools/jaotc/jnilibelf/Pointer"); - // Call back constructor to allocate a Pointer object, with an int argument - jmethodID constructorId = (*env)->GetMethodID(env, ptrClass, "", "(J)V"); - jobject retObj = (*env)->NewObject(env, ptrClass, constructorId, nativeAddr); + if (ptrClass != NULL) { + // Call back constructor to allocate a Pointer object, with an int argument + jmethodID constructorId = (*env)->GetMethodID(env, ptrClass, "", "(J)V"); + if (constructorId != NULL) { + retObj = (*env)->NewObject(env, ptrClass, constructorId, nativeAddr); + } + } return retObj; } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/elfmacros.h --- a/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/elfmacros.h Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/elfmacros.h Thu Aug 24 16:26:58 2017 +0200 @@ -33,6 +33,7 @@ #define ELF_NHDR Elf64_Nhdr #define ELF_DYN Elf64_Dyn #define ELF_ADDR Elf64_Addr +#define ELF_AUXV Elf64_auxv_t #define ELF_ST_TYPE ELF64_ST_TYPE @@ -45,6 +46,7 @@ #define ELF_NHDR Elf32_Nhdr #define ELF_DYN Elf32_Dyn #define ELF_ADDR Elf32_Addr +#define ELF_AUXV Elf32_auxv_t #define ELF_ST_TYPE ELF32_ST_TYPE diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c --- a/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ } - if (strlen(alt_root) + strlen(name) < PATH_MAX) { + if (strlen(alt_root) + strlen(name) > PATH_MAX) { // Buffer too small. return -1; } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c --- a/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c Thu Aug 24 16:26:58 2017 +0200 @@ -642,6 +642,18 @@ if (core_handle_prstatus(ph, descdata, notep->n_descsz) != true) { return false; } + } else if (notep->n_type == NT_AUXV) { + // Get first segment from entry point + ELF_AUXV *auxv = (ELF_AUXV *)descdata; + while (auxv->a_type != AT_NULL) { + if (auxv->a_type == AT_ENTRY) { + // Set entry point address to address of dynamic section. + // We will adjust it in read_exec_segments(). + ph->core->dynamic_addr = auxv->a_un.a_val; + break; + } + auxv++; + } } p = descdata + ROUNDUP(notep->n_descsz, 4); } @@ -832,7 +844,13 @@ // from PT_DYNAMIC we want to read address of first link_map addr case PT_DYNAMIC: { - ph->core->dynamic_addr = exec_php->p_vaddr; + if (exec_ehdr->e_type == ET_EXEC) { + ph->core->dynamic_addr = exec_php->p_vaddr; + } else { // ET_DYN + // dynamic_addr has entry point of executable. + // Thus we should substract it. + ph->core->dynamic_addr += exec_php->p_vaddr - exec_ehdr->e_entry; + } print_debug("address of _DYNAMIC is 0x%lx\n", ph->core->dynamic_addr); break; } @@ -1030,8 +1048,9 @@ goto err; } - if (read_elf_header(ph->core->exec_fd, &exec_ehdr) != true || exec_ehdr.e_type != ET_EXEC) { - print_debug("executable file is not a valid ELF ET_EXEC file\n"); + if (read_elf_header(ph->core->exec_fd, &exec_ehdr) != true || + ((exec_ehdr.e_type != ET_EXEC) && (exec_ehdr.e_type != ET_DYN))) { + print_debug("executable file is not a valid ELF file\n"); goto err; } diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.hotspot.agent/share/classes/module-info.java --- a/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,21 @@ * questions. */ +/** + * Defines the implementation of the HotSpot Serviceability Agent. + * + *

This module includes the {@index jhsdb jhsdb tool} tool to + * attach to a running Java Virtual Machine (JVM) or launch a postmortem + * debugger to analyze the content of a core-dump from a crashed JVM. + * + *

+ *
Tool Guides:
+ *
{@extLink jhsdb_tool_reference jhsdb}
+ *
+ * + * @moduleGraph + * @since 9 + */ module jdk.hotspot.agent { requires java.datatransfer; requires java.desktop; diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 20014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -114,6 +114,8 @@ } }); + writeHeapRecordPrologue(); + // write JavaThreads writeJavaThreads(); diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Mon Jul 03 13:18:55 2017 -0700 +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Thu Aug 24 16:26:58 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,8 +45,8 @@ * WARNING: This format is still under development, and is subject to * change without notice. * - * header "JAVA PROFILE 1.0.1" or "JAVA PROFILE 1.0.2" (0-terminated) - * u4 size of identifiers. Identifiers are used to represent + * header "JAVA PROFILE 1.0.2" (0-terminated) + * u4 size of identifiers. Identifiers are used to represent * UTF8 strings, objects, stack traces, etc. They usually * have the same size as host pointers. For example, on * Solaris and Win32, the size is 4. @@ -294,10 +294,9 @@ * u2 stack trace depth * * - * When the header is "JAVA PROFILE 1.0.2" a heap dump can optionally - * be generated as a sequence of heap dump segments. This sequence is - * terminated by an end record. The additional tags allowed by format - * "JAVA PROFILE 1.0.2" are: + * A heap dump can optionally be generated as a sequence of heap dump + * segments. This sequence is terminated by an end record. The additional + * tags allowed by format "JAVA PROFILE 1.0.2" are: * * HPROF_HEAP_DUMP_SEGMENT denote a heap dump segment * @@ -310,8 +309,6 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter { - // The heap size threshold used to determine if segmented format - // ("JAVA PROFILE 1.0.2") should be used. private static final long HPROF_SEGMENTED_HEAP_DUMP_THRESHOLD = 2L * 0x40000000; // The approximate size of a heap segment. Used to calculate when to create @@ -319,7 +316,6 @@ private static final long HPROF_SEGMENTED_HEAP_DUMP_SEGMENT_SIZE = 1L * 0x40000000; // hprof binary file header - private static final String HPROF_HEADER_1_0_1 = "JAVA PROFILE 1.0.1"; private static final String HPROF_HEADER_1_0_2 = "JAVA PROFILE 1.0.2"; // constants in enum HprofTag @@ -380,6 +376,7 @@ private static final int JVM_SIGNATURE_ARRAY = '['; private static final int JVM_SIGNATURE_CLASS = 'L'; + private static final long MAX_U4_VALUE = 0xFFFFFFFFL; int serialNum = 1; public synchronized void write(String fileName) throws IOException { @@ -469,7 +466,6 @@ // length later - hprof format requires length. out.flush(); currentSegmentStart = fos.getChannel().position(); - // write dummy length of 0 and we'll fix it later. out.writeInt(0); } @@ -479,7 +475,7 @@ protected void writeHeapRecordEpilogue() throws IOException { if (useSegmentedHeapDump) { out.flush(); - if ((fos.getChannel().position() - currentSegmentStart - 4) >= HPROF_SEGMENTED_HEAP_DUMP_SEGMENT_SIZE) { + if ((fos.getChannel().position() - currentSegmentStart - 4L) >= HPROF_SEGMENTED_HEAP_DUMP_SEGMENT_SIZE) { fillInHeapRecordLength(); currentSegmentStart = 0; } @@ -488,14 +484,14 @@ private void fillInHeapRecordLength() throws IOException { - // now get current position to calculate length + // now get the current position to calculate length long dumpEnd = fos.getChannel().position(); - // calculate length of heap data + // calculate the length of heap data long dumpLenLong = (dumpEnd - currentSegmentStart - 4L); // Check length boundary, overflow could happen but is _very_ unlikely - if(dumpLenLong >= (4L * 0x40000000)){ + if (dumpLenLong >= (4L * 0x40000000)) { throw new RuntimeException("Heap segment size overflow."); } @@ -517,6 +513,71 @@ fos.getChannel().position(currentPosition); } + // get the size in bytes for the requested type + private long getSizeForType(int type) throws IOException { + switch (type) { + case TypeArrayKlass.T_BOOLEAN: + return BOOLEAN_SIZE; + case TypeArrayKlass.T_INT: + return INT_SIZE; + case TypeArrayKlass.T_CHAR: + return CHAR_SIZE; + case TypeArrayKlass.T_SHORT: + return SHORT_SIZE; + case TypeArrayKlass.T_BYTE: + return BYTE_SIZE; + case TypeArrayKlass.T_LONG: + return LONG_SIZE; + case TypeArrayKlass.T_FLOAT: + return FLOAT_SIZE; + case TypeArrayKlass.T_DOUBLE: + return DOUBLE_SIZE; + default: + throw new RuntimeException( + "Should not reach here: Unknown type: " + type); + } + } + + private int getArrayHeaderSize(boolean isObjectAarray) { + return isObjectAarray? + ((int) BYTE_SIZE + 2 * (int) INT_SIZE + 2 * (int) OBJ_ID_SIZE): + (2 * (int) BYTE_SIZE + 2 * (int) INT_SIZE + (int) OBJ_ID_SIZE); + } + + // Check if we need to truncate an array + private int calculateArrayMaxLength(long originalArrayLength, + int headerSize, + long typeSize, + String typeName) throws IOException { + + long length = originalArrayLength; + + // now get the current position to calculate length + long dumpEnd = fos.getChannel().position(); + long originalLengthInBytes = originalArrayLength * typeSize; + + // calculate the length of heap data + long currentRecordLength = (dumpEnd - currentSegmentStart - 4L); + if (currentRecordLength > 0 && + (currentRecordLength + headerSize + originalLengthInBytes) > MAX_U4_VALUE) { + fillInHeapRecordLength(); + currentSegmentStart = 0; + writeHeapRecordPrologue(); + currentRecordLength = 0; + } + + // Calculate the max bytes we can use. + long maxBytes = (MAX_U4_VALUE - (headerSize + currentRecordLength)); + + if (originalLengthInBytes > maxBytes) { + length = maxBytes/typeSize; + System.err.println("WARNING: Cannot dump array of type " + typeName + + " with length " + originalArrayLength + + "; truncating to length " + length); + } + return (int) length; + } + private void writeClassDumpRecords() throws IOException { SystemDictionary sysDict = VM.getVM().getSystemDictionary(); ClassLoaderDataGraph cldGraph = VM.getVM().getClassLoaderDataGraph(); @@ -694,12 +755,16 @@ } protected void writeObjectArray(ObjArray array) throws IOException { + int headerSize = getArrayHeaderSize(true); + final int length = calculateArrayMaxLength(array.getLength(), + headerSize, + OBJ_ID_SIZE, + "Object"); out.writeByte((byte) HPROF_GC_OBJ_ARRAY_DUMP); writeObjectID(array); out.writeInt(DUMMY_STACK_TRACE_ID); - out.writeInt((int) array.getLength()); + out.writeInt(length); writeObjectID(array.getKlass().getJavaMirror()); - final int length = (int) array.getLength(); for (int index = 0; index < length; index++) { OopHandle handle = array.getOopHandleAt(index); writeObjectID(getAddressValue(handle)); @@ -707,101 +772,101 @@ } protected void writePrimitiveArray(TypeArray array) throws IOException { + int headerSize = getArrayHeaderSize(false); + TypeArrayKlass tak = (TypeArrayKlass) array.getKlass(); + final int type = (int) tak.getElementType(); + final String typeName = tak.getElementTypeName(); + final long typeSize = getSizeForType(type); + final int length = calculateArrayMaxLength(array.getLength(), + headerSize, + typeSize, + typeName); out.writeByte((byte) HPROF_GC_PRIM_ARRAY_DUMP); writeObjectID(array); out.writeInt(DUMMY_STACK_TRACE_ID); - out.writeInt((int) array.getLength()); - TypeArrayKlass tak = (TypeArrayKlass) array.getKlass(); - final int type = (int) tak.getElementType(); + out.writeInt(length); out.writeByte((byte) type); switch (type) { case TypeArrayKlass.T_BOOLEAN: - writeBooleanArray(array); + writeBooleanArray(array, length); break; case TypeArrayKlass.T_CHAR: - writeCharArray(array); + writeCharArray(array, length); break; case TypeArrayKlass.T_FLOAT: - writeFloatArray(array); + writeFloatArray(array, length); break; case TypeArrayKlass.T_DOUBLE: - writeDoubleArray(array); + writeDoubleArray(array, length); break; case TypeArrayKlass.T_BYTE: - writeByteArray(array); + writeByteArray(array, length); break; case TypeArrayKlass.T_SHORT: - writeShortArray(array); + writeShortArray(array, length); break; case TypeArrayKlass.T_INT: - writeIntArray(array); + writeIntArray(array, length); break; case TypeArrayKlass.T_LONG: - writeLongArray(array); + writeLongArray(array, length); break; default: - throw new RuntimeException("should not reach here"); + throw new RuntimeException( + "Should not reach here: Unknown type: " + type); } } - private void writeBooleanArray(TypeArray array) throws IOException { - final int length = (int) array.getLength(); + private void writeBooleanArray(TypeArray array, int length) throws IOException { for (int index = 0; index < length; index++) { long offset = BOOLEAN_BASE_OFFSET + index * BOOLEAN_SIZE; out.writeBoolean(array.getHandle().getJBooleanAt(offset)); } } - private void writeByteArray(TypeArray array) throws IOException { - final int length = (int) array.getLength(); + private void writeByteArray(TypeArray array, int length) throws IOException { for (int index = 0; index < length; index++) { long offset = BYTE_BASE_OFFSET + index * BYTE_SIZE; out.writeByte(array.getHandle().getJByteAt(offset)); } } - private void writeShortArray(TypeArray array) throws IOException { - final int length = (int) array.getLength(); + private void writeShortArray(TypeArray array, int length) throws IOException { for (int index = 0; index < length; index++) { long offset = SHORT_BASE_OFFSET + index * SHORT_SIZE; out.writeShort(array.getHandle().getJShortAt(offset)); } } - private void writeIntArray(TypeArray array) throws IOException { - final int length = (int) array.getLength(); + private void writeIntArray(TypeArray array, int length) throws IOException { for (int index = 0; index < length; index++) { long offset = INT_BASE_OFFSET + index * INT_SIZE; out.writeInt(array.getHandle().getJIntAt(offset)); } } - private void writeLongArray(TypeArray array) throws IOException { - final int length = (int) array.getLength(); + private void writeLongArray(TypeArray array, int length) throws IOException { for (int index = 0; index < length; index++) { long offset = LONG_BASE_OFFSET + index * LONG_SIZE; out.writeLong(array.getHandle().getJLongAt(offset)); } } - private void writeCharArray(TypeArray array) throws IOException { - final int length = (int) array.getLength(); + private void writeCharArray(TypeArray array, int length) throws IOException { for (int index = 0; index < length; index++) { long offset = CHAR_BASE_OFFSET + index * CHAR_SIZE; out.writeChar(array.getHandle().getJCharAt(offset)); } } - private void writeFloatArray(TypeArray array) throws IOException { - final int length = (int) array.getLength(); + private void writeFloatArray(TypeArray array, int length) throws IOException { for (int index = 0; index < length; index++) { long offset = FLOAT_BASE_OFFSET + index * FLOAT_SIZE; out.writeFloat(array.getHandle().getJFloatAt(offset)); } } - private void writeDoubleArray(TypeArray array) throws IOException { - final int length = (int) array.getLength(); + private void writeDoubleArray(TypeArray array, int length) throws IOException { for (int index = 0; index < length; index++) { long offset = DOUBLE_BASE_OFFSET + index * DOUBLE_SIZE; out.writeDouble(array.getHandle().getJDoubleAt(offset)); @@ -996,12 +1061,7 @@ // writes hprof binary file header private void writeFileHeader() throws IOException { // version string - if(useSegmentedHeapDump) { - out.writeBytes(HPROF_HEADER_1_0_2); - } - else { - out.writeBytes(HPROF_HEADER_1_0_1); - } + out.writeBytes(HPROF_HEADER_1_0_2); out.writeByte((byte)'\0'); // write identifier size. we use pointers as identifiers. diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.aarch64/src/jdk/vm/ci/aarch64/AArch64.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.aarch64/src/jdk/vm/ci/aarch64/AArch64.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,249 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.aarch64; + +import java.nio.ByteOrder; +import java.util.EnumSet; + +import jdk.vm.ci.code.Architecture; +import jdk.vm.ci.code.Register; +import jdk.vm.ci.code.Register.RegisterCategory; +import jdk.vm.ci.code.RegisterArray; +import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.PlatformKind; + +/** + * Represents the AArch64 architecture. + */ +public class AArch64 extends Architecture { + + public static final RegisterCategory CPU = new RegisterCategory("CPU"); + + // General purpose CPU registers + public static final Register r0 = new Register(0, 0, "r0", CPU); + public static final Register r1 = new Register(1, 1, "r1", CPU); + public static final Register r2 = new Register(2, 2, "r2", CPU); + public static final Register r3 = new Register(3, 3, "r3", CPU); + public static final Register r4 = new Register(4, 4, "r4", CPU); + public static final Register r5 = new Register(5, 5, "r5", CPU); + public static final Register r6 = new Register(6, 6, "r6", CPU); + public static final Register r7 = new Register(7, 7, "r7", CPU); + public static final Register r8 = new Register(8, 8, "r8", CPU); + public static final Register r9 = new Register(9, 9, "r9", CPU); + public static final Register r10 = new Register(10, 10, "r10", CPU); + public static final Register r11 = new Register(11, 11, "r11", CPU); + public static final Register r12 = new Register(12, 12, "r12", CPU); + public static final Register r13 = new Register(13, 13, "r13", CPU); + public static final Register r14 = new Register(14, 14, "r14", CPU); + public static final Register r15 = new Register(15, 15, "r15", CPU); + public static final Register r16 = new Register(16, 16, "r16", CPU); + public static final Register r17 = new Register(17, 17, "r17", CPU); + public static final Register r18 = new Register(18, 18, "r18", CPU); + public static final Register r19 = new Register(19, 19, "r19", CPU); + public static final Register r20 = new Register(20, 20, "r20", CPU); + public static final Register r21 = new Register(21, 21, "r21", CPU); + public static final Register r22 = new Register(22, 22, "r22", CPU); + public static final Register r23 = new Register(23, 23, "r23", CPU); + public static final Register r24 = new Register(24, 24, "r24", CPU); + public static final Register r25 = new Register(25, 25, "r25", CPU); + public static final Register r26 = new Register(26, 26, "r26", CPU); + public static final Register r27 = new Register(27, 27, "r27", CPU); + public static final Register r28 = new Register(28, 28, "r28", CPU); + public static final Register r29 = new Register(29, 29, "r29", CPU); + public static final Register r30 = new Register(30, 30, "r30", CPU); + + /* + * r31 is not a general purpose register, but represents either the stackpointer or the + * zero/discard register depending on the instruction. So we represent those two uses as two + * different registers. The register numbers are kept in sync with register_aarch64.hpp and have + * to be sequential, hence we also need a general r31 register here, which is never used. + */ + public static final Register r31 = new Register(31, 31, "r31", CPU); + public static final Register zr = new Register(32, 31, "zr", CPU); + public static final Register sp = new Register(33, 31, "sp", CPU); + + public static final Register lr = r30; + + // Used by runtime code: cannot be compiler-allocated. + public static final Register rscratch1 = r8; + public static final Register rscratch2 = r9; + + // @formatter:off + public static final RegisterArray cpuRegisters = new RegisterArray( + r0, r1, r2, r3, r4, r5, r6, r7, + r8, r9, r10, r11, r12, r13, r14, r15, + r16, r17, r18, r19, r20, r21, r22, r23, + r24, r25, r26, r27, r28, r29, r30, r31, + zr, sp + ); + // @formatter:on + + public static final RegisterCategory SIMD = new RegisterCategory("SIMD"); + + // Simd registers + public static final Register v0 = new Register(34, 0, "v0", SIMD); + public static final Register v1 = new Register(35, 1, "v1", SIMD); + public static final Register v2 = new Register(36, 2, "v2", SIMD); + public static final Register v3 = new Register(37, 3, "v3", SIMD); + public static final Register v4 = new Register(38, 4, "v4", SIMD); + public static final Register v5 = new Register(39, 5, "v5", SIMD); + public static final Register v6 = new Register(40, 6, "v6", SIMD); + public static final Register v7 = new Register(41, 7, "v7", SIMD); + public static final Register v8 = new Register(42, 8, "v8", SIMD); + public static final Register v9 = new Register(43, 9, "v9", SIMD); + public static final Register v10 = new Register(44, 10, "v10", SIMD); + public static final Register v11 = new Register(45, 11, "v11", SIMD); + public static final Register v12 = new Register(46, 12, "v12", SIMD); + public static final Register v13 = new Register(47, 13, "v13", SIMD); + public static final Register v14 = new Register(48, 14, "v14", SIMD); + public static final Register v15 = new Register(49, 15, "v15", SIMD); + public static final Register v16 = new Register(50, 16, "v16", SIMD); + public static final Register v17 = new Register(51, 17, "v17", SIMD); + public static final Register v18 = new Register(52, 18, "v18", SIMD); + public static final Register v19 = new Register(53, 19, "v19", SIMD); + public static final Register v20 = new Register(54, 20, "v20", SIMD); + public static final Register v21 = new Register(55, 21, "v21", SIMD); + public static final Register v22 = new Register(56, 22, "v22", SIMD); + public static final Register v23 = new Register(57, 23, "v23", SIMD); + public static final Register v24 = new Register(58, 24, "v24", SIMD); + public static final Register v25 = new Register(59, 25, "v25", SIMD); + public static final Register v26 = new Register(60, 26, "v26", SIMD); + public static final Register v27 = new Register(61, 27, "v27", SIMD); + public static final Register v28 = new Register(62, 28, "v28", SIMD); + public static final Register v29 = new Register(63, 29, "v29", SIMD); + public static final Register v30 = new Register(64, 30, "v30", SIMD); + public static final Register v31 = new Register(65, 31, "v31", SIMD); + + // @formatter:off + public static final RegisterArray simdRegisters = new RegisterArray( + v0, v1, v2, v3, v4, v5, v6, v7, + v8, v9, v10, v11, v12, v13, v14, v15, + v16, v17, v18, v19, v20, v21, v22, v23, + v24, v25, v26, v27, v28, v29, v30, v31 + ); + // @formatter:on + + // @formatter:off + public static final RegisterArray allRegisters = new RegisterArray( + r0, r1, r2, r3, r4, r5, r6, r7, + r8, r9, r10, r11, r12, r13, r14, r15, + r16, r17, r18, r19, r20, r21, r22, r23, + r24, r25, r26, r27, r28, r29, r30, r31, + zr, sp, + + v0, v1, v2, v3, v4, v5, v6, v7, + v8, v9, v10, v11, v12, v13, v14, v15, + v16, v17, v18, v19, v20, v21, v22, v23, + v24, v25, v26, v27, v28, v29, v30, v31 + ); + // @formatter:on + + /** + * Basic set of CPU features mirroring what is returned from the cpuid instruction. See: + * {@code VM_Version::cpuFeatureFlags}. + */ + public enum CPUFeature { + FP, + ASIMD, + EVTSTRM, + AES, + PMULL, + SHA1, + SHA2, + CRC32, + A53MAC, + DMB_ATOMICS + } + + private final EnumSet features; + + /** + * Set of flags to control code emission. + */ + public enum Flag { + UseBarriersForVolatile, + UseCRC32, + UseNeon + } + + private final EnumSet flags; + + public AArch64(EnumSet features, EnumSet flags) { + super("aarch64", AArch64Kind.QWORD, ByteOrder.LITTLE_ENDIAN, true, allRegisters, 0, 0, 0); + this.features = features; + this.flags = flags; + } + + public EnumSet getFeatures() { + return features; + } + + public EnumSet getFlags() { + return flags; + } + + @Override + public PlatformKind getPlatformKind(JavaKind javaKind) { + switch (javaKind) { + case Boolean: + case Byte: + return AArch64Kind.BYTE; + case Short: + case Char: + return AArch64Kind.WORD; + case Int: + return AArch64Kind.DWORD; + case Long: + case Object: + return AArch64Kind.QWORD; + case Float: + return AArch64Kind.SINGLE; + case Double: + return AArch64Kind.DOUBLE; + default: + return null; + } + } + + @Override + public boolean canStoreValue(RegisterCategory category, PlatformKind platformKind) { + AArch64Kind kind = (AArch64Kind) platformKind; + if (kind.isInteger()) { + return category.equals(CPU); + } else if (kind.isSIMD()) { + return category.equals(SIMD); + } + return false; + } + + @Override + public AArch64Kind getLargestStorableKind(RegisterCategory category) { + if (category.equals(CPU)) { + return AArch64Kind.QWORD; + } else if (category.equals(SIMD)) { + return AArch64Kind.V128_QWORD; + } else { + return null; + } + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.aarch64/src/jdk/vm/ci/aarch64/AArch64Kind.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.aarch64/src/jdk/vm/ci/aarch64/AArch64Kind.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.aarch64; + +import jdk.vm.ci.meta.PlatformKind; + +public enum AArch64Kind implements PlatformKind { + + // scalar + BYTE(1), + WORD(2), + DWORD(4), + QWORD(8), + SINGLE(4), + DOUBLE(8), + + // SIMD + V32_BYTE(4, BYTE), + V32_WORD(4, WORD), + V64_BYTE(8, BYTE), + V64_WORD(8, WORD), + V64_DWORD(8, DWORD), + V128_BYTE(16, BYTE), + V128_WORD(16, WORD), + V128_DWORD(16, DWORD), + V128_QWORD(16, QWORD), + V128_SINGLE(16, SINGLE), + V128_DOUBLE(16, DOUBLE); + + private final int size; + private final int vectorLength; + + private final AArch64Kind scalar; + private final EnumKey key = new EnumKey<>(this); + + AArch64Kind(int size) { + this.size = size; + this.scalar = this; + this.vectorLength = 1; + } + + AArch64Kind(int size, AArch64Kind scalar) { + this.size = size; + this.scalar = scalar; + + assert size % scalar.size == 0; + this.vectorLength = size / scalar.size; + } + + public AArch64Kind getScalar() { + return scalar; + } + + public int getSizeInBytes() { + return size; + } + + public int getVectorLength() { + return vectorLength; + } + + public Key getKey() { + return key; + } + + public boolean isInteger() { + switch (this) { + case BYTE: + case WORD: + case DWORD: + case QWORD: + return true; + default: + return false; + } + } + + public boolean isSIMD() { + switch (this) { + case SINGLE: + case DOUBLE: + case V32_BYTE: + case V32_WORD: + case V64_BYTE: + case V64_WORD: + case V64_DWORD: + case V128_BYTE: + case V128_WORD: + case V128_DWORD: + case V128_QWORD: + case V128_SINGLE: + case V128_DOUBLE: + return true; + default: + return false; + } + } + + public char getTypeChar() { + switch (this) { + case BYTE: + return 'b'; + case WORD: + return 'w'; + case DWORD: + return 'd'; + case QWORD: + return 'q'; + case SINGLE: + return 'S'; + case DOUBLE: + return 'D'; + case V32_BYTE: + case V32_WORD: + case V64_BYTE: + case V64_WORD: + case V64_DWORD: + case V128_BYTE: + case V128_WORD: + case V128_DWORD: + case V128_QWORD: + case V128_SINGLE: + case V128_DOUBLE: + return 'v'; + default: + return '-'; + } + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,306 @@ +/* + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.amd64; + +import static jdk.vm.ci.code.MemoryBarriers.LOAD_LOAD; +import static jdk.vm.ci.code.MemoryBarriers.LOAD_STORE; +import static jdk.vm.ci.code.MemoryBarriers.STORE_STORE; +import static jdk.vm.ci.code.Register.SPECIAL; + +import java.nio.ByteOrder; +import java.util.EnumSet; + +import jdk.vm.ci.code.Architecture; +import jdk.vm.ci.code.Register; +import jdk.vm.ci.code.Register.RegisterCategory; +import jdk.vm.ci.code.RegisterArray; +import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.PlatformKind; + +/** + * Represents the AMD64 architecture. + */ +public class AMD64 extends Architecture { + + public static final RegisterCategory CPU = new RegisterCategory("CPU"); + + // @formatter:off + + // General purpose CPU registers + public static final Register rax = new Register(0, 0, "rax", CPU); + public static final Register rcx = new Register(1, 1, "rcx", CPU); + public static final Register rdx = new Register(2, 2, "rdx", CPU); + public static final Register rbx = new Register(3, 3, "rbx", CPU); + public static final Register rsp = new Register(4, 4, "rsp", CPU); + public static final Register rbp = new Register(5, 5, "rbp", CPU); + public static final Register rsi = new Register(6, 6, "rsi", CPU); + public static final Register rdi = new Register(7, 7, "rdi", CPU); + + public static final Register r8 = new Register(8, 8, "r8", CPU); + public static final Register r9 = new Register(9, 9, "r9", CPU); + public static final Register r10 = new Register(10, 10, "r10", CPU); + public static final Register r11 = new Register(11, 11, "r11", CPU); + public static final Register r12 = new Register(12, 12, "r12", CPU); + public static final Register r13 = new Register(13, 13, "r13", CPU); + public static final Register r14 = new Register(14, 14, "r14", CPU); + public static final Register r15 = new Register(15, 15, "r15", CPU); + + public static final Register[] cpuRegisters = { + rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi, + r8, r9, r10, r11, r12, r13, r14, r15 + }; + + public static final RegisterCategory XMM = new RegisterCategory("XMM"); + + // XMM registers + public static final Register xmm0 = new Register(16, 0, "xmm0", XMM); + public static final Register xmm1 = new Register(17, 1, "xmm1", XMM); + public static final Register xmm2 = new Register(18, 2, "xmm2", XMM); + public static final Register xmm3 = new Register(19, 3, "xmm3", XMM); + public static final Register xmm4 = new Register(20, 4, "xmm4", XMM); + public static final Register xmm5 = new Register(21, 5, "xmm5", XMM); + public static final Register xmm6 = new Register(22, 6, "xmm6", XMM); + public static final Register xmm7 = new Register(23, 7, "xmm7", XMM); + + public static final Register xmm8 = new Register(24, 8, "xmm8", XMM); + public static final Register xmm9 = new Register(25, 9, "xmm9", XMM); + public static final Register xmm10 = new Register(26, 10, "xmm10", XMM); + public static final Register xmm11 = new Register(27, 11, "xmm11", XMM); + public static final Register xmm12 = new Register(28, 12, "xmm12", XMM); + public static final Register xmm13 = new Register(29, 13, "xmm13", XMM); + public static final Register xmm14 = new Register(30, 14, "xmm14", XMM); + public static final Register xmm15 = new Register(31, 15, "xmm15", XMM); + + public static final Register xmm16 = new Register(32, 16, "xmm16", XMM); + public static final Register xmm17 = new Register(33, 17, "xmm17", XMM); + public static final Register xmm18 = new Register(34, 18, "xmm18", XMM); + public static final Register xmm19 = new Register(35, 19, "xmm19", XMM); + public static final Register xmm20 = new Register(36, 20, "xmm20", XMM); + public static final Register xmm21 = new Register(37, 21, "xmm21", XMM); + public static final Register xmm22 = new Register(38, 22, "xmm22", XMM); + public static final Register xmm23 = new Register(39, 23, "xmm23", XMM); + + public static final Register xmm24 = new Register(40, 24, "xmm24", XMM); + public static final Register xmm25 = new Register(41, 25, "xmm25", XMM); + public static final Register xmm26 = new Register(42, 26, "xmm26", XMM); + public static final Register xmm27 = new Register(43, 27, "xmm27", XMM); + public static final Register xmm28 = new Register(44, 28, "xmm28", XMM); + public static final Register xmm29 = new Register(45, 29, "xmm29", XMM); + public static final Register xmm30 = new Register(46, 30, "xmm30", XMM); + public static final Register xmm31 = new Register(47, 31, "xmm31", XMM); + + public static final Register[] xmmRegistersSSE = { + xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, + xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15 + }; + + public static final Register[] xmmRegistersAVX512 = { + xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, + xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, + xmm16, xmm17, xmm18, xmm19, xmm20, xmm21, xmm22, xmm23, + xmm24, xmm25, xmm26, xmm27, xmm28, xmm29, xmm30, xmm31 + }; + + public static final RegisterCategory MASK = new RegisterCategory("MASK", false); + + public static final Register k0 = new Register(48, 0, "k0", MASK); + public static final Register k1 = new Register(49, 1, "k1", MASK); + public static final Register k2 = new Register(50, 2, "k2", MASK); + public static final Register k3 = new Register(51, 3, "k3", MASK); + public static final Register k4 = new Register(52, 4, "k4", MASK); + public static final Register k5 = new Register(53, 5, "k5", MASK); + public static final Register k6 = new Register(54, 6, "k6", MASK); + public static final Register k7 = new Register(55, 7, "k7", MASK); + + public static final RegisterArray valueRegistersSSE = new RegisterArray( + rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi, + r8, r9, r10, r11, r12, r13, r14, r15, + xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, + xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15 + ); + + public static final RegisterArray valueRegistersAVX512 = new RegisterArray( + rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi, + r8, r9, r10, r11, r12, r13, r14, r15, + xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, + xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, + xmm16, xmm17, xmm18, xmm19, xmm20, xmm21, xmm22, xmm23, + xmm24, xmm25, xmm26, xmm27, xmm28, xmm29, xmm30, xmm31, + k0, k1, k2, k3, k4, k5, k6, k7 + ); + + /** + * Register used to construct an instruction-relative address. + */ + public static final Register rip = new Register(56, -1, "rip", SPECIAL); + + public static final RegisterArray allRegisters = new RegisterArray( + rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi, + r8, r9, r10, r11, r12, r13, r14, r15, + xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, + xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, + xmm16, xmm17, xmm18, xmm19, xmm20, xmm21, xmm22, xmm23, + xmm24, xmm25, xmm26, xmm27, xmm28, xmm29, xmm30, xmm31, + k0, k1, k2, k3, k4, k5, k6, k7, + rip + ); + + // @formatter:on + + /** + * Basic set of CPU features mirroring what is returned from the cpuid instruction. See: + * {@code VM_Version::cpuFeatureFlags}. + */ + public enum CPUFeature { + CX8, + CMOV, + FXSR, + HT, + MMX, + AMD_3DNOW_PREFETCH, + SSE, + SSE2, + SSE3, + SSSE3, + SSE4A, + SSE4_1, + SSE4_2, + POPCNT, + LZCNT, + TSC, + TSCINV, + AVX, + AVX2, + AES, + ERMS, + CLMUL, + BMI1, + BMI2, + RTM, + ADX, + AVX512F, + AVX512DQ, + AVX512PF, + AVX512ER, + AVX512CD, + AVX512BW, + AVX512VL, + SHA, + FMA + } + + private final EnumSet features; + + /** + * Set of flags to control code emission. + */ + public enum Flag { + UseCountLeadingZerosInstruction, + UseCountTrailingZerosInstruction + } + + private final EnumSet flags; + + private final AMD64Kind largestKind; + + public AMD64(EnumSet features, EnumSet flags) { + super("AMD64", AMD64Kind.QWORD, ByteOrder.LITTLE_ENDIAN, true, allRegisters, LOAD_LOAD | LOAD_STORE | STORE_STORE, 1, 8); + this.features = features; + this.flags = flags; + assert features.contains(CPUFeature.SSE2) : "minimum config for x64"; + + if (features.contains(CPUFeature.AVX512F)) { + largestKind = AMD64Kind.V512_QWORD; + } else if (features.contains(CPUFeature.AVX)) { + largestKind = AMD64Kind.V256_QWORD; + } else { + largestKind = AMD64Kind.V128_QWORD; + } + } + + public EnumSet getFeatures() { + return features; + } + + public EnumSet getFlags() { + return flags; + } + + @Override + public RegisterArray getAvailableValueRegisters() { + if (features.contains(CPUFeature.AVX512F)) { + return valueRegistersAVX512; + } else { + return valueRegistersSSE; + } + } + + @Override + public PlatformKind getPlatformKind(JavaKind javaKind) { + switch (javaKind) { + case Boolean: + case Byte: + return AMD64Kind.BYTE; + case Short: + case Char: + return AMD64Kind.WORD; + case Int: + return AMD64Kind.DWORD; + case Long: + case Object: + return AMD64Kind.QWORD; + case Float: + return AMD64Kind.SINGLE; + case Double: + return AMD64Kind.DOUBLE; + default: + return null; + } + } + + @Override + public boolean canStoreValue(RegisterCategory category, PlatformKind platformKind) { + AMD64Kind kind = (AMD64Kind) platformKind; + if (kind.isInteger()) { + return category.equals(CPU); + } else if (kind.isXMM()) { + return category.equals(XMM); + } else { + assert kind.isMask(); + return category.equals(MASK); + } + } + + @Override + public AMD64Kind getLargestStorableKind(RegisterCategory category) { + if (category.equals(CPU)) { + return AMD64Kind.QWORD; + } else if (category.equals(XMM)) { + return largestKind; + } else if (category.equals(MASK)) { + return AMD64Kind.MASK64; + } else { + return null; + } + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64Kind.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64Kind.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.amd64; + +import jdk.vm.ci.meta.PlatformKind; + +public enum AMD64Kind implements PlatformKind { + + // scalar + BYTE(1), + WORD(2), + DWORD(4), + QWORD(8), + SINGLE(4), + DOUBLE(8), + + // SSE2 + V32_BYTE(4, BYTE), + V32_WORD(4, WORD), + V64_BYTE(8, BYTE), + V64_WORD(8, WORD), + V64_DWORD(8, DWORD), + V128_BYTE(16, BYTE), + V128_WORD(16, WORD), + V128_DWORD(16, DWORD), + V128_QWORD(16, QWORD), + V128_SINGLE(16, SINGLE), + V128_DOUBLE(16, DOUBLE), + + // AVX + V256_BYTE(32, BYTE), + V256_WORD(32, WORD), + V256_DWORD(32, DWORD), + V256_QWORD(32, QWORD), + V256_SINGLE(32, SINGLE), + V256_DOUBLE(32, DOUBLE), + + // AVX512 + V512_BYTE(64, BYTE), + V512_WORD(64, WORD), + V512_DWORD(64, DWORD), + V512_QWORD(64, QWORD), + V512_SINGLE(64, SINGLE), + V512_DOUBLE(64, DOUBLE), + + MASK8(1), + MASK16(2), + MASK32(4), + MASK64(8); + + private final int size; + private final int vectorLength; + + private final AMD64Kind scalar; + private final EnumKey key = new EnumKey<>(this); + + AMD64Kind(int size) { + this.size = size; + this.scalar = this; + this.vectorLength = 1; + } + + AMD64Kind(int size, AMD64Kind scalar) { + this.size = size; + this.scalar = scalar; + + assert size % scalar.size == 0; + this.vectorLength = size / scalar.size; + } + + public AMD64Kind getScalar() { + return scalar; + } + + public int getSizeInBytes() { + return size; + } + + public int getVectorLength() { + return vectorLength; + } + + public Key getKey() { + return key; + } + + public boolean isInteger() { + switch (this) { + case BYTE: + case WORD: + case DWORD: + case QWORD: + return true; + default: + return false; + } + } + + public boolean isXMM() { + switch (this) { + case SINGLE: + case DOUBLE: + case V32_BYTE: + case V32_WORD: + case V64_BYTE: + case V64_WORD: + case V64_DWORD: + case V128_BYTE: + case V128_WORD: + case V128_DWORD: + case V128_QWORD: + case V128_SINGLE: + case V128_DOUBLE: + case V256_BYTE: + case V256_WORD: + case V256_DWORD: + case V256_QWORD: + case V256_SINGLE: + case V256_DOUBLE: + case V512_BYTE: + case V512_WORD: + case V512_DWORD: + case V512_QWORD: + case V512_SINGLE: + case V512_DOUBLE: + return true; + default: + return false; + } + } + + public boolean isMask() { + switch (this) { + case MASK8: + case MASK16: + case MASK32: + case MASK64: + return true; + default: + return false; + } + } + + public char getTypeChar() { + switch (this) { + case BYTE: + return 'b'; + case WORD: + return 'w'; + case DWORD: + return 'd'; + case QWORD: + return 'q'; + case SINGLE: + return 'S'; + case DOUBLE: + return 'D'; + case V32_BYTE: + case V32_WORD: + case V64_BYTE: + case V64_WORD: + case V64_DWORD: + return 'v'; + case V128_BYTE: + case V128_WORD: + case V128_DWORD: + case V128_QWORD: + case V128_SINGLE: + case V128_DOUBLE: + return 'x'; + case V256_BYTE: + case V256_WORD: + case V256_DWORD: + case V256_QWORD: + case V256_SINGLE: + case V256_DOUBLE: + return 'y'; + case V512_BYTE: + case V512_WORD: + case V512_DWORD: + case V512_QWORD: + case V512_SINGLE: + case V512_DOUBLE: + return 'z'; + case MASK8: + case MASK16: + case MASK32: + case MASK64: + return 'k'; + default: + return '-'; + } + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/overview.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/overview.html Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,37 @@ + + + + + + + + +The jdk.vm.ci.code project provides an API to the runtime's native code cache. +It allows installation and execution of native code. + + + diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Architecture.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Architecture.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import java.nio.ByteOrder; + +import jdk.vm.ci.code.Register.RegisterCategory; +import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.PlatformKind; + +/** + * Represents a CPU architecture, including information such as its endianness, CPU registers, word + * width, etc. + */ +public abstract class Architecture { + + /** + * The architecture specific type of a native word. + */ + private final PlatformKind wordKind; + + /** + * The name of this architecture (e.g. "AMD64", "SPARCv9"). + */ + private final String name; + + /** + * List of all available registers on this architecture. The index of each register in this list + * is equal to its {@linkplain Register#number number}. + */ + private final RegisterArray registers; + + /** + * The byte ordering can be either little or big endian. + */ + private final ByteOrder byteOrder; + + /** + * Whether the architecture supports unaligned memory accesses. + */ + private final boolean unalignedMemoryAccess; + + /** + * Mask of the barrier constants denoting the barriers that are not required to be explicitly + * inserted under this architecture. + */ + private final int implicitMemoryBarriers; + + /** + * Offset in bytes from the beginning of a call instruction to the displacement. + */ + private final int machineCodeCallDisplacementOffset; + + /** + * The size of the return address pushed to the stack by a call instruction. A value of 0 + * denotes that call linkage uses registers instead (e.g. SPARC). + */ + private final int returnAddressSize; + + protected Architecture(String name, PlatformKind wordKind, ByteOrder byteOrder, boolean unalignedMemoryAccess, RegisterArray registers, int implicitMemoryBarriers, + int nativeCallDisplacementOffset, + int returnAddressSize) { + this.name = name; + this.registers = registers; + this.wordKind = wordKind; + this.byteOrder = byteOrder; + this.unalignedMemoryAccess = unalignedMemoryAccess; + this.implicitMemoryBarriers = implicitMemoryBarriers; + this.machineCodeCallDisplacementOffset = nativeCallDisplacementOffset; + this.returnAddressSize = returnAddressSize; + } + + /** + * Converts this architecture to a string. + * + * @return the string representation of this architecture + */ + @Override + public final String toString() { + return getName().toLowerCase(); + } + + /** + * Gets the natural size of words (typically registers and pointers) of this architecture, in + * bytes. + */ + public int getWordSize() { + return wordKind.getSizeInBytes(); + } + + public PlatformKind getWordKind() { + return wordKind; + } + + /** + * Gets the name of this architecture. + */ + public String getName() { + return name; + } + + /** + * Gets the list of all registers that exist on this architecture. This contains all registers + * that exist in the specification of this architecture. Not all of them may be available on + * this particular architecture instance. The index of each register in this list is equal to + * its {@linkplain Register#number number}. + */ + public RegisterArray getRegisters() { + return registers; + } + + /** + * Gets a list of all registers available for storing values on this architecture. This may be a + * subset of {@link #getRegisters()}, depending on the capabilities of this particular CPU. + */ + public RegisterArray getAvailableValueRegisters() { + return getRegisters(); + } + + public ByteOrder getByteOrder() { + return byteOrder; + } + + /** + * @return true if the architecture supports unaligned memory accesses. + */ + public boolean supportsUnalignedMemoryAccess() { + return unalignedMemoryAccess; + } + + /** + * Gets the size of the return address pushed to the stack by a call instruction. A value of 0 + * denotes that call linkage uses registers instead. + */ + public int getReturnAddressSize() { + return returnAddressSize; + } + + /** + * Gets the offset in bytes from the beginning of a call instruction to the displacement. + */ + public int getMachineCodeCallDisplacementOffset() { + return machineCodeCallDisplacementOffset; + } + + /** + * Determines the barriers in a given barrier mask that are explicitly required on this + * architecture. + * + * @param barriers a mask of the barrier constants + * @return the value of {@code barriers} minus the barriers unnecessary on this architecture + */ + public final int requiredBarriers(int barriers) { + return barriers & ~implicitMemoryBarriers; + } + + /** + * Determine whether a kind can be stored in a register of a given category. + * + * @param category the category of the register + * @param kind the kind that should be stored in the register + */ + public abstract boolean canStoreValue(RegisterCategory category, PlatformKind kind); + + /** + * Return the largest kind that can be stored in a register of a given category. + * + * @param category the category of the register + * @return the largest kind that can be stored in a register {@code category} + */ + public abstract PlatformKind getLargestStorableKind(RegisterCategory category); + + /** + * Return the {@link PlatformKind} that is used to store values of a given {@link JavaKind}. + */ + public abstract PlatformKind getPlatformKind(JavaKind javaKind); + + @Override + public final boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (obj instanceof Architecture) { + Architecture that = (Architecture) obj; + if (this.name.equals(that.name)) { + assert this.byteOrder.equals(that.byteOrder); + assert this.implicitMemoryBarriers == that.implicitMemoryBarriers; + assert this.machineCodeCallDisplacementOffset == that.machineCodeCallDisplacementOffset; + assert this.registers.equals(that.registers); + assert this.returnAddressSize == that.returnAddressSize; + assert this.unalignedMemoryAccess == that.unalignedMemoryAccess; + assert this.wordKind == that.wordKind; + return true; + } + } + return false; + } + + @Override + public final int hashCode() { + return name.hashCode(); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BailoutException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BailoutException.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import java.util.Locale; + +/** + * Exception thrown when the compiler refuses to compile a method because of problems with the + * method. e.g. bytecode wouldn't verify, too big, JSR/ret too complicated, etc. This exception is + * not meant to indicate problems with the compiler itself. + */ +public class BailoutException extends RuntimeException { + + public static final long serialVersionUID = 8974598793458772L; + private final boolean permanent; + + /** + * Creates a new {@link BailoutException}. + * + * + * @param args parameters to the formatter + */ + public BailoutException(String format, Object... args) { + super(String.format(Locale.ENGLISH, format, args)); + this.permanent = true; + } + + /** + * Creates a new {@link BailoutException}. + * + * + * @param args parameters to the formatter + */ + public BailoutException(Throwable cause, String format, Object... args) { + super(String.format(Locale.ENGLISH, format, args), cause); + this.permanent = true; + } + + /** + * Creates a new {@link BailoutException}. + * + * @param permanent specifies whether this exception will occur again if compilation is retried + * @param args parameters to the formatter + */ + public BailoutException(boolean permanent, String format, Object... args) { + super(String.format(Locale.ENGLISH, format, args)); + this.permanent = permanent; + } + + /** + * @return whether this exception will occur again if compilation is retried + */ + public boolean isPermanent() { + return permanent; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodeFrame.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodeFrame.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,338 @@ +/* + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import java.util.Arrays; + +import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.JavaValue; +import jdk.vm.ci.meta.ResolvedJavaMethod; +import jdk.vm.ci.meta.Value; + +/** + * Represents the Java bytecode frame state(s) at a given position including {@link Value locations} + * where to find the local variables, operand stack values and locked objects of the bytecode + * frame(s). + */ +public final class BytecodeFrame extends BytecodePosition { + + /** + * An array of values representing how to reconstruct the state of the Java frame. This is array + * is partitioned as follows: + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Start index (inclusive)End index (exclusive)Description
0numLocalsLocal variables
numLocalsnumLocals + numStackOperand stack
numLocals + numStackvalues.lengthLocked objects
+ *

+ * Note that the number of locals and the number of stack slots may be smaller than the maximum + * number of locals and stack slots as specified in the compiled method. + * + * This field is intentionally exposed as a mutable array that a compiler may modify (e.g. + * during register allocation). + */ + @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "field is intentionally mutable")// + public final JavaValue[] values; + + /** + * An array describing the Java kinds in {@link #values}. It records a kind for the locals and + * the operand stack. + */ + private final JavaKind[] slotKinds; + + /** + * The number of locals in the values array. + */ + public final int numLocals; + + /** + * The number of stack slots in the values array. + */ + public final int numStack; + + /** + * The number of locks in the values array. + */ + public final int numLocks; + + /** + * True if this is a position inside an exception handler before the exception object has been + * consumed. In this case, {@link #numStack} {@code == 1} and {@link #getStackValue(int) + * getStackValue(0)} is the location of the exception object. If deoptimization happens at this + * position, the interpreter will rethrow the exception instead of executing the bytecode + * instruction at this position. + */ + public final boolean rethrowException; + + /** + * Specifies if this object represents a frame state in the middle of executing a call. If true, + * the arguments to the call have been popped from the stack and the return value (for a + * non-void call) has not yet been pushed. + */ + public final boolean duringCall; + + /** + * This BCI should be used for frame states that are built for code with no meaningful BCI. + */ + public static final int UNKNOWN_BCI = -5; + + /** + * The BCI for exception unwind. This is synthetic code and has no representation in bytecode. + * In contrast with {@link #AFTER_EXCEPTION_BCI}, at this point, if the method is synchronized, + * the monitor is still held. + */ + public static final int UNWIND_BCI = -1; + + /** + * The BCI for the state before starting to execute a method. Note that if the method is + * synchronized, the monitor is not yet held. + */ + public static final int BEFORE_BCI = -2; + + /** + * The BCI for the state after finishing the execution of a method and returning normally. Note + * that if the method was synchronized the monitor is already released. + */ + public static final int AFTER_BCI = -3; + + /** + * The BCI for exception unwind. This is synthetic code and has no representation in bytecode. + * In contrast with {@link #UNWIND_BCI}, at this point, if the method is synchronized, the + * monitor is already released. + */ + public static final int AFTER_EXCEPTION_BCI = -4; + + /** + * This BCI should be used for states that cannot be the target of a deoptimization, like + * snippet frame states. + */ + public static final int INVALID_FRAMESTATE_BCI = -6; + + /** + * Determines if a given BCI matches one of the placeholder BCI constants defined in this class. + */ + public static boolean isPlaceholderBci(int bci) { + return bci < 0; + } + + /** + * Gets the name of a given placeholder BCI. + */ + public static String getPlaceholderBciName(int bci) { + assert isPlaceholderBci(bci); + if (bci == BytecodeFrame.AFTER_BCI) { + return "AFTER_BCI"; + } else if (bci == BytecodeFrame.AFTER_EXCEPTION_BCI) { + return "AFTER_EXCEPTION_BCI"; + } else if (bci == BytecodeFrame.INVALID_FRAMESTATE_BCI) { + return "INVALID_FRAMESTATE_BCI"; + } else if (bci == BytecodeFrame.BEFORE_BCI) { + return "BEFORE_BCI"; + } else if (bci == BytecodeFrame.UNKNOWN_BCI) { + return "UNKNOWN_BCI"; + } else { + assert bci == BytecodeFrame.UNWIND_BCI; + return "UNWIND_BCI"; + } + } + + /** + * Creates a new frame object. + * + * @param caller the caller frame (which may be {@code null}) + * @param method the method + * @param bci a BCI within the method + * @param rethrowException specifies if the VM should re-throw the pending exception when + * deopt'ing using this frame + * @param values the frame state {@link #values}. + * @param slotKinds the kinds in {@code values}. This array is now owned by this object and must + * not be mutated by the caller. + * @param numLocals the number of local variables + * @param numStack the depth of the stack + * @param numLocks the number of locked objects + */ + @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `slotKinds`") + public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, JavaValue[] values, JavaKind[] slotKinds, int numLocals, int numStack, + int numLocks) { + super(caller, method, bci); + assert values != null; + this.rethrowException = rethrowException; + this.duringCall = duringCall; + this.values = values; + this.slotKinds = slotKinds; + this.numLocals = numLocals; + this.numStack = numStack; + this.numLocks = numLocks; + assert !rethrowException || numStack == 1 : "must have exception on top of the stack"; + } + + /** + * Ensure that the frame state is formatted as expected by the JVM, with null or Illegal in the + * slot following a double word item. This should really be checked in FrameState itself but + * because of Word type rewriting and alternative backends that can't be done. + */ + public boolean validateFormat() { + if (caller() != null) { + caller().validateFormat(); + } + for (int i = 0; i < numLocals + numStack; i++) { + if (values[i] != null) { + JavaKind kind = slotKinds[i]; + if (kind.needsTwoSlots()) { + assert slotKinds.length > i + 1 : String.format("missing second word %s", this); + assert slotKinds[i + 1] == JavaKind.Illegal : this; + } + } + } + return true; + } + + /** + * Gets the kind of a local variable. + * + * @param i the local variable to query + * @return the kind of local variable {@code i} + * @throw {@link IndexOutOfBoundsException} if {@code i < 0 || i >= this.numLocals} + */ + public JavaKind getLocalValueKind(int i) { + if (i < 0 || i >= numLocals) { + throw new IndexOutOfBoundsException(); + } + return slotKinds[i]; + } + + /** + * Gets the kind of a stack slot. + * + * @param i the local variable to query + * @return the kind of stack slot {@code i} + * @throw {@link IndexOutOfBoundsException} if {@code i < 0 || i >= this.numStack} + */ + public JavaKind getStackValueKind(int i) { + if (i < 0 || i >= numStack) { + throw new IndexOutOfBoundsException(); + } + return slotKinds[i + numLocals]; + } + + /** + * Gets the value representing the specified local variable. + * + * @param i the local variable index + * @return the value that can be used to reconstruct the local's current value + * @throw {@link IndexOutOfBoundsException} if {@code i < 0 || i >= this.numLocals} + */ + public JavaValue getLocalValue(int i) { + if (i < 0 || i >= numLocals) { + throw new IndexOutOfBoundsException(); + } + return values[i]; + } + + /** + * Gets the value representing the specified stack slot. + * + * @param i the stack index + * @return the value that can be used to reconstruct the stack slot's current value + * @throw {@link IndexOutOfBoundsException} if {@code i < 0 || i >= this.numStack} + */ + public JavaValue getStackValue(int i) { + if (i < 0 || i >= numStack) { + throw new IndexOutOfBoundsException(); + } + return values[i + numLocals]; + } + + /** + * Gets the value representing the specified lock. + * + * @param i the lock index + * @return the value that can be used to reconstruct the lock's current value + * @throw {@link IndexOutOfBoundsException} if {@code i < 0 || i >= this.numLocks} + */ + public JavaValue getLockValue(int i) { + if (i < 0 || i >= numLocks) { + throw new IndexOutOfBoundsException(); + } + return values[i + numLocals + numStack]; + } + + /** + * Gets the caller of this frame. + * + * @return {@code null} if this frame has no caller + */ + public BytecodeFrame caller() { + return (BytecodeFrame) getCaller(); + } + + @Override + public int hashCode() { + return (numLocals + 1) ^ (numStack + 11) ^ (numLocks + 7); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof BytecodeFrame && super.equals(obj)) { + BytecodeFrame that = (BytecodeFrame) obj; + // @formatter:off + if (this.duringCall == that.duringCall && + this.rethrowException == that.rethrowException && + this.numLocals == that.numLocals && + this.numLocks == that.numLocks && + this.numStack == that.numStack && + Arrays.equals(this.values, that.values)) { + return true; + } + // @formatter:off + return true; + } + return false; + } + + @Override + public String toString() { + return CodeUtil.append(new StringBuilder(100), this).toString(); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodePosition.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodePosition.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import java.util.Objects; + +import jdk.vm.ci.meta.ResolvedJavaMethod; + +/** + * Represents a code position, that is, a chain of inlined methods with bytecode locations, that is + * communicated from the compiler to the runtime system. A code position can be used by the runtime + * system to reconstruct a source-level stack trace for exceptions and to create + * {@linkplain BytecodeFrame frames} for deoptimization. + */ +public class BytecodePosition { + + private final BytecodePosition caller; + private final ResolvedJavaMethod method; + private final int bci; + + /** + * Constructs a new object representing a given parent/caller, a given method, and a given BCI. + * + * @param caller the parent position + * @param method the method + * @param bci a BCI within the method + */ + public BytecodePosition(BytecodePosition caller, ResolvedJavaMethod method, int bci) { + assert method != null; + this.caller = caller; + this.method = method; + this.bci = bci; + } + + /** + * Converts this code position to a string representation. + * + * @return a string representation of this code position + */ + @Override + public String toString() { + return CodeUtil.append(new StringBuilder(100), this).toString(); + } + + /** + * Deep equality test. + */ + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (obj != null && getClass() == obj.getClass()) { + BytecodePosition that = (BytecodePosition) obj; + if (this.bci == that.bci && Objects.equals(this.getMethod(), that.getMethod()) && Objects.equals(this.caller, that.caller)) { + return true; + } + } + return false; + } + + @Override + public int hashCode() { + return getBCI(); + } + + /** + * @return The location within the method, as a bytecode index. The constant {@code -1} may be + * used to indicate the location is unknown, for example within code synthesized by the + * compiler. + */ + public int getBCI() { + return bci; + } + + /** + * @return The runtime interface method for this position. + */ + public ResolvedJavaMethod getMethod() { + return method; + } + + /** + * The position where this position has been called, {@code null} if none. + */ + public BytecodePosition getCaller() { + return caller; + } + + /** + * Adds a caller to the current position returning the new position. + */ + public BytecodePosition addCaller(BytecodePosition link) { + if (getCaller() == null) { + return new BytecodePosition(link, getMethod(), getBCI()); + } else { + return new BytecodePosition(getCaller().addCaller(link), getMethod(), getBCI()); + } + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CallingConvention.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CallingConvention.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import static jdk.vm.ci.code.ValueUtil.isAllocatableValue; +import static jdk.vm.ci.code.ValueUtil.isStackSlot; +import jdk.vm.ci.meta.AllocatableValue; +import jdk.vm.ci.meta.Value; + +/** + * A calling convention describes the locations in which the arguments for a call are placed and the + * location in which the return value is placed if the call is not void. + */ +public class CallingConvention { + + /** + * Marker interface denoting the type of a call for which a calling convention is requested. + */ + public interface Type { + } + + /** + * The amount of stack space (in bytes) required for the stack-based arguments of the call. + */ + private final int stackSize; + + private final AllocatableValue returnLocation; + + /** + * The ordered locations in which the arguments are placed. + */ + private final AllocatableValue[] argumentLocations; + + /** + * Creates a description of the registers and stack locations used by a call. + * + * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of + * the call + * @param returnLocation the location for the return value or {@link Value#ILLEGAL} if a void + * call + * @param argumentLocations the ordered locations in which the arguments are placed + */ + public CallingConvention(int stackSize, AllocatableValue returnLocation, AllocatableValue... argumentLocations) { + assert argumentLocations != null; + assert returnLocation != null; + this.argumentLocations = argumentLocations; + this.stackSize = stackSize; + this.returnLocation = returnLocation; + assert verify(); + } + + /** + * Gets the location for the return value or {@link Value#ILLEGAL} if a void call. + */ + public AllocatableValue getReturn() { + return returnLocation; + } + + /** + * Gets the location for the {@code index}'th argument. + */ + public AllocatableValue getArgument(int index) { + return argumentLocations[index]; + } + + /** + * Gets the amount of stack space (in bytes) required for the stack-based arguments of the call. + */ + public int getStackSize() { + return stackSize; + } + + /** + * Gets the number of locations required for the arguments. + */ + public int getArgumentCount() { + return argumentLocations.length; + } + + /** + * Gets the locations required for the arguments. + */ + @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "FB false positive") + public AllocatableValue[] getArguments() { + if (argumentLocations.length == 0) { + return argumentLocations; + } + return argumentLocations.clone(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("CallingConvention["); + String sep = ""; + for (Value op : argumentLocations) { + sb.append(sep).append(op); + sep = ", "; + } + if (!returnLocation.equals(Value.ILLEGAL)) { + sb.append(" -> ").append(returnLocation); + } + sb.append("]"); + return sb.toString(); + } + + private boolean verify() { + for (int i = 0; i < argumentLocations.length; i++) { + Value location = argumentLocations[i]; + assert isStackSlot(location) || isAllocatableValue(location); + } + return true; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CodeCacheProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CodeCacheProvider.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import jdk.vm.ci.code.site.Call; +import jdk.vm.ci.code.site.Mark; +import jdk.vm.ci.meta.ResolvedJavaMethod; +import jdk.vm.ci.meta.SpeculationLog; + +/** + * Access to code cache related details and requirements. + */ +public interface CodeCacheProvider { + + /** + * Installs code for a given method based on a given compilation result without making it the + * default implementation of the method. + * + * @param method a method implemented by the installed code + * @param compiledCode the compiled code to be added + * @param log the speculation log to be used + * @param installedCode a predefined {@link InstalledCode} object to use as a reference to the + * installed code. If {@code null}, a new {@link InstalledCode} object will be + * created. + * @return a reference to the ready-to-run code + * @throws BailoutException if the code installation failed + */ + default InstalledCode addCode(ResolvedJavaMethod method, CompiledCode compiledCode, SpeculationLog log, InstalledCode installedCode) { + return installCode(method, compiledCode, installedCode, log, false); + } + + /** + * Installs code for a given method based on a given compilation result and makes it the default + * implementation of the method. + * + * @param method a method implemented by the installed code and for which the installed code + * becomes the default implementation + * @param compiledCode the compiled code to be added + * @return a reference to the ready-to-run code + * @throws BailoutException if the code installation failed + */ + default InstalledCode setDefaultCode(ResolvedJavaMethod method, CompiledCode compiledCode) { + return installCode(method, compiledCode, null, null, true); + } + + /** + * Installs code based on a given compilation result. + * + * @param method the method compiled to produce {@code compiledCode} or {@code null} if the + * input to {@code compResult} was not a {@link ResolvedJavaMethod} + * @param compiledCode the compiled code to be added + * @param installedCode a pre-allocated {@link InstalledCode} object to use as a reference to + * the installed code. If {@code null}, a new {@link InstalledCode} object will be + * created. + * @param log the speculation log to be used + * @param isDefault specifies if the installed code should be made the default implementation of + * {@code compRequest.getMethod()}. The default implementation for a method is the + * code executed for standard calls to the method. This argument is ignored if + * {@code compRequest == null}. + * @return a reference to the compiled and ready-to-run installed code + * @throws BailoutException if the code installation failed + */ + InstalledCode installCode(ResolvedJavaMethod method, CompiledCode compiledCode, InstalledCode installedCode, SpeculationLog log, boolean isDefault); + + /** + * Invalidates {@code installedCode} such that {@link InvalidInstalledCodeException} will be + * raised the next time {@code installedCode} is + * {@linkplain InstalledCode#executeVarargs(Object...) executed}. + */ + void invalidateInstalledCode(InstalledCode installedCode); + + /** + * Gets a name for a {@link Mark} mark. + */ + default String getMarkName(Mark mark) { + return String.valueOf(mark.id); + } + + /** + * Gets a name for the {@linkplain Call#target target} of a {@link Call}. + */ + default String getTargetName(Call call) { + return String.valueOf(call.target); + } + + /** + * Gets the register configuration to use when compiling a given method. + */ + RegisterConfig getRegisterConfig(); + + /** + * Minimum size of the stack area reserved for outgoing parameters. This area is reserved in all + * cases, even when the compiled method has no regular call instructions. + * + * @return the minimum size of the outgoing parameter area in bytes + */ + int getMinimumOutgoingSize(); + + /** + * Gets a description of the target architecture. + */ + TargetDescription getTarget(); + + /** + * Create a new speculation log for the target runtime. + */ + SpeculationLog createSpeculationLog(); + + /** + * Returns the maximum absolute offset of a PC relative call to a given address from any + * position in the code cache or -1 when not applicable. Intended for determining the required + * size of address/offset fields. + */ + long getMaxCallTargetOffset(long address); + + /** + * Determines if debug info should also be emitted at non-safepoint locations. + */ + boolean shouldDebugNonSafepoints(); +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CodeUtil.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CodeUtil.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,439 @@ +/* + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Map; + +import jdk.vm.ci.meta.JavaType; +import jdk.vm.ci.meta.MetaUtil; +import jdk.vm.ci.meta.ResolvedJavaMethod; +import jdk.vm.ci.meta.Signature; + +/** + * Miscellaneous collection of utility methods used by {@code jdk.vm.ci.code} and its clients. + */ +public class CodeUtil { + + public static final String NEW_LINE = String.format("%n"); + + public static final int K = 1024; + public static final int M = 1024 * 1024; + + public static boolean isOdd(int n) { + return (n & 1) == 1; + } + + public static boolean isEven(int n) { + return (n & 1) == 0; + } + + /** + * Checks whether the specified integer is a power of two. + * + * @param val the value to check + * @return {@code true} if the value is a power of two; {@code false} otherwise + */ + public static boolean isPowerOf2(int val) { + return val > 0 && (val & val - 1) == 0; + } + + /** + * Checks whether the specified long is a power of two. + * + * @param val the value to check + * @return {@code true} if the value is a power of two; {@code false} otherwise + */ + public static boolean isPowerOf2(long val) { + return val > 0 && (val & val - 1) == 0; + } + + /** + * Computes the log (base 2) of the specified integer, rounding down. (E.g {@code log2(8) = 3}, + * {@code log2(21) = 4} ) + * + * @param val the value + * @return the log base 2 of the value + */ + public static int log2(int val) { + assert val > 0; + return (Integer.SIZE - 1) - Integer.numberOfLeadingZeros(val); + } + + /** + * Computes the log (base 2) of the specified long, rounding down. (E.g {@code log2(8) = 3}, + * {@code log2(21) = 4}) + * + * @param val the value + * @return the log base 2 of the value + */ + public static int log2(long val) { + assert val > 0; + return (Long.SIZE - 1) - Long.numberOfLeadingZeros(val); + } + + /** + * Narrow an integer value to a given bit width, and return the result as a signed long. + * + * @param value the value + * @param resultBits the result bit width + * @return {@code value} interpreted as {@code resultBits} bit number, encoded as signed long + */ + public static long narrow(long value, int resultBits) { + long ret = value & mask(resultBits); + return signExtend(ret, resultBits); + } + + /** + * Sign extend an integer. + * + * @param value the input value + * @param inputBits the bit width of the input value + * @return a signed long with the same value as the signed {@code inputBits}-bit number + * {@code value} + */ + public static long signExtend(long value, int inputBits) { + if (inputBits < 64) { + if ((value >>> (inputBits - 1) & 1) == 1) { + return value | (-1L << inputBits); + } else { + return value & ~(-1L << inputBits); + } + } else { + return value; + } + } + + /** + * Zero extend an integer. + * + * @param value the input value + * @param inputBits the bit width of the input value + * @return an unsigned long with the same value as the unsigned {@code inputBits}-bit number + * {@code value} + */ + public static long zeroExtend(long value, int inputBits) { + if (inputBits < 64) { + return value & ~(-1L << inputBits); + } else { + return value; + } + } + + /** + * Convert an integer to long. + * + * @param value the input value + * @param inputBits the bit width of the input value + * @param unsigned whether the values should be interpreted as signed or unsigned + * @return a long with the same value as the {@code inputBits}-bit number {@code value} + */ + public static long convert(long value, int inputBits, boolean unsigned) { + if (unsigned) { + return zeroExtend(value, inputBits); + } else { + return signExtend(value, inputBits); + } + } + + /** + * Get a bitmask with the low {@code bits} bit set and the high {@code 64 - bits} bit clear. + */ + public static long mask(int bits) { + assert 0 <= bits && bits <= 64; + if (bits == 64) { + return 0xffffffffffffffffL; + } else { + return (1L << bits) - 1; + } + } + + /** + * Get the minimum value representable in a {@code bits} bit signed integer. + */ + public static long minValue(int bits) { + assert 0 < bits && bits <= 64; + return -1L << (bits - 1); + } + + /** + * Get the maximum value representable in a {@code bits} bit signed integer. + */ + public static long maxValue(int bits) { + assert 0 < bits && bits <= 64; + return mask(bits - 1); + } + + /** + * Formats the values in a frame as a tabulated string. + * + * @param frame + * @return the values in {@code frame} as a tabulated string + */ + public static String tabulateValues(BytecodeFrame frame) { + int cols = Math.max(frame.numLocals, Math.max(frame.numStack, frame.numLocks)); + assert cols > 0; + ArrayList cells = new ArrayList<>(); + cells.add(""); + for (int i = 0; i < cols; i++) { + cells.add(i); + } + cols++; + if (frame.numLocals != 0) { + cells.add("locals:"); + cells.addAll(Arrays.asList(frame.values).subList(0, frame.numLocals)); + cells.addAll(Collections.nCopies(cols - frame.numLocals - 1, "")); + } + if (frame.numStack != 0) { + cells.add("stack:"); + cells.addAll(Arrays.asList(frame.values).subList(frame.numLocals, frame.numLocals + frame.numStack)); + cells.addAll(Collections.nCopies(cols - frame.numStack - 1, "")); + } + if (frame.numLocks != 0) { + cells.add("locks:"); + cells.addAll(Arrays.asList(frame.values).subList(frame.numLocals + frame.numStack, frame.values.length)); + cells.addAll(Collections.nCopies(cols - frame.numLocks - 1, "")); + } + Object[] cellArray = cells.toArray(); + for (int i = 0; i < cellArray.length; i++) { + if ((i % cols) != 0) { + cellArray[i] = "|" + cellArray[i]; + } + } + return CodeUtil.tabulate(cellArray, cols, 1, 1); + } + + /** + * Formats a given table as a string. The value of each cell is produced by + * {@link String#valueOf(Object)}. + * + * @param cells the cells of the table in row-major order + * @param cols the number of columns per row + * @param lpad the number of space padding inserted before each formatted cell value + * @param rpad the number of space padding inserted after each formatted cell value + * @return a string with one line per row and each column left-aligned + */ + public static String tabulate(Object[] cells, int cols, int lpad, int rpad) { + int rows = (cells.length + (cols - 1)) / cols; + int[] colWidths = new int[cols]; + for (int col = 0; col < cols; col++) { + for (int row = 0; row < rows; row++) { + int index = col + (row * cols); + if (index < cells.length) { + Object cell = cells[index]; + colWidths[col] = Math.max(colWidths[col], String.valueOf(cell).length()); + } + } + } + StringBuilder sb = new StringBuilder(); + String nl = NEW_LINE; + for (int row = 0; row < rows; row++) { + for (int col = 0; col < cols; col++) { + int index = col + (row * cols); + if (index < cells.length) { + for (int i = 0; i < lpad; i++) { + sb.append(' '); + } + Object cell = cells[index]; + String s = String.valueOf(cell); + int w = s.length(); + sb.append(s); + while (w < colWidths[col]) { + sb.append(' '); + w++; + } + for (int i = 0; i < rpad; i++) { + sb.append(' '); + } + } + } + sb.append(nl); + } + return sb.toString(); + } + + /** + * Appends a formatted code position to a {@link StringBuilder}. + * + * @param sb the {@link StringBuilder} to append to + * @param pos the code position to format and append to {@code sb} + * @return the value of {@code sb} + */ + public static StringBuilder append(StringBuilder sb, BytecodePosition pos) { + MetaUtil.appendLocation(sb.append("at "), pos.getMethod(), pos.getBCI()); + if (pos.getCaller() != null) { + sb.append(NEW_LINE); + append(sb, pos.getCaller()); + } + return sb; + } + + /** + * Appends a formatted frame to a {@link StringBuilder}. + * + * @param sb the {@link StringBuilder} to append to + * @param frame the frame to format and append to {@code sb} + * @return the value of {@code sb} + */ + public static StringBuilder append(StringBuilder sb, BytecodeFrame frame) { + MetaUtil.appendLocation(sb.append("at "), frame.getMethod(), frame.getBCI()); + assert sb.charAt(sb.length() - 1) == ']'; + sb.deleteCharAt(sb.length() - 1); + sb.append(", duringCall: ").append(frame.duringCall).append(", rethrow: ").append(frame.rethrowException).append(']'); + if (frame.values != null && frame.values.length > 0) { + sb.append(NEW_LINE); + String table = tabulateValues(frame); + String[] rows = table.split(NEW_LINE); + for (int i = 0; i < rows.length; i++) { + String row = rows[i]; + if (!row.trim().isEmpty()) { + sb.append(" ").append(row); + if (i != rows.length - 1) { + sb.append(NEW_LINE); + } + } + } + } + if (frame.caller() != null) { + sb.append(NEW_LINE); + append(sb, frame.caller()); + } else if (frame.getCaller() != null) { + sb.append(NEW_LINE); + append(sb, frame.getCaller()); + } + return sb; + } + + public interface RefMapFormatter { + + String formatStackSlot(int frameRefMapIndex); + } + + /** + * Formats a location present in a reference map. + */ + public static class DefaultRefMapFormatter implements RefMapFormatter { + + /** + * The size of a stack slot. + */ + public final int slotSize; + + /** + * The register used as the frame pointer. + */ + public final Register fp; + + /** + * The offset (in bytes) from the slot pointed to by {@link #fp} to the slot corresponding + * to bit 0 in the frame reference map. + */ + public final int refMapToFPOffset; + + public DefaultRefMapFormatter(int slotSize, Register fp, int refMapToFPOffset) { + this.slotSize = slotSize; + this.fp = fp; + this.refMapToFPOffset = refMapToFPOffset; + } + + @Override + public String formatStackSlot(int frameRefMapIndex) { + int refMapOffset = frameRefMapIndex * slotSize; + int fpOffset = refMapOffset + refMapToFPOffset; + if (fpOffset >= 0) { + return fp + "+" + fpOffset; + } + return fp.name + fpOffset; + } + } + + public static class NumberedRefMapFormatter implements RefMapFormatter { + + public String formatStackSlot(int frameRefMapIndex) { + return "s" + frameRefMapIndex; + } + + public String formatRegister(int regRefMapIndex) { + return "r" + regRefMapIndex; + } + } + + /** + * Appends a formatted debug info to a {@link StringBuilder}. + * + * @param sb the {@link StringBuilder} to append to + * @param info the debug info to format and append to {@code sb} + * @return the value of {@code sb} + */ + public static StringBuilder append(StringBuilder sb, DebugInfo info, RefMapFormatter formatterArg) { + RefMapFormatter formatter = formatterArg; + if (formatter == null) { + formatter = new NumberedRefMapFormatter(); + } + String nl = NEW_LINE; + ReferenceMap refMap = info.getReferenceMap(); + if (refMap != null) { + sb.append(refMap.toString()); + } + RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo(); + if (calleeSaveInfo != null) { + sb.append("callee-save-info:").append(nl); + Map map = calleeSaveInfo.slotsToRegisters(true); + for (Map.Entry e : map.entrySet()) { + sb.append(" ").append(e.getValue()).append(" -> ").append(formatter.formatStackSlot(e.getKey())).append(nl); + } + } + BytecodeFrame frame = info.frame(); + if (frame != null) { + append(sb, frame); + } else if (info.getBytecodePosition() != null) { + append(sb, info.getBytecodePosition()); + } + return sb; + } + + /** + * Create a calling convention from a {@link ResolvedJavaMethod}. + */ + public static CallingConvention getCallingConvention(CodeCacheProvider codeCache, CallingConvention.Type type, ResolvedJavaMethod method, ValueKindFactory valueKindFactory) { + Signature sig = method.getSignature(); + JavaType retType = sig.getReturnType(null); + int sigCount = sig.getParameterCount(false); + JavaType[] argTypes; + int argIndex = 0; + if (!method.isStatic()) { + argTypes = new JavaType[sigCount + 1]; + argTypes[argIndex++] = method.getDeclaringClass(); + } else { + argTypes = new JavaType[sigCount]; + } + for (int i = 0; i < sigCount; i++) { + argTypes[argIndex++] = sig.getParameterType(i, null); + } + + RegisterConfig registerConfig = codeCache.getRegisterConfig(); + return registerConfig.getCallingConvention(type, retType, argTypes, valueKindFactory); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CompilationRequest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CompilationRequest.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import jdk.vm.ci.meta.ResolvedJavaMethod; + +/** + * Represents a request to compile a method. + */ +public class CompilationRequest { + + private final ResolvedJavaMethod method; + + private final int entryBCI; + + /** + * Creates a request to compile a method starting at its entry point. + * + * @param method the method to be compiled + */ + public CompilationRequest(ResolvedJavaMethod method) { + this(method, -1); + } + + /** + * Creates a request to compile a method starting at a given BCI. + * + * @param method the method to be compiled + * @param entryBCI the bytecode index (BCI) at which to start compiling where -1 denotes the + * method's entry point + */ + public CompilationRequest(ResolvedJavaMethod method, int entryBCI) { + assert method != null; + this.method = method; + this.entryBCI = entryBCI; + } + + /** + * Gets the method to be compiled. + */ + public ResolvedJavaMethod getMethod() { + return method; + } + + /** + * Gets the bytecode index (BCI) at which to start compiling where -1 denotes a non-OSR + * compilation request and all other values denote an on stack replacement (OSR) compilation + * request. + */ + public int getEntryBCI() { + return entryBCI; + } + + @Override + public String toString() { + return method.format("%H.%n(%p)@" + entryBCI); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CompilationRequestResult.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CompilationRequestResult.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +/** + * Provides information about the result of a {@link CompilationRequest}. + */ +public interface CompilationRequestResult { + + /** + * Determines if the compilation was successful. + * + * @return a non-null object whose {@link Object#toString()} describes the failure or null if + * compilation was successful + */ + Object getFailure(); +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CompiledCode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CompiledCode.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +/** + * Marker type for an object containing the output of a compiler in a form suitable for installing + * into a managed code heap. Since the details of a code heap are specific to each runtime, this + * interface does not specify any methods. + */ +public interface CompiledCode { +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/DebugInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/DebugInfo.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import java.util.Objects; + +/** + * Represents the debugging information for a particular point of execution. This information + * includes: + *
    + *
  • a {@linkplain #getBytecodePosition() bytecode position}
  • + *
  • a reference map for registers and stack slots in the current frame
  • + *
  • a map from bytecode locals and operand stack slots to their values or locations from which + * their values can be read
  • + *
  • a map from the registers (in the caller's frame) to the slots where they are saved in the + * current frame
  • + *
+ */ +public final class DebugInfo { + + private final BytecodePosition bytecodePosition; + private ReferenceMap referenceMap; + private final VirtualObject[] virtualObjectMapping; + private RegisterSaveLayout calleeSaveInfo; + + /** + * Creates a new {@link DebugInfo} from the given values. + * + * @param codePos the {@linkplain BytecodePosition code position} or {@linkplain BytecodeFrame + * frame} info + * @param virtualObjectMapping the mapping of {@link VirtualObject}s to their real values. This + * array is now owned by this object and must not be mutated by the caller. + */ + @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `virtualObjectMapping`") + public DebugInfo(BytecodePosition codePos, VirtualObject[] virtualObjectMapping) { + this.bytecodePosition = codePos; + this.virtualObjectMapping = virtualObjectMapping; + } + + public DebugInfo(BytecodePosition codePos) { + this(codePos, null); + } + + public void setReferenceMap(ReferenceMap referenceMap) { + this.referenceMap = referenceMap; + } + + /** + * @return {@code true} if this debug information has a frame + */ + public boolean hasFrame() { + return getBytecodePosition() instanceof BytecodeFrame; + } + + /** + * Gets the deoptimization information for each inlined frame (if available). + * + * @return {@code null} if no frame de-opt info is {@linkplain #hasFrame() available} + */ + public BytecodeFrame frame() { + if (hasFrame()) { + return (BytecodeFrame) getBytecodePosition(); + } + return null; + } + + @Override + public String toString() { + return CodeUtil.append(new StringBuilder(100), this, null).toString(); + } + + /** + * @return The code position (including all inlined methods) of this debug info. If this is a + * {@link BytecodeFrame} instance, then it is also the deoptimization information for + * each inlined frame. + */ + public BytecodePosition getBytecodePosition() { + return bytecodePosition; + } + + public ReferenceMap getReferenceMap() { + return referenceMap; + } + + public VirtualObject[] getVirtualObjectMapping() { + return virtualObjectMapping; + } + + /** + * Sets the map from the registers (in the caller's frame) to the slots where they are saved in + * the current frame. + */ + public void setCalleeSaveInfo(RegisterSaveLayout calleeSaveInfo) { + this.calleeSaveInfo = calleeSaveInfo; + } + + /** + * Gets the map from the registers (in the caller's frame) to the slots where they are saved in + * the current frame. If no such information is available, {@code null} is returned. + */ + public RegisterSaveLayout getCalleeSaveInfo() { + return calleeSaveInfo; + } + + @Override + public int hashCode() { + throw new UnsupportedOperationException("hashCode"); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof DebugInfo) { + DebugInfo that = (DebugInfo) obj; + if (Objects.equals(this.bytecodePosition, that.bytecodePosition) && Objects.equals(this.calleeSaveInfo, that.calleeSaveInfo) && Objects.equals(this.referenceMap, that.referenceMap)) { + return true; + } + } + return false; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/InstalledCode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/InstalledCode.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +/** + * Represents a compiled instance of a method. It may have been invalidated or removed in the + * meantime. + */ +public class InstalledCode { + + /** + * Raw address address of entity representing this installed code. + */ + protected long address; + + /** + * Raw address of entryPoint of this installed code. + */ + protected long entryPoint; + + /** + * Counts how often the address field was reassigned. + */ + protected long version; + + protected final String name; + + public InstalledCode(String name) { + this.name = name; + } + + /** + * @return the address of entity representing this installed code. + */ + public final long getAddress() { + return address; + } + + /** + * @return the address of the normal entry point of the installed code. + */ + public final long getEntryPoint() { + return entryPoint; + } + + /** + * @return the version number of this installed code + */ + public final long getVersion() { + return version; + } + + /** + * Returns the name of this installed code. + */ + public String getName() { + return name; + } + + /** + * Returns the start address of this installed code if it is {@linkplain #isValid() valid}, 0 + * otherwise. + */ + public long getStart() { + return 0; + } + + /** + * @return true if the code represented by this object is still valid for invocation, false + * otherwise (may happen due to deopt, etc.) + */ + public boolean isValid() { + return entryPoint != 0; + } + + /** + * @return true if the code represented by this object still exists and might have live + * activations, false otherwise (may happen due to deopt, etc.) + */ + public boolean isAlive() { + return address != 0; + } + + /** + * Returns a copy of this installed code if it is {@linkplain #isValid() valid}, null otherwise. + */ + public byte[] getCode() { + return null; + } + + /** + * Invalidates this installed code such that any subsequent + * {@linkplain #executeVarargs(Object...) invocation} will throw an + * {@link InvalidInstalledCodeException} and all existing invocations will be deoptimized. + */ + public void invalidate() { + throw new UnsupportedOperationException(); + } + + /** + * Executes the installed code with a variable number of arguments. + * + * @param args the array of object arguments + * @return the value returned by the executed code + */ + @SuppressWarnings("unused") + public Object executeVarargs(Object... args) throws InvalidInstalledCodeException { + throw new UnsupportedOperationException(); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/InvalidInstalledCodeException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/InvalidInstalledCodeException.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +/** + * Exception thrown by the runtime in case an invalidated machine code is called. + */ +public final class InvalidInstalledCodeException extends Exception { + + private static final long serialVersionUID = -3540232440794244844L; +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Location.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Location.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +/** + * Represents a location where a value can be stored. This can be either a {@link Register} or a + * stack slot. + */ +public final class Location { + + public final Register reg; + public final int offset; + + private Location(Register reg, int offset) { + this.reg = reg; + this.offset = offset; + } + + /** + * Create a {@link Location} for a register. + */ + public static Location register(Register reg) { + return new Location(reg, 0); + } + + /** + * Create a {@link Location} for a vector subregister. + * + * @param reg the {@link Register vector register} + * @param offset the offset in bytes into the vector register + */ + public static Location subregister(Register reg, int offset) { + return new Location(reg, offset); + } + + /** + * Create a {@link Location} for a stack slot. + */ + public static Location stack(int offset) { + return new Location(null, offset); + } + + public boolean isRegister() { + return reg != null; + } + + public boolean isStack() { + return reg == null; + } + + @Override + public String toString() { + String regName; + if (isRegister()) { + regName = reg.name + ":"; + } else { + regName = "stack:"; + } + return regName + offset; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/MemoryBarriers.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/MemoryBarriers.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +/** + * Constants and intrinsic definition for memory barriers. + * + * The documentation for each constant is taken from Doug Lea's + * The JSR-133 Cookbook for Compiler + * Writers. + *

+ * The {@code JMM_*} constants capture the memory barriers necessary to implement the Java Memory + * Model with respect to volatile field accesses. Their values are explained by this comment from + * templateTable_i486.cpp in the HotSpot source code: + * + *

+ * Volatile variables demand their effects be made known to all CPU's in
+ * order.  Store buffers on most chips allow reads & writes to reorder; the
+ * JMM's ReadAfterWrite.java test fails in -Xint mode without some kind of
+ * memory barrier (i.e., it's not sufficient that the interpreter does not
+ * reorder volatile references, the hardware also must not reorder them).
+ *
+ * According to the new Java Memory Model (JMM):
+ * (1) All volatiles are serialized wrt to each other.
+ * ALSO reads & writes act as acquire & release, so:
+ * (2) A read cannot let unrelated NON-volatile memory refs that happen after
+ * the read float up to before the read.  It's OK for non-volatile memory refs
+ * that happen before the volatile read to float down below it.
+ * (3) Similarly, a volatile write cannot let unrelated NON-volatile memory refs
+ * that happen BEFORE the write float down to after the write.  It's OK for
+ * non-volatile memory refs that happen after the volatile write to float up
+ * before it.
+ *
+ * We only put in barriers around volatile refs (they are expensive), not
+ * _between_ memory refs (which would require us to track the flavor of the
+ * previous memory refs).  Requirements (2) and (3) require some barriers
+ * before volatile stores and after volatile loads.  These nearly cover
+ * requirement (1) but miss the volatile-store-volatile-load case.  This final
+ * case is placed after volatile-stores although it could just as well go
+ * before volatile-loads.
+ * 
+ */ +public class MemoryBarriers { + + /** + * The sequence {@code Load1; LoadLoad; Load2} ensures that {@code Load1}'s data are loaded + * before data accessed by {@code Load2} and all subsequent load instructions are loaded. In + * general, explicit {@code LoadLoad} barriers are needed on processors that perform speculative + * loads and/or out-of-order processing in which waiting load instructions can bypass waiting + * stores. On processors that guarantee to always preserve load ordering, these barriers amount + * to no-ops. + */ + public static final int LOAD_LOAD = 0x0001; + + /** + * The sequence {@code Load1; LoadStore; Store2} ensures that {@code Load1}'s data are loaded + * before all data associated with {@code Store2} and subsequent store instructions are flushed. + * {@code LoadStore} barriers are needed only on those out-of-order processors in which waiting + * store instructions can bypass loads. + */ + public static final int LOAD_STORE = 0x0002; + + /** + * The sequence {@code Store1; StoreLoad; Load2} ensures that {@code Store1}'s data are made + * visible to other processors (i.e., flushed to main memory) before data accessed by + * {@code Load2} and all subsequent load instructions are loaded. {@code StoreLoad} barriers + * protect against a subsequent load incorrectly using {@code Store1}'s data value rather than + * that from a more recent store to the same location performed by a different processor. + * Because of this, on the processors discussed below, a {@code StoreLoad} is strictly necessary + * only for separating stores from subsequent loads of the same location(s) as were stored + * before the barrier. {@code StoreLoad} barriers are needed on nearly all recent + * multiprocessors, and are usually the most expensive kind. Part of the reason they are + * expensive is that they must disable mechanisms that ordinarily bypass cache to satisfy loads + * from write-buffers. This might be implemented by letting the buffer fully flush, among other + * possible stalls. + */ + public static final int STORE_LOAD = 0x0004; + + /** + * The sequence {@code Store1; StoreStore; Store2} ensures that {@code Store1}'s data are + * visible to other processors (i.e., flushed to memory) before the data associated with + * {@code Store2} and all subsequent store instructions. In general, {@code StoreStore} barriers + * are needed on processors that do not otherwise guarantee strict ordering of flushes from + * write buffers and/or caches to other processors or main memory. + */ + public static final int STORE_STORE = 0x0008; + + public static final int JMM_PRE_VOLATILE_WRITE = LOAD_STORE | STORE_STORE; + public static final int JMM_POST_VOLATILE_WRITE = STORE_LOAD | STORE_STORE; + public static final int JMM_PRE_VOLATILE_READ = 0; + public static final int JMM_POST_VOLATILE_READ = LOAD_LOAD | LOAD_STORE; + + public static String barriersString(int barriers) { + StringBuilder sb = new StringBuilder(); + sb.append((barriers & LOAD_LOAD) != 0 ? "LOAD_LOAD " : ""); + sb.append((barriers & LOAD_STORE) != 0 ? "LOAD_STORE " : ""); + sb.append((barriers & STORE_LOAD) != 0 ? "STORE_LOAD " : ""); + sb.append((barriers & STORE_STORE) != 0 ? "STORE_STORE " : ""); + return sb.toString().trim(); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/ReferenceMap.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/ReferenceMap.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +/** + * Marker type for an object containing information about where the object references are in machine + * state (e.g., registers or stack locations). This is typically associated with an execution point + * in compiled code. + */ +public abstract class ReferenceMap { +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Register.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Register.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import jdk.vm.ci.meta.ValueKind; + +/** + * Represents a target machine register. + */ +public final class Register implements Comparable { + + public static final RegisterCategory SPECIAL = new RegisterCategory("SPECIAL"); + + /** + * Invalid register. + */ + public static final Register None = new Register(-1, -1, "noreg", SPECIAL); + + /** + * The identifier for this register that is unique across all the registers in a + * {@link Architecture}. A valid register has {@code number >= 0}. + */ + public final int number; + + /** + * The mnemonic of this register. + */ + public final String name; + + /** + * The actual encoding in a target machine instruction for this register, which may or may not + * be the same as {@link #number}. + */ + public final int encoding; + + /** + * The assembler calls this method to get the register's encoding. + */ + public int encoding() { + return encoding; + } + + /** + * A platform specific register category that describes which values can be stored in a + * register. + */ + private final RegisterCategory registerCategory; + + /** + * A platform specific register type that describes which values can be stored in a register. + */ + public static class RegisterCategory { + + private final String name; + private final boolean mayContainReference; + + public RegisterCategory(String name) { + this(name, true); + } + + public RegisterCategory(String name, boolean mayContainReference) { + this.name = name; + this.mayContainReference = mayContainReference; + } + + @Override + public String toString() { + return name; + } + + @Override + public int hashCode() { + return 23 + name.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof RegisterCategory) { + RegisterCategory that = (RegisterCategory) obj; + return this.name.equals(that.name); + } + return false; + } + } + + /** + * Creates a {@link Register} instance. + * + * @param number unique identifier for the register + * @param encoding the target machine encoding for the register + * @param name the mnemonic name for the register + * @param registerCategory the register category + */ + public Register(int number, int encoding, String name, RegisterCategory registerCategory) { + this.number = number; + this.name = name; + this.registerCategory = registerCategory; + this.encoding = encoding; + } + + public RegisterCategory getRegisterCategory() { + return registerCategory; + } + + /** + * Determine whether this register needs to be part of the reference map. + */ + public boolean mayContainReference() { + return registerCategory.mayContainReference; + } + + /** + * Gets this register as a {@linkplain RegisterValue value} with a specified kind. + * + * @param kind the specified kind + * @return the {@link RegisterValue} + */ + public RegisterValue asValue(ValueKind kind) { + return new RegisterValue(kind, this); + } + + /** + * Gets this register as a {@linkplain RegisterValue value} with no particular kind. + * + * @return a {@link RegisterValue} with {@link ValueKind#Illegal} kind. + */ + public RegisterValue asValue() { + return asValue(ValueKind.Illegal); + } + + /** + * Determines if this is a valid register. + * + * @return {@code true} iff this register is valid + */ + public boolean isValid() { + return number >= 0; + } + + @Override + public String toString() { + return name; + } + + @Override + public int compareTo(Register o) { + if (number < o.number) { + return -1; + } + if (number > o.number) { + return 1; + } + return 0; + } + + @Override + public int hashCode() { + return 17 + name.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof Register) { + Register other = (Register) obj; + if (number == other.number) { + assert name.equals(other.name); + assert encoding == other.encoding; + assert registerCategory.equals(other.registerCategory); + return true; + } + } + return false; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterArray.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterArray.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +/** + * An immutable ordered list of registers. Only required because Java lacks immutable arrays. + */ +public final class RegisterArray implements Iterable { + + private final Register[] registers; + private int hash; + + public RegisterArray(Register... registers) { + this.registers = registers; + } + + public RegisterArray(Collection registers) { + this.registers = registers.toArray(new Register[registers.size()]); + } + + /** + * Gets the number of registers. + */ + public int size() { + return registers.length; + } + + /** + * Gets the register at a given index. + * + * @param index the index of the register to retrieve + */ + public Register get(int index) { + return registers[index]; + } + + public void addTo(Collection collection) { + collection.addAll(Arrays.asList(registers)); + } + + /** + * Gets an immutable view of the registers as a list. + */ + public List asList() { + return Collections.unmodifiableList(Arrays.asList(registers)); + } + + /** + * Gets a copy of the registers as an array. + */ + public Register[] toArray() { + return registers.clone(); + } + + public Iterator iterator() { + return Arrays.asList(registers).iterator(); + } + + @Override + public int hashCode() { + if (hash == 0 && registers.length > 0) { + hash = Arrays.hashCode(registers); + } + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof RegisterArray) { + return Arrays.equals(registers, ((RegisterArray) obj).registers); + } + return false; + } + + @Override + public String toString() { + return Arrays.toString(registers); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterAttributes.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterAttributes.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * A collection of register attributes. The specific attribute values for a register may be local to + * a compilation context. For example, a {@link RegisterConfig} in use during a compilation will + * determine which registers are callee saved. + */ +public class RegisterAttributes { + + private final boolean callerSave; + private final boolean calleeSave; + private final boolean allocatable; + + public RegisterAttributes(boolean isCallerSave, boolean isCalleeSave, boolean isAllocatable) { + this.callerSave = isCallerSave; + this.calleeSave = isCalleeSave; + this.allocatable = isAllocatable; + } + + public static final RegisterAttributes NONE = new RegisterAttributes(false, false, false); + + /** + * Creates a map from register {@linkplain Register#number numbers} to register + * {@linkplain RegisterAttributes attributes} for a given register configuration and set of + * registers. + * + * @param registerConfig a register configuration + * @param registers a set of registers + * @return an array whose length is the max register number in {@code registers} plus 1. An + * element at index i holds the attributes of the register whose number is i. + */ + public static RegisterAttributes[] createMap(RegisterConfig registerConfig, RegisterArray registers) { + RegisterAttributes[] map = new RegisterAttributes[registers.size()]; + List callerSaveRegisters = registerConfig.getCallerSaveRegisters().asList(); + List calleeSaveRegisters = registerConfig.getCalleeSaveRegisters() == null ? Collections.emptyList() : registerConfig.getCalleeSaveRegisters().asList(); + List allocatableRegisters = registerConfig.getAllocatableRegisters().asList(); + for (Register reg : registers) { + if (reg != null) { + RegisterAttributes attr = new RegisterAttributes(callerSaveRegisters.contains(reg), calleeSaveRegisters.contains(reg), allocatableRegisters.contains(reg)); + if (map.length <= reg.number) { + map = Arrays.copyOf(map, reg.number + 1); + } + map[reg.number] = attr; + } + } + for (int i = 0; i < map.length; i++) { + if (map[i] == null) { + map[i] = NONE; + } + } + return map; + } + + /** + * @return {@code true} if a register is available for use by a register allocator otherwise + * {@code false} + */ + public boolean isAllocatable() { + return allocatable; + } + + /** + * @return {@code true} if a register whose value preservation (if required) across a call is + * the responsibility of the callee otherwise {@code false} + */ + public boolean isCalleeSave() { + return calleeSave; + } + + /** + * @return {@code true} if a register whose value preservation (if required) across a call is + * the responsibility of the caller otherwise {@code false} + */ + public boolean isCallerSave() { + return callerSave; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterConfig.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterConfig.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import jdk.vm.ci.code.CallingConvention.Type; +import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.JavaType; +import jdk.vm.ci.meta.PlatformKind; +import jdk.vm.ci.meta.ValueKind; + +/** + * A register configuration binds roles and {@linkplain RegisterAttributes attributes} to physical + * registers. + */ +public interface RegisterConfig { + + /** + * Gets the register to be used for returning a value of a given kind. + */ + Register getReturnRegister(JavaKind kind); + + /** + * Gets the maximum allowed size of the frame. + */ + default int getMaximumFrameSize() { + return Integer.MAX_VALUE; + } + + /** + * Gets the register used as the frame pointer. Spill slots and outgoing stack-based arguments + * are addressed relative to this register. + */ + Register getFrameRegister(); + + /** + * Gets the calling convention describing how arguments are passed. + * + * @param type the type of calling convention being requested + * @param returnType the return type (can be null for methods returning {@code void}) + * @param parameterTypes the types of the arguments of the call + * @param valueKindFactory the factory to create custom {@link ValueKind ValueKinds} + */ + CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, ValueKindFactory valueKindFactory); + + /** + * Gets the ordered set of registers that are can be used to pass parameters according to a + * given calling convention. + * + * @param type the type of calling convention + * @param kind specifies what kind of registers is being requested + * @return the ordered set of registers that may be used to pass parameters in a call conforming + * to {@code type} + */ + RegisterArray getCallingConventionRegisters(Type type, JavaKind kind); + + /** + * Gets the set of all registers that might be used by the register allocator. + * + * To get the set of registers the register allocator is allowed to use see + * {@link RegisterAllocationConfig#getAllocatableRegisters()} + */ + @SuppressWarnings("javadoc") + RegisterArray getAllocatableRegisters(); + + /** + * Filters a set of registers and returns only those that can be used by the register allocator + * for a value of a particular kind. + */ + RegisterArray filterAllocatableRegisters(PlatformKind kind, RegisterArray registers); + + /** + * Gets the registers whose values must be preserved by a method across any call it makes. + */ + RegisterArray getCallerSaveRegisters(); + + /** + * Gets the registers whose values must be preserved by the callee. + */ + RegisterArray getCalleeSaveRegisters(); + + /** + * Gets a map from register {@linkplain Register#number numbers} to register + * {@linkplain RegisterAttributes attributes} for this register configuration. + * + * @return an array where an element at index i holds the attributes of the register whose + * number is i + */ + RegisterAttributes[] getAttributesMap(); + + /** + * Determines if all {@link #getAllocatableRegisters() allocatable} registers are + * {@link #getCallerSaveRegisters() caller saved}. + */ + boolean areAllAllocatableRegistersCallerSaved(); +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterSaveLayout.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterSaveLayout.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.TreeMap; + +/** + * A map from registers to frame slots. This can be used to describe where callee saved registers + * are saved in a callee's frame. + */ +public final class RegisterSaveLayout { + + /** + * Keys. + */ + private final Register[] registers; + + /** + * Slot indexes relative to stack pointer. + */ + private final int[] slots; + + /** + * Creates a map from registers to frame slots. + * + * @param registers the keys in the map + * @param slots frame slot index for each register in {@code registers} + */ + @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `registers` and `slots`") + public RegisterSaveLayout(Register[] registers, int[] slots) { + assert registers.length == slots.length; + this.registers = registers; + this.slots = slots; + assert registersToSlots(false).size() == registers.length : "non-unique registers"; + assert new HashSet<>(registersToSlots(false).values()).size() == slots.length : "non-unqiue slots"; + } + + /** + * Gets the frame slot index for a given register. + * + * @param register register to get the frame slot index for + * @return frame slot index + */ + public int registerToSlot(Register register) { + for (int i = 0; i < registers.length; i++) { + if (register.equals(registers[i])) { + return slots[i]; + } + } + throw new IllegalArgumentException(register + " not saved by this layout: " + this); + } + + /** + * Gets this layout information as a {@link Map} from registers to slots. + */ + public Map registersToSlots(boolean sorted) { + Map result; + if (sorted) { + result = new TreeMap<>(); + } else { + result = new HashMap<>(); + } + for (int i = 0; i < registers.length; i++) { + result.put(registers[i], slots[i]); + } + return result; + } + + /** + * Gets this layout information as a {@link Map} from slots to registers. + */ + public Map slotsToRegisters(boolean sorted) { + Map result; + if (sorted) { + result = new TreeMap<>(); + } else { + result = new HashMap<>(); + } + for (int i = 0; i < registers.length; i++) { + result.put(slots[i], registers[i]); + } + return result; + } + + @Override + public int hashCode() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof RegisterSaveLayout) { + RegisterSaveLayout that = (RegisterSaveLayout) obj; + if (Arrays.equals(registers, that.registers) && Arrays.equals(slots, that.slots)) { + return true; + } + } + return false; + } + + @Override + public String toString() { + return registersToSlots(true).toString(); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterValue.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import jdk.vm.ci.meta.AllocatableValue; +import jdk.vm.ci.meta.ValueKind; + +/** + * Denotes a register that stores a value of a fixed kind. + */ +public final class RegisterValue extends AllocatableValue { + + private final Register reg; + + protected RegisterValue(ValueKind kind, Register register) { + super(kind); + this.reg = register; + } + + @Override + public String toString() { + return getRegister().name + getKindSuffix(); + } + + /** + * @return the register that contains the value + */ + public Register getRegister() { + return reg; + } + + @Override + public int hashCode() { + return 29 * super.hashCode() + reg.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof RegisterValue) { + RegisterValue other = (RegisterValue) obj; + return super.equals(obj) && reg.equals(other.reg); + } + return false; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/StackLockValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/StackLockValue.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import jdk.vm.ci.meta.AllocatableValue; +import jdk.vm.ci.meta.JavaValue; +import jdk.vm.ci.meta.Value; + +/** + * Represents lock information in the debug information. + */ +public final class StackLockValue implements JavaValue { + + private JavaValue owner; + private AllocatableValue slot; + private final boolean eliminated; + + public StackLockValue(JavaValue object, AllocatableValue slot, boolean eliminated) { + this.owner = object; + this.slot = slot; + this.eliminated = eliminated; + } + + public JavaValue getOwner() { + return owner; + } + + public void setOwner(JavaValue newOwner) { + this.owner = newOwner; + } + + public Value getSlot() { + return slot; + } + + public boolean isEliminated() { + return eliminated; + } + + @Override + public String toString() { + return "monitor[" + owner + (slot != null ? ", " + slot : "") + (eliminated ? ", eliminated" : "") + "]"; + } + + @Override + public int hashCode() { + final int prime = 43; + int result = super.hashCode(); + result = prime * result + (eliminated ? 1231 : 1237); + result = prime * result + owner.hashCode(); + result = prime * result + slot.hashCode(); + return result; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof StackLockValue) { + StackLockValue other = (StackLockValue) obj; + return super.equals(obj) && eliminated == other.eliminated && owner.equals(other.owner) && slot.equals(other.slot); + } + return false; + } + + public void setSlot(AllocatableValue stackSlot) { + slot = stackSlot; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/StackSlot.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/StackSlot.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import jdk.vm.ci.meta.AllocatableValue; +import jdk.vm.ci.meta.ValueKind; + +/** + * Represents a compiler spill slot or an outgoing stack-based argument in a method's frame or an + * incoming stack-based argument in a method's {@linkplain #isInCallerFrame() caller's frame}. + */ +public final class StackSlot extends AllocatableValue { + + private final int offset; + private final boolean addFrameSize; + + /** + * Gets a {@link StackSlot} instance representing a stack slot at a given index holding a value + * of a given kind. + * + * @param kind The kind of the value stored in the stack slot. + * @param offset The offset of the stack slot (in bytes) + * @param addFrameSize Specifies if the offset is relative to the stack pointer, or the + * beginning of the frame (stack pointer + total frame size). + */ + public static StackSlot get(ValueKind kind, int offset, boolean addFrameSize) { + assert addFrameSize || offset >= 0; + return new StackSlot(kind, offset, addFrameSize); + } + + /** + * Private constructor to enforce use of {@link #get(ValueKind, int, boolean)} so that a cache + * can be used. + */ + private StackSlot(ValueKind kind, int offset, boolean addFrameSize) { + super(kind); + this.offset = offset; + this.addFrameSize = addFrameSize; + } + + /** + * Gets the offset of this stack slot, relative to the stack pointer. + * + * @return The offset of this slot (in bytes). + */ + public int getOffset(int totalFrameSize) { + assert totalFrameSize > 0 || !addFrameSize; + int result = offset + (addFrameSize ? totalFrameSize : 0); + assert result >= 0; + return result; + } + + public boolean isInCallerFrame() { + return addFrameSize && offset >= 0; + } + + public int getRawOffset() { + return offset; + } + + public boolean getRawAddFrameSize() { + return addFrameSize; + } + + @Override + public String toString() { + if (!addFrameSize) { + return "out:" + offset + getKindSuffix(); + } else if (offset >= 0) { + return "in:" + offset + getKindSuffix(); + } else { + return "stack:" + (-offset) + getKindSuffix(); + } + } + + /** + * Gets this stack slot used to pass an argument from the perspective of a caller. + */ + public StackSlot asOutArg() { + assert offset >= 0; + if (addFrameSize) { + return get(getValueKind(), offset, false); + } + return this; + } + + /** + * Gets this stack slot used to pass an argument from the perspective of a callee. + */ + public StackSlot asInArg() { + assert offset >= 0; + if (!addFrameSize) { + return get(getValueKind(), offset, true); + } + return this; + } + + @Override + public int hashCode() { + final int prime = 37; + int result = super.hashCode(); + result = prime * result + (addFrameSize ? 1231 : 1237); + result = prime * result + offset; + return result; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof StackSlot) { + StackSlot other = (StackSlot) obj; + return super.equals(obj) && addFrameSize == other.addFrameSize && offset == other.offset; + } + return false; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/SuppressFBWarnings.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/SuppressFBWarnings.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +/** + * Used to suppress FindBugs warnings. + */ +@interface SuppressFBWarnings { + /** + * The set of FindBugs + * warnings that are to be + * suppressed in annotated element. The value can be a bug category, kind or pattern. + */ + String[] value(); + + /** + * Reason why the warning is suppressed. + */ + String justification(); +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/TargetDescription.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/TargetDescription.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import static jdk.vm.ci.meta.MetaUtil.identityHashCodeString; + +import jdk.vm.ci.meta.JavaKind; + +/** + * Represents the target machine for a compiler, including the CPU architecture, the size of + * pointers and references, alignment of stacks, caches, etc. + */ +public class TargetDescription { + + public final Architecture arch; + + /** + * Specifies if this is a multi-processor system. + */ + public final boolean isMP; + + /** + * Specifies if this target supports encoding objects inline in the machine code. + */ + public final boolean inlineObjects; + + /** + * The machine word size on this target. + */ + public final int wordSize; + + /** + * The {@link JavaKind} to be used for representing raw pointers and CPU registers in Java code. + */ + public final JavaKind wordJavaKind; + + /** + * The stack alignment requirement of the platform. For example, from Appendix D of + * Intel 64 and IA-32 Architectures + * Optimization Reference Manual: + * + *
+     *     "It is important to ensure that the stack frame is aligned to a
+     *      16-byte boundary upon function entry to keep local __m128 data,
+     *      parameters, and XMM register spill locations aligned throughout
+     *      a function invocation."
+     * 
+ */ + public final int stackAlignment; + + /** + * Maximum constant displacement at which a memory access can no longer be an implicit null + * check. + */ + public final int implicitNullCheckLimit; + + public TargetDescription(Architecture arch, boolean isMP, int stackAlignment, int implicitNullCheckLimit, boolean inlineObjects) { + this.arch = arch; + this.isMP = isMP; + this.wordSize = arch.getWordSize(); + this.wordJavaKind = JavaKind.fromWordSize(wordSize); + this.stackAlignment = stackAlignment; + this.implicitNullCheckLimit = implicitNullCheckLimit; + this.inlineObjects = inlineObjects; + + assert arch.getPlatformKind(wordJavaKind).equals(arch.getWordKind()); + } + + @Override + public final int hashCode() { + throw new UnsupportedOperationException(); + } + + @Override + public final boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof TargetDescription) { + TargetDescription that = (TargetDescription) obj; + // @formatter:off + if (this.implicitNullCheckLimit == that.implicitNullCheckLimit && + this.inlineObjects == that.inlineObjects && + this.isMP == that.isMP && + this.stackAlignment == that.stackAlignment && + this.wordJavaKind.equals(that.wordJavaKind) && + this.wordSize == that.wordSize && + this.arch.equals(that.arch)) { + return true; + } + // @formatter:on + } + return false; + } + + @Override + public String toString() { + return identityHashCodeString(this); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/ValueKindFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/ValueKindFactory.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.ValueKind; + +/** + * Can be implemented by compilers to create custom {@link ValueKind} subclasses. + */ +public interface ValueKindFactory> { + + K getValueKind(JavaKind javaKind); +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/ValueUtil.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/ValueUtil.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import jdk.vm.ci.meta.AllocatableValue; +import jdk.vm.ci.meta.JavaConstant; +import jdk.vm.ci.meta.JavaValue; +import jdk.vm.ci.meta.PlatformKind; +import jdk.vm.ci.meta.Value; + +/** + * Utility class for working with the {@link Value} class and its subclasses. + */ +public final class ValueUtil { + + public static boolean isIllegal(Value value) { + assert value != null; + return Value.ILLEGAL.equals(value); + } + + public static boolean isIllegalJavaValue(JavaValue value) { + assert value != null; + return Value.ILLEGAL.equals(value); + } + + public static boolean isLegal(Value value) { + return !isIllegal(value); + } + + public static boolean isVirtualObject(JavaValue value) { + assert value != null; + return value instanceof VirtualObject; + } + + public static VirtualObject asVirtualObject(JavaValue value) { + assert value != null; + return (VirtualObject) value; + } + + public static boolean isConstantJavaValue(JavaValue value) { + assert value != null; + return value instanceof JavaConstant; + } + + public static JavaConstant asConstantJavaValue(JavaValue value) { + assert value != null; + return (JavaConstant) value; + } + + public static boolean isAllocatableValue(Value value) { + assert value != null; + return value instanceof AllocatableValue; + } + + public static AllocatableValue asAllocatableValue(Value value) { + assert value != null; + return (AllocatableValue) value; + } + + public static boolean isStackSlot(Value value) { + assert value != null; + return value instanceof StackSlot; + } + + public static StackSlot asStackSlot(Value value) { + assert value != null; + return (StackSlot) value; + } + + public static boolean isRegister(Value value) { + assert value != null; + return value instanceof RegisterValue; + } + + public static Register asRegister(Value value) { + return asRegisterValue(value).getRegister(); + } + + public static RegisterValue asRegisterValue(Value value) { + assert value != null; + return (RegisterValue) value; + } + + public static Register asRegister(Value value, PlatformKind kind) { + if (value.getPlatformKind() != kind) { + throw new InternalError("needed: " + kind + " got: " + value.getPlatformKind()); + } else { + return asRegister(value); + } + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/VirtualObject.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/VirtualObject.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code; + +import java.util.Arrays; +import java.util.Collections; +import java.util.IdentityHashMap; +import java.util.Set; + +import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.JavaValue; +import jdk.vm.ci.meta.ResolvedJavaField; +import jdk.vm.ci.meta.ResolvedJavaType; + +/** + * An instance of this class represents an object whose allocation was removed by escape analysis. + * The information stored in the {@link VirtualObject} is used during deoptimization to recreate the + * object. + */ +public final class VirtualObject implements JavaValue { + + private final ResolvedJavaType type; + private JavaValue[] values; + private JavaKind[] slotKinds; + private final int id; + + /** + * Creates a new {@link VirtualObject} for the given type, with the given fields. If + * {@code type} is an instance class then {@code values} provides the values for the fields + * returned by {@link ResolvedJavaType#getInstanceFields(boolean) getInstanceFields(true)}. If + * {@code type} is an array then the length of the values array determines the reallocated array + * length. + * + * @param type the type of the object whose allocation was removed during compilation. This can + * be either an instance of an array type. + * @param id a unique id that identifies the object within the debug information for one + * position in the compiled code. + * @return a new {@link VirtualObject} instance. + */ + public static VirtualObject get(ResolvedJavaType type, int id) { + return new VirtualObject(type, id); + } + + private VirtualObject(ResolvedJavaType type, int id) { + this.type = type; + this.id = id; + } + + private static StringBuilder appendValue(StringBuilder buf, JavaValue value, Set visited) { + if (value instanceof VirtualObject) { + VirtualObject vo = (VirtualObject) value; + buf.append("vobject:").append(vo.type.toJavaName(false)).append(':').append(vo.id); + if (!visited.contains(vo)) { + visited.add(vo); + buf.append('{'); + if (vo.values == null) { + buf.append(""); + } else { + if (vo.type.isArray()) { + for (int i = 0; i < vo.values.length; i++) { + if (i != 0) { + buf.append(','); + } + buf.append(i).append('='); + appendValue(buf, vo.values[i], visited); + } + } else { + ResolvedJavaField[] fields = vo.type.getInstanceFields(true); + assert fields.length == vo.values.length : vo.type + ", fields=" + Arrays.toString(fields) + ", values=" + Arrays.toString(vo.values); + for (int i = 0; i < vo.values.length; i++) { + if (i != 0) { + buf.append(','); + } + buf.append(fields[i].getName()).append('='); + appendValue(buf, vo.values[i], visited); + } + } + } + buf.append('}'); + } + } else { + buf.append(value); + } + return buf; + } + + @Override + public String toString() { + Set visited = Collections.newSetFromMap(new IdentityHashMap()); + return appendValue(new StringBuilder(), this, visited).toString(); + } + + /** + * Returns the type of the object whose allocation was removed during compilation. This can be + * either an instance of an array type. + */ + public ResolvedJavaType getType() { + return type; + } + + /** + * Returns the array containing all the values to be stored into the object when it is + * recreated. This field is intentional exposed as a mutable array that a compiler may modify + * (e.g. during register allocation). + */ + @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "`values` is intentional mutable")// + public JavaValue[] getValues() { + return values; + } + + /** + * Returns the kind of the value at {@code index}. + */ + public JavaKind getSlotKind(int index) { + return slotKinds[index]; + } + + /** + * Returns the unique id that identifies the object within the debug information for one + * position in the compiled code. + */ + public int getId() { + return id; + } + + /** + * Overwrites the current set of values with a new one. + * + * @param values an array containing all the values to be stored into the object when it is + * recreated. + * @param slotKinds an array containing the Java kinds of the values. This must have the same + * length as {@code values}. This array is now owned by this object and must not be + * mutated by the caller. + */ + @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `slotKinds`") + public void setValues(JavaValue[] values, JavaKind[] slotKinds) { + assert values.length == slotKinds.length; + this.values = values; + this.slotKinds = slotKinds; + } + + @Override + public int hashCode() { + return 42 + type.hashCode(); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof VirtualObject) { + VirtualObject l = (VirtualObject) o; + if (!l.type.equals(type) || l.values.length != values.length) { + return false; + } + for (int i = 0; i < values.length; i++) { + /* + * Virtual objects can form cycles. Calling equals() could therefore lead to + * infinite recursion. + */ + if (!same(values[i], l.values[i])) { + return false; + } + } + return true; + } + return false; + } + + private static boolean same(Object o1, Object o2) { + return o1 == o2; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/package-info.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/package-info.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/** + * Package that defines the interface between a Java application that wants to install code and the + * runtime. The runtime provides in implementation of the {@link jdk.vm.ci.code.CodeCacheProvider} + * interface. The method + * {@link jdk.vm.ci.code.CodeCacheProvider#addCode(jdk.vm.ci.meta.ResolvedJavaMethod, CompiledCode, jdk.vm.ci.meta.SpeculationLog, InstalledCode)} + * can be used to install code. + */ +package jdk.vm.ci.code; diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Call.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Call.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code.site; + +import java.util.Objects; + +import jdk.vm.ci.code.DebugInfo; +import jdk.vm.ci.meta.InvokeTarget; + +/** + * Represents a call in the code. + */ +public final class Call extends Infopoint { + + /** + * The target of the call. + */ + public final InvokeTarget target; + + /** + * The size of the call instruction. + */ + public final int size; + + /** + * Specifies if this call is direct or indirect. A direct call has an immediate operand encoding + * the absolute or relative (to the call itself) address of the target. An indirect call has a + * register or memory operand specifying the target address of the call. + */ + public final boolean direct; + + public Call(InvokeTarget target, int pcOffset, int size, boolean direct, DebugInfo debugInfo) { + super(pcOffset, debugInfo, InfopointReason.CALL); + this.size = size; + this.target = target; + this.direct = direct; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof Call && super.equals(obj)) { + Call that = (Call) obj; + if (this.size == that.size && this.direct == that.direct && Objects.equals(this.target, that.target)) { + return true; + } + } + return false; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(pcOffset); + sb.append('['); + sb.append(target); + sb.append(']'); + + if (debugInfo != null) { + appendDebugInfo(sb, debugInfo); + } + + return sb.toString(); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/ConstantReference.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/ConstantReference.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code.site; + +import java.util.Objects; + +import jdk.vm.ci.meta.VMConstant; + +/** + * Represents an embedded {@link VMConstant} in the code or data section that needs to be + * {@link DataPatch patched} by the VM (e.g. an embedded pointer to a Java object). + */ +public final class ConstantReference extends Reference { + + private final VMConstant constant; + + public ConstantReference(VMConstant constant) { + this.constant = constant; + } + + public VMConstant getConstant() { + return constant; + } + + @Override + public String toString() { + return constant.toString(); + } + + @Override + public int hashCode() { + return constant.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof ConstantReference) { + ConstantReference that = (ConstantReference) obj; + return Objects.equals(this.constant, that.constant); + } + return false; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/DataPatch.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/DataPatch.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code.site; + +import java.util.Objects; + +import jdk.vm.ci.meta.VMConstant; + +/** + * Represents a code site that references some data. The associated data can be either a + * {@link DataSectionReference reference} to the data section, or it may be an inlined + * {@link VMConstant} that needs to be patched. + */ +public final class DataPatch extends Site { + + public Reference reference; + public Object note; + + public DataPatch(int pcOffset, Reference reference) { + super(pcOffset); + this.reference = reference; + this.note = null; + } + + public DataPatch(int pcOffset, Reference reference, Object note) { + super(pcOffset); + this.reference = reference; + this.note = note; + } + + @Override + public String toString() { + if (note != null) { + return String.format("%d[, note: %s]", pcOffset, reference.toString(), note.toString()); + } else { + return String.format("%d[]", pcOffset, reference.toString()); + } + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof DataPatch) { + DataPatch that = (DataPatch) obj; + if (this.pcOffset == that.pcOffset && Objects.equals(this.reference, that.reference) && Objects.equals(this.note, that.note)) { + return true; + } + } + return false; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/DataSectionReference.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/DataSectionReference.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code.site; + +/** + * Represents a pointer to some location in the data section that should be {@link DataPatch + * patched} into the code. + */ +public final class DataSectionReference extends Reference { + + private boolean initialized; + private int offset; + + public DataSectionReference() { + // will be set after the data section layout is fixed + offset = 0xDEADDEAD; + } + + public int getOffset() { + assert initialized; + + return offset; + } + + public void setOffset(int offset) { + assert !initialized; + initialized = true; + + this.offset = offset; + } + + @Override + public int hashCode() { + return offset; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof DataSectionReference) { + DataSectionReference that = (DataSectionReference) obj; + return this.offset == that.offset; + } + return false; + } + + @Override + public String toString() { + if (initialized) { + return String.format("DataSection[0x%x]", offset); + } else { + return "DataSection[?]"; + } + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/ExceptionHandler.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/ExceptionHandler.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code.site; + +/** + * Represents exception handler information for a specific code position. It includes the catch code + * position as well as the caught exception type. + */ +public final class ExceptionHandler extends Site { + + public final int handlerPos; + + public ExceptionHandler(int pcOffset, int handlerPos) { + super(pcOffset); + this.handlerPos = handlerPos; + } + + @Override + public String toString() { + return String.format("%d[]", pcOffset, handlerPos); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof ExceptionHandler) { + ExceptionHandler that = (ExceptionHandler) obj; + if (this.pcOffset == that.pcOffset && this.handlerPos == that.handlerPos) { + return true; + } + } + return false; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Infopoint.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Infopoint.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code.site; + +import java.util.Map; +import java.util.Objects; + +import jdk.vm.ci.code.BytecodePosition; +import jdk.vm.ci.code.DebugInfo; +import jdk.vm.ci.code.ReferenceMap; +import jdk.vm.ci.code.Register; +import jdk.vm.ci.code.RegisterSaveLayout; +import jdk.vm.ci.meta.MetaUtil; + +/** + * Represents an infopoint with associated debug info. Note that safepoints are also infopoints. + */ +public class Infopoint extends Site implements Comparable { + + public final DebugInfo debugInfo; + + public final InfopointReason reason; + + public Infopoint(int pcOffset, DebugInfo debugInfo, InfopointReason reason) { + super(pcOffset); + this.debugInfo = debugInfo; + this.reason = reason; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(pcOffset); + sb.append("[]"); + appendDebugInfo(sb, debugInfo); + return sb.toString(); + } + + @Override + public int compareTo(Infopoint o) { + if (pcOffset < o.pcOffset) { + return -1; + } else if (pcOffset > o.pcOffset) { + return 1; + } + return this.reason.compareTo(o.reason); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj != null && obj.getClass() == getClass()) { + Infopoint that = (Infopoint) obj; + if (this.pcOffset == that.pcOffset && Objects.equals(this.debugInfo, that.debugInfo) && Objects.equals(this.reason, that.reason)) { + return true; + } + } + return false; + } + + protected static void appendDebugInfo(StringBuilder sb, DebugInfo info) { + if (info != null) { + ReferenceMap refMap = info.getReferenceMap(); + if (refMap != null) { + sb.append(refMap.toString()); + sb.append(']'); + } + RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo(); + if (calleeSaveInfo != null) { + sb.append(" callee-save-info["); + String sep = ""; + for (Map.Entry e : calleeSaveInfo.registersToSlots(true).entrySet()) { + sb.append(sep).append(e.getKey()).append("->").append(e.getValue()); + sep = ", "; + } + sb.append(']'); + } + BytecodePosition codePos = info.getBytecodePosition(); + if (codePos != null) { + MetaUtil.appendLocation(sb.append(" "), codePos.getMethod(), codePos.getBCI()); + if (info.hasFrame()) { + sb.append(" #locals=").append(info.frame().numLocals).append(" #expr=").append(info.frame().numStack); + if (info.frame().numLocks > 0) { + sb.append(" #locks=").append(info.frame().numLocks); + } + } + } + } + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/InfopointReason.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/InfopointReason.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code.site; + +/** + * A reason for infopoint insertion. + */ +public enum InfopointReason { + + SAFEPOINT, + CALL, + IMPLICIT_EXCEPTION, + METHOD_START, + METHOD_END, + BYTECODE_POSITION; +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Mark.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Mark.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code.site; + +import java.util.Objects; + +/** + * Associates arbitrary information with a position in machine code. For example, HotSpot specific + * code in a compiler backend may use this to denote the position of a safepoint, exception handler + * entry point, verified entry point etc. + */ +public final class Mark extends Site { + + /** + * An object denoting extra semantic information about the machine code position of this mark. + */ + public final Object id; + + /** + * Creates a mark that associates {@code id} with the machine code position {@code pcOffset}. + * + * @param pcOffset + * @param id + */ + public Mark(int pcOffset, Object id) { + super(pcOffset); + this.id = id; + } + + @Override + public String toString() { + if (id == null) { + return String.format("%d[]", pcOffset); + } else if (id instanceof Integer) { + return String.format("%d[]", pcOffset, Integer.toHexString((Integer) id)); + } else { + return String.format("%d[]", pcOffset, id.toString()); + } + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof Mark) { + Mark that = (Mark) obj; + if (this.pcOffset == that.pcOffset && Objects.equals(this.id, that.id)) { + return true; + } + } + return false; + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Reference.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Reference.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code.site; + +/** + * Represents some external data that is referenced by the code. + */ +public abstract class Reference { + + @Override + public abstract int hashCode(); + + @Override + public abstract boolean equals(Object obj); +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Site.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Site.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code.site; + +import static jdk.vm.ci.meta.MetaUtil.identityHashCodeString; + +/** + * Represents a code position with associated additional information. + */ +public abstract class Site { + + /** + * The position (or offset) of this site with respect to the start of the target method. + */ + public final int pcOffset; + + public Site(int pos) { + this.pcOffset = pos; + } + + @Override + public final int hashCode() { + throw new UnsupportedOperationException("hashCode"); + } + + @Override + public String toString() { + return identityHashCodeString(this); + } + + @Override + public abstract boolean equals(Object obj); +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/stack/InspectedFrame.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/stack/InspectedFrame.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code.stack; + +import jdk.vm.ci.meta.ResolvedJavaMethod; + +/** + * Access to the object variables in a stack frame. + */ +public interface InspectedFrame { + + /** + * Returns the value of the object local at {@code index}. This value is a copy iff + * {@link #isVirtual(int)} is true. + */ + Object getLocal(int index); + + /** + * Returns whether the local at {@code index} is a virtual object, and therefore the object + * returned by {@link #getLocal(int)} is a copy. + */ + boolean isVirtual(int index); + + /** + * Returns true if the stack frame is a compiled stack frame and there are virtual objects + * anywhere in the current state of the compiled method. This can return true even if + * {@link #isVirtual(int)} return false for all locals. + */ + boolean hasVirtualObjects(); + + /** + * This method will materialize all virtual objects, deoptimize the stack frame and make sure + * that subsequent execution of the deoptimized frame uses the materialized values. + */ + void materializeVirtualObjects(boolean invalidateCode); + + /** + * @return the current bytecode index + */ + int getBytecodeIndex(); + + /** + * @return the current method + */ + ResolvedJavaMethod getMethod(); + + /** + * Checks if the current method is equal to the given method. This is semantically equivalent to + * {@code method.equals(getMethod())}, but can be implemented more efficiently. + */ + boolean isMethod(ResolvedJavaMethod method); +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/stack/InspectedFrameVisitor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/stack/InspectedFrameVisitor.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code.stack; + +/** + * Callback interface for {@link StackIntrospection#iterateFrames}. Implementations of + * {@link #visitFrame} return null to indicate that frame iteration should continue and the next + * caller frame should be visited; and return any non-null value to indicate that frame iteration + * should stop. + */ +public interface InspectedFrameVisitor { + + T visitFrame(InspectedFrame frame); +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/stack/StackIntrospection.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/stack/StackIntrospection.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.code.stack; + +import jdk.vm.ci.meta.ResolvedJavaMethod; + +public interface StackIntrospection { + + /** + * Accesses the current stack, providing {@link InspectedFrame}s to the visitor that can be used + * to inspect the stack frames' contents. Iteration continues as long as + * {@link InspectedFrameVisitor#visitFrame}, which is invoked for every {@link InspectedFrame}, + * returns null. Any non-null result of the visitor indicates that frame iteration should stop. + * + * @param initialMethods if this is non-{@code null}, then the stack trace will start at these + * methods + * @param matchingMethods if this is non-{@code null}, then only matching stack frames are + * returned + * @param initialSkip the number of matching methods to skip (including the initial method) + * @param visitor the visitor that is called for every matching method + * @return the last result returned by the visitor (which is non-null to indicate that iteration + * should stop), or null if the whole stack was iterated. + */ + T iterateFrames(ResolvedJavaMethod[] initialMethods, ResolvedJavaMethod[] matchingMethods, int initialSkip, InspectedFrameVisitor visitor); +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/InitTimer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/InitTimer.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.common; + +import java.util.concurrent.atomic.AtomicInteger; + +/** + * A facility for timing a step in the runtime initialization sequence. This is independent from all + * other JVMCI code so as to not perturb the initialization sequence. It is enabled by setting the + * {@code "jvmci.inittimer"} system property to {@code "true"}. + */ +public final class InitTimer implements AutoCloseable { + private final String name; + private final long start; + + private InitTimer(String name) { + int n = nesting.getAndIncrement(); + if (n == 0) { + initializingThread = Thread.currentThread(); + System.out.println("INITIALIZING THREAD: " + initializingThread); + } else { + assert Thread.currentThread() == initializingThread : Thread.currentThread() + " != " + initializingThread; + } + this.name = name; + this.start = System.currentTimeMillis(); + System.out.println("START: " + SPACES.substring(0, n * 2) + name); + } + + @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "only the initializing thread accesses this field") + public void close() { + final long end = System.currentTimeMillis(); + int n = nesting.decrementAndGet(); + System.out.println(" DONE: " + SPACES.substring(0, n * 2) + name + " [" + (end - start) + " ms]"); + if (n == 0) { + initializingThread = null; + } + } + + public static InitTimer timer(String name) { + return ENABLED ? new InitTimer(name) : null; + } + + public static InitTimer timer(String name, Object suffix) { + return ENABLED ? new InitTimer(name + suffix) : null; + } + + /** + * Specifies if initialization timing is enabled. Note: This property cannot use + * {@code HotSpotJVMCIRuntime.Option} since that class is not visible from this package. + */ + private static final boolean ENABLED = Boolean.getBoolean("jvmci.InitTimer"); + + public static final AtomicInteger nesting = ENABLED ? new AtomicInteger() : null; + public static final String SPACES = " "; + + /** + * Used to assert the invariant that all related initialization happens on the same thread. + */ + static Thread initializingThread; +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/JVMCIError.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/JVMCIError.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.common; + +import java.util.ArrayList; +import java.util.Locale; + +/** + * Indicates a condition in JVMCI related code that should never occur during normal operation. + */ +public class JVMCIError extends Error { + + private static final long serialVersionUID = 531632331813456233L; + + public static RuntimeException unimplemented() { + throw new JVMCIError("unimplemented"); + } + + public static RuntimeException unimplemented(String msg) { + throw new JVMCIError("unimplemented: %s", msg); + } + + public static RuntimeException shouldNotReachHere() { + throw new JVMCIError("should not reach here"); + } + + public static RuntimeException shouldNotReachHere(String msg) { + throw new JVMCIError("should not reach here: %s", msg); + } + + public static RuntimeException shouldNotReachHere(Throwable cause) { + throw new JVMCIError(cause); + } + + /** + * Checks a given condition and throws a {@link JVMCIError} if it is false. Guarantees are + * stronger than assertions in that they are always checked. Error messages for guarantee + * violations should clearly indicate the nature of the problem as well as a suggested solution + * if possible. + * + * @param condition the condition to check + * @param msg the message that will be associated with the error, in + * {@link String#format(String, Object...)} syntax + * @param args arguments to the format string + */ + public static void guarantee(boolean condition, String msg, Object... args) { + if (!condition) { + throw new JVMCIError("failed guarantee: " + msg, args); + } + } + + /** + * This constructor creates a {@link JVMCIError} with a given message. + * + * @param msg the message that will be associated with the error + */ + public JVMCIError(String msg) { + super(msg); + } + + /** + * This constructor creates a {@link JVMCIError} with a message assembled via + * {@link String#format(String, Object...)}. It always uses the ENGLISH locale in order to + * always generate the same output. + * + * @param msg the message that will be associated with the error, in String.format syntax + * @param args parameters to String.format - parameters that implement {@link Iterable} will be + * expanded into a [x, x, ...] representation. + */ + public JVMCIError(String msg, Object... args) { + super(format(msg, args)); + } + + /** + * This constructor creates a {@link JVMCIError} for a given causing Throwable instance. + * + * @param cause the original exception that contains additional information on this error + */ + public JVMCIError(Throwable cause) { + super(cause); + } + + private static String format(String msg, Object... args) { + if (args != null) { + // expand Iterable parameters into a list representation + for (int i = 0; i < args.length; i++) { + if (args[i] instanceof Iterable) { + ArrayList list = new ArrayList<>(); + for (Object o : (Iterable) args[i]) { + list.add(o); + } + args[i] = list.toString(); + } + } + } + return String.format(Locale.ENGLISH, msg, args); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/SuppressFBWarnings.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/SuppressFBWarnings.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.common; + +/** + * Used to suppress FindBugs warnings. + */ +@interface SuppressFBWarnings { + /** + * The set of FindBugs + * warnings that are to be + * suppressed in annotated element. The value can be a bug category, kind or pattern. + */ + String[] value(); + + /** + * Reason why the warning is suppressed. + */ + String justification(); +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotJVMCIBackendFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotJVMCIBackendFactory.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot.aarch64; + +import static jdk.vm.ci.common.InitTimer.timer; + +import java.util.EnumSet; + +import jdk.vm.ci.aarch64.AArch64; +import jdk.vm.ci.code.Architecture; +import jdk.vm.ci.code.RegisterConfig; +import jdk.vm.ci.code.TargetDescription; +import jdk.vm.ci.code.stack.StackIntrospection; +import jdk.vm.ci.common.InitTimer; +import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; +import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider; +import jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory; +import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider; +import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider; +import jdk.vm.ci.hotspot.HotSpotStackIntrospection; +import jdk.vm.ci.meta.ConstantReflectionProvider; +import jdk.vm.ci.runtime.JVMCIBackend; + +public class AArch64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory { + + protected EnumSet computeFeatures(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) { + // Configure the feature set using the HotSpot flag settings. + EnumSet features = EnumSet.noneOf(AArch64.CPUFeature.class); + return features; + } + + protected EnumSet computeFlags(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) { + EnumSet flags = EnumSet.noneOf(AArch64.Flag.class); + return flags; + } + + protected TargetDescription createTarget(AArch64HotSpotVMConfig config) { + final int stackFrameAlignment = 16; + final int implicitNullCheckLimit = 4096; + final boolean inlineObjects = true; + Architecture arch = new AArch64(computeFeatures(config), computeFlags(config)); + return new TargetDescription(arch, true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects); + } + + protected HotSpotConstantReflectionProvider createConstantReflection(HotSpotJVMCIRuntimeProvider runtime) { + return new HotSpotConstantReflectionProvider(runtime); + } + + protected RegisterConfig createRegisterConfig(AArch64HotSpotVMConfig config, TargetDescription target) { + return new AArch64HotSpotRegisterConfig(target, config.useCompressedOops); + } + + protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) { + return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig); + } + + protected HotSpotMetaAccessProvider createMetaAccess(HotSpotJVMCIRuntimeProvider runtime) { + return new HotSpotMetaAccessProvider(runtime); + } + + @Override + public String getArchitecture() { + return "aarch64"; + } + + @Override + public String toString() { + return "JVMCIBackend:" + getArchitecture(); + } + + @SuppressWarnings("try") + public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) { + + assert host == null; + AArch64HotSpotVMConfig config = new AArch64HotSpotVMConfig(runtime.getConfigStore()); + TargetDescription target = createTarget(config); + + RegisterConfig regConfig; + HotSpotCodeCacheProvider codeCache; + ConstantReflectionProvider constantReflection; + HotSpotMetaAccessProvider metaAccess; + StackIntrospection stackIntrospection; + try (InitTimer t = timer("create providers")) { + try (InitTimer rt = timer("create MetaAccess provider")) { + metaAccess = createMetaAccess(runtime); + } + try (InitTimer rt = timer("create RegisterConfig")) { + regConfig = createRegisterConfig(config, target); + } + try (InitTimer rt = timer("create CodeCache provider")) { + codeCache = createCodeCache(runtime, target, regConfig); + } + try (InitTimer rt = timer("create ConstantReflection provider")) { + constantReflection = createConstantReflection(runtime); + } + try (InitTimer rt = timer("create StackIntrospection provider")) { + stackIntrospection = new HotSpotStackIntrospection(runtime); + } + } + try (InitTimer rt = timer("instantiate backend")) { + return createBackend(metaAccess, codeCache, constantReflection, stackIntrospection); + } + } + + protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, + StackIntrospection stackIntrospection) { + return new JVMCIBackend(metaAccess, codeCache, constantReflection, stackIntrospection); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotRegisterConfig.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotRegisterConfig.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,299 @@ +/* + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot.aarch64; + +import static jdk.vm.ci.aarch64.AArch64.lr; +import static jdk.vm.ci.aarch64.AArch64.r0; +import static jdk.vm.ci.aarch64.AArch64.r1; +import static jdk.vm.ci.aarch64.AArch64.r2; +import static jdk.vm.ci.aarch64.AArch64.r3; +import static jdk.vm.ci.aarch64.AArch64.r4; +import static jdk.vm.ci.aarch64.AArch64.r5; +import static jdk.vm.ci.aarch64.AArch64.r6; +import static jdk.vm.ci.aarch64.AArch64.r7; +import static jdk.vm.ci.aarch64.AArch64.rscratch1; +import static jdk.vm.ci.aarch64.AArch64.rscratch2; +import static jdk.vm.ci.aarch64.AArch64.r12; +import static jdk.vm.ci.aarch64.AArch64.r27; +import static jdk.vm.ci.aarch64.AArch64.r28; +import static jdk.vm.ci.aarch64.AArch64.r29; +import static jdk.vm.ci.aarch64.AArch64.r31; +import static jdk.vm.ci.aarch64.AArch64.sp; +import static jdk.vm.ci.aarch64.AArch64.v0; +import static jdk.vm.ci.aarch64.AArch64.v1; +import static jdk.vm.ci.aarch64.AArch64.v2; +import static jdk.vm.ci.aarch64.AArch64.v3; +import static jdk.vm.ci.aarch64.AArch64.v4; +import static jdk.vm.ci.aarch64.AArch64.v5; +import static jdk.vm.ci.aarch64.AArch64.v6; +import static jdk.vm.ci.aarch64.AArch64.v7; +import static jdk.vm.ci.aarch64.AArch64.zr; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import jdk.vm.ci.aarch64.AArch64; +import jdk.vm.ci.code.Architecture; +import jdk.vm.ci.code.CallingConvention; +import jdk.vm.ci.code.CallingConvention.Type; +import jdk.vm.ci.code.Register; +import jdk.vm.ci.code.RegisterArray; +import jdk.vm.ci.code.RegisterAttributes; +import jdk.vm.ci.code.RegisterConfig; +import jdk.vm.ci.code.StackSlot; +import jdk.vm.ci.code.TargetDescription; +import jdk.vm.ci.code.ValueKindFactory; +import jdk.vm.ci.common.JVMCIError; +import jdk.vm.ci.hotspot.HotSpotCallingConventionType; +import jdk.vm.ci.meta.AllocatableValue; +import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.JavaType; +import jdk.vm.ci.meta.PlatformKind; +import jdk.vm.ci.meta.Value; +import jdk.vm.ci.meta.ValueKind; + +public class AArch64HotSpotRegisterConfig implements RegisterConfig { + + private final TargetDescription target; + + private final RegisterArray allocatable; + + /** + * The caller saved registers always include all parameter registers. + */ + private final RegisterArray callerSaved; + + private final boolean allAllocatableAreCallerSaved; + + private final RegisterAttributes[] attributesMap; + + @Override + public RegisterArray getAllocatableRegisters() { + return allocatable; + } + + @Override + public RegisterArray filterAllocatableRegisters(PlatformKind kind, RegisterArray registers) { + ArrayList list = new ArrayList<>(); + for (Register reg : registers) { + if (target.arch.canStoreValue(reg.getRegisterCategory(), kind)) { + list.add(reg); + } + } + + return new RegisterArray(list); + } + + @Override + public RegisterAttributes[] getAttributesMap() { + return attributesMap.clone(); + } + + private final RegisterArray javaGeneralParameterRegisters = new RegisterArray(r1, r2, r3, r4, r5, r6, r7, r0); + private final RegisterArray nativeGeneralParameterRegisters = new RegisterArray(r0, r1, r2, r3, r4, r5, r6, r7); + private final RegisterArray simdParameterRegisters = new RegisterArray(v0, v1, v2, v3, v4, v5, v6, v7); + + public static final Register inlineCacheRegister = rscratch2; + + /** + * Vtable stubs expect the metaspace Method in r12. + */ + public static final Register metaspaceMethodRegister = r12; + + public static final Register heapBaseRegister = r27; + public static final Register threadRegister = r28; + public static final Register fp = r29; + + private static final RegisterArray reservedRegisters + = new RegisterArray(rscratch1, rscratch2, threadRegister, fp, lr, r31, zr, sp); + + private static RegisterArray initAllocatable(Architecture arch, boolean reserveForHeapBase) { + RegisterArray allRegisters = arch.getAvailableValueRegisters(); + Register[] registers = new Register[allRegisters.size() - reservedRegisters.size() - (reserveForHeapBase ? 1 : 0)]; + List reservedRegistersList = reservedRegisters.asList(); + + int idx = 0; + for (Register reg : allRegisters) { + if (reservedRegistersList.contains(reg)) { + // skip reserved registers + continue; + } + assert !(reg.equals(threadRegister) || reg.equals(fp) || reg.equals(lr) || reg.equals(r31) || reg.equals(zr) || reg.equals(sp)); + if (reserveForHeapBase && reg.equals(heapBaseRegister)) { + // skip heap base register + continue; + } + + registers[idx++] = reg; + } + + assert idx == registers.length; + return new RegisterArray(registers); + } + + public AArch64HotSpotRegisterConfig(TargetDescription target, boolean useCompressedOops) { + this(target, initAllocatable(target.arch, useCompressedOops)); + assert callerSaved.size() >= allocatable.size(); + } + + public AArch64HotSpotRegisterConfig(TargetDescription target, RegisterArray allocatable) { + this.target = target; + + this.allocatable = allocatable; + Set callerSaveSet = new HashSet<>(); + allocatable.addTo(callerSaveSet); + simdParameterRegisters.addTo(callerSaveSet); + javaGeneralParameterRegisters.addTo(callerSaveSet); + nativeGeneralParameterRegisters.addTo(callerSaveSet); + callerSaved = new RegisterArray(callerSaveSet); + + allAllocatableAreCallerSaved = true; + attributesMap = RegisterAttributes.createMap(this, AArch64.allRegisters); + } + + @Override + public RegisterArray getCallerSaveRegisters() { + return callerSaved; + } + + public RegisterArray getCalleeSaveRegisters() { + return null; + } + + @Override + public boolean areAllAllocatableRegistersCallerSaved() { + return allAllocatableAreCallerSaved; + } + + @Override + public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, ValueKindFactory valueKindFactory) { + HotSpotCallingConventionType hotspotType = (HotSpotCallingConventionType) type; + if (type == HotSpotCallingConventionType.NativeCall) { + return callingConvention(nativeGeneralParameterRegisters, returnType, parameterTypes, hotspotType, valueKindFactory); + } + // On x64, parameter locations are the same whether viewed + // from the caller or callee perspective + return callingConvention(javaGeneralParameterRegisters, returnType, parameterTypes, hotspotType, valueKindFactory); + } + + @Override + public RegisterArray getCallingConventionRegisters(Type type, JavaKind kind) { + HotSpotCallingConventionType hotspotType = (HotSpotCallingConventionType) type; + switch (kind) { + case Boolean: + case Byte: + case Short: + case Char: + case Int: + case Long: + case Object: + return hotspotType == HotSpotCallingConventionType.NativeCall ? nativeGeneralParameterRegisters : javaGeneralParameterRegisters; + case Float: + case Double: + return simdParameterRegisters; + default: + throw JVMCIError.shouldNotReachHere(); + } + } + + private CallingConvention callingConvention(RegisterArray generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, HotSpotCallingConventionType type, + ValueKindFactory valueKindFactory) { + AllocatableValue[] locations = new AllocatableValue[parameterTypes.length]; + + int currentGeneral = 0; + int currentSIMD = 0; + int currentStackOffset = 0; + + for (int i = 0; i < parameterTypes.length; i++) { + final JavaKind kind = parameterTypes[i].getJavaKind().getStackKind(); + + switch (kind) { + case Byte: + case Boolean: + case Short: + case Char: + case Int: + case Long: + case Object: + if (currentGeneral < generalParameterRegisters.size()) { + Register register = generalParameterRegisters.get(currentGeneral++); + locations[i] = register.asValue(valueKindFactory.getValueKind(kind)); + } + break; + case Float: + case Double: + if (currentSIMD < simdParameterRegisters.size()) { + Register register = simdParameterRegisters.get(currentSIMD++); + locations[i] = register.asValue(valueKindFactory.getValueKind(kind)); + } + break; + default: + throw JVMCIError.shouldNotReachHere(); + } + + if (locations[i] == null) { + ValueKind valueKind = valueKindFactory.getValueKind(kind); + locations[i] = StackSlot.get(valueKind, currentStackOffset, !type.out); + currentStackOffset += Math.max(valueKind.getPlatformKind().getSizeInBytes(), target.wordSize); + } + } + + JavaKind returnKind = returnType == null ? JavaKind.Void : returnType.getJavaKind(); + AllocatableValue returnLocation = returnKind == JavaKind.Void ? Value.ILLEGAL : getReturnRegister(returnKind).asValue(valueKindFactory.getValueKind(returnKind.getStackKind())); + return new CallingConvention(currentStackOffset, returnLocation, locations); + } + + @Override + public Register getReturnRegister(JavaKind kind) { + switch (kind) { + case Boolean: + case Byte: + case Char: + case Short: + case Int: + case Long: + case Object: + return r0; + case Float: + case Double: + return v0; + case Void: + case Illegal: + return null; + default: + throw new UnsupportedOperationException("no return register for type " + kind); + } + } + + @Override + public Register getFrameRegister() { + return sp; + } + + @Override + public String toString() { + return String.format("Allocatable: " + getAllocatableRegisters() + "%n" + "CallerSave: " + getCallerSaveRegisters() + "%n"); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotVMConfig.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotVMConfig.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot.aarch64; + +import jdk.vm.ci.hotspot.HotSpotVMConfigAccess; +import jdk.vm.ci.hotspot.HotSpotVMConfigStore; + +/** + * Used to access native configuration details. + * + * All non-static, public fields in this class are so that they can be compiled as constants. + */ +class AArch64HotSpotVMConfig extends HotSpotVMConfigAccess { + + AArch64HotSpotVMConfig(HotSpotVMConfigStore config) { + super(config); + } + + final boolean linuxOs = System.getProperty("os.name", "").startsWith("Linux"); + + final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class); +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotJVMCIBackendFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotJVMCIBackendFactory.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot.amd64; + +import static jdk.vm.ci.common.InitTimer.timer; + +import java.util.EnumSet; + +import jdk.vm.ci.amd64.AMD64; +import jdk.vm.ci.code.Architecture; +import jdk.vm.ci.code.RegisterConfig; +import jdk.vm.ci.code.TargetDescription; +import jdk.vm.ci.code.stack.StackIntrospection; +import jdk.vm.ci.common.InitTimer; +import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; +import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider; +import jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory; +import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider; +import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider; +import jdk.vm.ci.hotspot.HotSpotStackIntrospection; +import jdk.vm.ci.meta.ConstantReflectionProvider; +import jdk.vm.ci.runtime.JVMCIBackend; + +public class AMD64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory { + + protected EnumSet computeFeatures(AMD64HotSpotVMConfig config) { + // Configure the feature set using the HotSpot flag settings. + EnumSet features = EnumSet.noneOf(AMD64.CPUFeature.class); + if ((config.vmVersionFeatures & config.amd643DNOWPREFETCH) != 0) { + features.add(AMD64.CPUFeature.AMD_3DNOW_PREFETCH); + } + assert config.useSSE >= 2 : "minimum config for x64"; + features.add(AMD64.CPUFeature.SSE); + features.add(AMD64.CPUFeature.SSE2); + if ((config.vmVersionFeatures & config.amd64SSE3) != 0) { + features.add(AMD64.CPUFeature.SSE3); + } + if ((config.vmVersionFeatures & config.amd64SSSE3) != 0) { + features.add(AMD64.CPUFeature.SSSE3); + } + if ((config.vmVersionFeatures & config.amd64SSE4A) != 0) { + features.add(AMD64.CPUFeature.SSE4A); + } + if ((config.vmVersionFeatures & config.amd64SSE41) != 0) { + features.add(AMD64.CPUFeature.SSE4_1); + } + if ((config.vmVersionFeatures & config.amd64SSE42) != 0) { + features.add(AMD64.CPUFeature.SSE4_2); + } + if ((config.vmVersionFeatures & config.amd64POPCNT) != 0) { + features.add(AMD64.CPUFeature.POPCNT); + } + if ((config.vmVersionFeatures & config.amd64LZCNT) != 0) { + features.add(AMD64.CPUFeature.LZCNT); + } + if ((config.vmVersionFeatures & config.amd64ERMS) != 0) { + features.add(AMD64.CPUFeature.ERMS); + } + if ((config.vmVersionFeatures & config.amd64AVX) != 0) { + features.add(AMD64.CPUFeature.AVX); + } + if ((config.vmVersionFeatures & config.amd64AVX2) != 0) { + features.add(AMD64.CPUFeature.AVX2); + } + if ((config.vmVersionFeatures & config.amd64AES) != 0) { + features.add(AMD64.CPUFeature.AES); + } + if ((config.vmVersionFeatures & config.amd643DNOWPREFETCH) != 0) { + features.add(AMD64.CPUFeature.AMD_3DNOW_PREFETCH); + } + if ((config.vmVersionFeatures & config.amd64BMI1) != 0) { + features.add(AMD64.CPUFeature.BMI1); + } + if ((config.vmVersionFeatures & config.amd64BMI2) != 0) { + features.add(AMD64.CPUFeature.BMI2); + } + if ((config.vmVersionFeatures & config.amd64RTM) != 0) { + features.add(AMD64.CPUFeature.RTM); + } + if ((config.vmVersionFeatures & config.amd64ADX) != 0) { + features.add(AMD64.CPUFeature.ADX); + } + if ((config.vmVersionFeatures & config.amd64AVX512F) != 0) { + features.add(AMD64.CPUFeature.AVX512F); + } + if ((config.vmVersionFeatures & config.amd64AVX512DQ) != 0) { + features.add(AMD64.CPUFeature.AVX512DQ); + } + if ((config.vmVersionFeatures & config.amd64AVX512PF) != 0) { + features.add(AMD64.CPUFeature.AVX512PF); + } + if ((config.vmVersionFeatures & config.amd64AVX512ER) != 0) { + features.add(AMD64.CPUFeature.AVX512ER); + } + if ((config.vmVersionFeatures & config.amd64AVX512CD) != 0) { + features.add(AMD64.CPUFeature.AVX512CD); + } + if ((config.vmVersionFeatures & config.amd64AVX512BW) != 0) { + features.add(AMD64.CPUFeature.AVX512BW); + } + if ((config.vmVersionFeatures & config.amd64AVX512VL) != 0) { + features.add(AMD64.CPUFeature.AVX512VL); + } + if ((config.vmVersionFeatures & config.amd64SHA) != 0) { + features.add(AMD64.CPUFeature.SHA); + } + if ((config.vmVersionFeatures & config.amd64FMA) != 0) { + features.add(AMD64.CPUFeature.FMA); + } + return features; + } + + protected EnumSet computeFlags(AMD64HotSpotVMConfig config) { + EnumSet flags = EnumSet.noneOf(AMD64.Flag.class); + if (config.useCountLeadingZerosInstruction) { + flags.add(AMD64.Flag.UseCountLeadingZerosInstruction); + } + if (config.useCountTrailingZerosInstruction) { + flags.add(AMD64.Flag.UseCountTrailingZerosInstruction); + } + return flags; + } + + protected TargetDescription createTarget(AMD64HotSpotVMConfig config) { + final int stackFrameAlignment = 16; + final int implicitNullCheckLimit = 4096; + final boolean inlineObjects = true; + Architecture arch = new AMD64(computeFeatures(config), computeFlags(config)); + return new TargetDescription(arch, true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects); + } + + protected HotSpotConstantReflectionProvider createConstantReflection(HotSpotJVMCIRuntimeProvider runtime) { + return new HotSpotConstantReflectionProvider(runtime); + } + + protected RegisterConfig createRegisterConfig(AMD64HotSpotVMConfig config, TargetDescription target) { + return new AMD64HotSpotRegisterConfig(target, config.useCompressedOops, config.windowsOs); + } + + protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) { + return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig); + } + + protected HotSpotMetaAccessProvider createMetaAccess(HotSpotJVMCIRuntimeProvider runtime) { + return new HotSpotMetaAccessProvider(runtime); + } + + @Override + public String getArchitecture() { + return "AMD64"; + } + + @Override + public String toString() { + return "JVMCIBackend:" + getArchitecture(); + } + + @SuppressWarnings("try") + public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) { + assert host == null; + AMD64HotSpotVMConfig config = new AMD64HotSpotVMConfig(runtime.getConfigStore()); + TargetDescription target = createTarget(config); + + RegisterConfig regConfig; + HotSpotCodeCacheProvider codeCache; + ConstantReflectionProvider constantReflection; + HotSpotMetaAccessProvider metaAccess; + StackIntrospection stackIntrospection; + try (InitTimer t = timer("create providers")) { + try (InitTimer rt = timer("create MetaAccess provider")) { + metaAccess = createMetaAccess(runtime); + } + try (InitTimer rt = timer("create RegisterConfig")) { + regConfig = createRegisterConfig(config, target); + } + try (InitTimer rt = timer("create CodeCache provider")) { + codeCache = createCodeCache(runtime, target, regConfig); + } + try (InitTimer rt = timer("create ConstantReflection provider")) { + constantReflection = createConstantReflection(runtime); + } + try (InitTimer rt = timer("create StackIntrospection provider")) { + stackIntrospection = new HotSpotStackIntrospection(runtime); + } + } + try (InitTimer rt = timer("instantiate backend")) { + return createBackend(metaAccess, codeCache, constantReflection, stackIntrospection); + } + } + + protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, + StackIntrospection stackIntrospection) { + return new JVMCIBackend(metaAccess, codeCache, constantReflection, stackIntrospection); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,321 @@ +/* + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot.amd64; + +import static jdk.vm.ci.amd64.AMD64.r12; +import static jdk.vm.ci.amd64.AMD64.r15; +import static jdk.vm.ci.amd64.AMD64.r8; +import static jdk.vm.ci.amd64.AMD64.r9; +import static jdk.vm.ci.amd64.AMD64.rax; +import static jdk.vm.ci.amd64.AMD64.rcx; +import static jdk.vm.ci.amd64.AMD64.rdi; +import static jdk.vm.ci.amd64.AMD64.rdx; +import static jdk.vm.ci.amd64.AMD64.rsi; +import static jdk.vm.ci.amd64.AMD64.rsp; +import static jdk.vm.ci.amd64.AMD64.xmm0; +import static jdk.vm.ci.amd64.AMD64.xmm1; +import static jdk.vm.ci.amd64.AMD64.xmm2; +import static jdk.vm.ci.amd64.AMD64.xmm3; +import static jdk.vm.ci.amd64.AMD64.xmm4; +import static jdk.vm.ci.amd64.AMD64.xmm5; +import static jdk.vm.ci.amd64.AMD64.xmm6; +import static jdk.vm.ci.amd64.AMD64.xmm7; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import jdk.vm.ci.code.Architecture; +import jdk.vm.ci.code.CallingConvention; +import jdk.vm.ci.code.CallingConvention.Type; +import jdk.vm.ci.code.Register; +import jdk.vm.ci.code.RegisterArray; +import jdk.vm.ci.code.RegisterAttributes; +import jdk.vm.ci.code.RegisterConfig; +import jdk.vm.ci.code.StackSlot; +import jdk.vm.ci.code.TargetDescription; +import jdk.vm.ci.code.ValueKindFactory; +import jdk.vm.ci.common.JVMCIError; +import jdk.vm.ci.hotspot.HotSpotCallingConventionType; +import jdk.vm.ci.meta.AllocatableValue; +import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.JavaType; +import jdk.vm.ci.meta.PlatformKind; +import jdk.vm.ci.meta.Value; +import jdk.vm.ci.meta.ValueKind; + +public class AMD64HotSpotRegisterConfig implements RegisterConfig { + + private final TargetDescription target; + + private final RegisterArray allocatable; + + /** + * The caller saved registers always include all parameter registers. + */ + private final RegisterArray callerSaved; + + private final boolean allAllocatableAreCallerSaved; + + private final RegisterAttributes[] attributesMap; + + @Override + public RegisterArray getAllocatableRegisters() { + return allocatable; + } + + @Override + public RegisterArray filterAllocatableRegisters(PlatformKind kind, RegisterArray registers) { + ArrayList list = new ArrayList<>(); + for (Register reg : registers) { + if (target.arch.canStoreValue(reg.getRegisterCategory(), kind)) { + list.add(reg); + } + } + + RegisterArray ret = new RegisterArray(list); + return ret; + } + + @Override + public RegisterAttributes[] getAttributesMap() { + return attributesMap.clone(); + } + + private final RegisterArray javaGeneralParameterRegisters; + private final RegisterArray nativeGeneralParameterRegisters; + private final RegisterArray javaXMMParameterRegisters; + private final RegisterArray nativeXMMParameterRegisters; + private final boolean windowsOS; + + /* + * Some ABIs (e.g. Windows) require a so-called "home space", that is a save area on the stack + * to store the argument registers + */ + private final boolean needsNativeStackHomeSpace; + + private static final RegisterArray reservedRegisters = new RegisterArray(rsp, r15); + + private static RegisterArray initAllocatable(Architecture arch, boolean reserveForHeapBase) { + RegisterArray allRegisters = arch.getAvailableValueRegisters(); + Register[] registers = new Register[allRegisters.size() - reservedRegisters.size() - (reserveForHeapBase ? 1 : 0)]; + List reservedRegistersList = reservedRegisters.asList(); + + int idx = 0; + for (Register reg : allRegisters) { + if (reservedRegistersList.contains(reg)) { + // skip reserved registers + continue; + } + if (reserveForHeapBase && reg.equals(r12)) { + // skip heap base register + continue; + } + + registers[idx++] = reg; + } + + assert idx == registers.length; + return new RegisterArray(registers); + } + + public AMD64HotSpotRegisterConfig(TargetDescription target, boolean useCompressedOops, boolean windowsOs) { + this(target, initAllocatable(target.arch, useCompressedOops), windowsOs); + assert callerSaved.size() >= allocatable.size(); + } + + public AMD64HotSpotRegisterConfig(TargetDescription target, RegisterArray allocatable, boolean windowsOS) { + this.target = target; + this.windowsOS = windowsOS; + + if (windowsOS) { + javaGeneralParameterRegisters = new RegisterArray(rdx, r8, r9, rdi, rsi, rcx); + nativeGeneralParameterRegisters = new RegisterArray(rcx, rdx, r8, r9); + nativeXMMParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3); + this.needsNativeStackHomeSpace = true; + } else { + javaGeneralParameterRegisters = new RegisterArray(rsi, rdx, rcx, r8, r9, rdi); + nativeGeneralParameterRegisters = new RegisterArray(rdi, rsi, rdx, rcx, r8, r9); + nativeXMMParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7); + this.needsNativeStackHomeSpace = false; + } + javaXMMParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7); + + this.allocatable = allocatable; + Set callerSaveSet = new HashSet<>(); + allocatable.addTo(callerSaveSet); + javaXMMParameterRegisters.addTo(callerSaveSet); + callerSaveSet.addAll(javaGeneralParameterRegisters.asList()); + nativeGeneralParameterRegisters.addTo(callerSaveSet); + callerSaved = new RegisterArray(callerSaveSet); + + allAllocatableAreCallerSaved = true; + attributesMap = RegisterAttributes.createMap(this, target.arch.getRegisters()); + } + + @Override + public RegisterArray getCallerSaveRegisters() { + return callerSaved; + } + + @Override + public RegisterArray getCalleeSaveRegisters() { + return null; + } + + @Override + public boolean areAllAllocatableRegistersCallerSaved() { + return allAllocatableAreCallerSaved; + } + + @Override + public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, ValueKindFactory valueKindFactory) { + HotSpotCallingConventionType hotspotType = (HotSpotCallingConventionType) type; + if (type == HotSpotCallingConventionType.NativeCall) { + return callingConvention(nativeGeneralParameterRegisters, nativeXMMParameterRegisters, windowsOS, returnType, parameterTypes, hotspotType, valueKindFactory); + } + // On x64, parameter locations are the same whether viewed + // from the caller or callee perspective + return callingConvention(javaGeneralParameterRegisters, javaXMMParameterRegisters, false, returnType, parameterTypes, hotspotType, valueKindFactory); + } + + @Override + public RegisterArray getCallingConventionRegisters(Type type, JavaKind kind) { + HotSpotCallingConventionType hotspotType = (HotSpotCallingConventionType) type; + switch (kind) { + case Boolean: + case Byte: + case Short: + case Char: + case Int: + case Long: + case Object: + return hotspotType == HotSpotCallingConventionType.NativeCall ? nativeGeneralParameterRegisters : javaGeneralParameterRegisters; + case Float: + case Double: + return hotspotType == HotSpotCallingConventionType.NativeCall ? nativeXMMParameterRegisters : javaXMMParameterRegisters; + default: + throw JVMCIError.shouldNotReachHere(); + } + } + + /** + * Hand out registers matching the calling convention from the {@code generalParameterRegisters} + * and {@code xmmParameterRegisters} sets. Normally registers are handed out from each set + * individually based on the type of the argument. If the {@code unified} flag is true then hand + * out registers in a single sequence, selecting between the sets based on the type. This is to + * support the Windows calling convention which only ever passes 4 arguments in registers, no + * matter their types. + * + * @param generalParameterRegisters + * @param xmmParameterRegisters + * @param unified + * @param returnType + * @param parameterTypes + * @param type + * @param valueKindFactory + * @return the resulting calling convention + */ + private CallingConvention callingConvention(RegisterArray generalParameterRegisters, RegisterArray xmmParameterRegisters, boolean unified, JavaType returnType, JavaType[] parameterTypes, + HotSpotCallingConventionType type, + ValueKindFactory valueKindFactory) { + assert !unified || generalParameterRegisters.size() == xmmParameterRegisters.size() : "must be same size in unified mode"; + AllocatableValue[] locations = new AllocatableValue[parameterTypes.length]; + + int currentGeneral = 0; + int currentXMM = 0; + int currentStackOffset = type == HotSpotCallingConventionType.NativeCall && needsNativeStackHomeSpace ? generalParameterRegisters.size() * target.wordSize : 0; + + for (int i = 0; i < parameterTypes.length; i++) { + final JavaKind kind = parameterTypes[i].getJavaKind().getStackKind(); + + switch (kind) { + case Byte: + case Boolean: + case Short: + case Char: + case Int: + case Long: + case Object: + if (currentGeneral < generalParameterRegisters.size()) { + Register register = generalParameterRegisters.get(currentGeneral++); + locations[i] = register.asValue(valueKindFactory.getValueKind(kind)); + } + break; + case Float: + case Double: + if ((unified ? currentGeneral : currentXMM) < xmmParameterRegisters.size()) { + Register register = xmmParameterRegisters.get(unified ? currentGeneral++ : currentXMM++); + locations[i] = register.asValue(valueKindFactory.getValueKind(kind)); + } + break; + default: + throw JVMCIError.shouldNotReachHere(); + } + + if (locations[i] == null) { + ValueKind valueKind = valueKindFactory.getValueKind(kind); + locations[i] = StackSlot.get(valueKind, currentStackOffset, !type.out); + currentStackOffset += Math.max(valueKind.getPlatformKind().getSizeInBytes(), target.wordSize); + } + } + assert !unified || currentXMM == 0 : "shouldn't be used in unified mode"; + + JavaKind returnKind = returnType == null ? JavaKind.Void : returnType.getJavaKind(); + AllocatableValue returnLocation = returnKind == JavaKind.Void ? Value.ILLEGAL : getReturnRegister(returnKind).asValue(valueKindFactory.getValueKind(returnKind.getStackKind())); + return new CallingConvention(currentStackOffset, returnLocation, locations); + } + + @Override + public Register getReturnRegister(JavaKind kind) { + switch (kind) { + case Boolean: + case Byte: + case Char: + case Short: + case Int: + case Long: + case Object: + return rax; + case Float: + case Double: + return xmm0; + case Void: + case Illegal: + return null; + default: + throw new UnsupportedOperationException("no return register for type " + kind); + } + } + + @Override + public Register getFrameRegister() { + return rsp; + } + + @Override + public String toString() { + return String.format("Allocatable: " + getAllocatableRegisters() + "%n" + "CallerSave: " + getCallerSaveRegisters() + "%n"); + } +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotVMConfig.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotVMConfig.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot.amd64; + +import jdk.vm.ci.hotspot.HotSpotVMConfigAccess; +import jdk.vm.ci.hotspot.HotSpotVMConfigStore; + +class AMD64HotSpotVMConfig extends HotSpotVMConfigAccess { + + AMD64HotSpotVMConfig(HotSpotVMConfigStore config) { + super(config); + } + + final boolean windowsOs = System.getProperty("os.name", "").startsWith("Windows"); + + final boolean useCountLeadingZerosInstruction = getFlag("UseCountLeadingZerosInstruction", Boolean.class); + final boolean useCountTrailingZerosInstruction = getFlag("UseCountTrailingZerosInstruction", Boolean.class); + final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class); + + // CPU capabilities + final int useSSE = getFlag("UseSSE", Integer.class); + final int useAVX = getFlag("UseAVX", Integer.class); + + final long vmVersionFeatures = getFieldValue("Abstract_VM_Version::_features", Long.class, "uint64_t"); + + // CPU feature flags + final long amd64CX8 = getConstant("VM_Version::CPU_CX8", Long.class); + final long amd64CMOV = getConstant("VM_Version::CPU_CMOV", Long.class); + final long amd64FXSR = getConstant("VM_Version::CPU_FXSR", Long.class); + final long amd64HT = getConstant("VM_Version::CPU_HT", Long.class); + final long amd64MMX = getConstant("VM_Version::CPU_MMX", Long.class); + final long amd643DNOWPREFETCH = getConstant("VM_Version::CPU_3DNOW_PREFETCH", Long.class); + final long amd64SSE = getConstant("VM_Version::CPU_SSE", Long.class); + final long amd64SSE2 = getConstant("VM_Version::CPU_SSE2", Long.class); + final long amd64SSE3 = getConstant("VM_Version::CPU_SSE3", Long.class); + final long amd64SSSE3 = getConstant("VM_Version::CPU_SSSE3", Long.class); + final long amd64SSE4A = getConstant("VM_Version::CPU_SSE4A", Long.class); + final long amd64SSE41 = getConstant("VM_Version::CPU_SSE4_1", Long.class); + final long amd64SSE42 = getConstant("VM_Version::CPU_SSE4_2", Long.class); + final long amd64POPCNT = getConstant("VM_Version::CPU_POPCNT", Long.class); + final long amd64LZCNT = getConstant("VM_Version::CPU_LZCNT", Long.class); + final long amd64TSC = getConstant("VM_Version::CPU_TSC", Long.class); + final long amd64TSCINV = getConstant("VM_Version::CPU_TSCINV", Long.class); + final long amd64AVX = getConstant("VM_Version::CPU_AVX", Long.class); + final long amd64AVX2 = getConstant("VM_Version::CPU_AVX2", Long.class); + final long amd64AES = getConstant("VM_Version::CPU_AES", Long.class); + final long amd64ERMS = getConstant("VM_Version::CPU_ERMS", Long.class); + final long amd64CLMUL = getConstant("VM_Version::CPU_CLMUL", Long.class); + final long amd64BMI1 = getConstant("VM_Version::CPU_BMI1", Long.class); + final long amd64BMI2 = getConstant("VM_Version::CPU_BMI2", Long.class); + final long amd64RTM = getConstant("VM_Version::CPU_RTM", Long.class); + final long amd64ADX = getConstant("VM_Version::CPU_ADX", Long.class); + final long amd64AVX512F = getConstant("VM_Version::CPU_AVX512F", Long.class); + final long amd64AVX512DQ = getConstant("VM_Version::CPU_AVX512DQ", Long.class); + final long amd64AVX512PF = getConstant("VM_Version::CPU_AVX512PF", Long.class); + final long amd64AVX512ER = getConstant("VM_Version::CPU_AVX512ER", Long.class); + final long amd64AVX512CD = getConstant("VM_Version::CPU_AVX512CD", Long.class); + final long amd64AVX512BW = getConstant("VM_Version::CPU_AVX512BW", Long.class); + final long amd64AVX512VL = getConstant("VM_Version::CPU_AVX512VL", Long.class); + final long amd64SHA = getConstant("VM_Version::CPU_SHA", Long.class); + final long amd64FMA = getConstant("VM_Version::CPU_FMA", Long.class); +} diff -r 830e16e5eef5 -r d9f6bc6ba599 hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java Thu Aug 24 16:26:58 2017 +0200 @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot.sparc; + +import static jdk.vm.ci.common.InitTimer.timer; + +import java.util.EnumSet; + +import jdk.vm.ci.code.Architecture; +import jdk.vm.ci.code.RegisterConfig; +import jdk.vm.ci.code.TargetDescription; +import jdk.vm.ci.code.stack.StackIntrospection; +import jdk.vm.ci.common.InitTimer; +import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; +import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider; +import jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory; +import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider; +import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider; +import jdk.vm.ci.hotspot.HotSpotStackIntrospection; +import jdk.vm.ci.runtime.JVMCIBackend; +import jdk.vm.ci.sparc.SPARC; +import jdk.vm.ci.sparc.SPARC.CPUFeature; + +public class SPARCHotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory { + + protected TargetDescrip