diff --git a/make/RunTests.gmk b/make/RunTests.gmk index 7b661be775f..c5237da2c13 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -45,7 +45,7 @@ ifneq ($(TEST_VM_OPTS), ) endif $(eval $(call ParseKeywordVariable, TEST_OPTS, \ - SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR, \ + SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR AOT_MODULES, \ STRING_KEYWORDS := VM_OPTIONS JAVA_OPTIONS, \ )) @@ -107,6 +107,90 @@ endif GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher, %, $(wildcard $(TEST_IMAGE_DIR)/hotspot/gtest/*/gtestLauncher)) GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, $(GTEST_LAUNCHER_DIRS))) +################################################################################ +# Optionally create AOT libraries for specified modules before running tests. +# Note, this could not be done during JDK build time. +################################################################################ + +# 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) + + ifeq ($(OPENJDK_TARGET_OS), windows) + $1_LD := $$(addsuffix $$(EXE_SUFFIX), $$(filter-out $$(FIXPATH), $$(LD))) + else + $1_LD := $$(LD) + endif + + $1_JAOTC_OPTS := \ + -J-Xmx4g --info \ + $$(addprefix -J, $$($1_VM_OPTIONS)) \ + $$(addprefix --compile-commands$(SPACE), $$($1_AOT_CCLIST)) \ + --linker-path $$($1_LD) \ + # + + ifneq ($$(filter -ea, $$($1_VM_OPTIONS)), ) + $1_JAOTC_OPTS += --compile-with-assertions + endif + + $$($1_AOT_LIB): $$(JDK_IMAGE_DIR)/release \ + $$(call DependOnVariable, $1_JAOTC_OPTS) \ + $$(call DependOnVariable, JDK_IMAGE_DIR) + $$(call LogWarn, Generating $$(patsubst $$(OUTPUTDIR)/%, %, $$@)) + $$(call MakeTargetDir) + $$(call ExecuteWithLog, $$@, \ + $$(FIXPATH) $$(JDK_IMAGE_DIR)/bin/jaotc \ + $$($1_JAOTC_OPTS) --output $$@ --module $$($1_MODULE) \ + ) + $$(call ExecuteWithLog, $$@.check, \ + $$(FIXPATH) $$(JDK_IMAGE_DIR)/bin/java \ + $$($1_VM_OPTIONS) -XX:+PrintAOT -XX:+UseAOTStrictLoading -XX:AOTLibrary=$$@ -version \ + > $$@.verify-aot \ + ) + + $1_AOT_OPTIONS += -XX:AOTLibrary=$$($1_AOT_LIB) + $1_AOT_TARGETS += $$($1_AOT_LIB) +endef + +# 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 ################################################################################ @@ -146,12 +230,15 @@ $(eval $(call SetTestOpt,JAVA_OPTIONS,JTREG)) $(eval $(call SetTestOpt,VM_OPTIONS,GTEST)) $(eval $(call SetTestOpt,JAVA_OPTIONS,GTEST)) +$(eval $(call SetTestOpt,AOT_MODULES,JTREG)) +$(eval $(call SetTestOpt,AOT_MODULES,GTEST)) + $(eval $(call SetTestOpt,JOBS,JTREG)) $(eval $(call SetTestOpt,TIMEOUT_FACTOR,JTREG)) $(eval $(call ParseKeywordVariable, JTREG, \ SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM \ - EXTRA_PROBLEM_LISTS KEYWORDS, \ + EXTRA_PROBLEM_LISTS KEYWORDS AOT_MODULES, \ STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS, \ )) @@ -161,7 +248,7 @@ ifneq ($(JTREG), ) endif $(eval $(call ParseKeywordVariable, GTEST, \ - SINGLE_KEYWORDS := REPEAT, \ + SINGLE_KEYWORDS := REPEAT AOT_MODULES, \ STRING_KEYWORDS := OPTIONS VM_OPTIONS JAVA_OPTIONS, \ )) @@ -407,7 +494,14 @@ define SetupRunGtestTestBody $1_GTEST_REPEAT :=--gtest_repeat=$$(GTEST_REPEAT) endif - run-test-$1: $(TEST_PREREQS) + ifneq ($$(GTEST_AOT_MODULES), ) + $$(eval $$(call SetupAot, $1, \ + MODULES := $$(GTEST_AOT_MODULES), \ + VM_OPTIONS := $$(GTEST_VM_OPTIONS) $$(GTEST_JAVA_OPTIONS), \ + )) + endif + + run-test-$1: $$($1_AOT_TARGETS) $$(call LogWarn) $$(call LogWarn, Running test '$$($1_TEST)') $$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR)) @@ -416,7 +510,7 @@ define SetupRunGtestTestBody -jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \ --gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \ $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \ - $$($1_GTEST_JAVA_OPTIONS) \ + $$(GTEST_JAVA_OPTIONS) $$($1_AOT_OPTIONS) \ > >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \ && $$(ECHO) $$$$? > $$($1_EXITCODE) \ || $$(ECHO) $$$$? > $$($1_EXITCODE) \ @@ -600,10 +694,21 @@ 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) - run-test-$1: clean-workdir-$1 $(TEST_PREREQS) + run-test-$1: clean-workdir-$1 $$($1_AOT_TARGETS) $$(call LogWarn) $$(call LogWarn, Running test '$$($1_TEST)') $$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR)) diff --git a/make/RunTestsPrebuilt.gmk b/make/RunTestsPrebuilt.gmk index ff9e8be1dc7..689e85b858f 100644 --- a/make/RunTestsPrebuilt.gmk +++ b/make/RunTestsPrebuilt.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2018, 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 @@ -95,12 +95,12 @@ endef # $1: The output file name # $2..$N: The lines to output to the file define CreateNewSpec - $(if $(strip $(26)), \ + $(if $(strip $(30)), \ $(error Internal makefile error: \ Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \ ) \ $(shell $(RM) $1) \ - $(foreach i, $(call sequence, 2, 25), \ + $(foreach i, $(call sequence, 2, 29), \ $(if $(strip $($i)), \ $(call AppendFile, $(strip $($i)), $1) \ ) \ @@ -235,6 +235,34 @@ ifeq ($(NUM_CORES), ) NUM_CORES := 1 endif +# Setup LD for AOT support +ifneq ($(DEVKIT_HOME), ) + ifeq ($(OPENJDK_TARGET_OS), windows) + LD := $(DEVKIT_HOME)/VC/bin/x64/link + LIBRARY_PREFIX := + SHARED_LIBRARY_SUFFIX := .dll + EXE_SUFFIX := .exe + else ifeq ($(OPENJDK_TARGET_OS), linux) + LD := $(DEVKIT_HOME)/bin/ld + LIBRARY_PREFIX := lib + SHARED_LIBRARY_SUFFIX := .so + EXE_SUFFIX := + else ifeq ($(OPENJDK_TARGET_OS), macosx) + LD := $(DEVKIT_HOME)/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld + LIBRARY_PREFIX := lib + SHARED_LIBRARY_SUFFIX := .dylib + EXE_SUFFIX := + else ifeq ($(OPENJDK_TARGET_OS), solaris) + # Prefer system linker for AOT on Solaris. + LD := ld + LIBRARY_PREFIX := lib + SHARED_LIBRARY_SUFFIX := .so + EXE_SUFFIX := + endif +else + LD := ld +endif + ################################################################################ # Generate the ephemeral spec file ################################################################################ @@ -270,6 +298,10 @@ $(call CreateNewSpec, $(NEW_SPEC), \ OPENJDK_TARGET_CPU_BITS := $(OPENJDK_TARGET_CPU_BITS), \ OPENJDK_TARGET_CPU_ENDIAN := $(OPENJDK_TARGET_CPU_ENDIAN), \ NUM_CORES := $(NUM_CORES), \ + LD := $(LD), \ + LIBRARY_PREFIX := $(LIBRARY_PREFIX), \ + SHARED_LIBRARY_SUFFIX := $(SHARED_LIBRARY_SUFFIX), \ + EXE_SUFFIX := $(EXE_SUFFIX), \ include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \ $(CUSTOM_NEW_SPEC_LINE), \ ) diff --git a/make/RunTestsPrebuiltSpec.gmk b/make/RunTestsPrebuiltSpec.gmk index 8564a1f7ddd..6d07505b3b1 100644 --- a/make/RunTestsPrebuiltSpec.gmk +++ b/make/RunTestsPrebuiltSpec.gmk @@ -186,3 +186,7 @@ endif ifeq ($(OPENJDK_BUILD_OS), windows) CYGPATH := cygpath endif + +################################################################################ +# Simple macros from spec.gmk.in +SHARED_LIBRARY=$(LIBRARY_PREFIX)$1$(SHARED_LIBRARY_SUFFIX) diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 8d4f6eba4d8..3fc6a234860 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -709,7 +709,8 @@ var getJibProfilesProfiles = function (input, common, data) { "run-test-prebuilt": { target_os: input.build_os, target_cpu: input.build_cpu, - dependencies: [ "jtreg", "gnumake", "boot_jdk", "jib", testedProfile + ".jdk", + dependencies: [ + "jtreg", "gnumake", "boot_jdk", "devkit", "jib", testedProfile + ".jdk", testedProfile + ".test" ], src: "src.conf", @@ -743,7 +744,6 @@ var getJibProfilesProfiles = function (input, common, data) { // This gives us a guaranteed working version of lldb for the jtreg failure handler. if (input.build_os == "macosx") { macosxRunTestExtra = { - dependencies: [ "devkit" ], environment_path: input.get("devkit", "install_path") + "/Xcode.app/Contents/Developer/usr/bin" }; @@ -836,7 +836,10 @@ var getJibProfilesDependencies = function (input, common) { organization: common.organization, ext: "tar.gz", module: "devkit-" + devkit_platform, - revision: devkit_platform_revisions[devkit_platform] + revision: devkit_platform_revisions[devkit_platform], + environment: { + "DEVKIT_HOME": input.get("devkit", "home_path"), + } }, build_devkit: { @@ -937,14 +940,6 @@ var getJibProfilesDependencies = function (input, common) { }, }; - // Need to add a value for the Visual Studio tools variable to make - // jaot be able to pick up the Visual Studio linker in testing. - if (input.target_os == "windows") { - dependencies.devkit.environment = { - VS120COMNTOOLS: input.get("devkit", "install_path") + "/Common7/Tools" - }; - } - return dependencies; }; diff --git a/test/hotspot/jtreg/compiler/aot/scripts/java.base-list.txt b/test/hotspot/jtreg/compiler/aot/scripts/java.base-list.txt index 5e9607fb8ec..94485e9b680 100644 --- a/test/hotspot/jtreg/compiler/aot/scripts/java.base-list.txt +++ b/test/hotspot/jtreg/compiler/aot/scripts/java.base-list.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2018 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 @@ -18,18 +18,3 @@ # 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. - -# jaotc: java.lang.StackOverflowError -exclude sun.util.resources.LocaleNames.getContents()[[Ljava/lang/Object; -exclude sun.util.resources.TimeZoneNames.getContents()[[Ljava/lang/Object; -exclude sun.util.resources.cldr.LocaleNames.getContents()[[Ljava/lang/Object; -exclude sun.util.resources..*.LocaleNames_.*.getContents\(\)\[\[Ljava/lang/Object; -exclude sun.util.resources..*.LocaleNames_.*_.*.getContents\(\)\[\[Ljava/lang/Object; -exclude sun.util.resources..*.TimeZoneNames_.*.getContents\(\)\[\[Ljava/lang/Object; -exclude sun.util.resources..*.TimeZoneNames_.*_.*.getContents\(\)\[\[Ljava/lang/Object; -# java.lang.Error: Trampoline must not be defined by the bootstrap classloader -exclude sun.reflect.misc.Trampoline.()V -exclude sun.reflect.misc.Trampoline.invoke(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; -# assert(referenceMask != -1) failed: must not be a derived reference type -exclude com.sun.crypto.provider.AESWrapCipher.engineUnwrap([BLjava/lang/String;I)Ljava/security/Key; -exclude sun.security.ssl.* diff --git a/test/hotspot/jtreg/compiler/aot/scripts/jdk.internal.vm.compiler-list.txt b/test/hotspot/jtreg/compiler/aot/scripts/jdk.internal.vm.compiler-list.txt index 1ffcffde4df..d9ca1653cc7 100644 --- a/test/hotspot/jtreg/compiler/aot/scripts/jdk.internal.vm.compiler-list.txt +++ b/test/hotspot/jtreg/compiler/aot/scripts/jdk.internal.vm.compiler-list.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2018, 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 @@ -19,20 +19,27 @@ # or visit www.oracle.com if you need additional information or have any # questions. +# exclude org.graalvm.compiler.hotspot.replacements.arraycopy.ArrayCopyCallNode.* exclude org.graalvm.compiler.hotspot.replacements.AESCryptSubstitutions.* exclude org.graalvm.compiler.hotspot.replacements.CipherBlockChainingSubstitutions.crypt(Ljava/lang/Object;[BII[BILjava/lang/Object;ZZ)V +exclude org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayAllocationSize(III)I +exclude org.graalvm.compiler.hotspot.replacements.PluginFactory_HotSpotReplacementsUtil\$config.execute(.*).* +exclude org.graalvm.compiler.hotspot.replacements.PluginFactory_HotSpotReplacementsUtil\$getWordKind.execute(.*).* +exclude org.graalvm.compiler.hotspot.replacements.PluginFactory_HotSpotReplacementsUtil\$getConfig.execute(.*). +# exclude org.graalvm.compiler.hotspot.stubs.StubUtil.printf(.*).* exclude org.graalvm.compiler.hotspot.stubs.StubUtil.decipher(J)V exclude org.graalvm.compiler.hotspot.stubs.StubUtil.fatal(.*).* # +exclude org.graalvm.compiler.nodes.java.NewArrayNode.newUninitializedArray(Ljava/lang/Class;I)Ljava/lang/Object; +exclude org.graalvm.compiler.nodes.java.DynamicNewArrayNode.newArray(Ljava/lang/Class;ILjdk/vm/ci/meta/JavaKind;)Ljava/lang/Object; +exclude org.graalvm.compiler.nodes.java.DynamicNewArrayNode.newUninitializedArray(Ljava/lang/Class;ILjdk/vm/ci/meta/JavaKind;)Ljava/lang/Object; +exclude org.graalvm.compiler.nodes.PiNode.piCastNonNull(Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; +# exclude org.graalvm.compiler.replacements.nodes.ArrayEqualsNode.equals(.*).* exclude org.graalvm.compiler.replacements.Log.print.* exclude org.graalvm.compiler.replacements.ReplacementsUtil.* exclude org.graalvm.compiler.replacements.SnippetCounter.* exclude org.graalvm.compiler.replacements.SnippetCounterNode.* -# -exclude org.graalvm.compiler.nodes.java.NewArrayNode.newUninitializedArray(Ljava/lang/Class;I)Ljava/lang/Object; -exclude org.graalvm.compiler.nodes.java.DynamicNewArrayNode.newUninitializedArray(Ljava/lang/Class;ILjdk/vm/ci/meta/JavaKind;)Ljava/lang/Object; -exclude org.graalvm.compiler.nodes.java.DynamicNewArrayNode.newArray(Ljava/lang/Class;ILjdk/vm/ci/meta/JavaKind;)Ljava/lang/Object; -exclude org.graalvm.compiler.nodes.PiNode.piCastNonNull(Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; +exclude org.graalvm.compiler.replacements.SnippetIntegerHistogram.inc(J)V