diff --git a/hphp/idl/asio.idl.php b/hphp/idl/asio.idl.php index d565d7f55..1fb369513 100644 --- a/hphp/idl/asio.idl.php +++ b/hphp/idl/asio.idl.php @@ -525,33 +525,6 @@ DefineFunction( ), )); -DefineFunction( - array( - 'name' => "markCurrentAsSucceeded", - 'desc' => "Mark currently running Continuation as succeeded and set its result", - 'flags' => HasDocComment | IsStatic, - 'return' => array( - 'type' => null, - ), - 'args' => array( - array( - 'name' => "result", - 'type' => Variant, - 'desc' => "A result of the currently running Continuation", - ), - ), - )); - -DefineFunction( - array( - 'name' => "markCurrentAsTailCall", - 'desc' => "Mark currently running Continuation for a tail call execution", - 'flags' => HasDocComment | IsStatic, - 'return' => array( - 'type' => null, - ), - )); - DefineFunction( array( 'name' => "getPrivData", diff --git a/hphp/runtime/ext/asio/continuation_wait_handle.cpp b/hphp/runtime/ext/asio/continuation_wait_handle.cpp index 385e0cced..83dd48e04 100644 --- a/hphp/runtime/ext/asio/continuation_wait_handle.cpp +++ b/hphp/runtime/ext/asio/continuation_wait_handle.cpp @@ -35,7 +35,7 @@ namespace { c_ContinuationWaitHandle::c_ContinuationWaitHandle(VM::Class* cb) : c_BlockableWaitHandle(cb), m_continuation(), m_child(), m_privData(), - m_depth(0), m_tailCall(false) { + m_depth(0) { } c_ContinuationWaitHandle::~c_ContinuationWaitHandle() { @@ -87,28 +87,6 @@ Object c_ContinuationWaitHandle::ti_start(const char* cls, CObjRef continuation) return wh; } -void c_ContinuationWaitHandle::ti_markcurrentassucceeded(const char* cls, CVarRef result) { - c_ContinuationWaitHandle* wh = AsioSession::Get()->getCurrentWaitHandle(); - if (!wh) { - Object e(SystemLib::AllocInvalidOperationExceptionObject( - "Unable to set result: no continuation running")); - throw e; - } - - wh->markAsSucceeded(tvToCell(result.asTypedValue())); -} - -void c_ContinuationWaitHandle::ti_markcurrentastailcall(const char* cls) { - c_ContinuationWaitHandle* wh = AsioSession::Get()->getCurrentWaitHandle(); - if (!wh) { - Object e(SystemLib::AllocInvalidOperationExceptionObject( - "Unable to setup tail call: no continuation running")); - throw e; - } - - wh->m_tailCall = true; -} - Object c_ContinuationWaitHandle::t_getprivdata() { return m_privData; } @@ -122,7 +100,6 @@ void c_ContinuationWaitHandle::start(c_Continuation* continuation, uint16_t dept m_child = nullptr; m_privData = nullptr; m_depth = depth; - m_tailCall = false; continuation->m_waitHandle = this; setState(STATE_SCHEDULED); @@ -141,30 +118,13 @@ void c_ContinuationWaitHandle::run() { setState(STATE_RUNNING); do { - if (m_tailCall) { - if (m_child.isNull()) { - markAsSucceeded(init_null_variant.asTypedValue()); - return; - } else if (m_child->isSucceeded()) { - markAsSucceeded(m_child->getResult()); - return; - } else { - m_tailCall = false; - } - } - // iterate continuation if (m_child.isNull()) { // first iteration or null dependency m_continuation->call_next(); } else if (m_child->isSucceeded()) { // child succeeded, pass the result to the continuation - if (IS_NULL_TYPE(m_child->getResult()->m_type)) { - // FIXME: may happen due to RescheduleWaitHandle - m_continuation->call_next(); - } else { - m_continuation->call_send(m_child->getResult()); - } + m_continuation->call_send(m_child->getResult()); } else if (m_child->isFailed()) { // child failed, raise the exception inside continuation m_continuation->call_raise(m_child->getException()); @@ -173,11 +133,6 @@ void c_ContinuationWaitHandle::run() { "Invariant violation: child neither succeeded nor failed"); } - // continuation was marked as finished via markCurrentAsFinished() - if (m_continuation.isNull()) { - return; - } - // continuation finished, retrieve result from its m_value if (m_continuation->m_done) { markAsSucceeded(m_continuation->m_value.asTypedValue()); diff --git a/hphp/runtime/ext/asio/continuation_wait_handle.ext_hhvm.cpp b/hphp/runtime/ext/asio/continuation_wait_handle.ext_hhvm.cpp index dd09cf627..e38928be8 100644 --- a/hphp/runtime/ext/asio/continuation_wait_handle.ext_hhvm.cpp +++ b/hphp/runtime/ext/asio/continuation_wait_handle.ext_hhvm.cpp @@ -121,69 +121,6 @@ TypedValue* tg_22ContinuationWaitHandle_start(HPHP::VM::ActRec *ar) { return &ar->m_r; } -/* -void HPHP::c_ContinuationWaitHandle::ti_markcurrentassucceeded(char const*, HPHP::Variant const&) -_ZN4HPHP24c_ContinuationWaitHandle25ti_markcurrentassucceededEPKcRKNS_7VariantE - -cls_ => rdi -result => rsi -*/ - -void th_22ContinuationWaitHandle_markCurrentAsSucceeded(char const* cls_, TypedValue* result) asm("_ZN4HPHP24c_ContinuationWaitHandle25ti_markcurrentassucceededEPKcRKNS_7VariantE"); - -TypedValue* tg_22ContinuationWaitHandle_markCurrentAsSucceeded(HPHP::VM::ActRec *ar) { - TypedValue rv; - int64_t count = ar->numArgs(); - TypedValue* args UNUSED = ((TypedValue*)ar) - 1; - if (count == 1LL) { - rv.m_data.num = 0LL; - rv.m_type = KindOfNull; - th_22ContinuationWaitHandle_markCurrentAsSucceeded(("ContinuationWaitHandle"), (args-0)); - frame_free_locals_no_this_inl(ar, 1); - memcpy(&ar->m_r, &rv, sizeof(TypedValue)); - return &ar->m_r; - } else { - throw_wrong_arguments_nr("ContinuationWaitHandle::markCurrentAsSucceeded", count, 1, 1, 1); - } - rv.m_data.num = 0LL; - rv.m_type = KindOfNull; - frame_free_locals_no_this_inl(ar, 1); - memcpy(&ar->m_r, &rv, sizeof(TypedValue)); - return &ar->m_r; - return &ar->m_r; -} - -/* -void HPHP::c_ContinuationWaitHandle::ti_markcurrentastailcall(char const*) -_ZN4HPHP24c_ContinuationWaitHandle24ti_markcurrentastailcallEPKc - -cls_ => rdi -*/ - -void th_22ContinuationWaitHandle_markCurrentAsTailCall(char const* cls_) asm("_ZN4HPHP24c_ContinuationWaitHandle24ti_markcurrentastailcallEPKc"); - -TypedValue* tg_22ContinuationWaitHandle_markCurrentAsTailCall(HPHP::VM::ActRec *ar) { - TypedValue rv; - int64_t count = ar->numArgs(); - TypedValue* args UNUSED = ((TypedValue*)ar) - 1; - if (count == 0LL) { - rv.m_data.num = 0LL; - rv.m_type = KindOfNull; - th_22ContinuationWaitHandle_markCurrentAsTailCall(("ContinuationWaitHandle")); - frame_free_locals_no_this_inl(ar, 0); - memcpy(&ar->m_r, &rv, sizeof(TypedValue)); - return &ar->m_r; - } else { - throw_toomany_arguments_nr("ContinuationWaitHandle::markCurrentAsTailCall", 0, 1); - } - rv.m_data.num = 0LL; - rv.m_type = KindOfNull; - frame_free_locals_no_this_inl(ar, 0); - memcpy(&ar->m_r, &rv, sizeof(TypedValue)); - return &ar->m_r; - return &ar->m_r; -} - /* HPHP::Object HPHP::c_ContinuationWaitHandle::t_getprivdata() _ZN4HPHP24c_ContinuationWaitHandle13t_getprivdataEv diff --git a/hphp/runtime/ext/ext_asio.h b/hphp/runtime/ext/ext_asio.h index 2b34a4856..548d0f1cf 100644 --- a/hphp/runtime/ext/ext_asio.h +++ b/hphp/runtime/ext/ext_asio.h @@ -287,14 +287,6 @@ class c_ContinuationWaitHandle : public c_BlockableWaitHandle { public: static Object t_start(CObjRef continuation) { return ti_start("continuationwaithandle", continuation); } - public: static void ti_markcurrentassucceeded(const char* cls , CVarRef result); - public: static void t_markcurrentassucceeded(CVarRef result) { - return ti_markcurrentassucceeded("continuationwaithandle", result); - } - public: static void ti_markcurrentastailcall(const char* cls ); - public: static void t_markcurrentastailcall() { - return ti_markcurrentastailcall("continuationwaithandle"); - } public: Object t_getprivdata(); public: void t_setprivdata(CObjRef data); @@ -319,7 +311,6 @@ class c_ContinuationWaitHandle : public c_BlockableWaitHandle { p_WaitHandle m_child; Object m_privData; uint16_t m_depth; - bool m_tailCall; static const int8_t STATE_SCHEDULED = 4; static const int8_t STATE_RUNNING = 5; diff --git a/hphp/runtime/ext_hhvm/ext_hhvm_infotabs.cpp b/hphp/runtime/ext_hhvm/ext_hhvm_infotabs.cpp index ef5fa4b36..a3d01d31f 100644 --- a/hphp/runtime/ext_hhvm/ext_hhvm_infotabs.cpp +++ b/hphp/runtime/ext_hhvm/ext_hhvm_infotabs.cpp @@ -2256,8 +2256,6 @@ TypedValue* tg_19BlockableWaitHandle___construct(VM::ActRec *ar); VM::Instance* new_ContinuationWaitHandle_Instance(VM::Class*); TypedValue* tg_22ContinuationWaitHandle___construct(VM::ActRec *ar); TypedValue* tg_22ContinuationWaitHandle_start(VM::ActRec *ar); -TypedValue* tg_22ContinuationWaitHandle_markCurrentAsSucceeded(VM::ActRec *ar); -TypedValue* tg_22ContinuationWaitHandle_markCurrentAsTailCall(VM::ActRec *ar); TypedValue* tg_22ContinuationWaitHandle_getPrivData(VM::ActRec *ar); TypedValue* tg_22ContinuationWaitHandle_setPrivData(VM::ActRec *ar); VM::Instance* new_GenArrayWaitHandle_Instance(VM::Class*); @@ -5292,12 +5290,10 @@ static const HhbcExtMethodInfo hhbc_ext_methods_BlockableWaitHandle[] = { { "__construct", tg_19BlockableWaitHandle___construct } }; -static const long long hhbc_ext_method_count_ContinuationWaitHandle = 6; +static const long long hhbc_ext_method_count_ContinuationWaitHandle = 4; static const HhbcExtMethodInfo hhbc_ext_methods_ContinuationWaitHandle[] = { { "__construct", tg_22ContinuationWaitHandle___construct }, { "start", tg_22ContinuationWaitHandle_start }, - { "markCurrentAsSucceeded", tg_22ContinuationWaitHandle_markCurrentAsSucceeded }, - { "markCurrentAsTailCall", tg_22ContinuationWaitHandle_markCurrentAsTailCall }, { "getPrivData", tg_22ContinuationWaitHandle_getPrivData }, { "setPrivData", tg_22ContinuationWaitHandle_setPrivData } }; diff --git a/hphp/system/asio.inc b/hphp/system/asio.inc index 9801ed850..9e6698541 100644 --- a/hphp/system/asio.inc +++ b/hphp/system/asio.inc @@ -19,7 +19,7 @@ S(17424), "/**\n * ( excerpt from http://php.net/manual/en/class.staticwaithandl S(16384), "/**\n * ( excerpt from http://php.net/manual/en/class.staticresultwaithandle.php\n * )\n *\n * A wait handle representing static result\n *\n */", "StaticExceptionWaitHandle", "staticwaithandle", NULL, "__construct", T(Void), S(0), NULL, S(16640), "/**\n * ( excerpt from\n * http://php.net/manual/en/staticexceptionwaithandle.construct.php )\n *\n *\n */", S(16640),"create", T(Object), S(0), "exception", T(Object), NULL, S(0), NULL, S(0), NULL, S(16896), "/**\n * ( excerpt from\n * http://php.net/manual/en/staticexceptionwaithandle.create.php )\n *\n * Create a wait handle that always fails with a given exception\n *\n * @exception object An exception wait handle will fail with\n *\n * @return object A StaticExceptionWaitHandle representing given\n * exception\n */", S(16896),NULL,NULL,NULL, S(16384), "/**\n * ( excerpt from\n * http://php.net/manual/en/class.staticexceptionwaithandle.php )\n *\n * A wait handle representing statically failed operation\n *\n */", "WaitableWaitHandle", "waithandle", NULL, "__construct", T(Void), S(0), NULL, S(16640), "/**\n * ( excerpt from http://php.net/manual/en/waitablewaithandle.construct.php\n * )\n *\n *\n */", S(16640),"getContextIdx", T(Int32), S(0), NULL, S(16384), "/**\n * ( excerpt from\n * http://php.net/manual/en/waitablewaithandle.getcontextidx.php )\n *\n * Get index of the scheduler context this wait handle operates in\n *\n * @return int An index of scheduler context this wait handle\n * operates in\n */", S(16384),"getCreator", T(Object), S(0), NULL, S(16384), "/**\n * ( excerpt from\n * http://php.net/manual/en/waitablewaithandle.getcreator.php )\n *\n * Get wait handle that created this wait handle\n *\n * @return object A ContinuationWaitHandle that was being executed\n * when this wait handle was constructed\n */", S(16384),"getParents", T(Array), S(0), NULL, S(16384), "/**\n * ( excerpt from\n * http://php.net/manual/en/waitablewaithandle.getparents.php )\n *\n * Get wait handles blocked on this wait handle\n *\n * @return vector An array of BlockableWaitHandles blocked on this\n * wait handle\n */", S(16384),"getStackTrace", T(Array), S(0), NULL, S(16384), "/**\n * ( excerpt from\n * http://php.net/manual/en/waitablewaithandle.getstacktrace.php )\n *\n * Get stack trace of this wait handle\n *\n * @return vector An array of WaitableWaitHandles representing full\n * stack trace, starting with this wait handle\n */", S(16384),NULL,NULL,NULL, S(17424), "/**\n * ( excerpt from http://php.net/manual/en/class.waitablewaithandle.php )\n *\n * A wait handle that can be waited upon\n *\n */", "BlockableWaitHandle", "waitablewaithandle", NULL, "__construct", T(Void), S(0), NULL, S(16640), "/**\n * ( excerpt from\n * http://php.net/manual/en/blockablewaithandle.construct.php )\n *\n *\n */", S(16640),NULL,NULL,NULL, -S(17424), "/**\n * ( excerpt from http://php.net/manual/en/class.blockablewaithandle.php )\n *\n * A wait handle that can be blocked on a dependency\n *\n */", "ContinuationWaitHandle", "blockablewaithandle", NULL, "__construct", T(Void), S(0), NULL, S(16640), "/**\n * ( excerpt from\n * http://php.net/manual/en/continuationwaithandle.construct.php )\n *\n *\n */", S(16640),"start", T(Object), S(0), "continuation", T(Object), NULL, S(0), NULL, S(0), NULL, S(16896), "/**\n * ( excerpt from http://php.net/manual/en/continuationwaithandle.start.php\n * )\n *\n * Start asynchronous execution of a given Continuation\n *\n * @continuation\n * object A Continuation to be started\n *\n * @return object A WaitHandle representing started Continuation\n */", S(16896),"markCurrentAsSucceeded", T(Void), S(0), "result", T(Variant), NULL, S(0), NULL, S(0), NULL, S(16896), "/**\n * ( excerpt from\n * http://php.net/manual/en/continuationwaithandle.markcurrentassucceeded.php\n * )\n *\n * Mark currently running Continuation as succeeded and set its result\n *\n * @result mixed A result of the currently running Continuation\n */", S(16896),"markCurrentAsTailCall", T(Void), S(0), NULL, S(16896), "/**\n * ( excerpt from\n * http://php.net/manual/en/continuationwaithandle.markcurrentastailcall.php\n * )\n *\n * Mark currently running Continuation for a tail call execution\n *\n */", S(16896),"getPrivData", T(Object), S(0), NULL, S(16384), "/**\n * ( excerpt from\n * http://php.net/manual/en/continuationwaithandle.getprivdata.php )\n *\n * Get user's private data\n *\n * @return object An Object with user's private data\n */", S(16384),"setPrivData", T(Void), S(0), "data", T(Object), NULL, S(0), NULL, S(0), NULL, S(16384), "/**\n * ( excerpt from\n * http://php.net/manual/en/continuationwaithandle.setprivdata.php )\n *\n * Set user's private data\n *\n * @data object An Object with user's private data\n */", S(16384),NULL,NULL,NULL, +S(17424), "/**\n * ( excerpt from http://php.net/manual/en/class.blockablewaithandle.php )\n *\n * A wait handle that can be blocked on a dependency\n *\n */", "ContinuationWaitHandle", "blockablewaithandle", NULL, "__construct", T(Void), S(0), NULL, S(16640), "/**\n * ( excerpt from\n * http://php.net/manual/en/continuationwaithandle.construct.php )\n *\n *\n */", S(16640),"start", T(Object), S(0), "continuation", T(Object), NULL, S(0), NULL, S(0), NULL, S(16896), "/**\n * ( excerpt from http://php.net/manual/en/continuationwaithandle.start.php\n * )\n *\n * Start asynchronous execution of a given Continuation\n *\n * @continuation\n * object A Continuation to be started\n *\n * @return object A WaitHandle representing started Continuation\n */", S(16896),"getPrivData", T(Object), S(0), NULL, S(16384), "/**\n * ( excerpt from\n * http://php.net/manual/en/continuationwaithandle.getprivdata.php )\n *\n * Get user's private data\n *\n * @return object An Object with user's private data\n */", S(16384),"setPrivData", T(Void), S(0), "data", T(Object), NULL, S(0), NULL, S(0), NULL, S(16384), "/**\n * ( excerpt from\n * http://php.net/manual/en/continuationwaithandle.setprivdata.php )\n *\n * Set user's private data\n *\n * @data object An Object with user's private data\n */", S(16384),NULL,NULL,NULL, S(16384), "/**\n * ( excerpt from http://php.net/manual/en/class.continuationwaithandle.php\n * )\n *\n * A wait handle representing asynchronous execution powered by\n * Continuation\n *\n */", "GenArrayWaitHandle", "blockablewaithandle", NULL, "__construct", T(Void), S(0), NULL, S(16640), "/**\n * ( excerpt from http://php.net/manual/en/genarraywaithandle.construct.php\n * )\n *\n *\n */", S(16640),"create", T(Object), S(0), "dependencies", T(Array), NULL, S(0), NULL, S(0), NULL, S(16896), "/**\n * ( excerpt from http://php.net/manual/en/genarraywaithandle.create.php )\n *\n * Create a wait handle that waits for a given array of dependencies\n *\n * @dependencies\n * map An Array of dependencies to wait for\n *\n * @return object A WaitHandle that will wait for a given array of\n * dependencies and return their results\n */", S(16896),NULL,NULL,NULL, S(16384), "/**\n * ( excerpt from http://php.net/manual/en/class.genarraywaithandle.php )\n *\n * A wait handle representing an array of asynchronous operations\n *\n */", "SetResultToRefWaitHandle", "blockablewaithandle", NULL, "__construct", T(Void), S(0), NULL, S(16640), "/**\n * ( excerpt from\n * http://php.net/manual/en/setresulttorefwaithandle.construct.php )\n *\n *\n */", S(16640),"create", T(Object), S(0), "wait_handle", T(Object), NULL, S(0), NULL, S(0), "ref", T(Variant), NULL, S(0), NULL, S(1), NULL, S(16896), "/**\n * ( excerpt from\n * http://php.net/manual/en/setresulttorefwaithandle.create.php )\n *\n * Create a wait handle that stores result of a dependency to a given\n * reference\n *\n * @wait_handle\n * object A wait handle to wait for\n * @ref mixed A reference to set the result to\n *\n * @return object A WaitHandle that will store the result of a\n * dependency to a given reference\n */", S(16896),NULL,NULL,NULL, S(16384), "/**\n * ( excerpt from\n * http://php.net/manual/en/class.setresulttorefwaithandle.php )\n *\n * A wait handle proxy that sets result to a given reference\n *\n */", "RescheduleWaitHandle", "waitablewaithandle", NULL, "__construct", T(Void), S(0), NULL, S(16640), "/**\n * ( excerpt from\n * http://php.net/manual/en/reschedulewaithandle.construct.php )\n *\n *\n */", S(16640),"create", T(Object), S(0), "queue", T(Int32), NULL, S(0), NULL, S(0), "priority", T(Int32), NULL, S(0), NULL, S(0), NULL, S(16896), "/**\n * ( excerpt from http://php.net/manual/en/reschedulewaithandle.create.php\n * )\n *\n * Create a wait handle that succeeds once desired scheduling priority is\n * eligible for execution\n *\n * @queue int A scheduling queue to use (defined by QUEUE_*\n * constants)\n * @priority int A non-negative number indicating scheduling priority\n * (0 runs first)\n *\n * @return object A RescheduleWaitHandle that succeeds once desired\n * scheduling priority is eligible for execution\n */", S(16896),NULL,NULL,"QUEUE_DEFAULT", T(Int32),"QUEUE_NO_PENDING_IO", T(Int32),NULL, diff --git a/hphp/system/class_map.cpp b/hphp/system/class_map.cpp index 19d0a9fd6..853f11ae5 100644 --- a/hphp/system/class_map.cpp +++ b/hphp/system/class_map.cpp @@ -22224,17 +22224,6 @@ const char *g_class_map[] = { NULL, NULL, NULL, - (const char *)0x10006240, "markCurrentAsSucceeded", "", (const char*)0, (const char*)0, - "/**\n * ( excerpt from\n * http://php.net/manual/en/continuationwaithandle.markcurrentassucceeded.php\n * )\n *\n * Mark currently running Continuation as succeeded and set its result\n *\n * @result mixed A result of the currently running Continuation\n */", - (const char *)-1, (const char *)0x2000, "result", "", (const char *)0xffffffff, "", "", NULL, - NULL, - NULL, - NULL, - (const char *)0x10006240, "markCurrentAsTailCall", "", (const char*)0, (const char*)0, - "/**\n * ( excerpt from\n * http://php.net/manual/en/continuationwaithandle.markcurrentastailcall.php\n * )\n *\n * Mark currently running Continuation for a tail call execution\n *\n */", - (const char *)-1, NULL, - NULL, - NULL, (const char *)0x10006040, "getPrivData", "", (const char*)0, (const char*)0, "/**\n * ( excerpt from\n * http://php.net/manual/en/continuationwaithandle.getprivdata.php )\n *\n * Get user's private data\n *\n * @return object An Object with user's private data\n */", (const char *)0x40, NULL,