< prev index next >

make/autoconf/hotspot.m4

Print this page
@@ -24,11 +24,11 @@
  #
  
  # All valid JVM features, regardless of platform
  VALID_JVM_FEATURES="compiler1 compiler2 zero minimal dtrace jvmti jvmci \
      graal vm-structs jni-check services management epsilongc g1gc parallelgc serialgc shenandoahgc zgc nmt cds \
-     static-build link-time-opt aot jfr"
+     static-build link-time-opt aot jfr tsan"
  
  # Deprecated JVM features (these are ignored, but with a warning)
  DEPRECATED_JVM_FEATURES="trace cmsgc"
  
  # All valid JVM variants

@@ -547,10 +547,51 @@
      else
        AC_MSG_RESULT([no])
      fi
    fi
  
+   AC_MSG_CHECKING([if tsan should be built])
+   # Check if user explicitly disabled tsan
+   if HOTSPOT_IS_JVM_FEATURE_DISABLED(tsan); then
+     AC_MSG_RESULT([no, forced])
+     INCLUDE_TSAN="false"
+   # Only enable ThreadSanitizer on supported platforms
+   elif test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
+     AC_MSG_RESULT([yes])
+     NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES tsan"
+     INCLUDE_TSAN="true"
+   else
+     AC_MSG_RESULT([no, platform not supported])
+     INCLUDE_TSAN="false"
+     if HOTSPOT_CHECK_JVM_FEATURE(tsan); then
+       AC_MSG_ERROR([ThreadSanitizer is currently not supported on this platform.])
+     fi
+   fi
+ 
+   # Add a configure option --<enable|disable>-tsan-launcher to allow
+   # more control on whether to link TSAN runtime with the launcher.
+   AC_ARG_ENABLE([tsan-launcher], [AS_HELP_STRING([--enable-tsan-launcher],
+       [link tsan runtime with the default JDK launcher. Default is consistent with whether tsan feature is enabled.])])
+   AC_MSG_CHECKING([if tsan should be linked with JDK launcher])
+   if test "x$INCLUDE_TSAN" = "xtrue"; then
+     if test "x$enable_tsan_launcher" = "xyes"; then
+       AC_MSG_RESULT([yes, forced])
+     elif test "x$enable_tsan_launcher" = "xno"; then
+       AC_MSG_RESULT([no, forced])
+       INCLUDE_TSAN="false"
+     else
+       AC_MSG_RESULT([yes, default])
+     fi
+   else
+     AC_MSG_RESULT([no, tsan feature is disabled])
+     if test "x$enable_tsan_launcher" = "xyes"; then
+       AC_MSG_ERROR([--enable-tsan-launcher can only be used when tsan feature is enabled.])
+     fi
+   fi
+ 
+   AC_SUBST(INCLUDE_TSAN)
+ 
    # Enable features depending on variant.
    JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_aot $JVM_FEATURES_graal"
    JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES"
    JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
    JVM_FEATURES_minimal="compiler1 minimal serialgc $JVM_FEATURES $JVM_FEATURES_link_time_opt"
< prev index next >