Revert Generator changes
Esse commit está contido em:
@@ -350,14 +350,6 @@ DefineFunction(
|
||||
),
|
||||
));
|
||||
|
||||
DefineFunction(
|
||||
array(
|
||||
'name' => 'getCalledClass',
|
||||
'return' => array(
|
||||
'type' => String,
|
||||
),
|
||||
));
|
||||
|
||||
DefineFunction(
|
||||
array(
|
||||
'name' => '__clone',
|
||||
|
||||
@@ -155,20 +155,26 @@ void c_Continuation::t_raised() {
|
||||
}
|
||||
|
||||
String c_Continuation::t_getorigfuncname() {
|
||||
return m_origFuncName;
|
||||
}
|
||||
|
||||
String c_Continuation::t_getcalledclass() {
|
||||
String called_class;
|
||||
if (actRec()->hasThis()) {
|
||||
called_class = actRec()->getThis()->getVMClass()->name()->data();
|
||||
} else if (actRec()->hasClass()) {
|
||||
called_class = actRec()->getClass()->name()->data();
|
||||
} else {
|
||||
called_class = String("");
|
||||
}
|
||||
if (called_class.size() == 0) {
|
||||
return m_origFuncName;
|
||||
}
|
||||
|
||||
return called_class;
|
||||
/*
|
||||
Replace the class name in m_origFuncName with the LSB class. This
|
||||
produces more useful traces.
|
||||
*/
|
||||
size_t method_pos = m_origFuncName.find("::");
|
||||
if (method_pos != std::string::npos) {
|
||||
return concat3(called_class, "::", m_origFuncName.substr(method_pos+2));
|
||||
} else {
|
||||
return m_origFuncName;
|
||||
}
|
||||
}
|
||||
|
||||
Variant c_Continuation::t___clone() {
|
||||
|
||||
@@ -728,44 +728,6 @@ TypedValue* tg_12Continuation_getOrigFuncName(HPHP::VM::ActRec *ar) {
|
||||
return &ar->m_r;
|
||||
}
|
||||
|
||||
/*
|
||||
HPHP::String HPHP::c_Continuation::t_getcalledclass()
|
||||
_ZN4HPHP14c_Continuation16t_getcalledclassEv
|
||||
|
||||
(return value) => rax
|
||||
_rv => rdi
|
||||
this_ => rsi
|
||||
*/
|
||||
|
||||
Value* th_12Continuation_getCalledClass(Value* _rv, ObjectData* this_) asm("_ZN4HPHP14c_Continuation16t_getcalledclassEv");
|
||||
|
||||
TypedValue* tg_12Continuation_getCalledClass(HPHP::VM::ActRec *ar) {
|
||||
TypedValue rv;
|
||||
int64_t count = ar->numArgs();
|
||||
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
||||
ObjectData* this_ = (ar->hasThis() ? ar->getThis() : NULL);
|
||||
if (this_) {
|
||||
if (count == 0LL) {
|
||||
rv.m_type = KindOfString;
|
||||
th_12Continuation_getCalledClass((&rv.m_data), (this_));
|
||||
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
|
||||
frame_free_locals_inl(ar, 0);
|
||||
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
||||
return &ar->m_r;
|
||||
} else {
|
||||
throw_toomany_arguments_nr("Continuation::getCalledClass", 0, 1);
|
||||
}
|
||||
} else {
|
||||
throw_instance_method_fatal("Continuation::getCalledClass");
|
||||
}
|
||||
rv.m_data.num = 0LL;
|
||||
rv.m_type = KindOfNull;
|
||||
frame_free_locals_inl(ar, 0);
|
||||
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
||||
return &ar->m_r;
|
||||
return &ar->m_r;
|
||||
}
|
||||
|
||||
/*
|
||||
HPHP::Variant HPHP::c_Continuation::t___clone()
|
||||
_ZN4HPHP14c_Continuation9t___cloneEv
|
||||
|
||||
@@ -61,7 +61,6 @@ class c_Continuation : public ExtObjectData {
|
||||
public: void t_raise(CVarRef v);
|
||||
public: void t_raised();
|
||||
public: String t_getorigfuncname();
|
||||
public: String t_getcalledclass();
|
||||
public: Variant t___clone();
|
||||
|
||||
static c_Continuation* alloc(VM::Class* cls, int nLocals, int nIters) {
|
||||
|
||||
@@ -2451,7 +2451,6 @@ TypedValue* tg_12Continuation_valid(VM::ActRec *ar);
|
||||
TypedValue* tg_12Continuation_send(VM::ActRec *ar);
|
||||
TypedValue* tg_12Continuation_raise(VM::ActRec *ar);
|
||||
TypedValue* tg_12Continuation_getOrigFuncName(VM::ActRec *ar);
|
||||
TypedValue* tg_12Continuation_getCalledClass(VM::ActRec *ar);
|
||||
TypedValue* tg_12Continuation___clone(VM::ActRec *ar);
|
||||
VM::Instance* new_DummyContinuation_Instance(VM::Class*);
|
||||
TypedValue* tg_17DummyContinuation___construct(VM::ActRec *ar);
|
||||
@@ -5538,7 +5537,7 @@ static const HhbcExtMethodInfo hhbc_ext_methods_PairIterator[] = {
|
||||
{ "rewind", tg_12PairIterator_rewind }
|
||||
};
|
||||
|
||||
static const long long hhbc_ext_method_count_Continuation = 17;
|
||||
static const long long hhbc_ext_method_count_Continuation = 16;
|
||||
static const HhbcExtMethodInfo hhbc_ext_methods_Continuation[] = {
|
||||
{ "__construct", tg_12Continuation___construct },
|
||||
{ "update", tg_12Continuation_update },
|
||||
@@ -5555,7 +5554,6 @@ static const HhbcExtMethodInfo hhbc_ext_methods_Continuation[] = {
|
||||
{ "send", tg_12Continuation_send },
|
||||
{ "raise", tg_12Continuation_raise },
|
||||
{ "getOrigFuncName", tg_12Continuation_getOrigFuncName },
|
||||
{ "getCalledClass", tg_12Continuation_getCalledClass },
|
||||
{ "__clone", tg_12Continuation___clone }
|
||||
};
|
||||
|
||||
|
||||
@@ -2341,9 +2341,8 @@ Array VMExecutionContext::debugBacktrace(bool skip /* = false */,
|
||||
if (fp->m_func->isNoInjection()) {
|
||||
continue;
|
||||
}
|
||||
// Builtins don't have a file and line number and Zend 5.5 does not
|
||||
// include this information for generators
|
||||
if (prevFp && !prevFp->m_func->isBuiltin() && !fp->m_func->isGenerator()) {
|
||||
// Builtins don't have a file and line number
|
||||
if (prevFp && !prevFp->m_func->isBuiltin()) {
|
||||
Unit* unit = prevFp->m_func->unit();
|
||||
assert(unit);
|
||||
const char *filename = unit->filepath()->data();
|
||||
@@ -6645,7 +6644,7 @@ VMExecutionContext::createContinuation(ActRec* fp,
|
||||
}
|
||||
static const StringData* closure = StringData::GetStaticString("{closure}");
|
||||
const StringData* origName =
|
||||
origFunc->isClosureBody() ? closure : origFunc->name();
|
||||
origFunc->isClosureBody() ? closure : origFunc->fullName();
|
||||
int nLocals = genFunc->numLocals();
|
||||
int nIters = genFunc->numIterators();
|
||||
Class* genClass = SystemLib::s_ContinuationClass;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| HipHop for PHP |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
@@ -21994,11 +21994,6 @@ const char *g_class_map[] = {
|
||||
(const char *)0x14 /* KindOfString */, NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(const char *)0x10006040, "getCalledClass", "", (const char*)0, (const char*)0,
|
||||
"/**\n * ( excerpt from http://php.net/manual/en/continuation.getcalledclass.php\n * )\n *\n *\n * @return string\n */",
|
||||
(const char *)0x14 /* KindOfString */, NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(const char *)0x10006040, "__clone", "", (const char*)0, (const char*)0,
|
||||
"/**\n * ( excerpt from http://php.net/manual/en/continuation.clone.php )\n *\n *\n * @return mixed\n */",
|
||||
(const char *)0xffffffff /* KindOfUnknown: $t: Variant */, NULL,
|
||||
|
||||
@@ -10,4 +10,3 @@ class ShortDerp extends BaseDerp {}
|
||||
|
||||
$sd = new ShortDerp;
|
||||
var_dump($sd->genDerp()->getOrigFuncName());
|
||||
var_dump($sd->genDerp()->getCalledClass());
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
string(7) "genDerp"
|
||||
string(9) "ShortDerp"
|
||||
string(18) "ShortDerp::genDerp"
|
||||
|
||||
@@ -10,18 +10,4 @@ function my_wrapper() {
|
||||
$gen->send(null);
|
||||
}
|
||||
|
||||
class my_class {
|
||||
static function my_member_generator() {
|
||||
$value = yield null;
|
||||
var_dump(debug_backtrace());
|
||||
}
|
||||
}
|
||||
|
||||
function my_class_wrapper() {
|
||||
$gen = my_class::my_member_generator();
|
||||
$gen->next();
|
||||
$gen->send(null);
|
||||
}
|
||||
|
||||
my_wrapper();
|
||||
my_class_wrapper();
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
array(4) {
|
||||
["file"]=>
|
||||
string(0) ""
|
||||
["line"]=>
|
||||
int(-1)
|
||||
["function"]=>
|
||||
string(12) "my_generator"
|
||||
["args"]=>
|
||||
@@ -36,7 +40,7 @@ array(3) {
|
||||
["file"]=>
|
||||
string(%d) "%s"
|
||||
["line"]=>
|
||||
int(26)
|
||||
int(13)
|
||||
["function"]=>
|
||||
string(10) "my_wrapper"
|
||||
["args"]=>
|
||||
@@ -44,53 +48,3 @@ array(3) {
|
||||
}
|
||||
}
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(4) {
|
||||
["function"]=>
|
||||
string(19) "my_member_generator"
|
||||
["class"]=>
|
||||
string(8) "my_class"
|
||||
["type"]=>
|
||||
string(2) "::"
|
||||
["args"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
object(Continuation)#1 (0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
[1]=>
|
||||
array(7) {
|
||||
["file"]=>
|
||||
string(%d) "%s"
|
||||
["line"]=>
|
||||
int(23)
|
||||
["function"]=>
|
||||
string(4) "send"
|
||||
["class"]=>
|
||||
string(12) "Continuation"
|
||||
["object"]=>
|
||||
object(Continuation)#1 (0) {
|
||||
}
|
||||
["type"]=>
|
||||
string(2) "->"
|
||||
["args"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
NULL
|
||||
}
|
||||
}
|
||||
[2]=>
|
||||
array(4) {
|
||||
["file"]=>
|
||||
string(%d) "%s"
|
||||
["line"]=>
|
||||
int(27)
|
||||
["function"]=>
|
||||
string(16) "my_class_wrapper"
|
||||
["args"]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ function f($x) {
|
||||
}
|
||||
$c = f(32);
|
||||
var_dump($c->getOrigFuncName());
|
||||
var_dump($c->getCalledClass());
|
||||
trait T {
|
||||
function f($x) { yield get_called_class(); }
|
||||
}
|
||||
@@ -14,8 +13,6 @@ class X { use T; }
|
||||
$x = new X;
|
||||
$c = $x->f(32);
|
||||
var_dump($c->getOrigFuncName());
|
||||
var_dump($c->getCalledClass());
|
||||
$fcn = function ($x) { yield $x; };
|
||||
$c = $fcn(32);
|
||||
var_dump($c->getOrigFuncName());
|
||||
var_dump($c->getCalledClass());
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
string(1) "f"
|
||||
string(0) ""
|
||||
string(1) "f"
|
||||
string(1) "X"
|
||||
string(4) "X::f"
|
||||
string(9) "{closure}"
|
||||
string(0) ""
|
||||
|
||||
@@ -6,7 +6,6 @@ function f($x) {
|
||||
}
|
||||
$c = f(32);
|
||||
var_dump($c->getOrigFuncName());
|
||||
var_dump($c->getCalledClass());
|
||||
class X {
|
||||
function f($x) { yield $x; }
|
||||
static function g($x) { yield get_called_class(); }
|
||||
@@ -15,14 +14,10 @@ class Y extends X {}
|
||||
$x = new X;
|
||||
$c = $x->f(32);
|
||||
var_dump($c->getOrigFuncName());
|
||||
var_dump($c->getCalledClass());
|
||||
$c = X::g(32);
|
||||
var_dump($c->getOrigFuncName());
|
||||
var_dump($c->getCalledClass());
|
||||
$c = Y::g(32);
|
||||
var_dump($c->getOrigFuncName());
|
||||
var_dump($c->getCalledClass());
|
||||
$fcn = function ($x) { yield $x; };
|
||||
$c = $fcn(32);
|
||||
var_dump($c->getOrigFuncName());
|
||||
var_dump($c->getCalledClass());
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
string(1) "f"
|
||||
string(0) ""
|
||||
string(1) "f"
|
||||
string(1) "X"
|
||||
string(1) "g"
|
||||
string(1) "X"
|
||||
string(1) "g"
|
||||
string(1) "Y"
|
||||
string(4) "X::f"
|
||||
string(4) "X::g"
|
||||
string(4) "Y::g"
|
||||
string(9) "{closure}"
|
||||
string(0) ""
|
||||
|
||||
@@ -26010,7 +26010,6 @@ bool TestCodeRun::TestYield() {
|
||||
"}\n"
|
||||
"$c = f(32);\n"
|
||||
"var_dump($c->getOrigFuncName());\n"
|
||||
"var_dump($c->getCalledClass());\n"
|
||||
"class X {\n"
|
||||
" function f($x) { yield $x; }\n"
|
||||
" static function g($x) { yield get_called_class(); }\n"
|
||||
@@ -26019,28 +26018,18 @@ bool TestCodeRun::TestYield() {
|
||||
"$x = new X;\n"
|
||||
"$c = $x->f(32);\n"
|
||||
"var_dump($c->getOrigFuncName());\n"
|
||||
"var_dump($c->getCalledClass());\n"
|
||||
"$c = X::g(32);\n"
|
||||
"var_dump($c->getOrigFuncName());\n"
|
||||
"var_dump($c->getCalledClass());\n"
|
||||
"$c = Y::g(32);\n"
|
||||
"var_dump($c->getOrigFuncName());\n"
|
||||
"var_dump($c->getCalledClass());\n"
|
||||
"$fcn = function ($x) { yield $x; };\n"
|
||||
"$c = $fcn(32);\n"
|
||||
"var_dump($c->getOrigFuncName());\n"
|
||||
"var_dump($c->getCalledClass());\n"
|
||||
,
|
||||
"var_dump($c->getOrigFuncName());\n",
|
||||
"string(1) \"f\"\n"
|
||||
"string(0) \"\"\n"
|
||||
"string(1) \"f\"\n"
|
||||
"string(1) \"X\"\n"
|
||||
"string(1) \"g\"\n"
|
||||
"string(1) \"X\"\n"
|
||||
"string(1) \"g\"\n"
|
||||
"string(1) \"Y\"\n"
|
||||
"string(9) \"{closure}\"\n"
|
||||
"string(0) \"\"\n");
|
||||
"string(4) \"X::f\"\n"
|
||||
"string(4) \"X::g\"\n"
|
||||
"string(4) \"Y::g\"\n"
|
||||
"string(9) \"{closure}\"\n");
|
||||
|
||||
MVCRO("<?php "
|
||||
"function gen() {"
|
||||
@@ -31667,7 +31656,6 @@ bool TestCodeRun::TestTraits() {
|
||||
"}\n"
|
||||
"$c = f(32);\n"
|
||||
"var_dump($c->getOrigFuncName());\n"
|
||||
"var_dump($c->getCalledClass());\n"
|
||||
"trait T {\n"
|
||||
" function f($x) { yield get_called_class(); }\n"
|
||||
"}\n"
|
||||
@@ -31675,18 +31663,13 @@ bool TestCodeRun::TestTraits() {
|
||||
"$x = new X;\n"
|
||||
"$c = $x->f(32);\n"
|
||||
"var_dump($c->getOrigFuncName());\n"
|
||||
"var_dump($c->getCalledClass());\n"
|
||||
"$fcn = function ($x) { yield $x; };\n"
|
||||
"$c = $fcn(32);\n"
|
||||
"var_dump($c->getOrigFuncName());\n"
|
||||
"var_dump($c->getCalledClass());\n"
|
||||
,
|
||||
"string(1) \"f\"\n"
|
||||
"string(0) \"\"\n"
|
||||
"string(1) \"f\"\n"
|
||||
"string(1) \"X\"\n"
|
||||
"string(4) \"X::f\"\n"
|
||||
"string(9) \"{closure}\"\n"
|
||||
"string(0) \"\"\n"
|
||||
);
|
||||
|
||||
MVCRO("<?php "
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário