Skip to content

Commit

Permalink
8264805: Remove the experimental Ahead-of-Time Compiler
Browse files Browse the repository at this point in the history
Reviewed-by: coleenp, erikj, stefank, iignatyev, dholmes, aph, shade, iklam, mchung, iveresov
  • Loading branch information
Vladimir Kozlov committed Apr 27, 2021
1 parent 15d4787 commit 694aced
Show file tree
Hide file tree
Showing 378 changed files with 200 additions and 26,970 deletions.
124 changes: 7 additions & 117 deletions make/RunTests.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2016, 2021, 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 @@ -46,7 +46,7 @@ endif

$(eval $(call ParseKeywordVariable, TEST_OPTS, \
SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR JCOV JCOV_DIFF_CHANGESET, \
STRING_KEYWORDS := VM_OPTIONS JAVA_OPTIONS AOT_MODULES, \
STRING_KEYWORDS := VM_OPTIONS JAVA_OPTIONS, \
))

# Helper function to propagate TEST_OPTS values.
Expand Down Expand Up @@ -134,96 +134,6 @@ ifeq ($(GCOV_ENABLED), true)
JTREG_COV_OPTIONS += -e:GCOV_PREFIX="$(GCOV_OUTPUT_DIR)"
endif

################################################################################
# Optionally create AOT libraries for specified modules before running tests.
# Note, this could not be done during JDK build time.
################################################################################
# Parameter 1 is the name of the rule.
#
# Remaining parameters are named arguments.
# MODULE The module to generate a library for
# BIN Output directory in which to put the library
# VM_OPTIONS List of JVM arguments to use when creating library
# OPTIONS_VAR Name of variable to put AOT java options in
# PREREQS_VAR Name of variable to put all AOT prerequisite rule targets in
# for test rules to depend on
#
SetupAotModule = $(NamedParamsMacroTemplate)
define SetupAotModuleBody
$1_AOT_LIB := $$($1_BIN)/$$(call SHARED_LIBRARY,$$($1_MODULE))
$1_AOT_CCLIST := $$(wildcard $$(TOPDIR)/test/hotspot/jtreg/compiler/aot/scripts/$$($1_MODULE)-list.txt)

# Create jaotc flags.
# VM flags which don't affect AOT code generation are filtered out:
# -Xcomp, -XX:+-TieredCompilation
$1_JAOTC_OPTS := \
-J-Xmx4g --info \
$$(addprefix -J, $$(filter-out -Xcomp %TieredCompilation, $$($1_VM_OPTIONS))) \
$$(addprefix --compile-commands$(SPACE), $$($1_AOT_CCLIST)) \
--linker-path $$(LD_JAOTC) \
#

ifneq ($$(filter -ea, $$($1_VM_OPTIONS)), )
$1_JAOTC_OPTS += --compile-with-assertions
endif

ifneq ($$(filter -XX:+VerifyOops, $$($1_VM_OPTIONS)), )
$1_JAOTC_OPTS += -J-Dgraal.AOTVerifyOops=true
endif

$$($1_AOT_LIB): $$(JDK_UNDER_TEST)/release \
$$(call DependOnVariable, $1_JAOTC_OPTS) \
$$(call DependOnVariable, JDK_UNDER_TEST)
$$(call LogWarn, Generating $$(patsubst $$(OUTPUTDIR)/%, %, $$@))
$$(call MakeTargetDir)
$$(call ExecuteWithLog, $$@, \
$((COV_ENVIRONMENT) \
$$(FIXPATH) $$(JDK_UNDER_TEST)/bin/jaotc \
$$($1_JAOTC_OPTS) --output $$@ --module $$($1_MODULE) \
)
$$(call ExecuteWithLog, $$@.check, ( \
$$(FIXPATH) $$(JDK_UNDER_TEST)/bin/java \
$$($1_VM_OPTIONS) -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions \
-XX:+PrintAOT -XX:+UseAOTStrictLoading \
-XX:AOTLibrary=$$@ -version \
> $$@.verify-aot \
))

$1_AOT_OPTIONS += -XX:+UnlockExperimentalVMOptions
$1_AOT_OPTIONS += -XX:AOTLibrary=$$($1_AOT_LIB)
$1_AOT_TARGETS += $$($1_AOT_LIB)
endef

################################################################################
# Optionally create AOT libraries before running tests.
# Note, this could not be done during JDK build time.
################################################################################
# Parameter 1 is the name of the rule.
#
# Remaining parameters are named arguments.
# MODULES The modules to generate a library for
# VM_OPTIONS List of JVM arguments to use when creating libraries
#
# After calling this, the following variables are defined
# $1_AOT_OPTIONS List of all java options needed to use the AOT libraries
# $1_AOT_TARGETS List of all targets that the test rule will need to depend on
#
SetupAot = $(NamedParamsMacroTemplate)
define SetupAotBody
$$(info Running with AOTd libraries for $$($1_MODULES))
# Put aot libraries in a separate directory so they are not deleted between
# test runs and may be reused between make invocations.
$$(foreach m, $$($1_MODULES), \
$$(eval $$(call SetupAotModule, $1_$$m, \
MODULE := $$m, \
BIN := $$(TEST_SUPPORT_DIR)/aot/$1, \
VM_OPTIONS := $$($1_VM_OPTIONS), \
)) \
$$(eval $1_AOT_OPTIONS += $$($1_$$m_AOT_OPTIONS)) \
$$(eval $1_AOT_TARGETS += $$($1_$$m_AOT_TARGETS)) \
)
endef

################################################################################
# Setup global test running parameters
################################################################################
Expand Down Expand Up @@ -282,7 +192,6 @@ endif

$(eval $(call SetTestOpt,VM_OPTIONS,JTREG))
$(eval $(call SetTestOpt,JAVA_OPTIONS,JTREG))
$(eval $(call SetTestOpt,AOT_MODULES,JTREG))

$(eval $(call SetTestOpt,JOBS,JTREG))
$(eval $(call SetTestOpt,TIMEOUT_FACTOR,JTREG))
Expand All @@ -293,7 +202,7 @@ $(eval $(call ParseKeywordVariable, JTREG, \
TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM RUN_PROBLEM_LISTS \
RETRY_COUNT MAX_OUTPUT, \
STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS KEYWORDS \
EXTRA_PROBLEM_LISTS AOT_MODULES LAUNCHER_OPTIONS, \
EXTRA_PROBLEM_LISTS LAUNCHER_OPTIONS, \
))

ifneq ($(JTREG), )
Expand All @@ -305,11 +214,10 @@ endif

$(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
$(eval $(call SetTestOpt,JAVA_OPTIONS,GTEST))
$(eval $(call SetTestOpt,AOT_MODULES,GTEST))

$(eval $(call ParseKeywordVariable, GTEST, \
SINGLE_KEYWORDS := REPEAT, \
STRING_KEYWORDS := OPTIONS VM_OPTIONS JAVA_OPTIONS AOT_MODULES, \
STRING_KEYWORDS := OPTIONS VM_OPTIONS JAVA_OPTIONS, \
))

ifneq ($(GTEST), )
Expand Down Expand Up @@ -592,14 +500,7 @@ define SetupRunGtestTestBody
$1_GTEST_REPEAT :=--gtest_repeat=$$(GTEST_REPEAT)
endif

ifneq ($$(GTEST_AOT_MODULES), )
$$(eval $$(call SetupAot, $1, \
MODULES := $$(GTEST_AOT_MODULES), \
VM_OPTIONS := $$(GTEST_VM_OPTIONS) $$(GTEST_JAVA_OPTIONS), \
))
endif

run-test-$1: pre-run-test $$($1_AOT_TARGETS)
run-test-$1: pre-run-test
$$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
Expand All @@ -610,7 +511,7 @@ define SetupRunGtestTestBody
--gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
--gtest_catch_exceptions=0 \
$$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \
$$(GTEST_JAVA_OPTIONS) $$($1_AOT_OPTIONS) \
$$(GTEST_JAVA_OPTIONS) \
> >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \
&& $$(ECHO) $$$$? > $$($1_EXITCODE) \
|| $$(ECHO) $$$$? > $$($1_EXITCODE) \
Expand Down Expand Up @@ -934,17 +835,6 @@ define SetupRunJtregTestBody
endif
endif

ifneq ($$(JTREG_AOT_MODULES), )
$$(eval $$(call SetupAot, $1, \
MODULES := $$(JTREG_AOT_MODULES), \
VM_OPTIONS := $$(JTREG_VM_OPTIONS) $$(JTREG_JAVA_OPTIONS), \
))
endif

ifneq ($$($1_AOT_OPTIONS), )
$1_JTREG_BASIC_OPTIONS += -vmoptions:"$$($1_AOT_OPTIONS)"
endif

clean-workdir-$1:
$$(RM) -r $$($1_TEST_SUPPORT_DIR)

Expand Down Expand Up @@ -979,7 +869,7 @@ define SetupRunJtregTestBody
done
endif

run-test-$1: pre-run-test clean-workdir-$1 $$($1_AOT_TARGETS)
run-test-$1: pre-run-test clean-workdir-$1
$$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR) \
Expand Down
24 changes: 1 addition & 23 deletions make/RunTestsPrebuilt.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2017, 2021, 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 @@ -222,25 +222,6 @@ ifeq ($(MEMORY_SIZE), )
MEMORY_SIZE := 1024
endif

# Setup LD for AOT support
ifneq ($(DEVKIT_HOME), )
ifeq ($(OPENJDK_TARGET_OS), windows)
LD_JAOTC := $(DEVKIT_HOME)/VC/bin/x64/link.exe
LIBRARY_PREFIX :=
SHARED_LIBRARY_SUFFIX := .dll
else ifeq ($(OPENJDK_TARGET_OS), linux)
LD_JAOTC := $(DEVKIT_HOME)/bin/ld
LIBRARY_PREFIX := lib
SHARED_LIBRARY_SUFFIX := .so
else ifeq ($(OPENJDK_TARGET_OS), macosx)
LD_JAOTC := $(DEVKIT_HOME)/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
LIBRARY_PREFIX := lib
SHARED_LIBRARY_SUFFIX := .dylib
endif
else
LD := ld
endif

ifneq ($(wildcard $(JDK_IMAGE_DIR)/template.xml), )
TEST_OPTS_JCOV := true
JCOV_IMAGE_DIR := $(JDK_IMAGE_DIR)
Expand Down Expand Up @@ -286,9 +267,6 @@ $(call CreateNewSpec, $(NEW_SPEC), \
OPENJDK_TARGET_CPU_ENDIAN := $(OPENJDK_TARGET_CPU_ENDIAN), \
NUM_CORES := $(NUM_CORES), \
MEMORY_SIZE := $(MEMORY_SIZE), \
LD_JAOTC := $(LD_JAOTC), \
LIBRARY_PREFIX := $(LIBRARY_PREFIX), \
SHARED_LIBRARY_SUFFIX := $(SHARED_LIBRARY_SUFFIX), \
include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \
TEST_OPTS_JCOV := $(TEST_OPTS_JCOV), \
$(CUSTOM_NEW_SPEC_LINE), \
Expand Down
50 changes: 5 additions & 45 deletions make/autoconf/jvm-features.m4
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
m4_define(jvm_features_valid, m4_normalize( \
ifdef([custom_jvm_features_valid], custom_jvm_features_valid) \
\
aot cds compiler1 compiler2 dtrace epsilongc g1gc graal jfr jni-check \
cds compiler1 compiler2 dtrace epsilongc g1gc graal jfr jni-check \
jvmci jvmti link-time-opt management minimal nmt opt-size parallelgc \
serialgc services shenandoahgc static-build vm-structs zero zgc \
))
Expand All @@ -55,7 +55,6 @@ m4_define(jvm_features_deprecated, m4_normalize(
))

# Feature descriptions
m4_define(jvm_feature_desc_aot, [enable ahead of time compilation (AOT)])
m4_define(jvm_feature_desc_cds, [enable class data sharing (CDS)])
m4_define(jvm_feature_desc_compiler1, [enable hotspot compiler C1])
m4_define(jvm_feature_desc_compiler2, [enable hotspot compiler C2])
Expand Down Expand Up @@ -94,7 +93,6 @@ AC_DEFUN_ONCE([JVM_FEATURES_PARSE_OPTIONS],
# For historical reasons, some jvm features have their own, shorter names.
# Keep those as aliases for the --enable-jvm-feature-* style arguments.
UTIL_ALIASED_ARG_ENABLE(aot, --enable-jvm-feature-aot)
UTIL_ALIASED_ARG_ENABLE(cds, --enable-jvm-feature-cds)
UTIL_ALIASED_ARG_ENABLE(dtrace, --enable-jvm-feature-dtrace)
Expand Down Expand Up @@ -229,34 +227,6 @@ AC_DEFUN([JVM_FEATURES_CHECK_AVAILABILITY],
fi
])

###############################################################################
# Check if the feature 'aot' is available on this platform.
#
AC_DEFUN_ONCE([JVM_FEATURES_CHECK_AOT],
[
JVM_FEATURES_CHECK_AVAILABILITY(aot, [
AC_MSG_CHECKING([if platform is supported by AOT])
# AOT is only available where JVMCI is available since it requires JVMCI.
if test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
AC_MSG_RESULT([yes])
elif test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = "xlinux-aarch64"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
AVAILABLE=false
fi
AC_MSG_CHECKING([if AOT source code is present])
if test -e "${TOPDIR}/src/jdk.internal.vm.compiler" && \
test -e "${TOPDIR}/src/jdk.aot"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no, missing src/jdk.internal.vm.compiler or src/jdk.aot])
AVAILABLE=false
fi
])
])

###############################################################################
# Check if the feature 'cds' is available on this platform.
#
Expand Down Expand Up @@ -440,7 +410,6 @@ AC_DEFUN_ONCE([JVM_FEATURES_PREPARE_PLATFORM],
# The checks below should add unavailable features to
# JVM_FEATURES_PLATFORM_UNAVAILABLE.
JVM_FEATURES_CHECK_AOT
JVM_FEATURES_CHECK_CDS
JVM_FEATURES_CHECK_DTRACE
JVM_FEATURES_CHECK_GRAAL
Expand Down Expand Up @@ -476,17 +445,17 @@ AC_DEFUN([JVM_FEATURES_PREPARE_VARIANT],
elif test "x$variant" = "xcore"; then
JVM_FEATURES_VARIANT_UNAVAILABLE="cds minimal zero"
elif test "x$variant" = "xzero"; then
JVM_FEATURES_VARIANT_UNAVAILABLE="aot cds compiler1 compiler2 \
JVM_FEATURES_VARIANT_UNAVAILABLE="cds compiler1 compiler2 \
graal jvmci minimal zgc"
else
JVM_FEATURES_VARIANT_UNAVAILABLE="minimal zero"
fi
# Check which features should be off by default for this JVM variant.
if test "x$variant" = "xclient"; then
JVM_FEATURES_VARIANT_FILTER="aot compiler2 graal jvmci link-time-opt opt-size"
JVM_FEATURES_VARIANT_FILTER="compiler2 graal jvmci link-time-opt opt-size"
elif test "x$variant" = "xminimal"; then
JVM_FEATURES_VARIANT_FILTER="aot cds compiler2 dtrace epsilongc g1gc \
JVM_FEATURES_VARIANT_FILTER="cds compiler2 dtrace epsilongc g1gc \
graal jfr jni-check jvmci jvmti management nmt parallelgc services \
shenandoahgc vm-structs zgc"
if test "x$OPENJDK_TARGET_CPU" = xarm ; then
Expand All @@ -497,7 +466,7 @@ AC_DEFUN([JVM_FEATURES_PREPARE_VARIANT],
link-time-opt"
fi
elif test "x$variant" = "xcore"; then
JVM_FEATURES_VARIANT_FILTER="aot compiler1 compiler2 graal jvmci \
JVM_FEATURES_VARIANT_FILTER="compiler1 compiler2 graal jvmci \
link-time-opt opt-size"
elif test "x$variant" = "xzero"; then
JVM_FEATURES_VARIANT_FILTER="jfr link-time-opt opt-size"
Expand Down Expand Up @@ -574,10 +543,6 @@ AC_DEFUN([JVM_FEATURES_VERIFY],
variant=$1
# Verify that dependencies are met for inter-feature relations.
if JVM_FEATURES_IS_ACTIVE(aot) && ! JVM_FEATURES_IS_ACTIVE(graal); then
AC_MSG_ERROR([Specified JVM feature 'aot' requires feature 'graal' for variant '$variant'])
fi
if JVM_FEATURES_IS_ACTIVE(graal) && ! JVM_FEATURES_IS_ACTIVE(jvmci); then
AC_MSG_ERROR([Specified JVM feature 'graal' requires feature 'jvmci' for variant '$variant'])
fi
Expand All @@ -597,9 +562,6 @@ AC_DEFUN([JVM_FEATURES_VERIFY],
# For backwards compatibility, disable a feature "globally" if one variant
# is missing the feature.
if ! JVM_FEATURES_IS_ACTIVE(aot); then
ENABLE_AOT="false"
fi
if ! JVM_FEATURES_IS_ACTIVE(cds); then
ENABLE_CDS="false"
fi
Expand Down Expand Up @@ -630,7 +592,6 @@ AC_DEFUN_ONCE([JVM_FEATURES_SETUP],
# For backwards compatibility, tentatively enable these features "globally",
# and disable them in JVM_FEATURES_VERIFY if a variant is found that are
# missing any of them.
ENABLE_AOT="true"
ENABLE_CDS="true"
INCLUDE_GRAAL="true"
INCLUDE_JVMCI="true"
Expand Down Expand Up @@ -669,7 +630,6 @@ AC_DEFUN_ONCE([JVM_FEATURES_SETUP],
AC_SUBST(JVM_FEATURES_zero)
AC_SUBST(JVM_FEATURES_custom)
AC_SUBST(ENABLE_AOT)
AC_SUBST(INCLUDE_GRAAL)
AC_SUBST(INCLUDE_JVMCI)
Expand Down
4 changes: 0 additions & 4 deletions make/autoconf/spec.gmk.in
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,6 @@ CPP := @CPP@
# The linker can be gcc or ld on unix systems, or link.exe on windows systems.
LD := @LD@

# Linker used by the jaotc tool for AOT compilation.
LD_JAOTC:=@LD_JAOTC@

# Xcode SDK path
SDKROOT:=@SDKROOT@

Expand Down Expand Up @@ -766,7 +763,6 @@ TAR_INCLUDE_PARAM:=@TAR_INCLUDE_PARAM@
TAR_SUPPORTS_TRANSFORM:=@TAR_SUPPORTS_TRANSFORM@

# Build setup
ENABLE_AOT:=@ENABLE_AOT@
USE_EXTERNAL_LIBJPEG:=@USE_EXTERNAL_LIBJPEG@
USE_EXTERNAL_LIBGIF:=@USE_EXTERNAL_LIBGIF@
USE_EXTERNAL_LIBZ:=@USE_EXTERNAL_LIBZ@
Expand Down
Loading

1 comment on commit 694aced

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.