pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

llvm-netbsd: Add a patch improving llvm::once_flag



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sun Feb 5 04:46:05 2017 +0100
Changeset:	9051b4dd6a42bae1de40513b1bfe8658368c6625

Modified Files:
	llvm-netbsd/distinfo
Added Files:
	llvm-netbsd/patches/patch-include_llvm_Support_Threading.h

Log Message:
llvm-netbsd: Add a patch improving llvm::once_flag

This is a prototype dedicated to send upstream.

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=9051b4dd6a42bae1de40513b1bfe8658368c6625

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 llvm-netbsd/distinfo                               |  1 +
 .../patches/patch-include_llvm_Support_Threading.h | 48 ++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diffs:
diff --git a/llvm-netbsd/distinfo b/llvm-netbsd/distinfo
index 7931384fd5..25deb90e95 100644
--- a/llvm-netbsd/distinfo
+++ b/llvm-netbsd/distinfo
@@ -12,3 +12,4 @@ Size (libcxx-3.6.2.src.tar.xz) = 944020 bytes
 SHA1 (llvm-3.6.2.src.tar.xz) = 7a00257eb2bc9431e4c77c3a36b033072c54bc7e
 RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
+SHA1 (patch-include_llvm_Support_Threading.h) = bfac6c1bbda4e71ed1101345c997bc1a19546c99
diff --git a/llvm-netbsd/patches/patch-include_llvm_Support_Threading.h b/llvm-netbsd/patches/patch-include_llvm_Support_Threading.h
new file mode 100644
index 0000000000..35e61ca507
--- /dev/null
+++ b/llvm-netbsd/patches/patch-include_llvm_Support_Threading.h
@@ -0,0 +1,48 @@
+$NetBSD$
+
+--- include/llvm/Support/Threading.h.orig	2017-02-05 03:45:42.682914655 +0000
++++ include/llvm/Support/Threading.h
+@@ -67,7 +67,11 @@ namespace llvm {
+ #else
+ 
+   enum InitStatus { Uninitialized = 0, Wait = 1, Done = 2 };
+-  typedef volatile sys::cas_flag once_flag;
++  class once_flag {
++  public:
++    once_flag() : status(::llvm::Uninitialized) {};
++    volatile ::llvm::sys::cas_flag status;
++  };
+ 
+   /// This macro is the only way you should define your once flag for LLVM's
+   /// call_once.
+@@ -96,24 +100,24 @@ namespace llvm {
+ #else
+     // For other platforms we use a generic (if brittle) version based on our
+     // atomics.
+-    sys::cas_flag old_val = sys::CompareAndSwap(&flag, Wait, Uninitialized);
++    sys::cas_flag old_val = sys::CompareAndSwap(&flag.status, Wait, Uninitialized);
+     if (old_val == Uninitialized) {
+       std::forward<Function>(F)(std::forward<Args>(ArgList)...);
+       sys::MemoryFence();
+       TsanIgnoreWritesBegin();
+-      TsanHappensBefore(&flag);
+-      flag = Done;
++      TsanHappensBefore(&flag.status);
++      flag.status = Done;
+       TsanIgnoreWritesEnd();
+     } else {
+       // Wait until any thread doing the call has finished.
+-      sys::cas_flag tmp = flag;
++      sys::cas_flag tmp = flag.status;
+       sys::MemoryFence();
+       while (tmp != Done) {
+-        tmp = flag;
++        tmp = flag.status;
+         sys::MemoryFence();
+       }
+     }
+-    TsanHappensAfter(&flag);
++    TsanHappensAfter(&flag.status);
+ #endif
+   }
+ 


Home | Main Index | Thread Index | Old Index