From 16ccd2e16dc62d227f037befc86643d32f33197f Mon Sep 17 00:00:00 2001 From: bsimmers Date: Tue, 5 Nov 2013 16:58:45 -0800 Subject: [PATCH] Move the rest of Type's methods into type.cpp Reviewed By: @jdelong Differential Revision: D1043399 --- hphp/runtime/vm/jit/ir.cpp | 64 -------------------------------------------- hphp/runtime/vm/jit/type.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/hphp/runtime/vm/jit/ir.cpp b/hphp/runtime/vm/jit/ir.cpp index 74f21705838..4ab6cbb0af5 100755 --- a/hphp/runtime/vm/jit/ir.cpp +++ b/hphp/runtime/vm/jit/ir.cpp @@ -46,70 +46,6 @@ namespace HPHP { namespace JIT { using namespace HPHP::Transl; -#define IRT(name, ...) const Type Type::name(Type::k##name); -IR_TYPES -#undef IRT - -std::string Type::toString() const { - // Try to find an exact match to a predefined type -# define IRT(name, ...) if (*this == name) return #name; - IR_TYPES -# undef IRT - - if (isBoxed()) { - return folly::to("Boxed", innerType().toString()); - } - if (isPtr()) { - return folly::to("PtrTo", deref().toString()); - } - - auto t = *this; - std::vector parts; - if (isSpecialized()) { - if (canSpecializeClass()) { - assert(m_class); - parts.push_back(folly::to(Type(m_bits & kAnyObj).toString(), - '<', m_class->name()->data(), - '>')); - t -= AnyObj; - } else if (canSpecializeArrayKind()) { - assert(hasArrayKind()); - parts.push_back( - folly::to(Type(m_bits & kAnyArr).toString(), '<', - ArrayData::kindToString(m_arrayKind), '>')); - t -= AnyArr; - } else { - not_reached(); - } - } - - // Concat all of the primitive types in the custom union type -# define IRT(name, ...) if (name <= t) parts.push_back(#name); - IRT_PRIMITIVE -# undef IRT - assert(!parts.empty()); - if (parts.size() == 1) { - return parts.front(); - } - return folly::format("{{{}}}", folly::join('|', parts)).str(); -} - -std::string Type::debugString(Type t) { - return t.toString(); -} - -Type Type::fromString(const std::string& str) { - static hphp_string_map types; - static bool init = false; - if (UNLIKELY(!init)) { -# define IRT(name, ...) types[#name] = name; - IR_TYPES -# undef IRT - init = true; - } - return mapGet(types, str, Type::None); -} - TRACE_SET_MOD(hhir); namespace { diff --git a/hphp/runtime/vm/jit/type.cpp b/hphp/runtime/vm/jit/type.cpp index 95d96eadf4c..74dc2a9bf5f 100644 --- a/hphp/runtime/vm/jit/type.cpp +++ b/hphp/runtime/vm/jit/type.cpp @@ -33,6 +33,70 @@ TRACE_SET_MOD(hhir); ////////////////////////////////////////////////////////////////////// +#define IRT(name, ...) const Type Type::name(Type::k##name); +IR_TYPES +#undef IRT + +std::string Type::toString() const { + // Try to find an exact match to a predefined type +# define IRT(name, ...) if (*this == name) return #name; + IR_TYPES +# undef IRT + + if (isBoxed()) { + return folly::to("Boxed", innerType().toString()); + } + if (isPtr()) { + return folly::to("PtrTo", deref().toString()); + } + + auto t = *this; + std::vector parts; + if (isSpecialized()) { + if (canSpecializeClass()) { + assert(m_class); + parts.push_back(folly::to(Type(m_bits & kAnyObj).toString(), + '<', m_class->name()->data(), + '>')); + t -= AnyObj; + } else if (canSpecializeArrayKind()) { + assert(hasArrayKind()); + parts.push_back( + folly::to(Type(m_bits & kAnyArr).toString(), '<', + ArrayData::kindToString(m_arrayKind), '>')); + t -= AnyArr; + } else { + not_reached(); + } + } + + // Concat all of the primitive types in the custom union type +# define IRT(name, ...) if (name <= t) parts.push_back(#name); + IRT_PRIMITIVE +# undef IRT + assert(!parts.empty()); + if (parts.size() == 1) { + return parts.front(); + } + return folly::format("{{{}}}", folly::join('|', parts)).str(); +} + +std::string Type::debugString(Type t) { + return t.toString(); +} + +Type Type::fromString(const std::string& str) { + static hphp_string_map types; + static bool init = false; + if (UNLIKELY(!init)) { +# define IRT(name, ...) types[#name] = name; + IR_TYPES +# undef IRT + init = true; + } + return mapGet(types, str, Type::None); +} + bool Type::checkValid() const { if (m_extra) { assert((!(m_bits & kAnyObj) || !(m_bits & kAnyArr)) && -- 2.11.4.GIT