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 #include "hphp/runtime/vm/jit/irgen-internal.h"
19 namespace HPHP
{ namespace jit
{ namespace irgen
{
21 //////////////////////////////////////////////////////////////////////
24 s_FATAL_NULL_THIS(Strings::FATAL_NULL_THIS
),
25 s_clsToStringWarning(Strings::CLASS_TO_STRING
);
27 SSATmp
* checkAndLoadThis(IRGS
& env
) {
29 auto const err
= cns(env
, s_FATAL_NULL_THIS
.get());
30 gen(env
, RaiseError
, err
);
31 return cns(env
, TBottom
);
36 SSATmp
* convertClsMethToVec(IRGS
& env
, SSATmp
* clsMeth
) {
37 assertx(clsMeth
->isA(TClsMeth
));
38 auto const cls
= gen(env
, LdClsName
, gen(env
, LdClsFromClsMeth
, clsMeth
));
39 auto const func
= gen(env
, LdFuncName
, gen(env
, LdFuncFromClsMeth
, clsMeth
));
40 auto vec
= gen(env
, AllocVArray
, PackedArrayData
{ 2 });
41 gen(env
, InitVecElem
, IndexData
{ 0 }, vec
, cls
);
42 gen(env
, InitVecElem
, IndexData
{ 1 }, vec
, func
);
46 SSATmp
* convertClassKey(IRGS
& env
, SSATmp
* key
) {
47 assertx (key
->type().isKnownDataType());
49 if (RuntimeOption::EvalRaiseClassConversionWarning
) {
50 gen(env
, RaiseWarning
, cns(env
, s_clsToStringWarning
.get()));
52 return gen(env
, LdClsName
, key
);
54 if (key
->isA(TLazyCls
)) {
55 if (RuntimeOption::EvalRaiseClassConversionWarning
) {
56 gen(env
, RaiseWarning
, cns(env
, s_clsToStringWarning
.get()));
58 return gen(env
, LdLazyClsName
, key
);
60 assertx(!key
->type().maybe(TCls
| TLazyCls
));
64 void defineStack(IRGS
& env
, FPInvOffset bcSPOff
) {
66 if (resumeMode(env
) != ResumeMode::None
) {
67 // rvmsp() points to the top of the stack in resumables
68 auto const irSPOff
= bcSPOff
;
69 gen(env
, DefRegSP
, DefStackData
{ irSPOff
, bcSPOff
});
71 // stack starts at the FP in regular functions
72 auto const irSPOff
= FPInvOffset
{ 0 };
73 gen(env
, DefFrameRelSP
, DefStackData
{ irSPOff
, bcSPOff
}, fp(env
));
76 // Now that the stack is initialized, update the BC marker and perform
77 // initial sync of the exception stack boundary.
79 env
.irb
->exceptionStackBoundary();
81 if (RuntimeOption::EvalHHIRGenerateAsserts
) {
82 // Assert that we're in the correct function.
83 gen(env
, DbgAssertFunc
, fp(env
));