Core-local allocator
[folly.git] / folly / PackedSyncPtr.h
index 00dc1e22419d38e975b37677bc2667547c218294..e11588e8419540a32f5ff80e38749253c1f134b1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,8 +18,8 @@
 
 #include <folly/Portability.h>
 
-#if !FOLLY_X64 && !FOLLY_PPC64
-# error "PackedSyncPtr is x64 and ppc64 specific code."
+#if !FOLLY_X64 && !FOLLY_PPC64 && !FOLLY_A64
+# error "PackedSyncPtr is x64, ppc64 or aarch64 specific code."
 #endif
 
 /*
@@ -135,7 +135,7 @@ public:
 
  private:
   PicoSpinLock<uintptr_t> data_;
-};
+} FOLLY_PACK_ATTR;
 
 static_assert(
     std::is_pod<PackedSyncPtr<void>>::value,
@@ -144,4 +144,9 @@ static_assert(sizeof(PackedSyncPtr<void>) == 8,
               "PackedSyncPtr should be only 8 bytes---something is "
               "messed up");
 
+template <typename T>
+std::ostream& operator<<(std::ostream& os, const PackedSyncPtr<T>& ptr) {
+  os << "PackedSyncPtr(" << ptr.get() << ", " << ptr.extra() << ")";
+  return os;
+}
 }