示例#1
0
TypedValue* APCLocalArray::NvGetStr(const ArrayData* ad,
                                    const StringData* key) {
  auto a = asSharedArray(ad);
  auto index = a->getIndex(key);
  if (index == -1) return nullptr;
  return (TypedValue*)&a->getValueRef(index);
}
示例#2
0
bool APCLocalArray::IsVectorData(const ArrayData* ad) {
  auto a = asSharedArray(ad);
  const auto n = a->size();
  for (ssize_t i = 0; i < n; i++) {
    if (a->getIndex(i) != i) return false;
  }
  return true;
}
示例#3
0
void SharedArray::NvGetKey(const ArrayData* ad, TypedValue* out, ssize_t pos) {
  auto a = asSharedArray(ad);
  Variant k = a->m_arr->getKey(pos);
  TypedValue* tv = k.asTypedValue();
  // copy w/out clobbering out->_count.
  out->m_type = tv->m_type;
  out->m_data.num = tv->m_data.num;
  if (tv->m_type != KindOfInt64) out->m_data.pstr->incRefCount();
}
示例#4
0
void APCLocalArray::Release(ArrayData* ad) {
  auto const smap = asSharedArray(ad);
  smap->~APCLocalArray();
  MM().smartFreeSize(smap, sizeof(APCLocalArray));
}
示例#5
0
ssize_t APCLocalArray::IterRewind(const ArrayData* ad, ssize_t prev) {
  assert(prev >= 0 && prev < asSharedArray(ad)->m_size);
  ssize_t next = prev - 1;
  return next >= 0 ? next : invalid_index;
}
示例#6
0
ssize_t APCLocalArray::IterAdvance(const ArrayData* ad, ssize_t prev) {
  auto a = asSharedArray(ad);
  return a->iterAdvanceImpl(prev);
}
示例#7
0
ssize_t APCLocalArray::IterEnd(const ArrayData* ad) {
  auto a = asSharedArray(ad);
  auto n = a->m_size;
  return n > 0 ? ssize_t(n - 1) : invalid_index;
}
示例#8
0
ssize_t APCLocalArray::IterBegin(const ArrayData* ad) {
  auto a = asSharedArray(ad);
  return a->m_size > 0 ? 0 : invalid_index;
}
示例#9
0
ssize_t SharedArray::IterAdvance(const ArrayData* ad, ssize_t prev) {
  auto a = asSharedArray(ad);
  assert(prev >= 0 && prev < a->m_size);
  ssize_t next = prev + 1;
  return next < a->m_size ? next : invalid_index;
}
示例#10
0
TypedValue* APCLocalArray::NvGetInt(const ArrayData* ad, int64_t k) {
  auto a = asSharedArray(ad);
  auto index = a->getIndex(k);
  if (index == -1) return nullptr;
  return (TypedValue*)&a->getValueRef(index);
}
示例#11
0
ArrayData *APCLocalArray::Escalate(const ArrayData* ad) {
  auto smap = asSharedArray(ad);
  auto ret = smap->loadElems();
  assert(!ret->isStatic());
  return ret;
}
示例#12
0
HOT_FUNC
void SharedArray::Release(ArrayData* ad) {
  auto const smap = asSharedArray(ad);
  smap->~SharedArray();
  MM().smartFreeSize(smap, sizeof(SharedArray));
}
示例#13
0
SharedVariant* SharedArray::GetSharedVariant(const ArrayData* ad) {
  auto a = asSharedArray(ad);
  if (a->m_arr->shouldCache()) return nullptr;
  return a->m_arr;
}
示例#14
0
CVarRef SharedArray::GetValueRef(const ArrayData* ad, ssize_t pos) {
  return asSharedArray(ad)->getValueRef(pos);
}
示例#15
0
bool APCLocalArray::ExistsStr(const ArrayData* ad, const StringData* k) {
  auto a = asSharedArray(ad);
  return a->getIndex(k) != -1;
}
示例#16
0
bool APCLocalArray::ExistsInt(const ArrayData* ad, int64_t k) {
  return asSharedArray(ad)->getIndex(k) != -1;
}
示例#17
0
ArrayData* APCLocalArray::EscalateForSort(ArrayData* ad) {
  auto a = asSharedArray(ad);
  auto ret = a->loadElems();
  assert(!ret->isStatic());
  return ret;
}