-
Bug
-
Resolution: Not an Issue
-
P3
-
16
The AOT library must be built with the same UseEmptySlotsInSupers value as used at runtime, since AOT assumes that all field offsets are the same as at runtime. When a mismatched UseEmptySlotsInSupers is specified, AOT code can fail.
Here's a simple reproducer that fails with a fastdebug build from a recent openjdk repo:
==========================================================================================
# doit.sh
# Please edit the following two lines
export JAVA_HOME=/jdk/bld/fastdebug/images/jdk
export DEVKIT=/home/iklam/devkit/latest
# Gather the list of classes to compile
${JAVA_HOME}/bin/java -Xshare:off -verbose -version 2> /dev/null | grep class.load.*jrt..java.base \
| sed -e 's/.*class,load..//g' -e 's/ source.*//g' > classes.txt
# This takes about 160 seconds on a fast machine
if test ! -f test.so; then
time ${JAVA_HOME}/bin/jaotc \
--info \
-J-Xmx4g \
-J-server \
-J-ea \
-J-esa \
--compile-commands open/test/hotspot/jtreg/compiler/aot/scripts/java.base-list.txt \
--linker-path ${DEVKIT}/bin/ld \
--compile-with-assertions \
--output \
test.so \
--class-name $(cat classes.txt) | tee test.so.log
fi
echo "=== running with +UseEmptySlotsInSupers (OK)"
${JAVA_HOME}/bin/java -Xshare:off -ea -esa -XX:+UnlockExperimentalVMOptions -XX:AOTLibrary=$(pwd)/test.so -XX:+UseEmptySlotsInSupers -version
echo "=== running with -UseEmptySlotsInSupers (will get stuck)"
${JAVA_HOME}/bin/java -Xshare:off -ea -esa -XX:+UnlockExperimentalVMOptions -XX:AOTLibrary=$(pwd)/test.so -XX:-UseEmptySlotsInSupers -version
==========================================================================================
$ bash doit.sh
=== running with +UseEmptySlotsInSupers (OK)
java version "16-internal" 2021-03-16
Java(TM) SE Runtime Environment (fastdebug build 16-internal+0-adhoc.iklam.open)
Java HotSpot(TM) 64-Bit Server VM (fastdebug build 16-internal+0-adhoc.iklam.open, mixed mode, aot)
=== running with -UseEmptySlotsInSupers (will get stuck)
^C
Here's a simple reproducer that fails with a fastdebug build from a recent openjdk repo:
==========================================================================================
# doit.sh
# Please edit the following two lines
export JAVA_HOME=/jdk/bld/fastdebug/images/jdk
export DEVKIT=/home/iklam/devkit/latest
# Gather the list of classes to compile
${JAVA_HOME}/bin/java -Xshare:off -verbose -version 2> /dev/null | grep class.load.*jrt..java.base \
| sed -e 's/.*class,load..//g' -e 's/ source.*//g' > classes.txt
# This takes about 160 seconds on a fast machine
if test ! -f test.so; then
time ${JAVA_HOME}/bin/jaotc \
--info \
-J-Xmx4g \
-J-server \
-J-ea \
-J-esa \
--compile-commands open/test/hotspot/jtreg/compiler/aot/scripts/java.base-list.txt \
--linker-path ${DEVKIT}/bin/ld \
--compile-with-assertions \
--output \
test.so \
--class-name $(cat classes.txt) | tee test.so.log
fi
echo "=== running with +UseEmptySlotsInSupers (OK)"
${JAVA_HOME}/bin/java -Xshare:off -ea -esa -XX:+UnlockExperimentalVMOptions -XX:AOTLibrary=$(pwd)/test.so -XX:+UseEmptySlotsInSupers -version
echo "=== running with -UseEmptySlotsInSupers (will get stuck)"
${JAVA_HOME}/bin/java -Xshare:off -ea -esa -XX:+UnlockExperimentalVMOptions -XX:AOTLibrary=$(pwd)/test.so -XX:-UseEmptySlotsInSupers -version
==========================================================================================
$ bash doit.sh
=== running with +UseEmptySlotsInSupers (OK)
java version "16-internal" 2021-03-16
Java(TM) SE Runtime Environment (fastdebug build 16-internal+0-adhoc.iklam.open)
Java HotSpot(TM) 64-Bit Server VM (fastdebug build 16-internal+0-adhoc.iklam.open, mixed mode, aot)
=== running with -UseEmptySlotsInSupers (will get stuck)
^C