Commit 328b22e8 authored by Michael Lee's avatar Michael Lee Committed by Facebook Github Bot 9

Use FOLLY_MOBILE to split some functionality

Summary: The guards already look for __APPLE__, but __ANDROID__ needs this as well.

Reviewed By: yfeldblum

Differential Revision: D3053976

fb-gh-sync-id: a9ba7a612d29502d4a7e691c6741837d4a8b42f0
shipit-source-id: a9ba7a612d29502d4a7e691c6741837d4a8b42f0
parent 2d14fafe
...@@ -210,7 +210,7 @@ namespace std { typedef ::max_align_t max_align_t; } ...@@ -210,7 +210,7 @@ namespace std { typedef ::max_align_t max_align_t; }
# error cannot define platform specific thread local storage # error cannot define platform specific thread local storage
#endif #endif
#if defined(__APPLE__) && (TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE) #if FOLLY_MOBILE
#undef FOLLY_TLS #undef FOLLY_TLS
#endif #endif
......
...@@ -150,7 +150,7 @@ pthread_rwlock_t Read 728698 24us 101ns 7.28ms 194us ...@@ -150,7 +150,7 @@ pthread_rwlock_t Read 728698 24us 101ns 7.28ms 194us
#endif #endif
// iOS doesn't define _mm_cvtsi64_si128 and friends // iOS doesn't define _mm_cvtsi64_si128 and friends
#if (FOLLY_SSE >= 2) && !TARGET_OS_IPHONE #if (FOLLY_SSE >= 2) && !FOLLY_MOBILE
#define RW_SPINLOCK_USE_SSE_INSTRUCTIONS_ #define RW_SPINLOCK_USE_SSE_INSTRUCTIONS_
#else #else
#undef RW_SPINLOCK_USE_SSE_INSTRUCTIONS_ #undef RW_SPINLOCK_USE_SSE_INSTRUCTIONS_
......
...@@ -236,7 +236,7 @@ AC_CACHE_CHECK( ...@@ -236,7 +236,7 @@ AC_CACHE_CHECK(
[for c++11 atomic support without GNU Atomic library], [for c++11 atomic support without GNU Atomic library],
[folly_cv_lib_libatomic], [folly_cv_lib_libatomic],
[AC_LINK_IFELSE( [AC_LINK_IFELSE(
[AC_LANG_PROGRAM[ [AC_LANG_SOURCE[
#include <atomic> #include <atomic>
int main() { int main() {
struct Test { int val; }; struct Test { int val; };
...@@ -501,6 +501,15 @@ else ...@@ -501,6 +501,15 @@ else
AC_CHECK_HEADERS([libunwind.h],, [use_follytestmain=no]) AC_CHECK_HEADERS([libunwind.h],, [use_follytestmain=no])
fi fi
AC_ARG_ENABLE([mobile],
AS_HELP_STRING([--enable-mobile],
[enables using main function from folly for tests]),
[mobile=${enableval}], [mobile=no])
AS_IF([test "x${mobile}" = "xyes"], [
AC_DEFINE([MOBILE], [1],
[Define to 1 for compiler guards for mobile targets.])
])
# Include directory that contains "folly" so #include <folly/Foo.h> works # Include directory that contains "folly" so #include <folly/Foo.h> works
AM_CPPFLAGS='-I$(top_srcdir)/..' AM_CPPFLAGS='-I$(top_srcdir)/..'
AM_CPPFLAGS="$AM_CPPFLAGS $BOOST_CPPFLAGS" AM_CPPFLAGS="$AM_CPPFLAGS $BOOST_CPPFLAGS"
......
...@@ -15,19 +15,20 @@ ...@@ -15,19 +15,20 @@
*/ */
#include <folly/detail/MemoryIdler.h> #include <folly/detail/MemoryIdler.h>
#include <folly/Logging.h> #include <folly/Logging.h>
#include <folly/Malloc.h> #include <folly/Malloc.h>
#include <folly/Portability.h>
#include <folly/ScopeGuard.h> #include <folly/ScopeGuard.h>
#include <folly/detail/CacheLocality.h> #include <folly/detail/CacheLocality.h>
#include <limits.h> #include <limits.h>
#include <pthread.h> #include <pthread.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <unistd.h>
#include <utility> #include <utility>
namespace folly { namespace detail { namespace folly { namespace detail {
AtomicStruct<std::chrono::steady_clock::duration> AtomicStruct<std::chrono::steady_clock::duration>
...@@ -92,7 +93,8 @@ void MemoryIdler::flushLocalMallocCaches() { ...@@ -92,7 +93,8 @@ void MemoryIdler::flushLocalMallocCaches() {
// Stack madvise isn't Linux or glibc specific, but the system calls // Stack madvise isn't Linux or glibc specific, but the system calls
// and arithmetic (and bug compatibility) are not portable. The set of // and arithmetic (and bug compatibility) are not portable. The set of
// platforms could be increased if it was useful. // platforms could be increased if it was useful.
#if (FOLLY_X64 || FOLLY_PPC64 ) && defined(_GNU_SOURCE) && defined(__linux__) #if (FOLLY_X64 || FOLLY_PPC64) && defined(_GNU_SOURCE) && \
defined(__linux__) && !FOLLY_MOBILE
static FOLLY_TLS uintptr_t tls_stackLimit; static FOLLY_TLS uintptr_t tls_stackLimit;
static FOLLY_TLS size_t tls_stackSize; static FOLLY_TLS size_t tls_stackSize;
......
...@@ -28,10 +28,11 @@ ...@@ -28,10 +28,11 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <folly/Foreach.h>
#include <folly/Exception.h> #include <folly/Exception.h>
#include <folly/Foreach.h>
#include <folly/Malloc.h> #include <folly/Malloc.h>
#include <folly/MicroSpinLock.h> #include <folly/MicroSpinLock.h>
#include <folly/Portability.h>
#include <folly/detail/StaticSingletonManager.h> #include <folly/detail/StaticSingletonManager.h>
...@@ -41,7 +42,7 @@ ...@@ -41,7 +42,7 @@
// //
// XXX: Ideally we would instead determine if emutls is in use at runtime as it // XXX: Ideally we would instead determine if emutls is in use at runtime as it
// is possible to configure glibc on Linux to use emutls regardless. // is possible to configure glibc on Linux to use emutls regardless.
#if !__APPLE__ && !__ANDROID__ #if !FOLLY_MOBILE && !defined(__APPLE__)
#define FOLLY_TLD_USE_FOLLY_TLS 1 #define FOLLY_TLD_USE_FOLLY_TLS 1
#else #else
#undef FOLLY_TLD_USE_FOLLY_TLS #undef FOLLY_TLD_USE_FOLLY_TLS
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <folly/futures/detail/Core.h> #include <folly/futures/detail/Core.h>
#include <folly/futures/Timekeeper.h> #include <folly/futures/Timekeeper.h>
#if defined(__ANDROID__) || defined(__APPLE__) #if FOLLY_MOBILE || defined(__APPLE__)
#define FOLLY_FUTURE_USING_FIBER 0 #define FOLLY_FUTURE_USING_FIBER 0
#else #else
#define FOLLY_FUTURE_USING_FIBER 1 #define FOLLY_FUTURE_USING_FIBER 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment