changeset 2423:299f3e9ed163

8166417: Integrate Graal-core into JDK for AOT compiler Reviewed-by: iveresov, erikj, ihse, mchung
author kvn
date Sun, 11 Dec 2016 12:09:13 -0800
parents 05ac48290793
children 5068c84c0844
files common/autoconf/generated-configure.sh common/autoconf/hotspot.m4 common/autoconf/spec.gmk.in make/CompileJavaModules.gmk make/Javadoc.gmk make/Main.gmk make/common/Modules.gmk
diffstat 7 files changed, 133 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/common/autoconf/generated-configure.sh	Thu Dec 08 17:13:07 2016 +0100
+++ b/common/autoconf/generated-configure.sh	Sun Dec 11 12:09:13 2016 -0800
@@ -700,6 +700,7 @@
 JVM_FEATURES_core
 JVM_FEATURES_client
 JVM_FEATURES_server
+INCLUDE_GRAAL
 INCLUDE_DTRACE
 GCOV_ENABLED
 ZIP_EXTERNAL_DEBUG_SYMBOLS
@@ -4247,7 +4248,7 @@
 
 # All valid JVM features, regardless of platform
 VALID_JVM_FEATURES="compiler1 compiler2 zero shark minimal dtrace jvmti jvmci \
-    fprof vm-structs jni-check services management all-gcs nmt cds static-build"
+    graal fprof vm-structs jni-check services management all-gcs nmt cds static-build"
 
 # All valid JVM variants
 VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom"
@@ -5082,7 +5083,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1481213545
+DATE_WHEN_GENERATED=1481486918
 
 ###############################################################################
 #
@@ -52761,18 +52762,44 @@
 
   # Only enable jvmci on x86_64, sparcv9 and aarch64.
   if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \
-      test "x$OPENJDK_TARGET_CPU" = "xsparcv9" || \
-      test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
+     test "x$OPENJDK_TARGET_CPU" = "xsparcv9" || \
+     test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
     JVM_FEATURES_jvmci="jvmci"
   else
     JVM_FEATURES_jvmci=""
   fi
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if jdk.vm.compiler should be built" >&5
+$as_echo_n "checking if jdk.vm.compiler should be built... " >&6; }
+  if   [[ " $JVM_FEATURES " =~ " graal " ]]  ; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, forced" >&5
+$as_echo "yes, forced" >&6; }
+    if test "x$JVM_FEATURES_jvmci" != "xjvmci" ; then
+      as_fn_error $? "Specified JVM feature 'graal' requires feature 'jvmci'" "$LINENO" 5
+    fi
+    INCLUDE_GRAAL="true"
+  else
+    # By default enable graal build on linux-X64 and when JVMCI is available
+    if test "x$JVM_FEATURES_jvmci" = "xjvmci" && test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = "xlinux-x86_64"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+      JVM_FEATURES_graal="graal"
+      INCLUDE_GRAAL="true"
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+      JVM_FEATURES_graal=""
+      INCLUDE_GRAAL="false"
+    fi
+  fi
+
+
+
   # All variants but minimal (and custom) get these features
   NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jvmti fprof vm-structs jni-check services management all-gcs nmt cds"
 
   # Enable features depending on variant.
-  JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
+  JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_graal"
   JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
   JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
   JVM_FEATURES_minimal="compiler1 minimal $JVM_FEATURES"
--- a/common/autoconf/hotspot.m4	Thu Dec 08 17:13:07 2016 +0100
+++ b/common/autoconf/hotspot.m4	Sun Dec 11 12:09:13 2016 -0800
@@ -25,7 +25,7 @@
 
 # All valid JVM features, regardless of platform
 VALID_JVM_FEATURES="compiler1 compiler2 zero shark minimal dtrace jvmti jvmci \
-    fprof vm-structs jni-check services management all-gcs nmt cds static-build"
+    graal fprof vm-structs jni-check services management all-gcs nmt cds static-build"
 
 # All valid JVM variants
 VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom"
@@ -256,18 +256,40 @@
 
   # Only enable jvmci on x86_64, sparcv9 and aarch64.
   if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \
-      test "x$OPENJDK_TARGET_CPU" = "xsparcv9" || \
-      test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
+     test "x$OPENJDK_TARGET_CPU" = "xsparcv9" || \
+     test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
     JVM_FEATURES_jvmci="jvmci"
   else
     JVM_FEATURES_jvmci=""
   fi
 
+  AC_MSG_CHECKING([if jdk.vm.compiler should be built])
+  if HOTSPOT_CHECK_JVM_FEATURE(graal); then
+    AC_MSG_RESULT([yes, forced])
+    if test "x$JVM_FEATURES_jvmci" != "xjvmci" ; then
+      AC_MSG_ERROR([Specified JVM feature 'graal' requires feature 'jvmci'])
+    fi
+    INCLUDE_GRAAL="true"
+  else
+    # By default enable graal build on linux-X64 and when JVMCI is available
+    if test "x$JVM_FEATURES_jvmci" = "xjvmci" && test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = "xlinux-x86_64"; then
+      AC_MSG_RESULT([yes])
+      JVM_FEATURES_graal="graal"
+      INCLUDE_GRAAL="true"
+    else
+      AC_MSG_RESULT([no])
+      JVM_FEATURES_graal=""
+      INCLUDE_GRAAL="false"
+    fi
+  fi
+
+  AC_SUBST(INCLUDE_GRAAL)
+
   # All variants but minimal (and custom) get these features
   NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jvmti fprof vm-structs jni-check services management all-gcs nmt cds"
 
   # Enable features depending on variant.
-  JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
+  JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_graal"
   JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
   JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
   JVM_FEATURES_minimal="compiler1 minimal $JVM_FEATURES"
--- a/common/autoconf/spec.gmk.in	Thu Dec 08 17:13:07 2016 +0100
+++ b/common/autoconf/spec.gmk.in	Sun Dec 11 12:09:13 2016 -0800
@@ -764,6 +764,7 @@
 #
 
 INCLUDE_SA=@INCLUDE_SA@
+INCLUDE_GRAAL=@INCLUDE_GRAAL@
 
 OS_VERSION_MAJOR:=@OS_VERSION_MAJOR@
 OS_VERSION_MINOR:=@OS_VERSION_MINOR@
--- a/make/CompileJavaModules.gmk	Thu Dec 08 17:13:07 2016 +0100
+++ b/make/CompileJavaModules.gmk	Sun Dec 11 12:09:13 2016 -0800
@@ -448,7 +448,47 @@
 
 ################################################################################
 
-jdk.vm.ci_ADD_JAVAC_FLAGS := -Xlint:-exports
+# -parameters provides method's parameters information in class file,
+# JVMCI compilers make use of that information for various sanity checks.
+# Don't use Indy strings concatenation to have good JVMCI startup performance.
+
+jdk.vm.ci_ADD_JAVAC_FLAGS := -parameters -Xlint:-exports -XDstringConcat=inline
+
+################################################################################
+
+jdk.vm.compiler_ADD_JAVAC_FLAGS := -parameters -XDstringConcat=inline
+
+jdk.vm.compiler_EXCLUDES += \
+    org.graalvm.compiler.core.match.processor \
+    org.graalvm.compiler.nodeinfo.processor \
+    org.graalvm.compiler.options.processor \
+    org.graalvm.compiler.serviceprovider.processor \
+    org.graalvm.compiler.replacements.verifier \
+    org.graalvm.compiler.api.directives.test \
+    org.graalvm.compiler.api.test \
+    org.graalvm.compiler.asm.aarch64.test \
+    org.graalvm.compiler.asm.amd64.test \
+    org.graalvm.compiler.asm.sparc.test \
+    org.graalvm.compiler.asm.test \
+    org.graalvm.compiler.core.amd64.test \
+    org.graalvm.compiler.core.sparc.test \
+    org.graalvm.compiler.core.test \
+    org.graalvm.compiler.debug.test \
+    org.graalvm.compiler.graph.test \
+    org.graalvm.compiler.hotspot.amd64.test \
+    org.graalvm.compiler.hotspot.lir.test \
+    org.graalvm.compiler.hotspot.test \
+    org.graalvm.compiler.jtt \
+    org.graalvm.compiler.lir.jtt \
+    org.graalvm.compiler.lir.test \
+    org.graalvm.compiler.microbenchmarks \
+    org.graalvm.compiler.nodes.test \
+    org.graalvm.compiler.options.test \
+    org.graalvm.compiler.phases.common.test \
+    org.graalvm.compiler.replacements.test \
+    org.graalvm.compiler.test \
+    org.graalvm.compiler.virtual.bench \
+    #
 
 ################################################################################
 
@@ -511,6 +551,14 @@
   MODULESOURCEPATH := $(call PathList, $(JVMCI_MODULESOURCEPATH))
 endif
 
+ifeq ($(MODULE), jdk.vm.compiler)
+  ## WORKAROUND jdk.vm.compiler source structure issue
+  VM_COMPILER_MODULESOURCEPATH := $(MODULESOURCEPATH) \
+      $(subst /$(MODULE)/,/*/, $(filter-out %processor/src %test/src %jtt/src %bench/src %microbenchmarks/src, \
+          $(wildcard $(HOTSPOT_TOPDIR)/src/$(MODULE)/share/classes/*/src)))
+  MODULESOURCEPATH := $(call PathList, $(VM_COMPILER_MODULESOURCEPATH))
+endif
+
 $(eval $(call SetupJavaCompilation, $(MODULE), \
     SETUP := $(if $($(MODULE)_SETUP), $($(MODULE)_SETUP), GENERATE_JDKBYTECODE), \
     MODULE := $(MODULE), \
--- a/make/Javadoc.gmk	Thu Dec 08 17:13:07 2016 +0100
+++ b/make/Javadoc.gmk	Sun Dec 11 12:09:13 2016 -0800
@@ -122,6 +122,7 @@
     org.w3c.dom.html \
     org.w3c.dom.stylesheets \
     org.w3c.dom.xpath \
+    org.graalvm.compiler.% \
     #
 
 CORE_PACKAGES := $(filter-out $(CORE_EXCLUDED_PACKAGES), \
--- a/make/Main.gmk	Thu Dec 08 17:13:07 2016 +0100
+++ b/make/Main.gmk	Sun Dec 11 12:09:13 2016 -0800
@@ -85,10 +85,14 @@
 
   buildtools-modules:
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileModuleTools.gmk)
+
+  buildtools-hotspot:
+	+($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk)
 endif
 
 ALL_TARGETS += buildtools-langtools interim-langtools \
-    interim-rmic interim-cldrconverter buildtools-jdk buildtools-modules
+    interim-rmic interim-cldrconverter buildtools-jdk buildtools-modules \
+    buildtools-hotspot
 
 ################################################################################
 # Special targets for certain modules
@@ -547,11 +551,13 @@
 
   buildtools-jdk: interim-langtools interim-cldrconverter
 
+  buildtools-hotspot: interim-langtools
+
   buildtools-modules: exploded-image-base
 
   $(CORBA_GENSRC_TARGETS): interim-langtools
 
-  $(HOTSPOT_GENSRC_TARGETS): interim-langtools
+  $(HOTSPOT_GENSRC_TARGETS): interim-langtools buildtools-hotspot
 
   $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
 
@@ -628,6 +634,14 @@
   # current JDK.
   jdk.vm.ci-gensrc-hotspot: java.base-java
 
+  # The annotation processing for jdk.vm.compiler needs classes from the current JDK.
+  jdk.vm.compiler-gensrc-hotspot: java.base-java java.management-java \
+      jdk.management-java jdk.vm.ci-java jdk.unsupported-java
+
+  # For jdk.vm.compiler, the gensrc step is generating a module-info.java.extra
+  # file to be processed by the gensrc-moduleinfo target.
+  jdk.vm.compiler-gensrc-moduleinfo: jdk.vm.compiler-gensrc-hotspot
+
   # Explicitly add dependencies for special targets
   java.base-java: unpack-sec
 
@@ -788,7 +802,7 @@
 # Virtual targets without recipes
 
 buildtools: buildtools-langtools interim-langtools interim-rmic \
-    buildtools-jdk
+    buildtools-jdk buildtools-hotspot
 
 hotspot: $(HOTSPOT_VARIANT_TARGETS) hotspot-jsig
 
--- a/make/common/Modules.gmk	Thu Dec 08 17:13:07 2016 +0100
+++ b/make/common/Modules.gmk	Sun Dec 11 12:09:13 2016 -0800
@@ -145,6 +145,13 @@
 endif
 
 ################################################################################
+# Filter out specific modules
+
+ifeq ($(INCLUDE_GRAAL), false)
+  MODULES_FILTER += jdk.vm.compiler
+endif
+
+################################################################################
 # Module list macros
 
 # Use append so that the custom extension may add to these variables