diff mbox

Import libcilkrts Build 4467 (PR target/68945)

Message ID yddh976mf1v.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Nov. 17, 2016, 1:06 p.m. UTC
I happened to notice that my libcilkrts SPARC port has been applied
upstream.  So to reach closure on this issue for the GCC 7 release, I'd
like to import upstream into mainline which seems to be covered by the
free-for-all clause in https://gcc.gnu.org/svnwrite.html#policies, even
though https://gcc.gnu.org/codingconventions.html#upstream lists nothing
specific and we have no listed maintainer.

A few issues are worth mention:

* Upstream still has a typo in the git URL in many files.  I've
  corrected that during the import to avoid a massive diff:

-#  https://bitbucket.org/intelcilkruntime/itnel-cilk-runtime.git are
+#  https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are

* libcilkrts.spec.in is missing upstream.  I've no idea if this is
  intentional.

* A few of my changes have been lost and I can't tell if this is by
  accident:

** Lost whitespace:


  I've done nothing about those, just wanted to point them out.

The following patch has passed x86_64-pc-linux-gnu bootstrap without
regressions; i386-pc-solaris2.12 and sparc-sun-solaris2.12 bootstraps
are currently running.

Ok for mainline if they pass?

Thanks.
        Rainer

Comments

Rainer Orth Nov. 17, 2016, 3:50 p.m. UTC | #1
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> I happened to notice that my libcilkrts SPARC port has been applied
> upstream.  So to reach closure on this issue for the GCC 7 release, I'd
> like to import upstream into mainline which seems to be covered by the
> free-for-all clause in https://gcc.gnu.org/svnwrite.html#policies, even
> though https://gcc.gnu.org/codingconventions.html#upstream lists nothing
> specific and we have no listed maintainer.

I initially used Ilya's intel.com address, which bounced.  Now using the
current address listed in MAINTAINERS...

> The following patch has passed x86_64-pc-linux-gnu bootstrap without
> regressions; i386-pc-solaris2.12 and sparc-sun-solaris2.12 bootstraps
> are currently running.
>
> Ok for mainline if they pass?

Both Solaris bootstraps have completed successfully now.

	Rainer
Ilya Verbin Nov. 17, 2016, 4:56 p.m. UTC | #2
2016-11-17 18:50 GMT+03:00 Rainer Orth <ro@cebitec.uni-bielefeld.de>:
> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>
>> I happened to notice that my libcilkrts SPARC port has been applied
>> upstream.  So to reach closure on this issue for the GCC 7 release, I'd
>> like to import upstream into mainline which seems to be covered by the
>> free-for-all clause in https://gcc.gnu.org/svnwrite.html#policies, even
>> though https://gcc.gnu.org/codingconventions.html#upstream lists nothing
>> specific and we have no listed maintainer.
>
> I initially used Ilya's intel.com address, which bounced.  Now using the
> current address listed in MAINTAINERS...

Yeah, I don't work for Intel anymore. And I'm not a libcilkrts
maintainer, so I can't approve it.

  -- Ilya

>> The following patch has passed x86_64-pc-linux-gnu bootstrap without
>> regressions; i386-pc-solaris2.12 and sparc-sun-solaris2.12 bootstraps
>> are currently running.
>>
>> Ok for mainline if they pass?
>
> Both Solaris bootstraps have completed successfully now.
>
>         Rainer
>
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
Jeff Law Nov. 17, 2016, 5:01 p.m. UTC | #3
On 11/17/2016 09:56 AM, Ilya Verbin wrote:
> 2016-11-17 18:50 GMT+03:00 Rainer Orth <ro@cebitec.uni-bielefeld.de>:
>> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>>
>>> I happened to notice that my libcilkrts SPARC port has been applied
>>> upstream.  So to reach closure on this issue for the GCC 7 release, I'd
>>> like to import upstream into mainline which seems to be covered by the
>>> free-for-all clause in https://gcc.gnu.org/svnwrite.html#policies, even
>>> though https://gcc.gnu.org/codingconventions.html#upstream lists nothing
>>> specific and we have no listed maintainer.
>>
>> I initially used Ilya's intel.com address, which bounced.  Now using the
>> current address listed in MAINTAINERS...
>
> Yeah, I don't work for Intel anymore. And I'm not a libcilkrts
> maintainer, so I can't approve it.
Do you want to be?  IIRC I was going to nominate you, but held off 
knowing your situation was going to change.

If you're interested in maintainer positions, I can certainly still 
nominate you.

jeff
Ilya Verbin Nov. 18, 2016, 5:34 p.m. UTC | #4
2016-11-17 20:01 GMT+03:00 Jeff Law <law@redhat.com>:
> On 11/17/2016 09:56 AM, Ilya Verbin wrote:
>>
>> 2016-11-17 18:50 GMT+03:00 Rainer Orth <ro@cebitec.uni-bielefeld.de>:
>>>
>>> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>>>
>>>> I happened to notice that my libcilkrts SPARC port has been applied
>>>> upstream.  So to reach closure on this issue for the GCC 7 release, I'd
>>>> like to import upstream into mainline which seems to be covered by the
>>>> free-for-all clause in https://gcc.gnu.org/svnwrite.html#policies, even
>>>> though https://gcc.gnu.org/codingconventions.html#upstream lists nothing
>>>> specific and we have no listed maintainer.
>>>
>>>
>>> I initially used Ilya's intel.com address, which bounced.  Now using the
>>> current address listed in MAINTAINERS...
>>
>>
>> Yeah, I don't work for Intel anymore. And I'm not a libcilkrts
>> maintainer, so I can't approve it.
>
> Do you want to be?  IIRC I was going to nominate you, but held off knowing
> your situation was going to change.
>
> If you're interested in maintainer positions, I can certainly still nominate
> you.

I have little experience with this library, and no longer have a
connection with Cilk developers an Intel, so I'm not interested.

  -- Ilya
Jeff Law Nov. 29, 2016, 9:25 p.m. UTC | #5
On 11/17/2016 06:06 AM, Rainer Orth wrote:
> I happened to notice that my libcilkrts SPARC port has been applied
> upstream.  So to reach closure on this issue for the GCC 7 release, I'd
> like to import upstream into mainline which seems to be covered by the
> free-for-all clause in https://gcc.gnu.org/svnwrite.html#policies, even
> though https://gcc.gnu.org/codingconventions.html#upstream lists nothing
> specific and we have no listed maintainer.
>
> A few issues are worth mention:
>
> * Upstream still has a typo in the git URL in many files.  I've
>   corrected that during the import to avoid a massive diff:
>
> -#  https://bitbucket.org/intelcilkruntime/itnel-cilk-runtime.git are
> +#  https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
>
> * libcilkrts.spec.in is missing upstream.  I've no idea if this is
>   intentional.
>
> * A few of my changes have been lost and I can't tell if this is by
>   accident:
>
> ** Lost whitespace:
>
> --- libcilkrts-old/Makefile.am	2016-05-04 16:44:24.000000000 +0000
> +++ libcilkrts-new/Makefile.am	2016-11-17 11:35:33.782987017 +0000
> @@ -54,7 +54,7 @@ GENERAL_FLAGS = -I$(top_srcdir)/include
>  # Enable Intel Cilk Plus extension
>  GENERAL_FLAGS += -fcilkplus
>
> -# Always generate unwind tables
> +#Always generate unwind tables
>  GENERAL_FLAGS += -funwind-tables
>
>  AM_CFLAGS = $(XCFLAGS) $(GENERAL_FLAGS) -std=c99
>
> ** Lost alphabetical order of targets:
>
> diff -rup libcilkrts-old/configure.ac libcilkrts-new/configure.ac
> --- libcilkrts-old/configure.ac	2016-11-16 18:34:28.000000000 +0000
> +++ libcilkrts-new/configure.ac	2016-11-17 11:35:33.800015570 +0000
> @@ -143,14 +145,14 @@ esac
>  # contains information on what's needed
>  case "${target}" in
>
> -  arm-*-*)
> -    config_dir="arm"
> -    ;;
> -
>    i?86-*-* | x86_64-*-*)
>      config_dir="x86"
>      ;;
>
> +  arm-*-*)
> +    config_dir="arm"
> +    ;;
> +
>    sparc*-*-*)
>      config_dir="sparc"
>      ;;
> diff -rup libcilkrts-old/configure.tgt libcilkrts-new/configure.tgt
> --- libcilkrts-old/configure.tgt	2016-11-16 18:34:28.000000000 +0000
> +++ libcilkrts-new/configure.tgt	2016-11-17 11:35:33.807873451 +0000
> @@ -44,10 +44,10 @@
>
>  # Disable Cilk Runtime library for unsupported architectures.
>  case "${target}" in
> -  arm-*-*)
> -    ;;
>    i?86-*-* | x86_64-*-*)
>      ;;
> +  arm-*-*)
> +    ;;
>    sparc*-*-*)
>      ;;
>    *-*-*)
>
>   I've done nothing about those, just wanted to point them out.
>
> The following patch has passed x86_64-pc-linux-gnu bootstrap without
> regressions; i386-pc-solaris2.12 and sparc-sun-solaris2.12 bootstraps
> are currently running.
>
> Ok for mainline if they pass?
Yes.  Sorry for not getting back to you sooner.

jeff
Rainer Orth Dec. 1, 2016, 3:22 p.m. UTC | #6
Hi Jeff,

>> The following patch has passed x86_64-pc-linux-gnu bootstrap without
>> regressions; i386-pc-solaris2.12 and sparc-sun-solaris2.12 bootstraps
>> are currently running.
>>
>> Ok for mainline if they pass?
> Yes.  Sorry for not getting back to you sooner.

no worries; I've been on vacation for a week anyway.

Thanks.
        Rainer
diff mbox

Patch

# HG changeset patch
# Parent  f20811cd2fde8357b5c51307decee8c877c1e16a
Import libcilkrts Build 4467 (PR target/68945)

diff --git a/libcilkrts/Makefile.am b/libcilkrts/Makefile.am
--- a/libcilkrts/Makefile.am
+++ b/libcilkrts/Makefile.am
@@ -54,7 +54,7 @@  GENERAL_FLAGS = -I$(top_srcdir)/include 
 # Enable Intel Cilk Plus extension
 GENERAL_FLAGS += -fcilkplus
 
-# Always generate unwind tables
+#Always generate unwind tables
 GENERAL_FLAGS += -funwind-tables
 
 AM_CFLAGS = $(XCFLAGS) $(GENERAL_FLAGS) -std=c99
diff --git a/libcilkrts/README b/libcilkrts/README
--- a/libcilkrts/README
+++ b/libcilkrts/README
@@ -1,14 +1,16 @@ 
-Intel(R) Cilk(TM) Plus runtime library
+Intel(R) Cilk(TM) Plus Runtime Library
 
 Index:
-1. BUILDING
-2. USING
-3. DOXYGEN DOCUMENTATION
-4. QUESTIONS OR BUGS
-5. CONTRIBUTIONS
+1. BUILDING WITH AUTOMAKE
+2. BUILDING WITH CMAKE
+3. INSTALLING TO VXWORKS
+4. USING
+5. DOXYGEN DOCUMENTATION
+6. QUESTIONS OR BUGS
+7. CONTRIBUTIONS
 
 #
-#  1. BUILDING:
+#  1. BUILDING WITH AUTOMAKE:
 #
 
 To distribute applications that use the Intel Cilk Plus language
@@ -40,22 +42,87 @@  configure script:
 
 % ./configure --prefix=/your/path/to/lib
 
-It is also possible to use CMake if the above method does not apply
-well in your environment. Instruction is available in CMakeLists.txt.
+#
+#  2. BUILDING WITH CMAKE:
+#
+
+To distribute applications that use the Intel Cilk Plus language
+extensions to non-development systems, you need to build the Intel
+Cilk Plus runtime library and distribute it with your application.
+This instruction describes the build process using CMake*, which
+supports Linux*, Windows*, and OS X*.  It is fine to use this process
+to build a Linux library, but it is highly recommended to use the
+more mature build process described above when building on Linux.
+
+You need the CMake tool and a C/C++ compiler that supports the Intel
+Cilk Plus language extensions, and the requirements for each operating
+systems are:
+
+Common:
+    CMake 3.0.0 or later
+    Make tools such as make (Linux, OS X) or nmake (Windows)
+Linux:
+    GCC* 4.9.2 or later, or Intel(R) C++ Compiler v12.1 or later
+Windows:
+    Intel C++ Compiler v12.1 or later
+    Visual Studio* 2010 or later
+OS X:
+    Cilk-enabled branch of Clang*/LLVM* (http://cilkplus.github.io),
+    or Intel C++ Compiler v12.1 or later
+
+The common steps to build the libraries are 1) invoke cmake with
+appropriate options, 2) invoke a make tool available on the system.
+The following examples show build processes on OS X and Windows.
+
+OS X:
+    % mkdir ./build && cd ./build
+    % cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
+            -DCMAKE_INSTALL_PREFIX=./install ..
+    % make && make install
+
+Windows:
+    % mkdir .\build && cd .\build
+    % cmake -G "NMake Makefiles" -DCMAKE_C_COMPILER=icl \
+            -DCMAKE_CXX_COMPILER=icl -DCMAKE_INSTALL_PREFIX=.\install ..
+    % nmake && nmake install
 
 #
-#  2. USING:
+#  3. INSTALLING TO VXWORKS OS
+#
+
+For Windows host, run VxWorks_Install.bat.
+For Linux host, run VxWorks_Install.sh.
+
+You may need to give environment variable WIND_BASE to indicate VxWorks
+installation path.
+
+Create a VSB project, and you will see a layer named "CILKPLUS_KERNEL".
+Enable it and build the project.
+
+Create a VIP project with ICC and add component INCLUDE_CILKPLUS, then you
+will get support of Intel Cilk Plus features in VxWorks.
+
+#
+#  4. USING:
 #
 
 The Intel(R) C++ Compiler will automatically try to bring in the
 Intel Cilk Plus runtime in any program that uses the relevant
-features.  GCC requires explicit linking of both the library and
-its dependencies (libpthread, libdl).  For example:
+features.  GCC and Clang requires an explicit compiler option,
+-fcilkplus, to enable Intel Cilk Plus language extensions.
+For example,
+
+% gcc -fcilkplus -o foo.exe foo.c
+% clang -fcilkplus -o foo.exe foo.c 
+
+Older GCC versions (e.g., 4.8 cilkplus branch) requires explicit linking
+of both the library and its dependencies (libpthread, libdl).
+For example:
 
 % gcc foo.c -lcilkrts -lpthread -ldl
 
 #
-#  3. DOXYGEN DOCUMENTATION:
+#  5. DOXYGEN DOCUMENTATION:
 #
 
 The library source has Doxygen markup.  Generate HTML documentation
@@ -64,7 +131,7 @@  based on the markup by changing director
 % doxygen doxygen.cfg
 
 #
-#  4. QUESTIONS OR BUGS:
+#  6. QUESTIONS OR BUGS:
 #
 
 Issues with the Intel Cilk Plus runtime can be addressed in the Intel
@@ -72,7 +139,7 @@  Cilk Plus forums:
 http://software.intel.com/en-us/forums/intel-cilk-plus/
 
 #
-#  5. CONTRIBUTIONS:
+#  7. CONTRIBUTIONS:
 #
 
 The Intel Cilk Plus runtime library is dual licensed. The upstream copy
@@ -85,6 +152,13 @@  contributed to the upstream version via 
 Thanks to Tobias Burnus for showing us the magic to make gcc and g++
 automatically include the Cilk Plus runtime.
 
+Thanks to Eric Olson for sharing his patch for Raspberry Pi* with us.
+
+Thanks to Rainer Orth for submitting patches for exception handling and
+enabling Cilk Plus on the SPARC* architecture.
+
 ------------------------
 Intel and Cilk are trademarks of Intel Corporation in the U.S. and/or
 other countries.
+
+*Other names and brands may be claimed as the property of others.
diff --git a/libcilkrts/configure.ac b/libcilkrts/configure.ac
--- a/libcilkrts/configure.ac
+++ b/libcilkrts/configure.ac
@@ -69,6 +69,10 @@  AC_PROG_CXX
 AC_CONFIG_FILES([Makefile libcilkrts.spec])
 AC_FUNC_ALLOCA
 
+# Check for dl functions
+AC_CHECK_LIB(dl, dladdr,
+             [AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()])])
+
 # Check whether the target supports protected visibility.
 save_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Werror"
@@ -141,11 +145,7 @@  esac
 # contains information on what's needed
 case "${target}" in
 
-  x86_64-*-*)
-    config_dir="x86"
-    ;;
-
-  i?86-*-*)
+  i?86-*-* | x86_64-*-*)
     config_dir="x86"
     ;;
 
@@ -153,6 +153,10 @@  case "${target}" in
     config_dir="arm"
     ;;
 
+  sparc*-*-*)
+    config_dir="sparc"
+    ;;
+
   *)
     config_dir="generic"
     ;;
diff --git a/libcilkrts/configure.tgt b/libcilkrts/configure.tgt
--- a/libcilkrts/configure.tgt
+++ b/libcilkrts/configure.tgt
@@ -44,12 +44,12 @@ 
 
 # Disable Cilk Runtime library for unsupported architectures.
 case "${target}" in
-  x86_64-*-*)
-    ;;
-  i?86-*-*)
+  i?86-*-* | x86_64-*-*)
     ;;
   arm-*-*)
     ;;
+  sparc*-*-*)
+    ;;
   *-*-*)
     UNSUPPORTED=1
     ;;
diff --git a/libcilkrts/include/cilk/cilk_undocumented.h b/libcilkrts/include/cilk/cilk_undocumented.h
--- a/libcilkrts/include/cilk/cilk_undocumented.h
+++ b/libcilkrts/include/cilk/cilk_undocumented.h
@@ -106,9 +106,6 @@  size_t __cilkrts_get_stack_size(void);
 CILK_EXPORT __CILKRTS_NOTHROW
 void __cilkrts_dump_stats(void);
 
-CILK_EXPORT __CILKRTS_NOTHROW
-int __cilkrts_irml_version(void);
-
 struct __cilk_tbb_unwatch_thunk;
 struct __cilk_tbb_stack_op_thunk;
 
diff --git a/libcilkrts/include/internal/cilk_version.h b/libcilkrts/include/internal/cilk_version.h
--- a/libcilkrts/include/internal/cilk_version.h
+++ b/libcilkrts/include/internal/cilk_version.h
@@ -49,10 +49,10 @@ 
 
 #define VERSION_MAJOR 2
 #define VERSION_MINOR 0
-#define VERSION_BUILD 4420
+#define VERSION_BUILD 4467
 #define VERSION_REV 0
-#define VERSION_STRING "2,0,4420,0"
-#define VERSION_HASH "3b2d6aa9059c"
+#define VERSION_STRING "2,0,4467,0"
+#define VERSION_HASH "b7e54d87bd17"
 #define VERSION_BRANCH "eng"
-#define TBB_REV_NUMBER "14788"
-#define VERSION_YEAR "2015"
+#define TBB_REV_NUMBER ""
+#define VERSION_YEAR "2016"
diff --git a/libcilkrts/include/internal/rev.mk b/libcilkrts/include/internal/rev.mk
--- a/libcilkrts/include/internal/rev.mk
+++ b/libcilkrts/include/internal/rev.mk
@@ -49,4 +49,4 @@ 
 #
 # It was automatically generated by cilkrts/include/internal/Makefile
 
-CILK_REVISION = 4420
+CILK_REVISION = 4467
diff --git a/libcilkrts/runtime/cilk-abi.c b/libcilkrts/runtime/cilk-abi.c
--- a/libcilkrts/runtime/cilk-abi.c
+++ b/libcilkrts/runtime/cilk-abi.c
@@ -709,7 +709,6 @@  CILK_API_TBB_RETCODE
     return 0;   /* Success! */
 }
 
-
 // This function must be called only within a continuation, within the stack
 // frame of the continuation itself.
 CILK_API_INT __cilkrts_synched(void)
diff --git a/libcilkrts/runtime/cilk_fiber-unix.cpp b/libcilkrts/runtime/cilk_fiber-unix.cpp
--- a/libcilkrts/runtime/cilk_fiber-unix.cpp
+++ b/libcilkrts/runtime/cilk_fiber-unix.cpp
@@ -220,7 +220,7 @@  NORETURN cilk_fiber_sysdep::run()
         // enough extra space from the top of the stack we are
         // switching to for any temporaries required for this run()
         // function.
-        JMPBUF_SP(m_resume_jmpbuf) = m_stack_base - frame_size;
+        JMPBUF_SP(m_resume_jmpbuf) = CILK_ADJUST_SP(m_stack_base - frame_size);
 
         // GCC doesn't allow us to call __builtin_longjmp in the same function
         // that calls __builtin_setjmp, so it's been moved into it's own
diff --git a/libcilkrts/runtime/cilk_fiber.h b/libcilkrts/runtime/cilk_fiber.h
--- a/libcilkrts/runtime/cilk_fiber.h
+++ b/libcilkrts/runtime/cilk_fiber.h
@@ -73,9 +73,12 @@ 
  *
  * A value of 0 means no debugging.
  * Higher values generate more debugging output.
+ *
  */
+
+#ifndef FIBER_DEBUG
 #define FIBER_DEBUG 0
-
+#endif
 /**
  * @brief Flag for validating reference counts.
  * 
diff --git a/libcilkrts/runtime/config/arm/os-fence.h b/libcilkrts/runtime/config/arm/os-fence.h
--- a/libcilkrts/runtime/config/arm/os-fence.h
+++ b/libcilkrts/runtime/config/arm/os-fence.h
@@ -47,6 +47,14 @@ 
  *  for your assistance in helping us improve Cilk Plus.
  **************************************************************************/
 
+// __atomic_* intrinsics are available since GCC 4.7.
+#define HAVE_ATOMIC_INTRINSICS defined(__GNUC__) && \
+                               (__GNUC__ * 10 + __GNUC_MINOR__ >= 47)
+
+// GCC before 4.4 does not implement __sync_synchronize properly
+#define HAVE_SYNC_INTRINSICS defined(__GNUC__) && \
+                             (__GNUC__ * 10 + __GNUC_MINOR__ >= 44)
+
 /*
  * void __cilkrts_fence(void)
  *
@@ -60,5 +68,12 @@ 
  * the CPUID instruction).
  */
 
-// COMMON_SYSDEP void __cilkrts_fence(void); ///< MFENCE instruction
-# define __cilkrts_fence() __asm__ __volatile__ ("mcr   p15,0,%[t],c7,c10,4\n" :: [t] "r" (0) : "memory");
+#if HAVE_ATOMIC_INTRINSICS
+#   define __cilkrts_fence() __atomic_thread_fence(__ATOMIC_SEQ_CST)
+#elif HAVE_SYNC_INTRINSICS
+#   define __cilkrts_fence() __sync_synchronize()
+#else
+#   define __cilkrts_fence()
+// Leaving this code just in case.
+//# define __cilkrts_fence() __asm__ __volatile__ ("mcr   p15,0,%[t],c7,c10,4\n" :: [t] "r" (0) : "memory");
+#endif
diff --git a/libcilkrts/runtime/except-gcc.cpp b/libcilkrts/runtime/except-gcc.cpp
--- a/libcilkrts/runtime/except-gcc.cpp
+++ b/libcilkrts/runtime/except-gcc.cpp
@@ -60,7 +60,9 @@ 
 #include <stdint.h>
 #include <typeinfo>
 
+#ifndef DEBUG_EXCEPTIONS
 #define DEBUG_EXCEPTIONS 0
+#endif
 
 struct pending_exception_info
 {
diff --git a/libcilkrts/runtime/global_state.cpp b/libcilkrts/runtime/global_state.cpp
--- a/libcilkrts/runtime/global_state.cpp
+++ b/libcilkrts/runtime/global_state.cpp
@@ -579,7 +579,6 @@  global_state_t* cilkg_init_global_state(
     g->stack_size = cilkos_validate_stack_size(g->stack_size);
     g->failure_to_allocate_stack = 0;
 
-
     return g;
 }
 
diff --git a/libcilkrts/runtime/global_state.h b/libcilkrts/runtime/global_state.h
--- a/libcilkrts/runtime/global_state.h
+++ b/libcilkrts/runtime/global_state.h
@@ -215,7 +215,6 @@  struct global_state_t { /* COMMON_PORTAB
     /// Global fiber pool
     cilk_fiber_pool fiber_pool;
 
-
     /**
      * @brief Track whether the runtime has failed to allocate a
      * stack.
diff --git a/libcilkrts/runtime/jmpbuf.h b/libcilkrts/runtime/jmpbuf.h
--- a/libcilkrts/runtime/jmpbuf.h
+++ b/libcilkrts/runtime/jmpbuf.h
@@ -107,6 +107,18 @@ 
  */
 #define SP(SF) JMPBUF_SP((SF)->ctx)
 
+/**
+ * @brief Some architecture-dependent stack adjustment.
+ */
+#if defined(__sparcv9)
+    // Subtract sparc v9 stack bias so the actual stack starts at the
+    // allocated area.
+#   define CILK_ADJUST_SP(SP) ((SP) - 2047)
+#   define CILK_UNADJUST_SP(SP) ((SP) + 2047)
+#else
+#   define CILK_ADJUST_SP(SP) (SP)
+#   define CILK_UNADJUST_SP(SP) (SP)
+#endif
 
 __CILKRTS_BEGIN_EXTERN_C
 
@@ -120,7 +132,7 @@ 
  */
 inline char *__cilkrts_get_sp(__cilkrts_stack_frame *sf)
 {
-    return (char *)SP(sf);
+    return (char *)CILK_UNADJUST_SP(SP(sf));
 }
 
 /**
diff --git a/libcilkrts/runtime/linux-symbols.ver b/libcilkrts/runtime/linux-symbols.ver
--- a/libcilkrts/runtime/linux-symbols.ver
+++ b/libcilkrts/runtime/linux-symbols.ver
@@ -71,7 +71,6 @@  CILKABI0
     __cilkrts_hyperobject_dealloc;
     __cilkrts_hyperobject_noop_destroy;
     __cilkrts_init;
-    __cilkrts_irml_version;
     __cilkrts_leave_frame;
     __cilkrts_metacall;
     __cilkrts_rethrow;
diff --git a/libcilkrts/runtime/local_state.h b/libcilkrts/runtime/local_state.h
--- a/libcilkrts/runtime/local_state.h
+++ b/libcilkrts/runtime/local_state.h
@@ -360,6 +360,13 @@  struct local_state  /* COMMON_PORTABLE *
     unsigned int steal_failure_count;
 
     /**
+     * Record indicating that the worker stole work at least once.
+     *
+     * [local read/write]
+     */
+    int has_stolen;
+
+    /**
      * 1 if work was stolen from another worker.  When true, this will flag
      * setup_for_execution_pedigree to increment the pedigree when we resume
      * execution to match the increment that would have been done on a return
diff --git a/libcilkrts/runtime/mac-symbols.txt b/libcilkrts/runtime/mac-symbols.txt
--- a/libcilkrts/runtime/mac-symbols.txt
+++ b/libcilkrts/runtime/mac-symbols.txt
@@ -33,7 +33,6 @@ 
 ___cilkrts_hyperobject_dealloc
 ___cilkrts_hyperobject_noop_destroy
 ___cilkrts_init
-
 ___cilkrts_leave_frame
 ___cilkrts_metacall
 ___cilkrts_resume
diff --git a/libcilkrts/runtime/os-unix.c b/libcilkrts/runtime/os-unix.c
--- a/libcilkrts/runtime/os-unix.c
+++ b/libcilkrts/runtime/os-unix.c
@@ -432,7 +432,9 @@  COMMON_SYSDEP void __cilkrts_idle(void)
 #elif defined(__MIC__)
     _mm_delay_32(1024);
 #elif defined(__linux__) || \
-      defined(__APPLE__)
+      defined(__APPLE__) || \
+      defined(__CYGWIN__)
+      
     usleep(10000);
 #else
 # error "Unsupported architecture"
@@ -452,6 +454,7 @@  COMMON_SYSDEP void __cilkrts_yield(void)
 {
 #if defined(__ANDROID__)  || \
     defined(__APPLE__)    || \
+    defined(__CYGWIN__)   || \
     defined(__FreeBSD__)  || \
     defined(__VXWORKS__)  || \
     (defined(__sun__) && defined(__svr4__))
diff --git a/libcilkrts/runtime/record-replay.cpp b/libcilkrts/runtime/record-replay.cpp
--- a/libcilkrts/runtime/record-replay.cpp
+++ b/libcilkrts/runtime/record-replay.cpp
@@ -262,7 +262,7 @@  char * walk_pedigree_nodes(char *p, cons
     if (pnode->parent)
     {
         p = walk_pedigree_nodes(p, pnode->parent);
-        p += cilk_snprintf_s(p, PEDIGREE_BUFF_SIZE, "%s", (char *) "_");
+        p += cilk_snprintf_s(p, PEDIGREE_BUFF_SIZE, "%s", (char *)"_");
     }
     return p + cilk_snprintf_l(p, PEDIGREE_BUFF_SIZE, "%" PRIu64, pnode->rank);
 }
diff --git a/libcilkrts/runtime/scheduler.c b/libcilkrts/runtime/scheduler.c
--- a/libcilkrts/runtime/scheduler.c
+++ b/libcilkrts/runtime/scheduler.c
@@ -1789,20 +1789,27 @@  static full_frame* check_for_work(__cilk
         if (NULL == ff) {
             // Punish the worker for failing to steal.
             // No quantum for you!
-            if (w->l->steal_failure_count > 30000) {
-                // Punish more if the worker has been doing unsuccessful steals
-                // for a long time. After return from the idle state, it will
-                // be given a grace period to react quickly.
+            unsigned int max_fails = w->g->max_steal_failures << 1;
+            if (w->l->has_stolen == 0 &&
+                w->l->steal_failure_count % max_fails == max_fails - 1) {
+                // Idle briefly if the worker has never stolen anything for
+                // the given grace period
                 __cilkrts_idle();
-                w->l->steal_failure_count -= 300;
             } else {
                 __cilkrts_yield();
             }
             w->l->steal_failure_count++;
+            if (w->l->steal_failure_count > (max_fails << 8)) {
+                // Reset the flag after certain amount of failures
+                // - This will reduce cpu time in top-level synched regions
+                // - max_fails can be controlled by user (CILK_STEAL_FAILURES)
+                w->l->has_stolen = 0;
+            }
         } else {
             // Reset steal_failure_count since there is obviously still work to
             // be done.
             w->l->steal_failure_count = 0;
+            w->l->has_stolen = 1;
         }
     }
     return ff;
@@ -2912,6 +2919,7 @@  void __cilkrts_restore_stealing(
     w->l->stats = NULL;
 #endif    
     w->l->steal_failure_count = 0;
+    w->l->has_stolen = 0;
 
     w->l->work_stolen = 0;
 
diff --git a/libcilkrts/runtime/scheduler.h b/libcilkrts/runtime/scheduler.h
--- a/libcilkrts/runtime/scheduler.h
+++ b/libcilkrts/runtime/scheduler.h
@@ -85,7 +85,10 @@ 
  * Print debugging messages and assertions for parallel reducers. 0 is
  * no debugging.  A higher value generates more output.
  */
+
+#ifndef REDPAR_DEBUG
 #define REDPAR_DEBUG 0
+#endif
 
 /**
  * @brief Lock the worker mutex to allow exclusive access to the
diff --git a/libcilkrts/runtime/sysdep-unix.c b/libcilkrts/runtime/sysdep-unix.c
--- a/libcilkrts/runtime/sysdep-unix.c
+++ b/libcilkrts/runtime/sysdep-unix.c
@@ -465,7 +465,7 @@  char* sysdep_reset_jump_buffers_for_resu
 
     CILK_ASSERT(fiber);
     void* sp = (void*)get_sp_for_executing_sf(cilk_fiber_get_stack_base(fiber), ff, sf);
-    SP(sf) = sp;
+    SP(sf) = CILK_ADJUST_SP(sp);
 
     /* Debugging: make sure stack is accessible. */
     ((volatile char *)sp)[-1];
@@ -495,7 +495,7 @@  NORETURN sysdep_longjmp_to_sf(char* new_
 #endif
 
     // Set the stack pointer.
-    SP(sf) = new_sp;
+    SP(sf) = CILK_ADJUST_SP(new_sp);
 
 #ifdef RESTORE_X86_FP_STATE
     if (CILK_FRAME_VERSION_VALUE(sf->flags) >= 1) {
@@ -568,7 +568,7 @@  static const char *get_runtime_path ()
 {
     // dladdr is a glibc extension. If it's available, use it to find the path
     // for libcilkrts.so
-#ifdef _GNU_SOURCE
+#if HAVE_DLADDR
     Dl_info info;
     if (0 != dladdr(dummy_function, &info))
         return info.dli_fname;
@@ -689,7 +689,6 @@  static void write_version_file (global_s
     // ==================
     // System cores: 8
     // Cilk workers requested: 8
-    // Thread creator: Private
 
     fprintf(fp, "\nThread information\n");
     fprintf(fp, "==================\n");
@@ -699,11 +698,6 @@  static void write_version_file (global_s
     fprintf(fp, "System cores: %d\n", (int)sysconf(_SC_NPROCESSORS_ONLN));
 #endif    
     fprintf(fp, "Cilk workers requested: %d\n", n);
-#if (PARALLEL_THREAD_CREATE)
-        fprintf(fp, "Thread creator: Private (parallel)\n");
-#else
-        fprintf(fp, "Thread creator: Private\n");
-#endif
 
     if (fp != stderr && fp != stdout) fclose(fp);
     else fflush(fp); // flush the handle buffer if it is stdout or stderr.