2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
19 #include "hphp/runtime/base/countable.h"
20 #include "hphp/util/type-scan.h"
21 #include "hphp/util/low-ptr.h"
31 using low_storage_t
= uint32_t;
32 using cls_meth_t
= ClsMethData
;
34 using low_storage_t
= uintptr_t;
35 using cls_meth_t
= ClsMethData
*;
38 ClsMethData() = default;
40 static cls_meth_t
make(Class
* cls
, Func
* func
);
42 bool validate() const;
44 Class
* getCls() const {
45 return reinterpret_cast<Class
*>(m_cls
);
48 Func
* getFunc() const {
49 return reinterpret_cast<Func
*>(m_func
);
52 String
getClsStr() const;
54 String
getFuncStr() const;
56 static constexpr ptrdiff_t clsOffset() {
57 return offsetof(ClsMethData
, m_cls
);
60 static constexpr ptrdiff_t funcOffset() {
61 return offsetof(ClsMethData
, m_func
);
64 bool isPersistent() const;
67 ClsMethData(Class
* cls
, Func
* func
);
74 static_assert(sizeof(ClsMethData
) == 8);
75 static_assert(ClsMethData::clsOffset() == 0, "Class offset must be 0");
76 static_assert(ClsMethData::funcOffset() == 4, "Func offset must be 4");