Add addAll() and setAll() APIs

Esse commit está contido em:
andrewparoski
2013-03-20 12:38:47 -07:00
commit de Sara Golemon
commit f6ec5180bb
11 arquivos alterados com 796 adições e 177 exclusões
+13
Ver Arquivo
@@ -4445,6 +4445,19 @@ class ReflectionClass implements Reflector {
return hphp_create_object($this->name, array_values($args));
}
// Do NOT modifiy this doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from
* http://php.net/manual/en/reflectionclass.newinstancewithoutconstructor.php )
*
* Creates a new instance of the class without invoking the constructor.
*
* @return mixed Returns a new instance of the class.
*/
public function newInstanceWithoutConstructor() {
return hphp_create_object_without_constructor($this->name);
}
// Do NOT modifiy this doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from
+108 -1
Ver Arquivo
@@ -201,7 +201,7 @@ DefineFunction(
'flags' => HasDocComment,
'desc' => "Stores a value into the Vector with the specified key, ".
"overwriting any previous value that was associated with ".
"the key. If the key is outside the bounds of the Vector, ".
"the key; if the key is outside the bounds of the Vector, ".
"an exception is thrown.",
'return' => array(
'type' => Object,
@@ -218,6 +218,26 @@ DefineFunction(
),
));
DefineFunction(
array(
'name' => "setAll",
'flags' => HasDocComment,
'desc' => "Stores each value produced by the specified KeyedIterable ".
"into the Vector using its corresponding key, overwriting ".
"any previous value that was associated with that key; if ".
"the key is outside the bounds of the Vector, an exception ".
"is thrown.",
'return' => array(
'type' => Object,
),
'args' => array(
array(
'name' => "iterable",
'type' => Variant,
),
),
));
DefineFunction(
array(
'name' => "put",
@@ -334,6 +354,23 @@ DefineFunction(
),
));
DefineFunction(
array(
'name' => "addAll",
'flags' => HasDocComment,
'desc' => "Adds the values produced by the specified Iterable to the ".
"end of this Vector using the next available integer keys.",
'return' => array(
'type' => Object,
),
'args' => array(
array(
'name' => "iterable",
'type' => Variant,
),
),
));
DefineFunction(
array(
'name' => "pop",
@@ -812,6 +849,24 @@ DefineFunction(
),
));
DefineFunction(
array(
'name' => "setAll",
'flags' => HasDocComment,
'desc' => "Stores each value produced by the specified KeyedIterable ".
"into the Map using its corresponding key, overwriting ".
"any previous value that was associated with that key.",
'return' => array(
'type' => Object,
),
'args' => array(
array(
'name' => "iterable",
'type' => Variant,
),
),
));
DefineFunction(
array(
'name' => "put",
@@ -945,6 +1000,23 @@ DefineFunction(
),
));
DefineFunction(
array(
'name' => "addAll",
'flags' => HasDocComment,
'desc' => "Adds the key/value Tuples produced by the specified ".
"Iterable to this Map.",
'return' => array(
'type' => Object,
),
'args' => array(
array(
'name' => "iterable",
'type' => Variant,
),
),
));
DefineFunction(
array(
'name' => "toArray",
@@ -1379,6 +1451,24 @@ DefineFunction(
),
));
DefineFunction(
array(
'name' => "setAll",
'flags' => HasDocComment,
'desc' => "Stores each value produced by the specified KeyedIterable ".
"into the StableMap using its corresponding key, overwriting ".
"any previous value that was associated with that key.",
'return' => array(
'type' => Object,
),
'args' => array(
array(
'name' => "iterable",
'type' => Variant,
),
),
));
DefineFunction(
array(
'name' => "put",
@@ -1512,6 +1602,23 @@ DefineFunction(
),
));
DefineFunction(
array(
'name' => "addAll",
'flags' => HasDocComment,
'desc' => "Adds the key/value Tuples produced by the specified ".
"Iterable to the end of this StableMap.",
'return' => array(
'type' => Object,
),
'args' => array(
array(
'name' => "iterable",
'type' => Variant,
),
),
));
DefineFunction(
array(
'name' => "toArray",
+123 -108
Ver Arquivo
@@ -122,10 +122,7 @@ void c_Vector::t___construct(CVarRef iterable /* = null_variant */) {
}
for (; iter; ++iter) {
Variant v = iter.second();
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell(&v);
add(tv);
}
}
@@ -162,9 +159,9 @@ void c_Vector::resize(int64_t sz, TypedValue* val) {
}
void c_Vector::reserve(int64_t sz) {
++m_versionNumber;
if (sz <= 0) return;
if (m_capacity < sz) {
++m_versionNumber;
m_capacity = sz;
m_data =
(TypedValue*)smart_realloc(m_data, m_capacity * sizeof(TypedValue));
@@ -199,19 +196,27 @@ ObjectData* c_Vector::clone() {
}
Object c_Vector::t_add(CVarRef val) {
TypedValue* tv = (TypedValue*)(&val);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell(&val);
add(tv);
return this;
}
Object c_Vector::t_append(CVarRef val) {
TypedValue* tv = (TypedValue*)(&val);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
Object c_Vector::t_addall(CVarRef iterable) {
size_t sz;
ArrayIter iter = getArrayIterHelper(iterable, sz);
if (sz) {
reserve(m_size + sz);
}
for (; iter; ++iter) {
Variant v = iter.second();
TypedValue* tv = tvToCell(v.asTypedValue());
add(tv);
}
return this;
}
Object c_Vector::t_append(CVarRef val) {
TypedValue* tv = cvarToCell(&val);
add(tv);
return this;
}
@@ -242,10 +247,7 @@ void c_Vector::t_resize(CVarRef sz, CVarRef value) {
"Parameter sz must be a non-negative integer"));
throw e;
}
TypedValue* val = (TypedValue*)(&value);
if (UNLIKELY(val->m_type == KindOfRef)) {
val = val->m_data.pref->tv();
}
TypedValue* val = cvarToCell(&value);
resize(intSz, val);
}
@@ -471,10 +473,7 @@ Object c_Vector::t_getiterator() {
Object c_Vector::t_set(CVarRef key, CVarRef value) {
if (key.isInteger()) {
TypedValue* tv = (TypedValue*)(&value);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell(&value);
set(key.toInt64(), tv);
return this;
}
@@ -482,6 +481,22 @@ Object c_Vector::t_set(CVarRef key, CVarRef value) {
return this;
}
Object c_Vector::t_setall(CVarRef iterable) {
size_t sz;
ArrayIter iter = getArrayIterHelper(iterable, sz);
for (; iter; ++iter) {
Variant k = iter.first();
Variant v = iter.second();
TypedValue* tvKey = tvToCell(k.asTypedValue());
TypedValue* tvVal = tvToCell(v.asTypedValue());
if (tvKey->m_type != KindOfInt64) {
throwBadKeyType();
}
set(tvKey->m_data.num, tvVal);
}
return this;
}
Object c_Vector::t_put(CVarRef key, CVarRef value) {
return t_set(key, value);
}
@@ -496,10 +511,7 @@ Object c_Vector::ti_fromitems(const char* cls, CVarRef iterable) {
}
for (uint i = 0; iter; ++i, ++iter) {
Variant v = iter.second();
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = tvToCell(v.asTypedValue());
target->add(tv);
}
return ret;
@@ -521,10 +533,7 @@ Object c_Vector::ti_fromarray(const char* cls, CVarRef arr) {
ssize_t pos = ad->iter_begin();
for (uint i = 0; i < sz; ++i, pos = ad->iter_advance(pos)) {
assert(pos != ArrayData::invalid_index);
TypedValue* tv = (TypedValue*)(&ad->getValueRef(pos));
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell((&ad->getValueRef(pos)));
tvRefcountedIncRef(tv);
data[i].m_data.num = tv->m_data.num;
data[i].m_type = tv->m_type;
@@ -914,10 +923,7 @@ void c_Map::t___construct(CVarRef iterable /* = null_variant */) {
for (; iter; ++iter) {
Variant k = iter.first();
Variant v = iter.second();
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = tvToCell(v.asTypedValue());
if (k.isInteger()) {
update(k.toInt64(), tv);
} else if (k.isString()) {
@@ -975,14 +981,23 @@ ObjectData* c_Map::clone() {
}
Object c_Map::t_add(CVarRef val) {
TypedValue* tv = (TypedValue*)(&val);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell(&val);
add(tv);
return this;
}
Object c_Map::t_addall(CVarRef iterable) {
size_t sz;
ArrayIter iter = getArrayIterHelper(iterable, sz);
reserve(m_size + sz);
for (; iter; ++iter) {
Variant v = iter.second();
TypedValue* tv = tvToCell(v.asTypedValue());
add(tv);
}
return this;
}
Object c_Map::t_clear() {
deleteBuckets();
freeData();
@@ -1040,10 +1055,7 @@ Variant c_Map::t_get(CVarRef key) {
}
Object c_Map::t_set(CVarRef key, CVarRef value) {
TypedValue* val = (TypedValue*)(&value);
if (UNLIKELY(val->m_type == KindOfRef)) {
val = val->m_data.pref->tv();
}
TypedValue* val = cvarToCell(&value);
if (key.isInteger()) {
update(key.toInt64(), val);
} else if (key.isString()) {
@@ -1054,6 +1066,25 @@ Object c_Map::t_set(CVarRef key, CVarRef value) {
return this;
}
Object c_Map::t_setall(CVarRef iterable) {
size_t sz;
ArrayIter iter = getArrayIterHelper(iterable, sz);
for (; iter; ++iter) {
Variant k = iter.first();
Variant v = iter.second();
TypedValue* tvKey = tvToCell(k.asTypedValue());
TypedValue* tvVal = tvToCell(v.asTypedValue());
if (tvKey->m_type == KindOfInt64) {
set(tvKey->m_data.num, tvVal);
} else if (IS_STRING_TYPE(tvKey->m_type)) {
set(tvKey->m_data.pstr, tvVal);
} else {
throwBadKeyType();
}
}
return this;
}
Object c_Map::t_put(CVarRef key, CVarRef value) {
return t_set(key, value);
}
@@ -1163,10 +1194,7 @@ Object c_Map::t_updatefromarray(CVarRef arr) {
for (ssize_t pos = ad->iter_begin(); pos != ArrayData::invalid_index;
pos = ad->iter_advance(pos)) {
Variant k = ad->getKey(pos);
TypedValue* tv = (TypedValue*)(&ad->getValueRef(pos));
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell((&ad->getValueRef(pos)));
if (k.isInteger()) {
update(k.toInt64(), tv);
} else {
@@ -1201,10 +1229,7 @@ Object c_Map::t_updatefromiterable(CVarRef it) {
for (ArrayIter iter = obj->begin(); iter; ++iter) {
Variant k = iter.first();
Variant v = iter.second();
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = tvToCell(v.asTypedValue());
if (k.isInteger()) {
update(k.toInt64(), tv);
} else {
@@ -1268,10 +1293,7 @@ Object c_Map::ti_fromitems(const char* cls, CVarRef iterable) {
}
for (; iter; ++iter) {
Variant v = iter.second();
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = tvToCell(v.asTypedValue());
if (UNLIKELY(tv->m_type != KindOfObject ||
!tv->m_data.pobj->instanceof(c_Tuple::s_cls))) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
@@ -1311,10 +1333,7 @@ Object c_Map::ti_fromarray(const char* cls, CVarRef arr) {
for (ssize_t pos = ad->iter_begin(); pos != ArrayData::invalid_index;
pos = ad->iter_advance(pos)) {
Variant k = ad->getKey(pos);
TypedValue* tv = (TypedValue*)(&ad->getValueRef(pos));
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell((&ad->getValueRef(pos)));
if (k.isInteger()) {
mp->update(k.toInt64(), tv);
} else {
@@ -1342,10 +1361,7 @@ Object c_Map::ti_fromiterable(const char* cls, CVarRef it) {
for (ArrayIter iter = obj->begin(); iter; ++iter) {
Variant k = iter.first();
Variant v = iter.second();
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell(&v);
if (k.isInteger()) {
target->update(k.toInt64(), tv);
} else {
@@ -1522,7 +1538,7 @@ bool c_Map::updateImpl(int64_t h, TypedValue* data) {
++m_size;
if (!p->tombstone()) {
if (UNLIKELY(++m_load >= computeMaxLoad())) {
resize();
grow();
p = findForInsert(h);
assert(p);
}
@@ -1555,7 +1571,7 @@ bool c_Map::updateImpl(StringData *key, TypedValue* data) {
++m_size;
if (!p->tombstone()) {
if (UNLIKELY(++m_load >= computeMaxLoad())) {
resize();
grow();
p = findForInsert(key->data(), key->size(), h);
assert(p);
}
@@ -1579,16 +1595,12 @@ void c_Map::erase(Bucket* p) {
}
p->data.m_type = (DataType)KindOfTombstone;
if (m_size < computeMinElements() && m_size) {
resize();
grow();
}
}
}
void c_Map::resize() {
reserve(m_size);
}
void c_Map::reserve(int64_t sz) {
void c_Map::growImpl(int64_t sz) {
++m_versionNumber;
if (sz < 2) {
if (sz <= 0) return;
@@ -1956,10 +1968,7 @@ void c_StableMap::t___construct(CVarRef iterable /* = null_variant */) {
for (; iter; ++iter) {
Variant k = iter.first();
Variant v = iter.second();
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell(&v);
if (k.isInteger()) {
update(k.toInt64(), tv);
} else if (k.isString()) {
@@ -2032,14 +2041,23 @@ ObjectData* c_StableMap::clone() {
}
Object c_StableMap::t_add(CVarRef val) {
TypedValue* tv = (TypedValue*)(&val);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell(&val);
add(tv);
return this;
}
Object c_StableMap::t_addall(CVarRef iterable) {
size_t sz;
ArrayIter iter = getArrayIterHelper(iterable, sz);
reserve(m_size + sz);
for (; iter; ++iter) {
Variant v = iter.second();
TypedValue* tv = cvarToCell(&v);
add(tv);
}
return this;
}
Object c_StableMap::t_clear() {
deleteBuckets();
freeData();
@@ -2099,10 +2117,7 @@ Variant c_StableMap::t_get(CVarRef key) {
}
Object c_StableMap::t_set(CVarRef key, CVarRef value) {
TypedValue* val = (TypedValue*)(&value);
if (UNLIKELY(val->m_type == KindOfRef)) {
val = val->m_data.pref->tv();
}
TypedValue* val = cvarToCell(&value);
if (key.isInteger()) {
update(key.toInt64(), val);
} else if (key.isString()) {
@@ -2113,6 +2128,25 @@ Object c_StableMap::t_set(CVarRef key, CVarRef value) {
return this;
}
Object c_StableMap::t_setall(CVarRef iterable) {
size_t sz;
ArrayIter iter = getArrayIterHelper(iterable, sz);
for (; iter; ++iter) {
Variant k = iter.first();
Variant v = iter.second();
TypedValue* tvKey = cvarToCell(&k);
TypedValue* tvVal = cvarToCell(&v);
if (tvKey->m_type == KindOfInt64) {
set(tvKey->m_data.num, tvVal);
} else if (IS_STRING_TYPE(tvKey->m_type)) {
set(tvKey->m_data.pstr, tvVal);
} else {
throwBadKeyType();
}
}
return this;
}
Object c_StableMap::t_put(CVarRef key, CVarRef value) {
return t_set(key, value);
}
@@ -2214,10 +2248,7 @@ Object c_StableMap::t_updatefromarray(CVarRef arr) {
for (ssize_t pos = ad->iter_begin(); pos != ArrayData::invalid_index;
pos = ad->iter_advance(pos)) {
Variant k = ad->getKey(pos);
TypedValue* tv = (TypedValue*)(&ad->getValueRef(pos));
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell((&ad->getValueRef(pos)));
if (k.isInteger()) {
update(k.toInt64(), tv);
} else {
@@ -2251,10 +2282,7 @@ Object c_StableMap::t_updatefromiterable(CVarRef it) {
for (ArrayIter iter = obj->begin(); iter; ++iter) {
Variant k = iter.first();
Variant v = iter.second();
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell(&v);
if (k.isInteger()) {
update(k.toInt64(), tv);
} else {
@@ -2316,10 +2344,7 @@ Object c_StableMap::ti_fromitems(const char* cls, CVarRef iterable) {
}
for (; iter; ++iter) {
Variant v = iter.second();
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell(&v);
if (UNLIKELY(tv->m_type != KindOfObject ||
!tv->m_data.pobj->instanceof(c_Tuple::s_cls))) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
@@ -2360,10 +2385,7 @@ Object c_StableMap::ti_fromarray(const char* cls, CVarRef arr) {
pos = ad->iter_advance(pos)) {
Variant k = ad->getKey(pos);
Variant v = ad->getValue(pos);
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell(&v);
if (k.isInteger()) {
smp->update(k.toInt64(), tv);
} else {
@@ -2391,10 +2413,7 @@ Object c_StableMap::ti_fromiterable(const char* cls, CVarRef it) {
for (ArrayIter iter = obj->begin(); iter; ++iter) {
Variant k = iter.first();
Variant v = iter.second();
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell(&v);
if (k.isInteger()) {
target->update(k.toInt64(), tv);
} else {
@@ -2511,7 +2530,7 @@ bool c_StableMap::updateImpl(int64_t h, TypedValue* data) {
}
++m_versionNumber;
if (++m_size > m_nTableSize) {
resize();
grow();
}
p = NEW(Bucket)(data);
p->setIntKey(h);
@@ -2540,7 +2559,7 @@ bool c_StableMap::updateImpl(StringData *key, TypedValue* data) {
}
++m_versionNumber;
if (++m_size > m_nTableSize) {
resize();
grow();
}
p = NEW(Bucket)(data);
p->setStrKey(key, h);
@@ -2576,11 +2595,7 @@ void c_StableMap::erase(Bucket** prev) {
}
}
void c_StableMap::resize() {
reserve(m_size);
}
void c_StableMap::reserve(int64_t sz) {
void c_StableMap::growImpl(int64_t sz) {
++m_versionNumber;
if (sz < 4) {
if (sz <= 0) return;
+234
Ver Arquivo
@@ -336,6 +336,45 @@ TypedValue* tg_6Vector_set(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Vector::t_setall(HPHP::Variant const&)
_ZN4HPHP8c_Vector8t_setallERKNS_7VariantE
(return value) => rax
_rv => rdi
this_ => rsi
iterable => rdx
*/
Value* th_6Vector_setAll(Value* _rv, ObjectData* this_, TypedValue* iterable) asm("_ZN4HPHP8c_Vector8t_setallERKNS_7VariantE");
TypedValue* tg_6Vector_setAll(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 == 1LL) {
rv.m_type = KindOfObject;
th_6Vector_setAll((&rv.m_data), (this_), (args-0));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_wrong_arguments_nr("Vector::setAll", count, 1, 1, 1);
}
} else {
throw_instance_method_fatal("Vector::setAll");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Vector::t_put(HPHP::Variant const&, HPHP::Variant const&)
_ZN4HPHP8c_Vector5t_putERKNS_7VariantES3_
@@ -605,6 +644,45 @@ TypedValue* tg_6Vector_add(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Vector::t_addall(HPHP::Variant const&)
_ZN4HPHP8c_Vector8t_addallERKNS_7VariantE
(return value) => rax
_rv => rdi
this_ => rsi
iterable => rdx
*/
Value* th_6Vector_addAll(Value* _rv, ObjectData* this_, TypedValue* iterable) asm("_ZN4HPHP8c_Vector8t_addallERKNS_7VariantE");
TypedValue* tg_6Vector_addAll(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 == 1LL) {
rv.m_type = KindOfObject;
th_6Vector_addAll((&rv.m_data), (this_), (args-0));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_wrong_arguments_nr("Vector::addAll", count, 1, 1, 1);
}
} else {
throw_instance_method_fatal("Vector::addAll");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Variant HPHP::c_Vector::t_pop()
_ZN4HPHP8c_Vector5t_popEv
@@ -1813,6 +1891,45 @@ TypedValue* tg_3Map_set(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Map::t_setall(HPHP::Variant const&)
_ZN4HPHP5c_Map8t_setallERKNS_7VariantE
(return value) => rax
_rv => rdi
this_ => rsi
iterable => rdx
*/
Value* th_3Map_setAll(Value* _rv, ObjectData* this_, TypedValue* iterable) asm("_ZN4HPHP5c_Map8t_setallERKNS_7VariantE");
TypedValue* tg_3Map_setAll(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 == 1LL) {
rv.m_type = KindOfObject;
th_3Map_setAll((&rv.m_data), (this_), (args-0));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_wrong_arguments_nr("Map::setAll", count, 1, 1, 1);
}
} else {
throw_instance_method_fatal("Map::setAll");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Map::t_put(HPHP::Variant const&, HPHP::Variant const&)
_ZN4HPHP5c_Map5t_putERKNS_7VariantES3_
@@ -2121,6 +2238,45 @@ TypedValue* tg_3Map_add(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Map::t_addall(HPHP::Variant const&)
_ZN4HPHP5c_Map8t_addallERKNS_7VariantE
(return value) => rax
_rv => rdi
this_ => rsi
iterable => rdx
*/
Value* th_3Map_addAll(Value* _rv, ObjectData* this_, TypedValue* iterable) asm("_ZN4HPHP5c_Map8t_addallERKNS_7VariantE");
TypedValue* tg_3Map_addAll(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 == 1LL) {
rv.m_type = KindOfObject;
th_3Map_addAll((&rv.m_data), (this_), (args-0));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_wrong_arguments_nr("Map::addAll", count, 1, 1, 1);
}
} else {
throw_instance_method_fatal("Map::addAll");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Array HPHP::c_Map::t_toarray()
_ZN4HPHP5c_Map9t_toarrayEv
@@ -3298,6 +3454,45 @@ TypedValue* tg_9StableMap_set(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_StableMap::t_setall(HPHP::Variant const&)
_ZN4HPHP11c_StableMap8t_setallERKNS_7VariantE
(return value) => rax
_rv => rdi
this_ => rsi
iterable => rdx
*/
Value* th_9StableMap_setAll(Value* _rv, ObjectData* this_, TypedValue* iterable) asm("_ZN4HPHP11c_StableMap8t_setallERKNS_7VariantE");
TypedValue* tg_9StableMap_setAll(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 == 1LL) {
rv.m_type = KindOfObject;
th_9StableMap_setAll((&rv.m_data), (this_), (args-0));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_wrong_arguments_nr("StableMap::setAll", count, 1, 1, 1);
}
} else {
throw_instance_method_fatal("StableMap::setAll");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_StableMap::t_put(HPHP::Variant const&, HPHP::Variant const&)
_ZN4HPHP11c_StableMap5t_putERKNS_7VariantES3_
@@ -3606,6 +3801,45 @@ TypedValue* tg_9StableMap_add(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_StableMap::t_addall(HPHP::Variant const&)
_ZN4HPHP11c_StableMap8t_addallERKNS_7VariantE
(return value) => rax
_rv => rdi
this_ => rsi
iterable => rdx
*/
Value* th_9StableMap_addAll(Value* _rv, ObjectData* this_, TypedValue* iterable) asm("_ZN4HPHP11c_StableMap8t_addallERKNS_7VariantE");
TypedValue* tg_9StableMap_addAll(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 == 1LL) {
rv.m_type = KindOfObject;
th_9StableMap_addAll((&rv.m_data), (this_), (args-0));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_wrong_arguments_nr("StableMap::addAll", count, 1, 1, 1);
}
} else {
throw_instance_method_fatal("StableMap::addAll");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Array HPHP::c_StableMap::t_toarray()
_ZN4HPHP11c_StableMap9t_toarrayEv
+53 -60
Ver Arquivo
@@ -47,6 +47,7 @@ class c_Vector : public ExtObjectDataFlags<ObjectData::VectorAttrInit|
public: void freeData();
public: void t___construct(CVarRef iterable = null_variant);
public: Object t_add(CVarRef val);
public: Object t_addall(CVarRef val);
public: Object t_append(CVarRef val); // deprecated
public: Variant t_pop();
public: void t_resize(CVarRef sz, CVarRef value);
@@ -58,6 +59,7 @@ class c_Vector : public ExtObjectDataFlags<ObjectData::VectorAttrInit|
public: Variant t_at(CVarRef key);
public: Variant t_get(CVarRef key);
public: Object t_set(CVarRef key, CVarRef value);
public: Object t_setall(CVarRef iterable);
public: Object t_put(CVarRef key, CVarRef value); // deprecated
public: bool t_contains(CVarRef key); // deprecated
public: bool t_containskey(CVarRef key);
@@ -231,6 +233,7 @@ class c_Map : public ExtObjectDataFlags<ObjectData::MapAttrInit|
public: void freeData();
public: void t___construct(CVarRef iterable = null_variant);
public: Object t_add(CVarRef val);
public: Object t_addall(CVarRef val);
public: Object t_clear();
public: bool t_isempty();
public: int64_t t_count();
@@ -239,6 +242,7 @@ class c_Map : public ExtObjectDataFlags<ObjectData::MapAttrInit|
public: Variant t_at(CVarRef key);
public: Variant t_get(CVarRef key);
public: Object t_set(CVarRef key, CVarRef value);
public: Object t_setall(CVarRef iterable);
public: Object t_put(CVarRef key, CVarRef value); // deprecated
public: bool t_contains(CVarRef key);
public: bool t_containskey(CVarRef key);
@@ -322,7 +326,11 @@ class c_Map : public ExtObjectDataFlags<ObjectData::MapAttrInit|
public: bool contains(StringData* key) {
return find(key->data(), key->size(), key->hash());
}
public: void reserve(int64_t sz);
public: void reserve(int64_t sz) {
if (int64_t(m_load) + sz - int64_t(m_size) >= computeMaxLoad()) {
growImpl(sz);
}
}
public: int getVersionNumber() {
return m_versionNumber;
}
@@ -477,7 +485,11 @@ private:
}
void erase(Bucket* prev);
void resize();
void growImpl(int64_t sz);
void grow() {
growImpl(m_size);
}
void deleteBuckets();
ssize_t iter_begin() const;
@@ -540,6 +552,7 @@ class c_StableMap : public ExtObjectDataFlags<ObjectData::StableMapAttrInit|
public: void freeData();
public: void t___construct(CVarRef iterable = null_variant);
public: Object t_add(CVarRef val);
public: Object t_addall(CVarRef val);
public: Object t_clear();
public: bool t_isempty();
public: int64_t t_count();
@@ -548,6 +561,7 @@ class c_StableMap : public ExtObjectDataFlags<ObjectData::StableMapAttrInit|
public: Variant t_at(CVarRef key);
public: Variant t_get(CVarRef key);
public: Object t_set(CVarRef key, CVarRef value);
public: Object t_setall(CVarRef iterable);
public: Object t_put(CVarRef key, CVarRef value); // deprecated
public: bool t_contains(CVarRef key);
public: bool t_containskey(CVarRef key);
@@ -629,7 +643,11 @@ class c_StableMap : public ExtObjectDataFlags<ObjectData::StableMapAttrInit|
public: bool contains(StringData* key) {
return find(key->data(), key->size(), key->hash());
}
public: void reserve(int64_t sz);
public: void reserve(int64_t sz) {
if (sz > int64_t(m_nTableSize)) {
growImpl(sz);
}
}
public: int getVersionNumber() {
return m_versionNumber;
}
@@ -746,7 +764,11 @@ private:
}
void erase(Bucket** prev);
void resize();
void growImpl(int64_t sz);
void grow() {
growImpl(m_size);
}
void deleteBuckets();
ssize_t iter_begin() const;
@@ -927,6 +949,10 @@ class c_TupleIterator : public ExtObjectData {
///////////////////////////////////////////////////////////////////////////////
inline TypedValue* cvarToCell(const Variant* v) {
return const_cast<TypedValue*>(tvToCell(v->asTypedValue()));
}
inline TypedValue* collectionGet(ObjectData* obj, TypedValue* key) {
assert(key->m_type != KindOfRef);
switch (obj->getCollectionType()) {
@@ -1045,23 +1071,23 @@ inline Variant& collectionOffsetGet(ObjectData* obj, int64_t offset) {
switch (obj->getCollectionType()) {
case Collection::VectorType: {
c_Vector* vec = static_cast<c_Vector*>(obj);
return *(Variant*)(vec->at(offset));
return tvAsVariant(vec->at(offset));
}
case Collection::MapType: {
c_Map* mp = static_cast<c_Map*>(obj);
return *(Variant*)(mp->at(offset));
return tvAsVariant(mp->at(offset));
}
case Collection::StableMapType: {
c_StableMap* smp = static_cast<c_StableMap*>(obj);
return *(Variant*)(smp->at(offset));
return tvAsVariant(smp->at(offset));
}
case Collection::TupleType: {
c_Tuple* tup = static_cast<c_Tuple*>(obj);
return *(Variant*)(tup->at(offset));
return tvAsVariant(tup->at(offset));
}
default:
assert(false);
return *(Variant*)(NULL);
return tvAsVariant(NULL);
}
}
@@ -1075,11 +1101,11 @@ inline Variant& collectionOffsetGet(ObjectData* obj, CStrRef offset) {
}
case Collection::MapType: {
c_Map* mp = static_cast<c_Map*>(obj);
return *(Variant*)(mp->at(key));
return tvAsVariant(mp->at(key));
}
case Collection::StableMapType: {
c_StableMap* smp = static_cast<c_StableMap*>(obj);
return *(Variant*)(smp->at(key));
return tvAsVariant(smp->at(key));
}
case Collection::TupleType: {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
@@ -1088,27 +1114,24 @@ inline Variant& collectionOffsetGet(ObjectData* obj, CStrRef offset) {
}
default:
assert(false);
return *(Variant*)(NULL);
return tvAsVariant(NULL);
}
}
inline Variant& collectionOffsetGet(ObjectData* obj, CVarRef offset) {
TypedValue* key = (TypedValue*)(&offset);
if (key->m_type == KindOfRef) {
key = key->m_data.pref->tv();
}
TypedValue* key = cvarToCell(&offset);
switch (obj->getCollectionType()) {
case Collection::VectorType:
return *(Variant*)(c_Vector::OffsetGet(obj, key));
return tvAsVariant(c_Vector::OffsetGet(obj, key));
case Collection::MapType:
return *(Variant*)(c_Map::OffsetGet(obj, key));
return tvAsVariant(c_Map::OffsetGet(obj, key));
case Collection::StableMapType:
return *(Variant*)(c_StableMap::OffsetGet(obj, key));
return tvAsVariant(c_StableMap::OffsetGet(obj, key));
case Collection::TupleType:
return *(Variant*)(c_Tuple::OffsetGet(obj, key));
return tvAsVariant(c_Tuple::OffsetGet(obj, key));
default:
assert(false);
return *(Variant*)(NULL);
return tvAsVariant(NULL);
}
}
@@ -1125,10 +1148,7 @@ inline Variant& collectionOffsetGet(ObjectData* obj, litstr offset) {
}
inline void collectionOffsetSet(ObjectData* obj, int64_t offset, CVarRef val) {
TypedValue* tv = (TypedValue*)(&val);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell(&val);
if (UNLIKELY(tv->m_type == KindOfUninit)) {
tv = (TypedValue*)(&init_null_variant);
}
@@ -1160,10 +1180,7 @@ inline void collectionOffsetSet(ObjectData* obj, int64_t offset, CVarRef val) {
inline void collectionOffsetSet(ObjectData* obj, CStrRef offset, CVarRef val) {
StringData* key = offset.get();
TypedValue* tv = (TypedValue*)(&val);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* tv = cvarToCell(&val);
if (UNLIKELY(tv->m_type == KindOfUninit)) {
tv = (TypedValue*)(&init_null_variant);
}
@@ -1194,14 +1211,8 @@ inline void collectionOffsetSet(ObjectData* obj, CStrRef offset, CVarRef val) {
}
inline void collectionOffsetSet(ObjectData* obj, CVarRef offset, CVarRef val) {
TypedValue* key = (TypedValue*)(&offset);
if (UNLIKELY(key->m_type == KindOfRef)) {
key = key->m_data.pref->tv();
}
TypedValue* tv = (TypedValue*)(&val);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
TypedValue* key = cvarToCell(&offset);
TypedValue* tv = cvarToCell(&val);
if (UNLIKELY(tv->m_type == KindOfUninit)) {
tv = (TypedValue*)(&init_null_variant);
}
@@ -1240,10 +1251,7 @@ inline void collectionOffsetSet(ObjectData* obj, litstr offset, CVarRef val) {
}
inline bool collectionOffsetContains(ObjectData* obj, CVarRef offset) {
TypedValue* key = (TypedValue*)(&offset);
if (key->m_type == KindOfRef) {
key = key->m_data.pref->tv();
}
TypedValue* key = cvarToCell(&offset);
switch (obj->getCollectionType()) {
case Collection::VectorType:
return c_Vector::OffsetContains(obj, key);
@@ -1260,10 +1268,7 @@ inline bool collectionOffsetContains(ObjectData* obj, CVarRef offset) {
}
inline bool collectionOffsetIsset(ObjectData* obj, CVarRef offset) {
TypedValue* key = (TypedValue*)(&offset);
if (key->m_type == KindOfRef) {
key = key->m_data.pref->tv();
}
TypedValue* key = cvarToCell(&offset);
switch (obj->getCollectionType()) {
case Collection::VectorType:
return c_Vector::OffsetIsset(obj, key);
@@ -1280,10 +1285,7 @@ inline bool collectionOffsetIsset(ObjectData* obj, CVarRef offset) {
}
inline bool collectionOffsetEmpty(ObjectData* obj, CVarRef offset) {
TypedValue* key = (TypedValue*)(&offset);
if (key->m_type == KindOfRef) {
key = key->m_data.pref->tv();
}
TypedValue* key = cvarToCell(&offset);
switch (obj->getCollectionType()) {
case Collection::VectorType:
return c_Vector::OffsetEmpty(obj, key);
@@ -1300,21 +1302,12 @@ inline bool collectionOffsetEmpty(ObjectData* obj, CVarRef offset) {
}
inline void collectionOffsetUnset(ObjectData* obj, CVarRef offset) {
TypedValue* key = (TypedValue*)(&offset);
if (UNLIKELY(key->m_type == KindOfRef)) {
key = key->m_data.pref->tv();
}
TypedValue* key = cvarToCell(&offset);
collectionUnset(obj, key);
}
inline void collectionOffsetAppend(ObjectData* obj, CVarRef val) {
TypedValue* tv = (TypedValue*)(&val);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
if (UNLIKELY(tv->m_type == KindOfUninit)) {
tv = (TypedValue*)(&init_null_variant);
}
TypedValue* tv = cvarToCell(&val);
collectionAppend(obj, tv);
}
+52
Ver Arquivo
@@ -499,6 +499,58 @@ TypedValue* fg_hphp_create_object(HPHP::VM::ActRec *ar) {
/*
HPHP::Object HPHP::f_hphp_create_object_without_constructor(HPHP::String const&)
_ZN4HPHP40f_hphp_create_object_without_constructorERKNS_6StringE
(return value) => rax
_rv => rdi
name => rsi
*/
Value* fh_hphp_create_object_without_constructor(Value* _rv, Value* name) asm("_ZN4HPHP40f_hphp_create_object_without_constructorERKNS_6StringE");
TypedValue * fg1_hphp_create_object_without_constructor(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
TypedValue * fg1_hphp_create_object_without_constructor(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
rv->m_type = KindOfObject;
tvCastToStringInPlace(args-0);
fh_hphp_create_object_without_constructor((&rv->m_data), &args[-0].m_data);
if (rv->m_data.num == 0LL)rv->m_type = KindOfNull;
return rv;
}
TypedValue* fg_hphp_create_object_without_constructor(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count == 1LL) {
if (IS_STRING_TYPE((args-0)->m_type)) {
rv.m_type = KindOfObject;
fh_hphp_create_object_without_constructor((&rv.m_data), &args[-0].m_data);
if (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;
} else {
fg1_hphp_create_object_without_constructor(&rv, ar, count);
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
}
} else {
throw_wrong_arguments_nr("hphp_create_object_without_constructor", 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;
}
/*
HPHP::Variant HPHP::f_hphp_get_property(HPHP::Object const&, HPHP::String const&, HPHP::String const&)
_ZN4HPHP19f_hphp_get_propertyERKNS_6ObjectERKNS_6StringES5_
+11
Ver Arquivo
@@ -133,6 +133,17 @@ params => rdx
Value* fh_hphp_create_object(Value* _rv, Value* name, Value* params) asm("_ZN4HPHP20f_hphp_create_objectERKNS_6StringERKNS_5ArrayE");
/*
HPHP::Object HPHP::f_hphp_create_object_without_constructor(HPHP::String const&)
_ZN4HPHP40f_hphp_create_object_without_constructorERKNS_6StringE
(return value) => rax
_rv => rdi
name => rsi
*/
Value* fh_hphp_create_object_without_constructor(Value* _rv, Value* name) asm("_ZN4HPHP40f_hphp_create_object_without_constructorERKNS_6StringE");
/*
HPHP::Variant HPHP::f_hphp_get_property(HPHP::Object const&, HPHP::String const&, HPHP::String const&)
_ZN4HPHP19f_hphp_get_propertyERKNS_6ObjectERKNS_6StringES5_
+18 -4
Ver Arquivo
@@ -1797,6 +1797,7 @@ TypedValue* fg_hphp_invoke(VM::ActRec *ar);
TypedValue* fg_hphp_invoke_method(VM::ActRec *ar);
TypedValue* fg_hphp_instanceof(VM::ActRec *ar);
TypedValue* fg_hphp_create_object(VM::ActRec *ar);
TypedValue* fg_hphp_create_object_without_constructor(VM::ActRec *ar);
TypedValue* fg_hphp_get_property(VM::ActRec *ar);
TypedValue* fg_hphp_set_property(VM::ActRec *ar);
TypedValue* fg_hphp_get_static_property(VM::ActRec *ar);
@@ -2280,6 +2281,7 @@ TypedValue* tg_6Vector_keys(VM::ActRec *ar);
TypedValue* tg_6Vector_at(VM::ActRec *ar);
TypedValue* tg_6Vector_get(VM::ActRec *ar);
TypedValue* tg_6Vector_set(VM::ActRec *ar);
TypedValue* tg_6Vector_setAll(VM::ActRec *ar);
TypedValue* tg_6Vector_put(VM::ActRec *ar);
TypedValue* tg_6Vector_clear(VM::ActRec *ar);
TypedValue* tg_6Vector_contains(VM::ActRec *ar);
@@ -2287,6 +2289,7 @@ TypedValue* tg_6Vector_containsKey(VM::ActRec *ar);
TypedValue* tg_6Vector_removeKey(VM::ActRec *ar);
TypedValue* tg_6Vector_append(VM::ActRec *ar);
TypedValue* tg_6Vector_add(VM::ActRec *ar);
TypedValue* tg_6Vector_addAll(VM::ActRec *ar);
TypedValue* tg_6Vector_pop(VM::ActRec *ar);
TypedValue* tg_6Vector_resize(VM::ActRec *ar);
TypedValue* tg_6Vector_toArray(VM::ActRec *ar);
@@ -2321,6 +2324,7 @@ TypedValue* tg_3Map_keys(VM::ActRec *ar);
TypedValue* tg_3Map_at(VM::ActRec *ar);
TypedValue* tg_3Map_get(VM::ActRec *ar);
TypedValue* tg_3Map_set(VM::ActRec *ar);
TypedValue* tg_3Map_setAll(VM::ActRec *ar);
TypedValue* tg_3Map_put(VM::ActRec *ar);
TypedValue* tg_3Map_clear(VM::ActRec *ar);
TypedValue* tg_3Map_contains(VM::ActRec *ar);
@@ -2329,6 +2333,7 @@ TypedValue* tg_3Map_remove(VM::ActRec *ar);
TypedValue* tg_3Map_removeKey(VM::ActRec *ar);
TypedValue* tg_3Map_discard(VM::ActRec *ar);
TypedValue* tg_3Map_add(VM::ActRec *ar);
TypedValue* tg_3Map_addAll(VM::ActRec *ar);
TypedValue* tg_3Map_toArray(VM::ActRec *ar);
TypedValue* tg_3Map_copyAsArray(VM::ActRec *ar);
TypedValue* tg_3Map_toKeysArray(VM::ActRec *ar);
@@ -2362,6 +2367,7 @@ TypedValue* tg_9StableMap_keys(VM::ActRec *ar);
TypedValue* tg_9StableMap_at(VM::ActRec *ar);
TypedValue* tg_9StableMap_get(VM::ActRec *ar);
TypedValue* tg_9StableMap_set(VM::ActRec *ar);
TypedValue* tg_9StableMap_setAll(VM::ActRec *ar);
TypedValue* tg_9StableMap_put(VM::ActRec *ar);
TypedValue* tg_9StableMap_clear(VM::ActRec *ar);
TypedValue* tg_9StableMap_contains(VM::ActRec *ar);
@@ -2370,6 +2376,7 @@ TypedValue* tg_9StableMap_remove(VM::ActRec *ar);
TypedValue* tg_9StableMap_removeKey(VM::ActRec *ar);
TypedValue* tg_9StableMap_discard(VM::ActRec *ar);
TypedValue* tg_9StableMap_add(VM::ActRec *ar);
TypedValue* tg_9StableMap_addAll(VM::ActRec *ar);
TypedValue* tg_9StableMap_toArray(VM::ActRec *ar);
TypedValue* tg_9StableMap_copyAsArray(VM::ActRec *ar);
TypedValue* tg_9StableMap_toKeysArray(VM::ActRec *ar);
@@ -3034,7 +3041,7 @@ TypedValue* tg_9XMLWriter_endDTD(VM::ActRec *ar);
TypedValue* tg_9XMLWriter_flush(VM::ActRec *ar);
TypedValue* tg_9XMLWriter_outputMemory(VM::ActRec *ar);
const long long hhbc_ext_funcs_count = 2207;
const long long hhbc_ext_funcs_count = 2208;
const HhbcExtFuncInfo hhbc_ext_funcs[] = {
{ "apache_note", fg_apache_note, (void *)&fh_apache_note },
{ "apache_request_headers", fg_apache_request_headers, (void *)&fh_apache_request_headers },
@@ -4810,6 +4817,7 @@ const HhbcExtFuncInfo hhbc_ext_funcs[] = {
{ "hphp_invoke_method", fg_hphp_invoke_method, (void *)&fh_hphp_invoke_method },
{ "hphp_instanceof", fg_hphp_instanceof, (void *)&fh_hphp_instanceof },
{ "hphp_create_object", fg_hphp_create_object, (void *)&fh_hphp_create_object },
{ "hphp_create_object_without_constructor", fg_hphp_create_object_without_constructor, (void *)&fh_hphp_create_object_without_constructor },
{ "hphp_get_property", fg_hphp_get_property, (void *)&fh_hphp_get_property },
{ "hphp_set_property", fg_hphp_set_property, (void *)&fh_hphp_set_property },
{ "hphp_get_static_property", fg_hphp_get_static_property, (void *)&fh_hphp_get_static_property },
@@ -5326,7 +5334,7 @@ static const HhbcExtMethodInfo hhbc_ext_methods_DummyClosure[] = {
{ "__construct", tg_12DummyClosure___construct }
};
static const long long hhbc_ext_method_count_Vector = 33;
static const long long hhbc_ext_method_count_Vector = 35;
static const HhbcExtMethodInfo hhbc_ext_methods_Vector[] = {
{ "__construct", tg_6Vector___construct },
{ "isEmpty", tg_6Vector_isEmpty },
@@ -5336,6 +5344,7 @@ static const HhbcExtMethodInfo hhbc_ext_methods_Vector[] = {
{ "at", tg_6Vector_at },
{ "get", tg_6Vector_get },
{ "set", tg_6Vector_set },
{ "setAll", tg_6Vector_setAll },
{ "put", tg_6Vector_put },
{ "clear", tg_6Vector_clear },
{ "contains", tg_6Vector_contains },
@@ -5343,6 +5352,7 @@ static const HhbcExtMethodInfo hhbc_ext_methods_Vector[] = {
{ "removeKey", tg_6Vector_removeKey },
{ "append", tg_6Vector_append },
{ "add", tg_6Vector_add },
{ "addAll", tg_6Vector_addAll },
{ "pop", tg_6Vector_pop },
{ "resize", tg_6Vector_resize },
{ "toArray", tg_6Vector_toArray },
@@ -5373,7 +5383,7 @@ static const HhbcExtMethodInfo hhbc_ext_methods_VectorIterator[] = {
{ "rewind", tg_14VectorIterator_rewind }
};
static const long long hhbc_ext_method_count_Map = 33;
static const long long hhbc_ext_method_count_Map = 35;
static const HhbcExtMethodInfo hhbc_ext_methods_Map[] = {
{ "__construct", tg_3Map___construct },
{ "isEmpty", tg_3Map_isEmpty },
@@ -5383,6 +5393,7 @@ static const HhbcExtMethodInfo hhbc_ext_methods_Map[] = {
{ "at", tg_3Map_at },
{ "get", tg_3Map_get },
{ "set", tg_3Map_set },
{ "setAll", tg_3Map_setAll },
{ "put", tg_3Map_put },
{ "clear", tg_3Map_clear },
{ "contains", tg_3Map_contains },
@@ -5391,6 +5402,7 @@ static const HhbcExtMethodInfo hhbc_ext_methods_Map[] = {
{ "removeKey", tg_3Map_removeKey },
{ "discard", tg_3Map_discard },
{ "add", tg_3Map_add },
{ "addAll", tg_3Map_addAll },
{ "toArray", tg_3Map_toArray },
{ "copyAsArray", tg_3Map_copyAsArray },
{ "toKeysArray", tg_3Map_toKeysArray },
@@ -5420,7 +5432,7 @@ static const HhbcExtMethodInfo hhbc_ext_methods_MapIterator[] = {
{ "rewind", tg_11MapIterator_rewind }
};
static const long long hhbc_ext_method_count_StableMap = 33;
static const long long hhbc_ext_method_count_StableMap = 35;
static const HhbcExtMethodInfo hhbc_ext_methods_StableMap[] = {
{ "__construct", tg_9StableMap___construct },
{ "isEmpty", tg_9StableMap_isEmpty },
@@ -5430,6 +5442,7 @@ static const HhbcExtMethodInfo hhbc_ext_methods_StableMap[] = {
{ "at", tg_9StableMap_at },
{ "get", tg_9StableMap_get },
{ "set", tg_9StableMap_set },
{ "setAll", tg_9StableMap_setAll },
{ "put", tg_9StableMap_put },
{ "clear", tg_9StableMap_clear },
{ "contains", tg_9StableMap_contains },
@@ -5438,6 +5451,7 @@ static const HhbcExtMethodInfo hhbc_ext_methods_StableMap[] = {
{ "removeKey", tg_9StableMap_removeKey },
{ "discard", tg_9StableMap_discard },
{ "add", tg_9StableMap_add },
{ "addAll", tg_9StableMap_addAll },
{ "toArray", tg_9StableMap_toArray },
{ "copyAsArray", tg_9StableMap_copyAsArray },
{ "toKeysArray", tg_9StableMap_toKeysArray },
+43 -1
Ver Arquivo
@@ -5513,6 +5513,12 @@ const char *g_class_map[] = {
NULL,
NULL,
NULL,
(const char *)0x10416040, "hphp_create_object_without_constructor", "", (const char*)0, (const char*)0,
"/**\n * ( HipHop specific )\n *\n * Used by FFI interface for other languages to call into PHP.\n *\n * @name string\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "name", "", (const char *)0x14, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10416040, "hphp_get_property", "", (const char*)0, (const char*)0,
"/**\n * ( HipHop specific )\n *\n * Used by FFI interface for other languages to call into PHP.\n *\n * @obj object\n * @cls string\n * @prop string\n *\n * @return mixed\n */",
(const char *)0xffffffff, (const char *)0x2000, "obj", "", (const char *)0x40, "", "", NULL,
@@ -22410,12 +22416,18 @@ const char *g_class_map[] = {
NULL,
NULL,
(const char *)0x10006040, "set", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/vector.set.php )\n *\n * Stores a value into the Vector with the specified key, overwriting any\n * previous value that was associated with the key. If the key is outside\n * the bounds of the Vector, an exception is thrown.\n *\n * @key mixed\n * @value mixed\n *\n * @return object\n */",
"/**\n * ( excerpt from http://php.net/manual/en/vector.set.php )\n *\n * Stores a value into the Vector with the specified key, overwriting any\n * previous value that was associated with the key; if the key is outside\n * the bounds of the Vector, an exception is thrown.\n *\n * @key mixed\n * @value mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "key", "", (const char *)0xffffffff, "", "", NULL,
(const char *)0x2000, "value", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10006040, "setAll", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/vector.setall.php )\n *\n * Stores each value produced by the specified KeyedIterable into the\n * Vector using its corresponding key, overwriting any previous value that\n * was associated with that key; if the key is outside the bounds of the\n * Vector, an exception is thrown.\n *\n * @iterable mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "iterable", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10006040, "put", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/vector.put.php )\n *\n * Stores a value into the Vector with the specified key, overwriting any\n * previous value that was associated with the key. If the key is outside\n * the bounds of the Vector, an exception is thrown.\n *\n * @key mixed\n * @value mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "key", "", (const char *)0xffffffff, "", "", NULL,
@@ -22458,6 +22470,12 @@ const char *g_class_map[] = {
NULL,
NULL,
NULL,
(const char *)0x10006040, "addAll", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/vector.addall.php )\n *\n * Adds the values produced by the specified Iterable to the end of this\n * Vector using the next available integer keys.\n *\n * @iterable mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "iterable", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10006040, "pop", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/vector.pop.php )\n *\n *\n * @return mixed\n */",
(const char *)0xffffffff, NULL,
@@ -22655,6 +22673,12 @@ const char *g_class_map[] = {
NULL,
NULL,
NULL,
(const char *)0x10006040, "setAll", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.setall.php )\n *\n * Stores each value produced by the specified KeyedIterable into the Map\n * using its corresponding key, overwriting any previous value that was\n * associated with that key.\n *\n * @iterable mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "iterable", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10006040, "put", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.put.php )\n *\n * Stores a value into the Map with the specified key, overwriting any\n * previous value that was associated with the key.\n *\n * @key mixed\n * @value mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "key", "", (const char *)0xffffffff, "", "", NULL,
@@ -22703,6 +22727,12 @@ const char *g_class_map[] = {
NULL,
NULL,
NULL,
(const char *)0x10006040, "addAll", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.addall.php )\n *\n * Adds the key/value Tuples produced by the specified Iterable to this\n * Map.\n *\n * @iterable mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "iterable", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10006040, "toArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.toarray.php )\n *\n * Returns an array built from the keys and values from this Map.\n *\n * @return map\n */",
(const char *)0x20, NULL,
@@ -22888,6 +22918,12 @@ const char *g_class_map[] = {
NULL,
NULL,
NULL,
(const char *)0x10006040, "setAll", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.setall.php )\n *\n * Stores each value produced by the specified KeyedIterable into the\n * StableMap using its corresponding key, overwriting any previous value\n * that was associated with that key.\n *\n * @iterable mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "iterable", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10006040, "put", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.put.php )\n *\n * Stores a value into the StableMap with the specified key, overwriting\n * any previous value that was associated with the key.\n *\n * @key mixed\n * @value mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "key", "", (const char *)0xffffffff, "", "", NULL,
@@ -22936,6 +22972,12 @@ const char *g_class_map[] = {
NULL,
NULL,
NULL,
(const char *)0x10006040, "addAll", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.addall.php )\n *\n * Adds the key/value Tuples produced by the specified Iterable to the end\n * of this StableMap.\n *\n * @iterable mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "iterable", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10006040, "toArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.toarray.php )\n *\n * Returns an array built from the keys and values from this StableMap.\n *\n * @return map\n */",
(const char *)0x20, NULL,
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
+138
Ver Arquivo
@@ -26248,6 +26248,144 @@ bool TestCodeRun::TestHint() {
"}\n"
);
MVCRO("<?php\n"
"function f1() {\n"
" $a = Vector {11, 22};\n"
" $b = Vector {33, 44};\n"
" $a->addAll($b);\n"
" var_dump($a);\n"
"}\n"
"function f2() {\n"
" $a = Vector {11, 22};\n"
" $b = StableMap {'a' => 33, 'b' => 44};\n"
" $a->addAll($b);\n"
" var_dump($a);\n"
"}\n"
"function f3() {\n"
" $a = StableMap {'a' => 11, 'b' => 22};\n"
" $b = Vector {Tuple {'e', 33}, Tuple {'f', 44}};\n"
" $a->addAll($b);\n"
" var_dump($a);\n"
"}\n"
"function f4() {\n"
" $a = StableMap {'a' => 11, 'b' => 22};\n"
" $b = StableMap {'c' => Tuple {'e', 33}, 'd' => Tuple {'f', 44}};\n"
" $a->addAll($b);\n"
" var_dump($a);\n"
"}\n"
"f1();\n"
"f2();\n"
"f3();\n"
"f4();\n"
,
"object(Vector)#1 (4) {\n"
" [0]=>\n"
" int(11)\n"
" [1]=>\n"
" int(22)\n"
" [2]=>\n"
" int(33)\n"
" [3]=>\n"
" int(44)\n"
"}\n"
"object(Vector)#1 (4) {\n"
" [0]=>\n"
" int(11)\n"
" [1]=>\n"
" int(22)\n"
" [2]=>\n"
" int(33)\n"
" [3]=>\n"
" int(44)\n"
"}\n"
"object(StableMap)#1 (4) {\n"
" [\"a\"]=>\n"
" int(11)\n"
" [\"b\"]=>\n"
" int(22)\n"
" [\"e\"]=>\n"
" int(33)\n"
" [\"f\"]=>\n"
" int(44)\n"
"}\n"
"object(StableMap)#4 (4) {\n"
" [\"a\"]=>\n"
" int(11)\n"
" [\"b\"]=>\n"
" int(22)\n"
" [\"e\"]=>\n"
" int(33)\n"
" [\"f\"]=>\n"
" int(44)\n"
"}\n"
);
MVCRO("<?php\n"
"function f1() {\n"
" $a = Vector {};\n"
" $a->resize(4, null);\n"
" $b = Vector {42, 73};\n"
" $a->setAll($b);\n"
" var_dump($a);\n"
"}\n"
"function f2() {\n"
" $a = Vector {};\n"
" $a->resize(4, null);\n"
" $b = Map {3 => 42, 2 => 73};\n"
" $a->setAll($b);\n"
" var_dump($a);\n"
"}\n"
"function f3() {\n"
" $a = StableMap {};\n"
" $b = Vector {42, 73};\n"
" $a->setAll($b);\n"
" var_dump($a);\n"
"}\n"
"function f4() {\n"
" $a = StableMap {};\n"
" $b = StableMap {3 => 42, 2 => 73};\n"
" $a->setAll($b);\n"
" var_dump($a);\n"
"}\n"
"f1();\n"
"f2();\n"
"f3();\n"
"f4();\n"
,
"object(Vector)#1 (4) {\n"
" [0]=>\n"
" int(42)\n"
" [1]=>\n"
" int(73)\n"
" [2]=>\n"
" NULL\n"
" [3]=>\n"
" NULL\n"
"}\n"
"object(Vector)#1 (4) {\n"
" [0]=>\n"
" NULL\n"
" [1]=>\n"
" NULL\n"
" [2]=>\n"
" int(73)\n"
" [3]=>\n"
" int(42)\n"
"}\n"
"object(StableMap)#1 (2) {\n"
" [0]=>\n"
" int(42)\n"
" [1]=>\n"
" int(73)\n"
"}\n"
"object(StableMap)#1 (2) {\n"
" [3]=>\n"
" int(42)\n"
" [2]=>\n"
" int(73)\n"
"}\n"
);
return true;
}