Cleanup more unused code in Continuation
m_method was unused, and __construct had a couple of unused parameters. Also bring the idl back into sync.
Esse commit está contido em:
@@ -174,7 +174,7 @@ public:
|
||||
++m_index;
|
||||
}
|
||||
|
||||
inline void nextCheck() {
|
||||
inline void startedCheck() {
|
||||
if (m_index < 0LL) {
|
||||
throw_exception(
|
||||
Object(SystemLib::AllocExceptionObject("Need to call next() first")));
|
||||
@@ -188,17 +188,32 @@ public:
|
||||
Variant m_value;
|
||||
Variant m_received;
|
||||
String m_origFuncName;
|
||||
String m_called_class;
|
||||
bool m_done;
|
||||
bool m_running;
|
||||
bool m_should_throw;
|
||||
bool m_isMethod;
|
||||
const CallInfo *m_callInfo;
|
||||
union {
|
||||
void *m_extra;
|
||||
VM::Func *m_vmFunc;
|
||||
};
|
||||
|
||||
int m_localsOffset;
|
||||
VM::Func *m_vmFunc;
|
||||
int64_t m_label
|
||||
VM::ActRec* m_arPtr;
|
||||
|
||||
p_ContinuationWaitHandle m_waitHandle;
|
||||
|
||||
SmartPtr<HphpArray> m_VMStatics;
|
||||
|
||||
String& getCalledClass() { not_reached(); }
|
||||
|
||||
HphpArray* getStaticLocals();
|
||||
static size_t sizeForLocalsAndIters(int nLocals, int nIters) {
|
||||
return (sizeof(c_Continuation) + sizeof(TypedValue) * nLocals +
|
||||
sizeof(VM::Iter) * nIters + sizeof(VM::ActRec));
|
||||
}
|
||||
VM::ActRec* actRec() {
|
||||
return m_arPtr;
|
||||
}
|
||||
TypedValue* locals() {
|
||||
return (TypedValue*)(uintptr_t(this) + m_localsOffset);
|
||||
}
|
||||
EOT
|
||||
,
|
||||
)
|
||||
@@ -215,14 +230,6 @@ DefineFunction(
|
||||
'name' => 'func',
|
||||
'type' => Int64,
|
||||
),
|
||||
array(
|
||||
'name' => 'extra',
|
||||
'type' => Int64,
|
||||
),
|
||||
array(
|
||||
'name' => 'isMethod',
|
||||
'type' => Boolean,
|
||||
),
|
||||
array(
|
||||
'name' => 'origFuncName',
|
||||
'type' => String,
|
||||
|
||||
@@ -58,7 +58,7 @@ c_Continuation::c_Continuation(VM::Class* cb) :
|
||||
m_index(-1LL),
|
||||
m_value(Variant::nullInit), m_received(Variant::nullInit),
|
||||
m_done(false), m_running(false), m_should_throw(false),
|
||||
m_isMethod(false), m_vmFunc(nullptr), m_label(0ll) {
|
||||
m_vmFunc(nullptr), m_label(0ll) {
|
||||
}
|
||||
|
||||
c_Continuation::~c_Continuation() {
|
||||
@@ -79,11 +79,9 @@ c_Continuation::~c_Continuation() {
|
||||
}
|
||||
|
||||
void c_Continuation::t___construct(
|
||||
int64_t func, int64_t extra, bool isMethod,
|
||||
CStrRef origFuncName, CVarRef obj, CArrRef args) {
|
||||
m_vmFunc = (VM::Func*) extra;
|
||||
int64_t func, CStrRef origFuncName, CVarRef obj, CArrRef args) {
|
||||
m_vmFunc = (VM::Func*)func;
|
||||
assert(m_vmFunc);
|
||||
m_isMethod = isMethod;
|
||||
m_origFuncName = origFuncName;
|
||||
|
||||
if (!obj.isNull()) {
|
||||
|
||||
@@ -213,19 +213,17 @@ HPHP::VM::Instance* new_Continuation_Instance(HPHP::VM::Class* cls) {
|
||||
|
||||
IMPLEMENT_CLASS(Continuation);
|
||||
/*
|
||||
void HPHP::c_Continuation::t___construct(long, long, bool, HPHP::String const&, HPHP::Variant const&, HPHP::Array const&)
|
||||
_ZN4HPHP14c_Continuation13t___constructEllbRKNS_6StringERKNS_7VariantERKNS_5ArrayE
|
||||
void HPHP::c_Continuation::t___construct(long, HPHP::String const&, HPHP::Variant const&, HPHP::Array const&)
|
||||
_ZN4HPHP14c_Continuation13t___constructElRKNS_6StringERKNS_7VariantERKNS_5ArrayE
|
||||
|
||||
this_ => rdi
|
||||
func => rsi
|
||||
extra => rdx
|
||||
isMethod => rcx
|
||||
origFuncName => r8
|
||||
obj => r9
|
||||
args => st0
|
||||
origFuncName => rdx
|
||||
obj => rcx
|
||||
args => r8
|
||||
*/
|
||||
|
||||
void th_12Continuation___construct(ObjectData* this_, long func, long extra, bool isMethod, Value* origFuncName, TypedValue* obj, Value* args) asm("_ZN4HPHP14c_Continuation13t___constructEllbRKNS_6StringERKNS_7VariantERKNS_5ArrayE");
|
||||
void th_12Continuation___construct(ObjectData* this_, long func, Value* origFuncName, TypedValue* obj, Value* args) asm("_ZN4HPHP14c_Continuation13t___constructElRKNS_6StringERKNS_7VariantERKNS_5ArrayE");
|
||||
|
||||
TypedValue* tg1_12Continuation___construct(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count, ObjectData* this_) __attribute__((noinline,cold));
|
||||
TypedValue* tg1_12Continuation___construct(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count, ObjectData* this_) {
|
||||
@@ -233,28 +231,22 @@ TypedValue* tg1_12Continuation___construct(TypedValue* rv, HPHP::VM::ActRec* ar,
|
||||
rv->m_data.num = 0LL;
|
||||
rv->m_type = KindOfNull;
|
||||
switch (count) {
|
||||
default: // count >= 6
|
||||
if ((args-5)->m_type != KindOfArray) {
|
||||
tvCastToArrayInPlace(args-5);
|
||||
default: // count >= 4
|
||||
if ((args-3)->m_type != KindOfArray) {
|
||||
tvCastToArrayInPlace(args-3);
|
||||
}
|
||||
case 5:
|
||||
case 4:
|
||||
case 3:
|
||||
case 2:
|
||||
break;
|
||||
}
|
||||
if (!IS_STRING_TYPE((args-3)->m_type)) {
|
||||
tvCastToStringInPlace(args-3);
|
||||
}
|
||||
if ((args-2)->m_type != KindOfBoolean) {
|
||||
tvCastToBooleanInPlace(args-2);
|
||||
}
|
||||
if ((args-1)->m_type != KindOfInt64) {
|
||||
tvCastToInt64InPlace(args-1);
|
||||
if (!IS_STRING_TYPE((args-1)->m_type)) {
|
||||
tvCastToStringInPlace(args-1);
|
||||
}
|
||||
if ((args-0)->m_type != KindOfInt64) {
|
||||
tvCastToInt64InPlace(args-0);
|
||||
}
|
||||
Variant defVal4;
|
||||
th_12Continuation___construct((this_), (long)(args[-0].m_data.num), (long)(args[-1].m_data.num), (bool)(args[-2].m_data.num), (Value*)(args-3), (count > 4) ? (args-4) : (TypedValue*)(&defVal4), (count > 5) ? (Value*)(args-5) : (Value*)(&null_array));
|
||||
Variant defVal2;
|
||||
th_12Continuation___construct((this_), (long)(args[-0].m_data.num), (Value*)(args-1), (count > 2) ? (args-2) : (TypedValue*)(&defVal2), (count > 3) ? (Value*)(args-3) : (Value*)(&null_array));
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -264,30 +256,30 @@ TypedValue* tg_12Continuation___construct(HPHP::VM::ActRec *ar) {
|
||||
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
||||
ObjectData* this_ = (ar->hasThis() ? ar->getThis() : NULL);
|
||||
if (this_) {
|
||||
if (count >= 4LL && count <= 6LL) {
|
||||
if ((count <= 5 || (args-5)->m_type == KindOfArray) && IS_STRING_TYPE((args-3)->m_type) && (args-2)->m_type == KindOfBoolean && (args-1)->m_type == KindOfInt64 && (args-0)->m_type == KindOfInt64) {
|
||||
if (count >= 2LL && count <= 4LL) {
|
||||
if ((count <= 3 || (args-3)->m_type == KindOfArray) && IS_STRING_TYPE((args-1)->m_type) && (args-0)->m_type == KindOfInt64) {
|
||||
rv.m_data.num = 0LL;
|
||||
rv.m_type = KindOfNull;
|
||||
Variant defVal4;
|
||||
th_12Continuation___construct((this_), (long)(args[-0].m_data.num), (long)(args[-1].m_data.num), (bool)(args[-2].m_data.num), (Value*)(args-3), (count > 4) ? (args-4) : (TypedValue*)(&defVal4), (count > 5) ? (Value*)(args-5) : (Value*)(&null_array));
|
||||
frame_free_locals_inl(ar, 6);
|
||||
Variant defVal2;
|
||||
th_12Continuation___construct((this_), (long)(args[-0].m_data.num), (Value*)(args-1), (count > 2) ? (args-2) : (TypedValue*)(&defVal2), (count > 3) ? (Value*)(args-3) : (Value*)(&null_array));
|
||||
frame_free_locals_inl(ar, 4);
|
||||
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
||||
return &ar->m_r;
|
||||
} else {
|
||||
tg1_12Continuation___construct(&rv, ar, count , this_);
|
||||
frame_free_locals_inl(ar, 6);
|
||||
frame_free_locals_inl(ar, 4);
|
||||
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
||||
return &ar->m_r;
|
||||
}
|
||||
} else {
|
||||
throw_wrong_arguments_nr("Continuation::__construct", count, 4, 6, 1);
|
||||
throw_wrong_arguments_nr("Continuation::__construct", count, 2, 4, 1);
|
||||
}
|
||||
} else {
|
||||
throw_instance_method_fatal("Continuation::__construct");
|
||||
}
|
||||
rv.m_data.num = 0LL;
|
||||
rv.m_type = KindOfNull;
|
||||
frame_free_locals_inl(ar, 6);
|
||||
frame_free_locals_inl(ar, 4);
|
||||
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
||||
return &ar->m_r;
|
||||
return &ar->m_r;
|
||||
|
||||
@@ -47,7 +47,7 @@ class c_Continuation : public ExtObjectData {
|
||||
// need to implement
|
||||
public: c_Continuation(VM::Class* cls = c_Continuation::s_cls);
|
||||
public: ~c_Continuation();
|
||||
public: void t___construct(int64_t func, int64_t extra, bool isMethod, CStrRef origFuncName, CVarRef obj = uninit_null(), CArrRef args = null_array);
|
||||
public: void t___construct(int64_t func, CStrRef origFuncName, CVarRef obj = uninit_null(), CArrRef args = null_array);
|
||||
public: void t_update(int64_t label, CVarRef value);
|
||||
public: void t_done();
|
||||
public: Object t_getwaithandle();
|
||||
@@ -115,7 +115,6 @@ public:
|
||||
bool m_done;
|
||||
bool m_running;
|
||||
bool m_should_throw;
|
||||
bool m_isMethod;
|
||||
|
||||
int m_localsOffset;
|
||||
VM::Func *m_vmFunc;
|
||||
|
||||
@@ -6859,8 +6859,9 @@ VMExecutionContext::createContinuation(ActRec* fp,
|
||||
cont->incRefCount();
|
||||
cont->setNoDestruct();
|
||||
try {
|
||||
cont->t___construct((int64_t)0, (int64_t)genFunc, isMethod,
|
||||
StrNR(const_cast<StringData*>(origName)), obj, args);
|
||||
cont->t___construct(uintptr_t(genFunc),
|
||||
StrNR(const_cast<StringData*>(origName)),
|
||||
obj, args);
|
||||
} catch (...) {
|
||||
decRefObj(cont);
|
||||
throw;
|
||||
|
||||
@@ -21933,10 +21933,8 @@ const char *g_class_map[] = {
|
||||
"/**\n * ( excerpt from http://php.net/manual/en/class.continuation.php )\n *\n *\n */",
|
||||
"iterator", "awaitable", NULL,
|
||||
(const char *)0x10006040, "__construct", "", (const char*)0, (const char*)0,
|
||||
"/**\n * ( excerpt from http://php.net/manual/en/continuation.construct.php )\n *\n *\n * @func int\n * @extra int\n * @isMethod bool\n * @origFuncName\n * string\n * @obj mixed\n * @args map\n */",
|
||||
"/**\n * ( excerpt from http://php.net/manual/en/continuation.construct.php )\n *\n *\n * @func int\n * @origFuncName\n * string\n * @obj mixed\n * @args map\n */",
|
||||
(const char *)-1, (const char *)0x2000, "func", "", (const char *)0xa, "", "", NULL,
|
||||
(const char *)0x2000, "extra", "", (const char *)0xa, "", "", NULL,
|
||||
(const char *)0x2000, "isMethod", "", (const char *)0x9, "", "", NULL,
|
||||
(const char *)0x2000, "origFuncName", "", (const char *)0x14, "", "", NULL,
|
||||
(const char *)0x2000, "obj", "", (const char *)0xffffffff, "N;", "null", NULL,
|
||||
(const char *)0x2000, "args", "", (const char *)0x20, "N;", "null", NULL,
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário