|
|
|
@ -840,6 +840,11 @@ trait MethodCallTrait |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$funcName = ''; |
|
|
|
$funcName = ''; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// A variable method name explicitly requests runtime dispatch. Such a |
|
|
|
|
|
|
|
// call site commonly receives unrelated route/callback names, so a |
|
|
|
|
|
|
|
// monomorphic method cache adds guards and request state without a |
|
|
|
|
|
|
|
// reliable hit rate. Cache only a source-level identifier. |
|
|
|
|
|
|
|
$cacheMethod = $this->isNamedMethod($expr->name); |
|
|
|
|
|
|
|
|
|
|
|
$requiresDynamicScope = $this->runtimeMethodRequiresDynamicScope( |
|
|
|
$requiresDynamicScope = $this->runtimeMethodRequiresDynamicScope( |
|
|
|
$class, |
|
|
|
$class, |
|
|
|
@ -862,6 +867,10 @@ trait MethodCallTrait |
|
|
|
if (empty($expr->args)) { |
|
|
|
if (empty($expr->args)) { |
|
|
|
if ($requiresDynamicScope && $this->methodDef) { |
|
|
|
if ($requiresDynamicScope && $this->methodDef) { |
|
|
|
if (!$resolvedMethodPtr) { |
|
|
|
if (!$resolvedMethodPtr) { |
|
|
|
|
|
|
|
if (!$cacheMethod) { |
|
|
|
|
|
|
|
return 'php::callScoped(' . $object . ', ' . $methodPtr . ', ' |
|
|
|
|
|
|
|
. $this->getCallableScopeExpr() . ')'; |
|
|
|
|
|
|
|
} |
|
|
|
return 'typephp_call_method_scoped_cached(' . $object . ', ' . $methodPtr . ', ' |
|
|
|
return 'typephp_call_method_scoped_cached(' . $object . ', ' . $methodPtr . ', ' |
|
|
|
. $this->getCallableScopeExpr() . ', ' . $this->getMethodCallCache() . ')'; |
|
|
|
. $this->getCallableScopeExpr() . ', ' . $this->getMethodCallCache() . ')'; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -871,6 +880,9 @@ trait MethodCallTrait |
|
|
|
return 'php::callScoped(' . $object . ', ' . $methodPtr . ', ' . $this->getCallableScopeExpr() . ')'; |
|
|
|
return 'php::callScoped(' . $object . ', ' . $methodPtr . ', ' . $this->getCallableScopeExpr() . ')'; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!$resolvedMethodPtr) { |
|
|
|
if (!$resolvedMethodPtr) { |
|
|
|
|
|
|
|
if (!$cacheMethod) { |
|
|
|
|
|
|
|
return $object . '.call(' . $methodPtr . ')'; |
|
|
|
|
|
|
|
} |
|
|
|
return 'typephp_call_method_cached(' . $object . ', ' . $methodPtr . ', ' |
|
|
|
return 'typephp_call_method_cached(' . $object . ', ' . $methodPtr . ', ' |
|
|
|
. $this->getMethodCallCache() . ')'; |
|
|
|
. $this->getMethodCallCache() . ')'; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -881,10 +893,17 @@ trait MethodCallTrait |
|
|
|
if (!$resolvedMethodPtr) { |
|
|
|
if (!$resolvedMethodPtr) { |
|
|
|
$callArgs = $this->parseCallArgs($expr->args, $funcName, $class); |
|
|
|
$callArgs = $this->parseCallArgs($expr->args, $funcName, $class); |
|
|
|
if ($requiresDynamicScope && $this->methodDef) { |
|
|
|
if ($requiresDynamicScope && $this->methodDef) { |
|
|
|
|
|
|
|
if (!$cacheMethod) { |
|
|
|
|
|
|
|
return 'php::callScoped(' . $object . ', ' . $methodPtr . ', ' |
|
|
|
|
|
|
|
. $this->getCallableScopeExpr() . ', ' . $callArgs . ')'; |
|
|
|
|
|
|
|
} |
|
|
|
return 'typephp_call_method_scoped_cached(' . $object . ', ' . $methodPtr . ', ' |
|
|
|
return 'typephp_call_method_scoped_cached(' . $object . ', ' . $methodPtr . ', ' |
|
|
|
. $this->getCallableScopeExpr() . ', ' . $this->getMethodCallCache() . ', ' |
|
|
|
. $this->getCallableScopeExpr() . ', ' . $this->getMethodCallCache() . ', ' |
|
|
|
. $callArgs . ')'; |
|
|
|
. $callArgs . ')'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!$cacheMethod) { |
|
|
|
|
|
|
|
return $object . '.call(' . $methodPtr . ', ' . $callArgs . ')'; |
|
|
|
|
|
|
|
} |
|
|
|
return 'typephp_call_method_cached(' . $object . ', ' . $methodPtr . ', ' |
|
|
|
return 'typephp_call_method_cached(' . $object . ', ' . $methodPtr . ', ' |
|
|
|
. $this->getMethodCallCache() . ', ' . $callArgs . ')'; |
|
|
|
. $this->getMethodCallCache() . ', ' . $callArgs . ')'; |
|
|
|
} |
|
|
|
} |
|
|
|
|