diff --git a/hphp/idl/continuation.idl.php b/hphp/idl/continuation.idl.php index 283677fc5..8502d7fa4 100644 --- a/hphp/idl/continuation.idl.php +++ b/hphp/idl/continuation.idl.php @@ -350,14 +350,6 @@ DefineFunction( ), )); -DefineFunction( - array( - 'name' => 'getCalledClass', - 'return' => array( - 'type' => String, - ), - )); - DefineFunction( array( 'name' => '__clone', diff --git a/hphp/runtime/ext/ext_continuation.cpp b/hphp/runtime/ext/ext_continuation.cpp index 39d535f48..510661522 100644 --- a/hphp/runtime/ext/ext_continuation.cpp +++ b/hphp/runtime/ext/ext_continuation.cpp @@ -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() { diff --git a/hphp/runtime/ext/ext_continuation.ext_hhvm.cpp b/hphp/runtime/ext/ext_continuation.ext_hhvm.cpp index d76f923dc..bec956dd2 100644 --- a/hphp/runtime/ext/ext_continuation.ext_hhvm.cpp +++ b/hphp/runtime/ext/ext_continuation.ext_hhvm.cpp @@ -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 diff --git a/hphp/runtime/ext/ext_continuation.h b/hphp/runtime/ext/ext_continuation.h index 226ef7239..7e447795d 100644 --- a/hphp/runtime/ext/ext_continuation.h +++ b/hphp/runtime/ext/ext_continuation.h @@ -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) { diff --git a/hphp/runtime/ext_hhvm/ext_hhvm_infotabs.cpp b/hphp/runtime/ext_hhvm/ext_hhvm_infotabs.cpp index e5897d119..4ae190b16 100644 --- a/hphp/runtime/ext_hhvm/ext_hhvm_infotabs.cpp +++ b/hphp/runtime/ext_hhvm/ext_hhvm_infotabs.cpp @@ -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 } }; diff --git a/hphp/runtime/vm/bytecode.cpp b/hphp/runtime/vm/bytecode.cpp index aea864e5c..42d6de2bc 100644 --- a/hphp/runtime/vm/bytecode.cpp +++ b/hphp/runtime/vm/bytecode.cpp @@ -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; diff --git a/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp b/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp index 4b4e1d195..eca03e14e 100644 --- a/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp @@ -1,4 +1,4 @@ - /* +/* +----------------------------------------------------------------------+ | HipHop for PHP | +----------------------------------------------------------------------+ diff --git a/hphp/system/class_map.cpp b/hphp/system/class_map.cpp index cc465b234..31ebd8886 100644 --- a/hphp/system/class_map.cpp +++ b/hphp/system/class_map.cpp @@ -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, diff --git a/hphp/test/quick/continuation-funcname.php b/hphp/test/quick/continuation-funcname.php index 6a6b7fd35..1bd9b634f 100644 --- a/hphp/test/quick/continuation-funcname.php +++ b/hphp/test/quick/continuation-funcname.php @@ -10,4 +10,3 @@ class ShortDerp extends BaseDerp {} $sd = new ShortDerp; var_dump($sd->genDerp()->getOrigFuncName()); -var_dump($sd->genDerp()->getCalledClass()); diff --git a/hphp/test/quick/continuation-funcname.php.expect b/hphp/test/quick/continuation-funcname.php.expect index 783c0489f..5469b8fb6 100644 --- a/hphp/test/quick/continuation-funcname.php.expect +++ b/hphp/test/quick/continuation-funcname.php.expect @@ -1,2 +1 @@ -string(7) "genDerp" -string(9) "ShortDerp" +string(18) "ShortDerp::genDerp" diff --git a/hphp/test/quick/debug_backtrace_continuation.php b/hphp/test/quick/debug_backtrace_continuation.php index d70746bc9..051152299 100644 --- a/hphp/test/quick/debug_backtrace_continuation.php +++ b/hphp/test/quick/debug_backtrace_continuation.php @@ -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(); diff --git a/hphp/test/quick/debug_backtrace_continuation.php.expectf b/hphp/test/quick/debug_backtrace_continuation.php.expectf index d1d4a6378..4489604c5 100644 --- a/hphp/test/quick/debug_backtrace_continuation.php.expectf +++ b/hphp/test/quick/debug_backtrace_continuation.php.expectf @@ -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) { - } - } -} diff --git a/hphp/test/slow/traits/2071.php b/hphp/test/slow/traits/2071.php index a38546acc..9d5d8cf25 100644 --- a/hphp/test/slow/traits/2071.php +++ b/hphp/test/slow/traits/2071.php @@ -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()); diff --git a/hphp/test/slow/traits/2071.php.expect b/hphp/test/slow/traits/2071.php.expect index 245282613..16582bd16 100644 --- a/hphp/test/slow/traits/2071.php.expect +++ b/hphp/test/slow/traits/2071.php.expect @@ -1,6 +1,3 @@ string(1) "f" -string(0) "" -string(1) "f" -string(1) "X" +string(4) "X::f" string(9) "{closure}" -string(0) "" diff --git a/hphp/test/slow/yield/2174.php b/hphp/test/slow/yield/2174.php index e9a0df55b..072e478d8 100644 --- a/hphp/test/slow/yield/2174.php +++ b/hphp/test/slow/yield/2174.php @@ -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()); diff --git a/hphp/test/slow/yield/2174.php.expect b/hphp/test/slow/yield/2174.php.expect index a49480f25..90f151ca5 100644 --- a/hphp/test/slow/yield/2174.php.expect +++ b/hphp/test/slow/yield/2174.php.expect @@ -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) "" diff --git a/hphp/test/test_code_run.cpp b/hphp/test/test_code_run.cpp index b6e640435..b51ea628f 100644 --- a/hphp/test/test_code_run.cpp +++ b/hphp/test/test_code_run.cpp @@ -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("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("