Remove need for unstable feature attribute in HHVM
[hiphop-php.git] / hphp / system / systemlib.h
blob83f58b1bf44a0059eb2686f0486769dc808e7088
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
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_SYSTEMLIB_H_
18 #define incl_HPHP_SYSTEMLIB_H_
20 #include "hphp/runtime/base/types.h"
21 #include "hphp/runtime/base/tv-variant.h"
22 #include "hphp/util/portability.h"
24 namespace HPHP {
25 struct ObjectData;
26 struct Unit;
27 struct Class;
28 struct Func;
29 struct Object;
30 } //namespace HPHP
32 namespace HPHP { namespace SystemLib {
33 ///////////////////////////////////////////////////////////////////////////////
35 #define SYSTEMLIB_CLASSES(x) \
36 x(stdclass) \
37 x(Exception) \
38 x(BadMethodCallException) \
39 x(InvalidArgumentException) \
40 x(TypeAssertionException) \
41 x(RuntimeException) \
42 x(OutOfBoundsException) \
43 x(InvalidOperationException) \
44 x(pinitSentinel) \
45 x(resource) \
46 x(Directory) \
47 x(SplFileInfo) \
48 x(SplFileObject) \
49 x(DateTimeInterface) \
50 x(DateTimeImmutable) \
51 x(DOMException) \
52 x(PDOException) \
53 x(SoapFault) \
54 x(Serializable) \
55 x(ArrayAccess) \
56 x(ArrayIterator) \
57 x(IteratorAggregate) \
58 x(Countable) \
59 x(LazyKVZipIterable) \
60 x(LazyIterableView) \
61 x(LazyKeyedIterableView) \
62 x(CURLFile) \
63 x(__PHP_Incomplete_Class) \
64 x(DivisionByZeroException) \
65 x(InvalidForeachArgumentException) \
66 x(UndefinedPropertyException) \
67 x(UndefinedVariableException) \
68 x(TypecastException)
70 #define SYSTEMLIB_HH_CLASSES(x) \
71 x(Traversable) \
72 x(Iterator) \
73 x(SwitchableClass) \
74 /* */
76 extern bool s_inited;
77 extern bool s_anyNonPersistentBuiltins;
78 extern std::string s_source;
79 extern Unit* s_unit;
80 extern Unit* s_hhas_unit;
81 extern Func* s_nullFunc;
82 extern Func* s_nullCtor;
84 #define DECLARE_SYSTEMLIB_CLASS(cls) \
85 extern Class* s_ ## cls ## Class;
86 SYSTEMLIB_CLASSES(DECLARE_SYSTEMLIB_CLASS)
87 #undef DECLARE_SYSTEMLIB_CLASS
89 #define DECLARE_SYSTEMLIB_HH_CLASS(cls) \
90 extern Class* s_HH_ ## cls ## Class;
91 SYSTEMLIB_HH_CLASSES(DECLARE_SYSTEMLIB_HH_CLASS)
92 #undef DECLARE_SYSTEMLIB_HH_CLASS
94 extern Class* s_ThrowableClass;
95 extern Class* s_BaseExceptionClass;
96 extern Class* s_ErrorClass;
97 extern Class* s_ArithmeticErrorClass;
98 extern Class* s_ArgumentCountErrorClass;
99 extern Class* s_AssertionErrorClass;
100 extern Class* s_DivisionByZeroErrorClass;
101 extern Class* s_ParseErrorClass;
102 extern Class* s_TypeErrorClass;
103 extern Class* s_MethCallerHelperClass;
104 extern Class* s_DynMethCallerHelperClass;
106 Object AllocStdClassObject();
107 Object AllocPinitSentinel();
108 Object AllocExceptionObject(const Variant& message);
109 Object AllocErrorObject(const Variant& message);
110 Object AllocArithmeticErrorObject(const Variant& message);
111 Object AllocArgumentCountErrorObject(const Variant& message);
112 Object AllocDivisionByZeroErrorObject(const Variant& message);
113 Object AllocParseErrorObject(const Variant& message);
114 Object AllocTypeErrorObject(const Variant& message);
115 Object AllocBadMethodCallExceptionObject(const Variant& message);
116 Object AllocInvalidArgumentExceptionObject(const Variant& message);
117 Object AllocTypeAssertionExceptionObject(const Variant& message);
118 Object AllocRuntimeExceptionObject(const Variant& message);
119 Object AllocOutOfBoundsExceptionObject(const Variant& message);
120 Object AllocInvalidOperationExceptionObject(const Variant& message);
121 Object AllocDOMExceptionObject(const Variant& message);
122 Object AllocDivisionByZeroExceptionObject();
123 Object AllocDirectoryObject();
124 Object AllocPDOExceptionObject();
125 Object AllocSoapFaultObject(const Variant& code,
126 const Variant& message,
127 const Variant& actor = uninit_variant,
128 const Variant& detail = uninit_variant,
129 const Variant& name = uninit_variant,
130 const Variant& header = uninit_variant);
131 Object AllocLazyKVZipIterableObject(const Variant& mp);
133 Object AllocLazyIterableViewObject(const Variant& iterable);
134 Object AllocLazyKeyedIterableViewObject(const Variant& iterable);
136 [[noreturn]] void throwExceptionObject(const Variant& message);
137 [[noreturn]] void throwErrorObject(const Variant& message);
138 [[noreturn]] void throwArithmeticErrorObject(const Variant& message);
139 [[noreturn]] void throwArgumentCountErrorObject(const Variant& message);
140 [[noreturn]] void throwDivisionByZeroErrorObject(const Variant& message);
141 [[noreturn]] void throwParseErrorObject(const Variant& message);
142 [[noreturn]] void throwTypeErrorObject(const Variant& message);
143 [[noreturn]]
144 void throwBadMethodCallExceptionObject(const Variant& message);
145 [[noreturn]]
146 void throwInvalidArgumentExceptionObject(const Variant& message);
147 [[noreturn]] void throwTypeAssertionExceptionObject(const Variant& message);
148 [[noreturn]] void throwRuntimeExceptionObject(const Variant& message);
149 [[noreturn]] void throwOutOfBoundsExceptionObject(const Variant& message);
150 [[noreturn]]
151 void throwInvalidOperationExceptionObject(const Variant& message);
152 [[noreturn]]
153 void throwDOMExceptionObject(const Variant& message);
154 [[noreturn]] void throwDivisionByZeroExceptionObject();
155 [[noreturn]]
156 void throwSoapFaultObject(const Variant& code,
157 const Variant& message,
158 const Variant& actor = uninit_variant,
159 const Variant& detail = uninit_variant,
160 const Variant& name = uninit_variant,
161 const Variant& header = uninit_variant);
162 [[noreturn]] void throwInvalidForeachArgumentExceptionObject();
163 [[noreturn]] void throwUndefinedPropertyExceptionObject(const Variant& message);
164 [[noreturn]] void throwUndefinedVariableExceptionObject(const Variant& message);
165 [[noreturn]] void throwTypecastExceptionObject(const Variant& message);
168 * Register a persistent unit to be re-merged (in non-repo mode)
170 void addPersistentUnit(Unit* unit);
173 * Re-merge all persistent units
175 void mergePersistentUnits();
178 * Setup the shared null constructor.
180 void setupNullCtor(Class* cls);
183 * Return a fresh 86reifiedinit method.
185 Func* getNull86reifiedinit(Class* cls);
187 ///////////////////////////////////////////////////////////////////////////////
188 }} // namespace HPHP::SystemLib
190 #endif