82326d7ec8
We had the belief that m_type as an int32_t (and in at least one
place, an int64_t) burned in many places. This is going to make any kind of
re-encoding of TypedValues nearly impossible.
Redirect all such accesses via some helpers, so e.g.
a. cmpl(KindOfUninit, base[TVOFF(m_type)]);
becomes
emitCmpTVType(a, KindOfUninit, base[TVOFF(m_type)]);
which may do byte or dword access, depending on m_type's actual size. While
this is motivated by 7pack, I'm planning to route it through trunk to
prevent any more of the old style accesses from cropping up.
49 linhas
1.8 KiB
C++
49 linhas
1.8 KiB
C++
/*
|
|
+----------------------------------------------------------------------+
|
|
| HipHop for PHP |
|
|
+----------------------------------------------------------------------+
|
|
| Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
|
|
+----------------------------------------------------------------------+
|
|
| This source file is subject to version 3.01 of the PHP license, |
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
| available through the world-wide-web at the following url: |
|
|
| http://www.php.net/license/3_01.txt |
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
+----------------------------------------------------------------------+
|
|
*/
|
|
#ifndef META_H_
|
|
#define META_H_
|
|
|
|
#include <boost/type_traits.hpp>
|
|
#include <boost/mpl/if.hpp>
|
|
|
|
|
|
namespace HPHP {
|
|
|
|
// is_const_iterator: by analogy with is_const et al.
|
|
template<typename Iter>
|
|
struct is_const_iterator {
|
|
typedef typename std::iterator_traits<Iter>::pointer pointer;
|
|
typedef typename boost::is_const<
|
|
typename boost::remove_pointer<pointer>::type
|
|
>::type type;
|
|
static bool const value = type::value;
|
|
};
|
|
|
|
// match_iterator: return Value with the same const-ness as Iter.
|
|
template<typename Iter,
|
|
typename Value = typename std::iterator_traits<Iter>::type>
|
|
struct match_iterator : boost::mpl::eval_if<
|
|
is_const_iterator<Iter>,
|
|
boost::add_const<Value>,
|
|
boost::remove_const<Value> > {};
|
|
|
|
// field_type: provide the type of a struct field.
|
|
#define field_type(strct, fld) decltype(((strct*)0)->fld)
|
|
|
|
}
|
|
|
|
#endif /* META_H_ */
|