Skip to content

Commit

Permalink
Merge branch 'master' of https://git.openjdk.java.net/jdk into JDK-82…
Browse files Browse the repository at this point in the history
…55150
  • Loading branch information
rwestrel committed Nov 13, 2020
2 parents e3887a7 + b4d0186 commit 90493e6
Show file tree
Hide file tree
Showing 456 changed files with 15,594 additions and 9,340 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/dist/
/.idea/
/.vscode/
/nbproject/
nbproject/private/
/webrev
/.src-rev
Expand Down
37 changes: 23 additions & 14 deletions doc/building.html
Original file line number Diff line number Diff line change
Expand Up @@ -629,21 +629,30 @@ <h3 id="creating-and-using-sysroots-with-qemu-deboostrap">Creating And Using Sys
<p>Fortunately, you can create sysroots for foreign architectures with tools provided by your OS. On Debian/Ubuntu systems, one could use <code>qemu-deboostrap</code> to create the <em>target</em> system chroot, which would have the native libraries and headers specific to that <em>target</em> system. After that, we can use the cross-compiler on the <em>build</em> system, pointing into chroot to get the build dependencies right. This allows building for foreign architectures with native compilation speed.</p>
<p>For example, cross-compiling to AArch64 from x86_64 could be done like this:</p>
<ul>
<li>Install cross-compiler on the <em>build</em> system:</li>
</ul>
<pre><code>apt install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu</code></pre>
<ul>
<li>Create chroot on the <em>build</em> system, configuring it for <em>target</em> system:</li>
</ul>
<pre><code>sudo qemu-debootstrap --arch=arm64 --verbose \
--include=fakeroot,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng12-dev \
--resolve-deps jessie /chroots/arm64 http://httpredir.debian.org/debian/</code></pre>
<ul>
<li>Configure and build with newly created chroot as sysroot/toolchain-path:</li>
</ul>
<pre><code>CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ sh ./configure --openjdk-target=aarch64-linux-gnu --with-sysroot=/chroots/arm64/ --with-toolchain-path=/chroots/arm64/
<li><p>Install cross-compiler on the <em>build</em> system:</p>
<pre><code>apt install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu</code></pre></li>
<li><p>Create chroot on the <em>build</em> system, configuring it for <em>target</em> system:</p>
<pre><code>sudo qemu-debootstrap \
--arch=arm64 \
--verbose \
--include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev \
--resolve-deps \
buster \
~/sysroot-arm64 \
http://httpredir.debian.org/debian/</code></pre></li>
<li><p>Make sure the symlinks inside the newly created chroot point to proper locations:</p>
<pre><code>sudo chroot ~/sysroot-arm64 symlinks -cr .</code></pre></li>
<li><p>Configure and build with newly created chroot as sysroot/toolchain-path:</p>
<pre><code>CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ sh ./configure \
--openjdk-target=aarch64-linux-gnu \
--with-sysroot=~/sysroot-arm64 \
--with-toolchain-path=~/sysroot-arm64 \
--with-freetype-lib=~/sysroot-arm64/usr/lib/aarch64-linux-gnu/ \
--with-freetype-include=~/sysroot-arm64/usr/include/freetype2/ \
--x-libraries=~/sysroot-arm64/usr/lib/aarch64-linux-gnu/
make images
ls build/linux-aarch64-normal-server-release/</code></pre>
ls build/linux-aarch64-server-release/</code></pre></li>
</ul>
<p>The build does not create new files in that chroot, so it can be reused for multiple builds without additional cleanup.</p>
<p>Architectures that are known to successfully cross-compile like this are:</p>
<table>
Expand Down
42 changes: 29 additions & 13 deletions doc/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -1086,23 +1086,39 @@ for foreign architectures with native compilation speed.
For example, cross-compiling to AArch64 from x86_64 could be done like this:

* Install cross-compiler on the *build* system:
```
apt install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
```
```
apt install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
```

* Create chroot on the *build* system, configuring it for *target* system:
```
sudo qemu-debootstrap --arch=arm64 --verbose \
--include=fakeroot,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng12-dev \
--resolve-deps jessie /chroots/arm64 http://httpredir.debian.org/debian/
```
```
sudo qemu-debootstrap \
--arch=arm64 \
--verbose \
--include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev \
--resolve-deps \
buster \
~/sysroot-arm64 \
http://httpredir.debian.org/debian/
```

* Make sure the symlinks inside the newly created chroot point to proper locations:
```
sudo chroot ~/sysroot-arm64 symlinks -cr .
```

* Configure and build with newly created chroot as sysroot/toolchain-path:
```
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ sh ./configure --openjdk-target=aarch64-linux-gnu --with-sysroot=/chroots/arm64/ --with-toolchain-path=/chroots/arm64/
make images
ls build/linux-aarch64-normal-server-release/
```
```
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ sh ./configure \
--openjdk-target=aarch64-linux-gnu \
--with-sysroot=~/sysroot-arm64 \
--with-toolchain-path=~/sysroot-arm64 \
--with-freetype-lib=~/sysroot-arm64/usr/lib/aarch64-linux-gnu/ \
--with-freetype-include=~/sysroot-arm64/usr/include/freetype2/ \
--x-libraries=~/sysroot-arm64/usr/lib/aarch64-linux-gnu/
make images
ls build/linux-aarch64-server-release/
```

The build does not create new files in that chroot, so it can be reused for multiple builds
without additional cleanup.
Expand Down
9 changes: 6 additions & 3 deletions make/autoconf/configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 2020, 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
Expand Down Expand Up @@ -49,7 +49,7 @@ export LC_ALL=C
if test "x$CUSTOM_CONFIG_DIR" != x; then
custom_hook=$CUSTOM_CONFIG_DIR/custom-hook.m4
if test ! -e $custom_hook; then
echo "CUSTOM_CONFIG_DIR not pointing to a proper custom config dir."
echo "CUSTOM_CONFIG_DIR ($CUSTOM_CONFIG_DIR) not pointing to a proper custom config dir."
echo "Error: Cannot continue" 1>&2
exit 1
fi
Expand Down Expand Up @@ -83,6 +83,7 @@ autoconf_missing_help() {
BREW="`type -p brew 2> /dev/null`"
ZYPPER="`type -p zypper 2> /dev/null`"
CYGWIN="`type -p cygpath 2> /dev/null`"
UNAMEOUT="`uname 2> /dev/null`"

if test "x$ZYPPER" != x; then
PKGHANDLER_COMMAND="sudo zypper install autoconf"
Expand All @@ -92,6 +93,8 @@ autoconf_missing_help() {
PKGHANDLER_COMMAND="sudo yum install autoconf"
elif test "x$BREW" != x; then
PKGHANDLER_COMMAND="brew install autoconf"
elif test "x$UNAMEOUT" == xAIX; then
echo "You might be able to fix this by installing autoconf from the 'AIX Toolbox for Linux Applications' (or compile it from the sources)."
elif test "x$CYGWIN" != x; then
PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P autoconf )"
fi
Expand All @@ -114,7 +117,7 @@ generate_configure_script() {
AUTOCONF="`type -p autoconf 2> /dev/null`"
if test "x$AUTOCONF" = x; then
echo
echo "Autoconf is not found on the PATH, and AUTOCONF is not set."
echo "Autoconf is not found on the PATH ($PATH), and AUTOCONF is not set."
echo "You need autoconf to be able to generate a runnable configure script."
autoconf_missing_help
echo "Error: Cannot find autoconf" 1>&2
Expand Down
11 changes: 0 additions & 11 deletions make/hotspot/gensrc/GensrcJvmti.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,6 @@ $(eval $(call SetupJvmtiGeneration, jvmti.h, jvmtiH.xsl, \
$(eval $(call SetupJvmtiGeneration, jvmti.html, jvmti.xsl, \
-PARAM majorversion $(VERSION_FEATURE)))

JVMTI_BC_SRCDIR := $(TOPDIR)/src/hotspot/share/interpreter/zero

ifeq ($(call check-jvm-feature, zero), true)
$(eval $(call SetupXslTransform, bytecodeInterpreterWithChecks.cpp, \
XML_FILE := $(JVMTI_BC_SRCDIR)/bytecodeInterpreterWithChecks.xml, \
XSL_FILE := $(JVMTI_BC_SRCDIR)/bytecodeInterpreterWithChecks.xsl, \
OUTPUT_DIR := $(JVMTI_OUTPUTDIR), \
DEPS := $(JVMTI_BC_SRCDIR)/bytecodeInterpreter.cpp, \
))
endif

################################################################################
# Copy jvmti.h to include dir

Expand Down
1 change: 1 addition & 0 deletions make/modules/java.base/Gensrc.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ include gensrc/GensrcExceptions.gmk
include gensrc/GensrcVarHandles.gmk
include gensrc/GensrcModuleLoaderMap.gmk
include gensrc/GensrcEmojiData.gmk
include gensrc/GensrcScopedMemoryAccess.gmk

# GensrcLocaleData.gmk does not set TARGETS, so we must choose which targets
# to include.
Expand Down
151 changes: 151 additions & 0 deletions make/modules/java.base/gensrc/GensrcScopedMemoryAccess.gmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
#
# Copyright (c) 2020, 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.
#

SCOPED_MEMORY_ACCESS_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/misc
SCOPED_MEMORY_ACCESS_SRC_DIR := $(TOPDIR)/src/java.base/share/classes/jdk/internal/misc
SCOPED_MEMORY_ACCESS_TEMPLATE := $(SCOPED_MEMORY_ACCESS_SRC_DIR)/X-ScopedMemoryAccess.java.template
SCOPED_MEMORY_ACCESS_BIN_TEMPLATE := $(SCOPED_MEMORY_ACCESS_SRC_DIR)/X-ScopedMemoryAccess-bin.java.template
SCOPED_MEMORY_ACCESS_DEST := $(SCOPED_MEMORY_ACCESS_GENSRC_DIR)/ScopedMemoryAccess.java

################################################################################
# Setup a rule for generating the ScopedMemoryAccess java class
# Param 1 - Variable declaration prefix
# Param 2 - Type with first letter capitalized
define GenerateScopedOp

$1_Type := $2

ifeq ($$($1_Type), Byte)
$1_type := byte
$1_BoxType := $$($1_Type)

$1_rawType := $$($1_type)
$1_RawType := $$($1_Type)
$1_RawBoxType := $$($1_BoxType)

$1_ARGS += -Kbyte
endif

ifeq ($$($1_Type), Short)
$1_type := short
$1_BoxType := $$($1_Type)

$1_rawType := $$($1_type)
$1_RawType := $$($1_Type)
$1_RawBoxType := $$($1_BoxType)
$1_ARGS += -KUnaligned
endif

ifeq ($$($1_Type), Char)
$1_type := char
$1_BoxType := Character

$1_rawType := $$($1_type)
$1_RawType := $$($1_Type)
$1_RawBoxType := $$($1_BoxType)
$1_ARGS += -KUnaligned
endif

ifeq ($$($1_Type), Int)
$1_type := int
$1_BoxType := Integer

$1_rawType := $$($1_type)
$1_RawType := $$($1_Type)
$1_RawBoxType := $$($1_BoxType)

$1_ARGS += -KCAS
$1_ARGS += -KAtomicAdd
$1_ARGS += -KBitwise
$1_ARGS += -KUnaligned
endif

ifeq ($$($1_Type), Long)
$1_type := long
$1_BoxType := $$($1_Type)

$1_rawType := $$($1_type)
$1_RawType := $$($1_Type)
$1_RawBoxType := $$($1_BoxType)

$1_ARGS += -KCAS
$1_ARGS += -KAtomicAdd
$1_ARGS += -KBitwise
$1_ARGS += -KUnaligned
endif

ifeq ($$($1_Type), Float)
$1_type := float
$1_BoxType := $$($1_Type)

$1_rawType := int
$1_RawType := Int
$1_RawBoxType := Integer

$1_ARGS += -KCAS
$1_ARGS += -KfloatingPoint
endif

ifeq ($$($1_Type), Double)
$1_type := double
$1_BoxType := $$($1_Type)

$1_rawType := long
$1_RawType := Long
$1_RawBoxType := Long

$1_ARGS += -KCAS
$1_ARGS += -KfloatingPoint
endif

ifneq ($$(findstring $$($1_Type), Byte Short Char Int Long Float Double), )
$1_ARGS += -KAtomicAdd
endif

ifneq ($$(findstring $$($1_Type), Boolean Byte Short Char Int Long), )
$1_ARGS += -KBitwise
endif

ifneq ($$(findstring $$($1_Type), Byte Short Char), )
$1_ARGS += -KShorterThanInt
endif
endef

################################################################################
# Setup a rule for generating the ScopedMemoryAccess java class

SCOPE_MEMORY_ACCESS_TYPES := Byte Short Char Int Long Float Double
$(foreach t, $(SCOPE_MEMORY_ACCESS_TYPES), \
$(eval $(call GenerateScopedOp,BIN_$t,$t)))

$(SCOPED_MEMORY_ACCESS_DEST): $(BUILD_TOOLS_JDK) $(SCOPED_MEMORY_ACCESS_TEMPLATE) $(SCOPED_MEMORY_ACCESS_BIN_TEMPLATE)
$(call MakeDir, $(SCOPED_MEMORY_ACCESS_GENSRC_DIR))
$(CP) $(SCOPED_MEMORY_ACCESS_TEMPLATE) $(SCOPED_MEMORY_ACCESS_DEST)
$(foreach t, $(SCOPE_MEMORY_ACCESS_TYPES), \
$(TOOL_SPP) -nel -K$(BIN_$t_type) -Dtype=$(BIN_$t_type) -DType=$(BIN_$t_Type) $(BIN_$t_ARGS) \
-i$(SCOPED_MEMORY_ACCESS_BIN_TEMPLATE) -o$(SCOPED_MEMORY_ACCESS_DEST) ;)
$(PRINTF) "}\n" >> $(SCOPED_MEMORY_ACCESS_DEST)

TARGETS += $(SCOPED_MEMORY_ACCESS_DEST)
Loading

0 comments on commit 90493e6

Please sign in to comment.