Inline simple printers (easier inline testing)
- Inlines simple constant print functions (makes it easier to test inlining side effects in a simple manner) - This also confirms that FPushObjMethodD inlining is working as expected
Esse commit está contido em:
@@ -1138,6 +1138,17 @@ bool shouldIRInline(const Func* curFunc,
|
||||
return atRet();
|
||||
};
|
||||
|
||||
// Constants that can be printed without an InterpOne.
|
||||
auto simplePrintConstant = [&]() -> bool {
|
||||
switch (current) {
|
||||
case OpFalse: case OpInt: case OpString: case OpTrue: case OpNull:
|
||||
next();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
resetCursor();
|
||||
|
||||
////////////
|
||||
@@ -1178,7 +1189,7 @@ bool shouldIRInline(const Func* curFunc,
|
||||
}
|
||||
|
||||
/*
|
||||
* Continuation allocation functions that take no arguments.
|
||||
* Continuation allocation functions.
|
||||
*/
|
||||
resetCursor();
|
||||
if (current == OpCreateCont) {
|
||||
@@ -1207,6 +1218,14 @@ bool shouldIRInline(const Func* curFunc,
|
||||
return accept("$this instanceof D");
|
||||
}
|
||||
|
||||
// E.g. String; Print; PopC; Null; RetC
|
||||
// Useful primarily for debugging.
|
||||
resetCursor();
|
||||
if (simplePrintConstant() && nextIf(OpPrint) && nextIf(OpPopC) &&
|
||||
simpleCell() && cellManipRet()) {
|
||||
return accept("constant printer");
|
||||
}
|
||||
|
||||
return refuse("unknown kind of function");
|
||||
}
|
||||
|
||||
|
||||
@@ -129,8 +129,6 @@ void TraceBuilder::trackDefInlineFP(IRInstruction* inst) {
|
||||
*
|
||||
* We set m_thisIsAvailable to true on any object method, because we
|
||||
* just don't inline calls to object methods with a null $this.
|
||||
*
|
||||
* Static methods probably broken #2490252.
|
||||
*/
|
||||
m_fpValue = calleeFP;
|
||||
m_spValue = calleeSP;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
class A {
|
||||
function __destruct() {
|
||||
print "destructor\n";
|
||||
}
|
||||
|
||||
static function printer() { print "static\n"; }
|
||||
}
|
||||
|
||||
function main() {
|
||||
(new A())->printer();
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -0,0 +1,2 @@
|
||||
destructor
|
||||
static
|
||||
Referência em uma Nova Issue
Bloquear um usuário