diff --git a/hphp/runtime/vm/translator/targetcache.cpp b/hphp/runtime/vm/translator/targetcache.cpp index be67230b6..3980e0098 100644 --- a/hphp/runtime/vm/translator/targetcache.cpp +++ b/hphp/runtime/vm/translator/targetcache.cpp @@ -99,8 +99,8 @@ __thread void* tl_targetCaches = nullptr; static_assert(kConditionFlagsOff + sizeof(ssize_t) <= 64, "kConditionFlagsOff too large"); size_t s_frontier = kConditionFlagsOff + 64; -static size_t s_persistent_frontier = 0; -static size_t s_persistent_start = 0; +size_t s_persistent_frontier = 0; +size_t s_persistent_start = 0; static size_t s_next_bit; static size_t s_bits_to_go; static int s_tc_fd; diff --git a/hphp/runtime/vm/translator/targetcache.h b/hphp/runtime/vm/translator/targetcache.h index ce4cd3cbd..b5a8e8fec 100644 --- a/hphp/runtime/vm/translator/targetcache.h +++ b/hphp/runtime/vm/translator/targetcache.h @@ -40,6 +40,8 @@ void flush(); */ extern __thread void* tl_targetCaches; extern size_t s_frontier; +extern size_t s_persistent_frontier; +extern size_t s_persistent_start; static const int kConditionFlagsOff = 0; diff --git a/hphp/runtime/vm/translator/translator-x64.cpp b/hphp/runtime/vm/translator/translator-x64.cpp index 6e23ca9f2..5e310b759 100644 --- a/hphp/runtime/vm/translator/translator-x64.cpp +++ b/hphp/runtime/vm/translator/translator-x64.cpp @@ -12207,6 +12207,8 @@ std::string TranslatorX64::getUsage() { size_t stubsUsage = astubs.code.frontier - astubs.code.base; size_t dataUsage = m_globalData.frontier - m_globalData.base; size_t tcUsage = TargetCache::s_frontier; + size_t persistentUsage = + TargetCache::s_persistent_frontier - TargetCache::s_persistent_start; Util::string_printf( usage, "tx64: %9zd bytes (%" PRId64 "%%) in ahot.code\n" @@ -12215,7 +12217,8 @@ std::string TranslatorX64::getUsage() { "tx64: %9zd bytes (%" PRId64 "%%) in a.code from ir\n" "tx64: %9zd bytes (%" PRId64 "%%) in astubs.code from ir\n" "tx64: %9zd bytes (%" PRId64 "%%) in m_globalData\n" - "tx64: %9zd bytes (%" PRId64 "%%) in targetCache\n", + "tx64: %9zd bytes (%" PRId64 "%%) in targetCache\n" + "tx64: %9zd bytes (%" PRId64 "%%) in persistentCache\n", aHotUsage, 100 * aHotUsage / ahot.code.size, aUsage, 100 * aUsage / a.code.size, stubsUsage, 100 * stubsUsage / astubs.code.size, @@ -12223,7 +12226,9 @@ std::string TranslatorX64::getUsage() { m_irAstubsUsage, 100 * m_irAstubsUsage / astubs.code.size, dataUsage, 100 * dataUsage / m_globalData.size, tcUsage, - 100 * tcUsage / RuntimeOption::EvalJitTargetCacheSize); + 400 * tcUsage / RuntimeOption::EvalJitTargetCacheSize / 3, + persistentUsage, + 400 * persistentUsage / RuntimeOption::EvalJitTargetCacheSize); return usage; } diff --git a/hphp/util/base.h b/hphp/util/base.h index d7d906b1d..52f646c3d 100644 --- a/hphp/util/base.h +++ b/hphp/util/base.h @@ -499,23 +499,6 @@ struct file_closer { } }; -/////////////////////////////////////////////////////////////////////////////// -// Non-gcc compat -#define ATTRIBUTE_UNUSED __attribute__((unused)) -#define ATTRIBUTE_NORETURN __attribute__((noreturn)) -#ifndef ATTRIBUTE_PRINTF -#if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ > 6 -#define ATTRIBUTE_PRINTF(a1,a2) __attribute__((__format__ (__printf__, a1, a2))) -#else -#define ATTRIBUTE_PRINTF(a1,a2) -#endif -#endif -#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __ICC >= 1200 || __GNUC__ > 4 -#define ATTRIBUTE_COLD __attribute__((cold)) -#else -#define ATTRIBUTE_COLD -#endif - /////////////////////////////////////////////////////////////////////////////// /* diff --git a/hphp/util/util.h b/hphp/util/util.h index 3c94c6d8a..6e11cd25d 100644 --- a/hphp/util/util.h +++ b/hphp/util/util.h @@ -36,6 +36,27 @@ namespace HPHP { namespace Util { /////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +// Non-gcc compat +#ifndef __GNUC__ +#define __attribute__(x) +#endif + +#define ATTRIBUTE_UNUSED __attribute__((unused)) +#define ATTRIBUTE_NORETURN __attribute__((noreturn)) +#ifndef ATTRIBUTE_PRINTF +#if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ > 6 +#define ATTRIBUTE_PRINTF(a1,a2) __attribute__((__format__ (__printf__, a1, a2))) +#else +#define ATTRIBUTE_PRINTF(a1,a2) +#endif +#endif +#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __ICC >= 1200 || __GNUC__ > 4 +#define ATTRIBUTE_COLD __attribute__((cold)) +#else +#define ATTRIBUTE_COLD +#endif + #define ALWAYS_INLINE __attribute__((always_inline)) #define NEVER_INLINE __attribute__((noinline)) #define INLINE_SINGLE_CALLER ALWAYS_INLINE @@ -231,7 +252,8 @@ const void *buffer_append(const void *buf1, int size1, /** * printf into a std::string. */ -void string_printf(std::string &msg, const char *fmt, ...); +void string_printf(std::string &msg, + const char *fmt, ...) ATTRIBUTE_PRINTF(2,3); void string_vsnprintf(std::string &msg, const char *fmt, va_list ap); /**