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 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_RDS_SYMBOL_H_
18 #define incl_HPHP_RDS_SYMBOL_H_
20 #include "hphp/runtime/base/types.h"
22 #include "hphp/util/low-ptr.h"
24 #include <boost/variant.hpp>
27 #include <type_traits>
36 struct ArrayAccessProfile
;
37 struct ArrayIterProfile
;
38 struct CallTargetProfile
;
42 struct IsTypeStructProfile
;
51 ///////////////////////////////////////////////////////////////////////////////
53 * RDS symbols are centrally registered here.
55 * All StringData*'s below must be static strings.
59 * Symbols for rds::Link's.
61 struct LinkID
{ const char* type
; };
62 struct LinkName
{ const char* type
; LowStringPtr name
; };
65 * Class constant values are TypedValue's stored in RDS.
67 struct ClsConstant
{ LowStringPtr clsName
;
68 LowStringPtr cnsName
; };
71 * StaticMethod{F,}Cache allocations.
73 * These are used to cache static method dispatch targets in a given class
74 * context. The `name' field here is a string that encodes the target class,
75 * property, and source context.
77 struct StaticMethod
{ LowStringPtr name
; };
78 struct StaticMethodF
{ LowStringPtr name
; };
81 * Profiling translations may store various kinds of junk under symbols that
82 * are keyed on translation id.
84 * These generally should go in Mode::Local or Mode::Persistent, depending on
87 #define RDS_PROFILE_SYMBOLS \
88 PR(ArrayAccessProfile) \
89 PR(ArrayIterProfile) \
90 PR(CallTargetProfile) \
93 PR(IsTypeStructProfile) \
99 enum class ProfileKind
{
109 Profile(TransID transId
, Offset bcOff
, const StringData
* name
)
110 : kind
{ProfileKind::None
}
117 Profile(const jit::T*, TransID transId, \
118 Offset bcOff, const StringData* name) \
119 : kind{ProfileKind::T} \
134 * Static class properties in Mode::Local.
136 struct SPropCache
{ LowPtr
<const Class
> cls
;
139 struct StaticMemoValue
{ FuncId funcId
; };
140 struct StaticMemoCache
{ FuncId funcId
; };
142 struct LSBMemoValue
{
143 LowPtr
<const Class
> cls
;
147 struct LSBMemoCache
{
148 LowPtr
<const Class
> cls
;
156 using Symbol
= boost::variant
<
171 std::string
symbol_kind(const Symbol
&);
172 std::string
symbol_rep(const Symbol
&);
173 bool symbol_eq(const Symbol
&, const Symbol
&);
174 size_t symbol_hash(const Symbol
&);
176 ///////////////////////////////////////////////////////////////////////////////