--- old/make/lib/JvmFeatures.gmk 2016-11-09 21:50:48.000000000 -0800 +++ new/make/lib/JvmFeatures.gmk 2016-11-09 21:50:48.000000000 -0800 @@ -146,3 +146,11 @@ memBaseline.cpp memReporter.cpp mallocTracker.cpp virtualMemoryTracker.cpp nmtCommon.cpp \ memTracker.cpp nmtDCmd.cpp mallocSiteTable.cpp endif + +ifeq ($(call check-jvm-feature, aot), true) + JVM_CFLAGS_FEATURES += -DINCLUDE_AOT +else + JVM_EXCLUDE_FILES += \ + compiledIC_aot_x86_64.cpp compilerRuntime.cpp \ + aotCodeHeap.cpp aotCompiledMethod.cpp aotLoader.cpp compiledIC_aot.cpp +endif --- /dev/null 2016-11-09 21:50:49.000000000 -0800 +++ new/make/CompileTools.gmk 2016-11-09 21:50:49.000000000 -0800 @@ -0,0 +1,160 @@ +# +# 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. +# + +# This must be the first rule +default: all + +include $(SPEC) +include MakeBase.gmk + +include JavaCompilation.gmk +include SetupJavaCompilers.gmk + +TARGETS := + +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, hotspot, CompileTools.gmk)) + +ifeq ($(ENABLE_AOT), true) + VM_CI_SRC_DIR := $(HOTSPOT_TOPDIR)/src/jdk.vm.ci/share/classes + + SRC_DIR := $(HOTSPOT_TOPDIR)/src/jdk.vm.compiler/share/classes + + ############################################################################## + # Compile the annotation processors + $(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_MATCH_PROCESSOR, \ + SETUP := GENERATE_OLDBYTECODE, \ + SRC := \ + $(SRC_DIR)/com.oracle.graal.compiler/src \ + $(SRC_DIR)/com.oracle.graal.compiler.common/src \ + $(SRC_DIR)/com.oracle.graal.compiler.match.processor/src \ + $(SRC_DIR)/com.oracle.graal.api.collections/src \ + $(SRC_DIR)/com.oracle.graal.api.replacements/src \ + $(SRC_DIR)/com.oracle.graal.asm/src \ + $(SRC_DIR)/com.oracle.graal.bytecode/src \ + $(SRC_DIR)/com.oracle.graal.code/src \ + $(SRC_DIR)/com.oracle.graal.debug/src \ + $(SRC_DIR)/com.oracle.graal.graph/src \ + $(SRC_DIR)/com.oracle.graal.lir/src \ + $(SRC_DIR)/com.oracle.graal.loop/src \ + $(SRC_DIR)/com.oracle.graal.loop.phases/src \ + $(SRC_DIR)/com.oracle.graal.nodeinfo/src \ + $(SRC_DIR)/com.oracle.graal.nodes/src \ + $(SRC_DIR)/com.oracle.graal.options/src \ + $(SRC_DIR)/com.oracle.graal.phases/src \ + $(SRC_DIR)/com.oracle.graal.phases.common/src \ + $(SRC_DIR)/com.oracle.graal.serviceprovider/src \ + $(SRC_DIR)/com.oracle.graal.virtual/src \ + $(VM_CI_SRC_DIR)/jdk.vm.ci.code/src \ + $(VM_CI_SRC_DIR)/jdk.vm.ci.common/src \ + $(VM_CI_SRC_DIR)/jdk.vm.ci.meta/src \ + $(VM_CI_SRC_DIR)/jdk.vm.ci.runtime/src \ + $(VM_CI_SRC_DIR)/jdk.vm.ci.services/src \ + , \ + EXCLUDE_FILES := $(EXCLUDE_FILES), \ + BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.match.processor, \ + JAR := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.match.processor.jar, \ + )) + + TARGETS += $(BUILD_VM_COMPILER_MATCH_PROCESSOR) + + ############################################################################## + + $(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_NODEINFO_PROCESSOR, \ + SETUP := GENERATE_OLDBYTECODE, \ + SRC := \ + $(SRC_DIR)/com.oracle.graal.nodeinfo/src \ + $(SRC_DIR)/com.oracle.graal.nodeinfo.processor/src \ + , \ + BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.nodeinfo.processor, \ + JAR := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.nodeinfo.processor.jar, \ + )) + + TARGETS += $(BUILD_VM_COMPILER_NODEINFO_PROCESSOR) + + ############################################################################## + + $(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_OPTIONS_PROCESSOR, \ + SETUP := GENERATE_OLDBYTECODE, \ + SRC := \ + $(SRC_DIR)/com.oracle.graal.options/src \ + $(SRC_DIR)/com.oracle.graal.options.processor/src \ + , \ + BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.options.processor, \ + JAR := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.options.processor.jar, \ + )) + + TARGETS += $(BUILD_VM_COMPILER_OPTIONS_PROCESSOR) + + ############################################################################## + + $(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_REPLACEMENTS_VERIFIER, \ + SETUP := GENERATE_OLDBYTECODE, \ + SRC := \ + $(SRC_DIR)/com.oracle.graal.replacements.verifier/src \ + $(SRC_DIR)/com.oracle.graal.api.collections/src \ + $(SRC_DIR)/com.oracle.graal.api.replacements/src \ + $(SRC_DIR)/com.oracle.graal.code/src \ + $(SRC_DIR)/com.oracle.graal.compiler.common/src \ + $(SRC_DIR)/com.oracle.graal.debug/src \ + $(SRC_DIR)/com.oracle.graal.graph/src \ + $(SRC_DIR)/com.oracle.graal.nodeinfo/src \ + $(SRC_DIR)/com.oracle.graal.options/src \ + $(SRC_DIR)/com.oracle.graal.serviceprovider/src \ + $(VM_CI_SRC_DIR)/jdk.vm.ci.code/src \ + $(VM_CI_SRC_DIR)/jdk.vm.ci.common/src \ + $(VM_CI_SRC_DIR)/jdk.vm.ci.meta/src \ + $(VM_CI_SRC_DIR)/jdk.vm.ci.runtime/src \ + $(VM_CI_SRC_DIR)/jdk.vm.ci.services/src \ + , \ + EXCLUDE_FILES := $(EXCLUDE_FILES), \ + BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.replacements.verifier, \ + JAR := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.replacements.verifier.jar, \ + )) + + TARGETS += $(BUILD_VM_COMPILER_REPLACEMENTS_VERIFIER) + + ############################################################################## + + $(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_SERVICEPROVIDER_PROCESSOR, \ + SETUP := GENERATE_OLDBYTECODE, \ + SRC := \ + $(SRC_DIR)/com.oracle.graal.serviceprovider/src \ + $(SRC_DIR)/com.oracle.graal.serviceprovider.processor/src \ + $(VM_CI_SRC_DIR)/jdk.vm.ci.services/src \ + , \ + EXCLUDE_FILES := $(EXCLUDE_FILES), \ + BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.serviceprovider.processor, \ + JAR := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.serviceprovider.processor.jar, \ + )) + + TARGETS += $(BUILD_VM_COMPILER_SERVICEPROVIDER_PROCESSOR) + + ############################################################################## +endif + +all: $(TARGETS) + +.PHONY: all --- /dev/null 2016-11-09 21:50:49.000000000 -0800 +++ new/make/Tools.gmk 2016-11-09 21:50:49.000000000 -0800 @@ -0,0 +1,69 @@ +# +# 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. +# + +################################################################################ +# This file is meant to be included by makefiles using any of the build tools +# compiled by CompileTools.gmk. It assumes that CompileTools.gmk has already +# been run in a separate top level target. It should contain definitions for +# build tools targets without defining the rules to build them so that usage of +# those tools can define prerequisites to them. + +include JavaCompilation.gmk + +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, hotspot, Tools.gmk)) + +ifeq ($(ENABLE_AOT), true) + $(eval $(call SetupJavaCompilationCompileTarget, \ + BUILD_VM_COMPILER_MATCH_PROCESSOR, \ + BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.match.processor, \ + SETUP := GENERATE_JDKBYTECODE, \ + )) + + $(eval $(call SetupJavaCompilationCompileTarget, \ + BUILD_VM_COMPILER_NODEINFO_PROCESSOR, \ + BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.nodeinfo.processor, \ + SETUP := GENERATE_JDKBYTECODE, \ + )) + + $(eval $(call SetupJavaCompilationCompileTarget, \ + BUILD_VM_COMPILER_OPTIONS_PROCESSOR, \ + BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.options.processor, \ + SETUP := GENERATE_JDKBYTECODE, \ + )) + + $(eval $(call SetupJavaCompilationCompileTarget, \ + BUILD_VM_COMPILER_REPLACEMENTS_VERIFIER, \ + BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.replacements.verifier, \ + SETUP := GENERATE_JDKBYTECODE, \ + )) + + $(eval $(call SetupJavaCompilationCompileTarget, \ + BUILD_VM_COMPILER_SERVICEPROVIDER_PROCESSOR, \ + BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.serviceprovider.processor, \ + SETUP := GENERATE_JDKBYTECODE, \ + )) +endif +################################################################################ --- /dev/null 2016-11-09 21:50:50.000000000 -0800 +++ new/make/gensrc/Gensrc-jdk.vm.compiler.gmk 2016-11-09 21:50:50.000000000 -0800 @@ -0,0 +1,141 @@ +# +# 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 +include Tools.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 := \ + com.oracle.graal.code \ + com.oracle.graal.compiler \ + com.oracle.graal.compiler.aarch64 \ + com.oracle.graal.compiler.amd64 \ + com.oracle.graal.compiler.common \ + com.oracle.graal.compiler.sparc \ + com.oracle.graal.debug \ + com.oracle.graal.hotspot \ + com.oracle.graal.hotspot.aarch64 \ + com.oracle.graal.hotspot.amd64 \ + com.oracle.graal.hotspot.sparc \ + com.oracle.graal.graph \ + com.oracle.graal.java \ + com.oracle.graal.lir \ + com.oracle.graal.lir.amd64 \ + com.oracle.graal.loop \ + com.oracle.graal.loop.phases \ + com.oracle.graal.nodes \ + com.oracle.graal.replacements \ + com.oracle.graal.replacements.aarch64 \ + com.oracle.graal.replacements.amd64 \ + com.oracle.graal.phases \ + com.oracle.graal.phases.common \ + com.oracle.graal.printer \ + com.oracle.graal.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 && \ + for i in $$($(LS)); do \ + c=$$($(CAT) $$i | $(TR) -d '\n\r'); \ + $(ECHO) "provides $$c with $$i;" >> $@; \ + done); \ + $(ECHO) "uses com.oracle.graal.options.OptionDescriptors;" >> $@; \ + for i in $$($(FIND) $(GENSRC_DIR) -name '*_OptionDescriptors.java'); do \ + c=$$($(ECHO) $$i | $(SED) 's:.*/jdk\.vm\.compiler/\(.*\)\.java:\1:' | $(TR) '/' '.'); \ + $(ECHO) "provides com.oracle.graal.options.OptionDescriptors with $$c;" >> $@; \ + done + +TARGETS += $(GENSRC_DIR)/module-info.java.extra + +################################################################################ + +all: $(TARGETS) + +.PHONY: default all --- /dev/null 2016-11-09 21:50:50.000000000 -0800 +++ new/make/lib/Lib-jdk.aot.gmk 2016-11-09 21:50:50.000000000 -0800 @@ -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. 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. +# + +include $(SPEC) +include NativeCompilation.gmk + +$(eval $(call IncludeCustomExtension, hotspot, lib/Lib-jdk.aot.gmk)) + +############################################################################## +# Build libjelfshim only when AOT is enabled. +ifeq ($(ENABLE_AOT), true) + JELFSHIM_NAME := jelfshim + + $(eval $(call SetupNativeCompilation, BUILD_LIBJELFSHIM, \ + TOOLCHAIN := TOOLCHAIN_DEFAULT, \ + OPTIMIZATION := LOW, \ + LIBRARY := $(JELFSHIM_NAME), \ + OUTPUT_DIR := $(call FindLibDirForModule, $(MODULE)), \ + SRC := $(HOTSPOT_TOPDIR)/src/jdk.aot/unix/native/libjelfshim, \ + CFLAGS := $(CFLAGS_JDKLIB) $(ELF_CFLAGS) \ + -DAOT_VERSION_STRING='"$(VERSION_STRING)"' \ + -I$(SUPPORT_OUTPUTDIR)/headers/$(MODULE), \ + LDFLAGS := $(LDFLAGS_JDKLIB), \ + OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/lib$(JELFSHIM_NAME), \ + LIBS := $(ELF_LIBS) $(LIBS_JDKLIB), \ + )) + + TARGETS += $(BUILD_LIBJELFSHIM) +endif + +##############################################################################