2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
6 | Copyright (c) 1997-2010 The PHP Group |
7 +----------------------------------------------------------------------+
8 | This source file is subject to version 3.01 of the PHP license, |
9 | that is bundled with this package in the file LICENSE, and is |
10 | available through the world-wide-web at the following url: |
11 | http://www.php.net/license/3_01.txt |
12 | If you did not receive a copy of the PHP license and are unable to |
13 | obtain it through the world-wide-web, please send a note to |
14 | license@php.net so we can mail you a copy immediately. |
15 +----------------------------------------------------------------------+
18 #include "runtime/ext_hhvm/ext_hhvm.h"
19 #include "runtime/base/builtin_functions.h"
20 #include "runtime/base/array/array_init.h"
21 #include "runtime/ext/ext.h"
22 #include "runtime/vm/class.h"
23 #include "runtime/vm/runtime.h"
28 bool fh_apc_store(Value
* key
, TypedValue
* var
, long ttl
, long cache_id
) asm("_ZN4HPHP11f_apc_storeERKNS_6StringERKNS_7VariantEll");
30 void fg1_apc_store(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
31 void fg1_apc_store(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
32 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
34 default: // count >= 4
35 if ((args
-3)->m_type
!= KindOfInt64
) {
36 tvCastToInt64InPlace(args
-3);
39 if ((args
-2)->m_type
!= KindOfInt64
) {
40 tvCastToInt64InPlace(args
-2);
45 if (!IS_STRING_TYPE((args
-0)->m_type
)) {
46 tvCastToStringInPlace(args
-0);
48 rv
->m_type
= KindOfBoolean
;
49 rv
->m_data
.num
= (fh_apc_store(&args
[-0].m_data
, (args
-1), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
52 TypedValue
* fg_apc_store(ActRec
* ar
) {
54 TypedValue
* rv
= &rvSpace
;
55 int32_t count
= ar
->numArgs();
56 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
57 if (count
>= 2 && count
<= 4) {
58 if ((count
<= 3 || (args
- 3)->m_type
== KindOfInt64
) &&
59 (count
<= 2 || (args
- 2)->m_type
== KindOfInt64
) &&
60 IS_STRING_TYPE((args
- 0)->m_type
)) {
61 rv
->m_type
= KindOfBoolean
;
62 rv
->m_data
.num
= (fh_apc_store(&args
[-0].m_data
, (args
-1), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
64 fg1_apc_store(rv
, ar
, count
);
67 throw_wrong_arguments_nr("apc_store", count
, 2, 4, 1);
69 rv
->m_type
= KindOfNull
;
71 frame_free_locals_no_this_inl(ar
, 4);
72 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
76 bool fh_apc_add(Value
* key
, TypedValue
* var
, long ttl
, long cache_id
) asm("_ZN4HPHP9f_apc_addERKNS_6StringERKNS_7VariantEll");
78 void fg1_apc_add(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
79 void fg1_apc_add(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
80 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
82 default: // count >= 4
83 if ((args
-3)->m_type
!= KindOfInt64
) {
84 tvCastToInt64InPlace(args
-3);
87 if ((args
-2)->m_type
!= KindOfInt64
) {
88 tvCastToInt64InPlace(args
-2);
93 if (!IS_STRING_TYPE((args
-0)->m_type
)) {
94 tvCastToStringInPlace(args
-0);
96 rv
->m_type
= KindOfBoolean
;
97 rv
->m_data
.num
= (fh_apc_add(&args
[-0].m_data
, (args
-1), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
100 TypedValue
* fg_apc_add(ActRec
* ar
) {
102 TypedValue
* rv
= &rvSpace
;
103 int32_t count
= ar
->numArgs();
104 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
105 if (count
>= 2 && count
<= 4) {
106 if ((count
<= 3 || (args
- 3)->m_type
== KindOfInt64
) &&
107 (count
<= 2 || (args
- 2)->m_type
== KindOfInt64
) &&
108 IS_STRING_TYPE((args
- 0)->m_type
)) {
109 rv
->m_type
= KindOfBoolean
;
110 rv
->m_data
.num
= (fh_apc_add(&args
[-0].m_data
, (args
-1), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
112 fg1_apc_add(rv
, ar
, count
);
115 throw_wrong_arguments_nr("apc_add", count
, 2, 4, 1);
116 rv
->m_data
.num
= 0LL;
117 rv
->m_type
= KindOfNull
;
119 frame_free_locals_no_this_inl(ar
, 4);
120 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
124 TypedValue
* fh_apc_fetch(TypedValue
* _rv
, TypedValue
* key
, TypedValue
* success
, long cache_id
) asm("_ZN4HPHP11f_apc_fetchERKNS_7VariantERKNS_14VRefParamValueEl");
126 void fg1_apc_fetch(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
127 void fg1_apc_fetch(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
128 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
129 tvCastToInt64InPlace(args
-2);
130 VRefParamValue defVal1
= uninit_null();
131 fh_apc_fetch(rv
, (args
-0), (count
> 1) ? (args
-1) : (TypedValue
*)(&defVal1
), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0));
132 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
135 TypedValue
* fg_apc_fetch(ActRec
* ar
) {
137 TypedValue
* rv
= &rvSpace
;
138 int32_t count
= ar
->numArgs();
139 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
140 if (count
>= 1 && count
<= 3) {
141 if ((count
<= 2 || (args
- 2)->m_type
== KindOfInt64
)) {
142 VRefParamValue defVal1
= uninit_null();
143 fh_apc_fetch(rv
, (args
-0), (count
> 1) ? (args
-1) : (TypedValue
*)(&defVal1
), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0));
144 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
146 fg1_apc_fetch(rv
, ar
, count
);
149 throw_wrong_arguments_nr("apc_fetch", count
, 1, 3, 1);
150 rv
->m_data
.num
= 0LL;
151 rv
->m_type
= KindOfNull
;
153 frame_free_locals_no_this_inl(ar
, 3);
154 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
158 TypedValue
* fh_apc_delete(TypedValue
* _rv
, TypedValue
* key
, long cache_id
) asm("_ZN4HPHP12f_apc_deleteERKNS_7VariantEl");
160 void fg1_apc_delete(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
161 void fg1_apc_delete(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
162 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
163 tvCastToInt64InPlace(args
-1);
164 fh_apc_delete(rv
, (args
-0), (count
> 1) ? (long)(args
[-1].m_data
.num
) : (long)(0));
165 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
168 TypedValue
* fg_apc_delete(ActRec
* ar
) {
170 TypedValue
* rv
= &rvSpace
;
171 int32_t count
= ar
->numArgs();
172 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
173 if (count
>= 1 && count
<= 2) {
174 if ((count
<= 1 || (args
- 1)->m_type
== KindOfInt64
)) {
175 fh_apc_delete(rv
, (args
-0), (count
> 1) ? (long)(args
[-1].m_data
.num
) : (long)(0));
176 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
178 fg1_apc_delete(rv
, ar
, count
);
181 throw_wrong_arguments_nr("apc_delete", count
, 1, 2, 1);
182 rv
->m_data
.num
= 0LL;
183 rv
->m_type
= KindOfNull
;
185 frame_free_locals_no_this_inl(ar
, 2);
186 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
190 bool fh_apc_clear_cache(long cache_id
) asm("_ZN4HPHP17f_apc_clear_cacheEl");
192 void fg1_apc_clear_cache(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
193 void fg1_apc_clear_cache(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
194 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
195 tvCastToInt64InPlace(args
-0);
196 rv
->m_type
= KindOfBoolean
;
197 rv
->m_data
.num
= (fh_apc_clear_cache((count
> 0) ? (long)(args
[-0].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
200 TypedValue
* fg_apc_clear_cache(ActRec
* ar
) {
202 TypedValue
* rv
= &rvSpace
;
203 int32_t count
= ar
->numArgs();
204 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
206 if ((count
<= 0 || (args
- 0)->m_type
== KindOfInt64
)) {
207 rv
->m_type
= KindOfBoolean
;
208 rv
->m_data
.num
= (fh_apc_clear_cache((count
> 0) ? (long)(args
[-0].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
210 fg1_apc_clear_cache(rv
, ar
, count
);
213 throw_toomany_arguments_nr("apc_clear_cache", 1, 1);
214 rv
->m_data
.num
= 0LL;
215 rv
->m_type
= KindOfNull
;
217 frame_free_locals_no_this_inl(ar
, 1);
218 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
222 TypedValue
* fh_apc_inc(TypedValue
* _rv
, Value
* key
, long step
, TypedValue
* success
, long cache_id
) asm("_ZN4HPHP9f_apc_incERKNS_6StringElRKNS_14VRefParamValueEl");
224 void fg1_apc_inc(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
225 void fg1_apc_inc(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
226 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
228 default: // count >= 4
229 if ((args
-3)->m_type
!= KindOfInt64
) {
230 tvCastToInt64InPlace(args
-3);
234 if ((args
-1)->m_type
!= KindOfInt64
) {
235 tvCastToInt64InPlace(args
-1);
240 if (!IS_STRING_TYPE((args
-0)->m_type
)) {
241 tvCastToStringInPlace(args
-0);
243 VRefParamValue defVal2
= uninit_null();
244 fh_apc_inc(rv
, &args
[-0].m_data
, (count
> 1) ? (long)(args
[-1].m_data
.num
) : (long)(1), (count
> 2) ? (args
-2) : (TypedValue
*)(&defVal2
), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0));
245 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
248 TypedValue
* fg_apc_inc(ActRec
* ar
) {
250 TypedValue
* rv
= &rvSpace
;
251 int32_t count
= ar
->numArgs();
252 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
253 if (count
>= 1 && count
<= 4) {
254 if ((count
<= 3 || (args
- 3)->m_type
== KindOfInt64
) &&
255 (count
<= 1 || (args
- 1)->m_type
== KindOfInt64
) &&
256 IS_STRING_TYPE((args
- 0)->m_type
)) {
257 VRefParamValue defVal2
= uninit_null();
258 fh_apc_inc(rv
, &args
[-0].m_data
, (count
> 1) ? (long)(args
[-1].m_data
.num
) : (long)(1), (count
> 2) ? (args
-2) : (TypedValue
*)(&defVal2
), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0));
259 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
261 fg1_apc_inc(rv
, ar
, count
);
264 throw_wrong_arguments_nr("apc_inc", count
, 1, 4, 1);
265 rv
->m_data
.num
= 0LL;
266 rv
->m_type
= KindOfNull
;
268 frame_free_locals_no_this_inl(ar
, 4);
269 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
273 TypedValue
* fh_apc_dec(TypedValue
* _rv
, Value
* key
, long step
, TypedValue
* success
, long cache_id
) asm("_ZN4HPHP9f_apc_decERKNS_6StringElRKNS_14VRefParamValueEl");
275 void fg1_apc_dec(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
276 void fg1_apc_dec(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
277 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
279 default: // count >= 4
280 if ((args
-3)->m_type
!= KindOfInt64
) {
281 tvCastToInt64InPlace(args
-3);
285 if ((args
-1)->m_type
!= KindOfInt64
) {
286 tvCastToInt64InPlace(args
-1);
291 if (!IS_STRING_TYPE((args
-0)->m_type
)) {
292 tvCastToStringInPlace(args
-0);
294 VRefParamValue defVal2
= uninit_null();
295 fh_apc_dec(rv
, &args
[-0].m_data
, (count
> 1) ? (long)(args
[-1].m_data
.num
) : (long)(1), (count
> 2) ? (args
-2) : (TypedValue
*)(&defVal2
), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0));
296 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
299 TypedValue
* fg_apc_dec(ActRec
* ar
) {
301 TypedValue
* rv
= &rvSpace
;
302 int32_t count
= ar
->numArgs();
303 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
304 if (count
>= 1 && count
<= 4) {
305 if ((count
<= 3 || (args
- 3)->m_type
== KindOfInt64
) &&
306 (count
<= 1 || (args
- 1)->m_type
== KindOfInt64
) &&
307 IS_STRING_TYPE((args
- 0)->m_type
)) {
308 VRefParamValue defVal2
= uninit_null();
309 fh_apc_dec(rv
, &args
[-0].m_data
, (count
> 1) ? (long)(args
[-1].m_data
.num
) : (long)(1), (count
> 2) ? (args
-2) : (TypedValue
*)(&defVal2
), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0));
310 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
312 fg1_apc_dec(rv
, ar
, count
);
315 throw_wrong_arguments_nr("apc_dec", count
, 1, 4, 1);
316 rv
->m_data
.num
= 0LL;
317 rv
->m_type
= KindOfNull
;
319 frame_free_locals_no_this_inl(ar
, 4);
320 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
324 bool fh_apc_cas(Value
* key
, long old_cas
, long new_cas
, long cache_id
) asm("_ZN4HPHP9f_apc_casERKNS_6StringElll");
326 void fg1_apc_cas(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
327 void fg1_apc_cas(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
328 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
330 default: // count >= 4
331 if ((args
-3)->m_type
!= KindOfInt64
) {
332 tvCastToInt64InPlace(args
-3);
337 if ((args
-2)->m_type
!= KindOfInt64
) {
338 tvCastToInt64InPlace(args
-2);
340 if ((args
-1)->m_type
!= KindOfInt64
) {
341 tvCastToInt64InPlace(args
-1);
343 if (!IS_STRING_TYPE((args
-0)->m_type
)) {
344 tvCastToStringInPlace(args
-0);
346 rv
->m_type
= KindOfBoolean
;
347 rv
->m_data
.num
= (fh_apc_cas(&args
[-0].m_data
, (long)(args
[-1].m_data
.num
), (long)(args
[-2].m_data
.num
), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
350 TypedValue
* fg_apc_cas(ActRec
* ar
) {
352 TypedValue
* rv
= &rvSpace
;
353 int32_t count
= ar
->numArgs();
354 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
355 if (count
>= 3 && count
<= 4) {
356 if ((count
<= 3 || (args
- 3)->m_type
== KindOfInt64
) &&
357 (args
- 2)->m_type
== KindOfInt64
&&
358 (args
- 1)->m_type
== KindOfInt64
&&
359 IS_STRING_TYPE((args
- 0)->m_type
)) {
360 rv
->m_type
= KindOfBoolean
;
361 rv
->m_data
.num
= (fh_apc_cas(&args
[-0].m_data
, (long)(args
[-1].m_data
.num
), (long)(args
[-2].m_data
.num
), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
363 fg1_apc_cas(rv
, ar
, count
);
366 throw_wrong_arguments_nr("apc_cas", count
, 3, 4, 1);
367 rv
->m_data
.num
= 0LL;
368 rv
->m_type
= KindOfNull
;
370 frame_free_locals_no_this_inl(ar
, 4);
371 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
375 TypedValue
* fh_apc_exists(TypedValue
* _rv
, TypedValue
* key
, long cache_id
) asm("_ZN4HPHP12f_apc_existsERKNS_7VariantEl");
377 void fg1_apc_exists(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
378 void fg1_apc_exists(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
379 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
380 tvCastToInt64InPlace(args
-1);
381 fh_apc_exists(rv
, (args
-0), (count
> 1) ? (long)(args
[-1].m_data
.num
) : (long)(0));
382 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
385 TypedValue
* fg_apc_exists(ActRec
* ar
) {
387 TypedValue
* rv
= &rvSpace
;
388 int32_t count
= ar
->numArgs();
389 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
390 if (count
>= 1 && count
<= 2) {
391 if ((count
<= 1 || (args
- 1)->m_type
== KindOfInt64
)) {
392 fh_apc_exists(rv
, (args
-0), (count
> 1) ? (long)(args
[-1].m_data
.num
) : (long)(0));
393 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
395 fg1_apc_exists(rv
, ar
, count
);
398 throw_wrong_arguments_nr("apc_exists", count
, 1, 2, 1);
399 rv
->m_data
.num
= 0LL;
400 rv
->m_type
= KindOfNull
;
402 frame_free_locals_no_this_inl(ar
, 2);
403 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
407 TypedValue
* fh_apc_cache_info(TypedValue
* _rv
, long cache_id
, bool limited
) asm("_ZN4HPHP16f_apc_cache_infoElb");
409 void fg1_apc_cache_info(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
410 void fg1_apc_cache_info(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
411 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
413 default: // count >= 2
414 if ((args
-1)->m_type
!= KindOfBoolean
) {
415 tvCastToBooleanInPlace(args
-1);
418 if ((args
-0)->m_type
!= KindOfInt64
) {
419 tvCastToInt64InPlace(args
-0);
424 fh_apc_cache_info(rv
, (count
> 0) ? (long)(args
[-0].m_data
.num
) : (long)(0), (count
> 1) ? (bool)(args
[-1].m_data
.num
) : (bool)(false));
425 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
428 TypedValue
* fg_apc_cache_info(ActRec
* ar
) {
430 TypedValue
* rv
= &rvSpace
;
431 int32_t count
= ar
->numArgs();
432 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
434 if ((count
<= 1 || (args
- 1)->m_type
== KindOfBoolean
) &&
435 (count
<= 0 || (args
- 0)->m_type
== KindOfInt64
)) {
436 fh_apc_cache_info(rv
, (count
> 0) ? (long)(args
[-0].m_data
.num
) : (long)(0), (count
> 1) ? (bool)(args
[-1].m_data
.num
) : (bool)(false));
437 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
439 fg1_apc_cache_info(rv
, ar
, count
);
442 throw_toomany_arguments_nr("apc_cache_info", 2, 1);
443 rv
->m_data
.num
= 0LL;
444 rv
->m_type
= KindOfNull
;
446 frame_free_locals_no_this_inl(ar
, 2);
447 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
451 Value
* fh_apc_sma_info(Value
* _rv
, bool limited
) asm("_ZN4HPHP14f_apc_sma_infoEb");
453 void fg1_apc_sma_info(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
454 void fg1_apc_sma_info(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
455 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
456 tvCastToBooleanInPlace(args
-0);
457 rv
->m_type
= KindOfArray
;
458 fh_apc_sma_info(&(rv
->m_data
), (count
> 0) ? (bool)(args
[-0].m_data
.num
) : (bool)(false));
459 if (rv
->m_data
.num
== 0LL) rv
->m_type
= KindOfNull
;
462 TypedValue
* fg_apc_sma_info(ActRec
* ar
) {
464 TypedValue
* rv
= &rvSpace
;
465 int32_t count
= ar
->numArgs();
466 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
468 if ((count
<= 0 || (args
- 0)->m_type
== KindOfBoolean
)) {
469 rv
->m_type
= KindOfArray
;
470 fh_apc_sma_info(&(rv
->m_data
), (count
> 0) ? (bool)(args
[-0].m_data
.num
) : (bool)(false));
471 if (rv
->m_data
.num
== 0LL) rv
->m_type
= KindOfNull
;
473 fg1_apc_sma_info(rv
, ar
, count
);
476 throw_toomany_arguments_nr("apc_sma_info", 1, 1);
477 rv
->m_data
.num
= 0LL;
478 rv
->m_type
= KindOfNull
;
480 frame_free_locals_no_this_inl(ar
, 1);
481 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
485 bool fh_apc_define_constants(Value
* key
, Value
* constants
, bool case_sensitive
, long cache_id
) asm("_ZN4HPHP22f_apc_define_constantsERKNS_6StringES2_bl");
487 void fg1_apc_define_constants(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
488 void fg1_apc_define_constants(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
489 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
491 default: // count >= 4
492 if ((args
-3)->m_type
!= KindOfInt64
) {
493 tvCastToInt64InPlace(args
-3);
496 if ((args
-2)->m_type
!= KindOfBoolean
) {
497 tvCastToBooleanInPlace(args
-2);
502 if (!IS_STRING_TYPE((args
-1)->m_type
)) {
503 tvCastToStringInPlace(args
-1);
505 if (!IS_STRING_TYPE((args
-0)->m_type
)) {
506 tvCastToStringInPlace(args
-0);
508 rv
->m_type
= KindOfBoolean
;
509 rv
->m_data
.num
= (fh_apc_define_constants(&args
[-0].m_data
, &args
[-1].m_data
, (count
> 2) ? (bool)(args
[-2].m_data
.num
) : (bool)(true), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
512 TypedValue
* fg_apc_define_constants(ActRec
* ar
) {
514 TypedValue
* rv
= &rvSpace
;
515 int32_t count
= ar
->numArgs();
516 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
517 if (count
>= 2 && count
<= 4) {
518 if ((count
<= 3 || (args
- 3)->m_type
== KindOfInt64
) &&
519 (count
<= 2 || (args
- 2)->m_type
== KindOfBoolean
) &&
520 IS_STRING_TYPE((args
- 1)->m_type
) &&
521 IS_STRING_TYPE((args
- 0)->m_type
)) {
522 rv
->m_type
= KindOfBoolean
;
523 rv
->m_data
.num
= (fh_apc_define_constants(&args
[-0].m_data
, &args
[-1].m_data
, (count
> 2) ? (bool)(args
[-2].m_data
.num
) : (bool)(true), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
525 fg1_apc_define_constants(rv
, ar
, count
);
528 throw_wrong_arguments_nr("apc_define_constants", count
, 2, 4, 1);
529 rv
->m_data
.num
= 0LL;
530 rv
->m_type
= KindOfNull
;
532 frame_free_locals_no_this_inl(ar
, 4);
533 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
537 bool fh_apc_load_constants(Value
* key
, bool case_sensitive
, long cache_id
) asm("_ZN4HPHP20f_apc_load_constantsERKNS_6StringEbl");
539 void fg1_apc_load_constants(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
540 void fg1_apc_load_constants(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
541 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
543 default: // count >= 3
544 if ((args
-2)->m_type
!= KindOfInt64
) {
545 tvCastToInt64InPlace(args
-2);
548 if ((args
-1)->m_type
!= KindOfBoolean
) {
549 tvCastToBooleanInPlace(args
-1);
554 if (!IS_STRING_TYPE((args
-0)->m_type
)) {
555 tvCastToStringInPlace(args
-0);
557 rv
->m_type
= KindOfBoolean
;
558 rv
->m_data
.num
= (fh_apc_load_constants(&args
[-0].m_data
, (count
> 1) ? (bool)(args
[-1].m_data
.num
) : (bool)(true), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
561 TypedValue
* fg_apc_load_constants(ActRec
* ar
) {
563 TypedValue
* rv
= &rvSpace
;
564 int32_t count
= ar
->numArgs();
565 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
566 if (count
>= 1 && count
<= 3) {
567 if ((count
<= 2 || (args
- 2)->m_type
== KindOfInt64
) &&
568 (count
<= 1 || (args
- 1)->m_type
== KindOfBoolean
) &&
569 IS_STRING_TYPE((args
- 0)->m_type
)) {
570 rv
->m_type
= KindOfBoolean
;
571 rv
->m_data
.num
= (fh_apc_load_constants(&args
[-0].m_data
, (count
> 1) ? (bool)(args
[-1].m_data
.num
) : (bool)(true), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
573 fg1_apc_load_constants(rv
, ar
, count
);
576 throw_wrong_arguments_nr("apc_load_constants", count
, 1, 3, 1);
577 rv
->m_data
.num
= 0LL;
578 rv
->m_type
= KindOfNull
;
580 frame_free_locals_no_this_inl(ar
, 3);
581 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
585 bool fh_apc_compile_file(Value
* filename
, bool atomic
, long cache_id
) asm("_ZN4HPHP18f_apc_compile_fileERKNS_6StringEbl");
587 void fg1_apc_compile_file(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
588 void fg1_apc_compile_file(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
589 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
591 default: // count >= 3
592 if ((args
-2)->m_type
!= KindOfInt64
) {
593 tvCastToInt64InPlace(args
-2);
596 if ((args
-1)->m_type
!= KindOfBoolean
) {
597 tvCastToBooleanInPlace(args
-1);
602 if (!IS_STRING_TYPE((args
-0)->m_type
)) {
603 tvCastToStringInPlace(args
-0);
605 rv
->m_type
= KindOfBoolean
;
606 rv
->m_data
.num
= (fh_apc_compile_file(&args
[-0].m_data
, (count
> 1) ? (bool)(args
[-1].m_data
.num
) : (bool)(true), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
609 TypedValue
* fg_apc_compile_file(ActRec
* ar
) {
611 TypedValue
* rv
= &rvSpace
;
612 int32_t count
= ar
->numArgs();
613 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
614 if (count
>= 1 && count
<= 3) {
615 if ((count
<= 2 || (args
- 2)->m_type
== KindOfInt64
) &&
616 (count
<= 1 || (args
- 1)->m_type
== KindOfBoolean
) &&
617 IS_STRING_TYPE((args
- 0)->m_type
)) {
618 rv
->m_type
= KindOfBoolean
;
619 rv
->m_data
.num
= (fh_apc_compile_file(&args
[-0].m_data
, (count
> 1) ? (bool)(args
[-1].m_data
.num
) : (bool)(true), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
621 fg1_apc_compile_file(rv
, ar
, count
);
624 throw_wrong_arguments_nr("apc_compile_file", count
, 1, 3, 1);
625 rv
->m_data
.num
= 0LL;
626 rv
->m_type
= KindOfNull
;
628 frame_free_locals_no_this_inl(ar
, 3);
629 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
633 Value
* fh_apc_filehits(Value
* _rv
) asm("_ZN4HPHP14f_apc_filehitsEv");
635 TypedValue
* fg_apc_filehits(ActRec
* ar
) {
637 TypedValue
* rv
= &rvSpace
;
638 int32_t count
= ar
->numArgs();
639 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
641 rv
->m_type
= KindOfArray
;
642 fh_apc_filehits(&(rv
->m_data
));
643 if (rv
->m_data
.num
== 0LL) rv
->m_type
= KindOfNull
;
645 throw_toomany_arguments_nr("apc_filehits", 0, 1);
646 rv
->m_data
.num
= 0LL;
647 rv
->m_type
= KindOfNull
;
649 frame_free_locals_no_this_inl(ar
, 0);
650 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
654 TypedValue
* fh_apc_delete_file(TypedValue
* _rv
, TypedValue
* keys
, long cache_id
) asm("_ZN4HPHP17f_apc_delete_fileERKNS_7VariantEl");
656 void fg1_apc_delete_file(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
657 void fg1_apc_delete_file(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
658 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
659 tvCastToInt64InPlace(args
-1);
660 fh_apc_delete_file(rv
, (args
-0), (count
> 1) ? (long)(args
[-1].m_data
.num
) : (long)(0));
661 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
664 TypedValue
* fg_apc_delete_file(ActRec
* ar
) {
666 TypedValue
* rv
= &rvSpace
;
667 int32_t count
= ar
->numArgs();
668 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
669 if (count
>= 1 && count
<= 2) {
670 if ((count
<= 1 || (args
- 1)->m_type
== KindOfInt64
)) {
671 fh_apc_delete_file(rv
, (args
-0), (count
> 1) ? (long)(args
[-1].m_data
.num
) : (long)(0));
672 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
674 fg1_apc_delete_file(rv
, ar
, count
);
677 throw_wrong_arguments_nr("apc_delete_file", count
, 1, 2, 1);
678 rv
->m_data
.num
= 0LL;
679 rv
->m_type
= KindOfNull
;
681 frame_free_locals_no_this_inl(ar
, 2);
682 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
686 TypedValue
* fh_apc_bin_dump(TypedValue
* _rv
, long cache_id
, TypedValue
* filter
) asm("_ZN4HPHP14f_apc_bin_dumpElRKNS_7VariantE");
688 void fg1_apc_bin_dump(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
689 void fg1_apc_bin_dump(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
690 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
691 tvCastToInt64InPlace(args
-0);
692 fh_apc_bin_dump(rv
, (count
> 0) ? (long)(args
[-0].m_data
.num
) : (long)(0), (count
> 1) ? (args
-1) : (TypedValue
*)(&null_variant
));
693 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
696 TypedValue
* fg_apc_bin_dump(ActRec
* ar
) {
698 TypedValue
* rv
= &rvSpace
;
699 int32_t count
= ar
->numArgs();
700 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
702 if ((count
<= 0 || (args
- 0)->m_type
== KindOfInt64
)) {
703 fh_apc_bin_dump(rv
, (count
> 0) ? (long)(args
[-0].m_data
.num
) : (long)(0), (count
> 1) ? (args
-1) : (TypedValue
*)(&null_variant
));
704 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
706 fg1_apc_bin_dump(rv
, ar
, count
);
709 throw_toomany_arguments_nr("apc_bin_dump", 2, 1);
710 rv
->m_data
.num
= 0LL;
711 rv
->m_type
= KindOfNull
;
713 frame_free_locals_no_this_inl(ar
, 2);
714 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
718 bool fh_apc_bin_load(Value
* data
, long flags
, long cache_id
) asm("_ZN4HPHP14f_apc_bin_loadERKNS_6StringEll");
720 void fg1_apc_bin_load(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
721 void fg1_apc_bin_load(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
722 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
724 default: // count >= 3
725 if ((args
-2)->m_type
!= KindOfInt64
) {
726 tvCastToInt64InPlace(args
-2);
729 if ((args
-1)->m_type
!= KindOfInt64
) {
730 tvCastToInt64InPlace(args
-1);
735 if (!IS_STRING_TYPE((args
-0)->m_type
)) {
736 tvCastToStringInPlace(args
-0);
738 rv
->m_type
= KindOfBoolean
;
739 rv
->m_data
.num
= (fh_apc_bin_load(&args
[-0].m_data
, (count
> 1) ? (long)(args
[-1].m_data
.num
) : (long)(0), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
742 TypedValue
* fg_apc_bin_load(ActRec
* ar
) {
744 TypedValue
* rv
= &rvSpace
;
745 int32_t count
= ar
->numArgs();
746 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
747 if (count
>= 1 && count
<= 3) {
748 if ((count
<= 2 || (args
- 2)->m_type
== KindOfInt64
) &&
749 (count
<= 1 || (args
- 1)->m_type
== KindOfInt64
) &&
750 IS_STRING_TYPE((args
- 0)->m_type
)) {
751 rv
->m_type
= KindOfBoolean
;
752 rv
->m_data
.num
= (fh_apc_bin_load(&args
[-0].m_data
, (count
> 1) ? (long)(args
[-1].m_data
.num
) : (long)(0), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
754 fg1_apc_bin_load(rv
, ar
, count
);
757 throw_wrong_arguments_nr("apc_bin_load", count
, 1, 3, 1);
758 rv
->m_data
.num
= 0LL;
759 rv
->m_type
= KindOfNull
;
761 frame_free_locals_no_this_inl(ar
, 3);
762 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
766 TypedValue
* fh_apc_bin_dumpfile(TypedValue
* _rv
, long cache_id
, TypedValue
* filter
, Value
* filename
, long flags
, Value
* context
) asm("_ZN4HPHP18f_apc_bin_dumpfileElRKNS_7VariantERKNS_6StringElRKNS_6ObjectE");
768 void fg1_apc_bin_dumpfile(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
769 void fg1_apc_bin_dumpfile(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
770 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
772 default: // count >= 5
773 if ((args
-4)->m_type
!= KindOfObject
) {
774 tvCastToObjectInPlace(args
-4);
777 if ((args
-3)->m_type
!= KindOfInt64
) {
778 tvCastToInt64InPlace(args
-3);
783 if (!IS_STRING_TYPE((args
-2)->m_type
)) {
784 tvCastToStringInPlace(args
-2);
786 if ((args
-0)->m_type
!= KindOfInt64
) {
787 tvCastToInt64InPlace(args
-0);
789 Object defVal4
= uninit_null();
790 fh_apc_bin_dumpfile(rv
, (long)(args
[-0].m_data
.num
), (args
-1), &args
[-2].m_data
, (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0), (count
> 4) ? &args
[-4].m_data
: (Value
*)(&defVal4
));
791 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
794 TypedValue
* fg_apc_bin_dumpfile(ActRec
* ar
) {
796 TypedValue
* rv
= &rvSpace
;
797 int32_t count
= ar
->numArgs();
798 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
799 if (count
>= 3 && count
<= 5) {
800 if ((count
<= 4 || (args
- 4)->m_type
== KindOfObject
) &&
801 (count
<= 3 || (args
- 3)->m_type
== KindOfInt64
) &&
802 IS_STRING_TYPE((args
- 2)->m_type
) &&
803 (args
- 0)->m_type
== KindOfInt64
) {
804 Object defVal4
= uninit_null();
805 fh_apc_bin_dumpfile(rv
, (long)(args
[-0].m_data
.num
), (args
-1), &args
[-2].m_data
, (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0), (count
> 4) ? &args
[-4].m_data
: (Value
*)(&defVal4
));
806 if (rv
->m_type
== KindOfUninit
) rv
->m_type
= KindOfNull
;
808 fg1_apc_bin_dumpfile(rv
, ar
, count
);
811 throw_wrong_arguments_nr("apc_bin_dumpfile", count
, 3, 5, 1);
812 rv
->m_data
.num
= 0LL;
813 rv
->m_type
= KindOfNull
;
815 frame_free_locals_no_this_inl(ar
, 5);
816 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));
820 bool fh_apc_bin_loadfile(Value
* filename
, Value
* context
, long flags
, long cache_id
) asm("_ZN4HPHP18f_apc_bin_loadfileERKNS_6StringERKNS_6ObjectEll");
822 void fg1_apc_bin_loadfile(TypedValue
* rv
, ActRec
* ar
, int32_t count
) __attribute__((noinline
,cold
));
823 void fg1_apc_bin_loadfile(TypedValue
* rv
, ActRec
* ar
, int32_t count
) {
824 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
826 default: // count >= 4
827 if ((args
-3)->m_type
!= KindOfInt64
) {
828 tvCastToInt64InPlace(args
-3);
831 if ((args
-2)->m_type
!= KindOfInt64
) {
832 tvCastToInt64InPlace(args
-2);
835 if ((args
-1)->m_type
!= KindOfObject
) {
836 tvCastToObjectInPlace(args
-1);
841 if (!IS_STRING_TYPE((args
-0)->m_type
)) {
842 tvCastToStringInPlace(args
-0);
844 rv
->m_type
= KindOfBoolean
;
845 Object defVal1
= uninit_null();
846 rv
->m_data
.num
= (fh_apc_bin_loadfile(&args
[-0].m_data
, (count
> 1) ? &args
[-1].m_data
: (Value
*)(&defVal1
), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
849 TypedValue
* fg_apc_bin_loadfile(ActRec
* ar
) {
851 TypedValue
* rv
= &rvSpace
;
852 int32_t count
= ar
->numArgs();
853 TypedValue
* args UNUSED
= ((TypedValue
*)ar
) - 1;
854 if (count
>= 1 && count
<= 4) {
855 if ((count
<= 3 || (args
- 3)->m_type
== KindOfInt64
) &&
856 (count
<= 2 || (args
- 2)->m_type
== KindOfInt64
) &&
857 (count
<= 1 || (args
- 1)->m_type
== KindOfObject
) &&
858 IS_STRING_TYPE((args
- 0)->m_type
)) {
859 rv
->m_type
= KindOfBoolean
;
860 Object defVal1
= uninit_null();
861 rv
->m_data
.num
= (fh_apc_bin_loadfile(&args
[-0].m_data
, (count
> 1) ? &args
[-1].m_data
: (Value
*)(&defVal1
), (count
> 2) ? (long)(args
[-2].m_data
.num
) : (long)(0), (count
> 3) ? (long)(args
[-3].m_data
.num
) : (long)(0))) ? 1LL : 0LL;
863 fg1_apc_bin_loadfile(rv
, ar
, count
);
866 throw_wrong_arguments_nr("apc_bin_loadfile", count
, 1, 4, 1);
867 rv
->m_data
.num
= 0LL;
868 rv
->m_type
= KindOfNull
;
870 frame_free_locals_no_this_inl(ar
, 4);
871 memcpy(&ar
->m_r
, rv
, sizeof(TypedValue
));