RefData* staticLocInitImpl(StringData* name, ActRec* fp, TypedValue val, TargetCache::CacheHandle ch) { assert(useTargetCache == (bool)ch); HphpArray* map; if (useTargetCache) { // If we have a cache handle, we know the current func isn't a // closure or generator closure so we can directly grab its static // locals map. const Func* func = fp->m_func; assert(!(func->isClosureBody() || func->isGeneratorFromClosure())); map = func->getStaticLocals(); } else { map = get_static_locals(fp); } TypedValue *mapVal = map->nvGet(name); if (!mapVal) { map->set(name, tvAsCVarRef(&val), false); mapVal = map->nvGet(name); } if (mapVal->m_type != KindOfRef) { tvBox(mapVal); } assert(mapVal->m_type == KindOfRef); RefData* ret = mapVal->m_data.pref; if (useTargetCache) { *TargetCache::handleToPtr<RefData*>(ch) = ret; } ret->incRefCount(); return ret; }
// создает переменную с именем по коду. Ищет в подключенных модулях (среди встроенных переменных и пользовательских шаблонов) RefData* RefProgram::createVariableByTypename(unistring code, unistring value){ MODULE_LIST::iterator modit = modules.begin(), end = modules.end(); RefModuleBase* mod = 0; RefDllModule *dllmod = 0; RefUserModule *usermod= 0; RefData* result = 0; while (modit != end){ //TODO: сделать поиск согласно порядку подключения модулей mod = &(*modit->second); dllmod = dynamic_cast<RefDllModule*>(mod); if (dllmod){ result=dllmod->constructVariable(code, value); if (result && ref_dynamic_cast<RefVariable>(result)) { return result; } if (result) { SYSTEMERRORn("not variable loading like variable: " << result->debug()); } } else { usermod = dynamic_cast<RefUserModule*>(mod); if (!usermod) SYSTEMERRORn("unknown children of RefModuleBase"); RefTemplateBase *tp = usermod->getTemplateByName(code); if (tp){ RefTemplateBase *templ = ref_dynamic_cast<RefTemplateBase>(tp); if (templ){ return new RefVarChains(code, value); } } } ++modit; } return 0; }
bool operator() (ESM::CellRef& ref, RefData& data) { Ogre::SceneNode* handle = data.getBaseNode(); if (handle) mHandles.push_back (handle); data.setBaseNode(0); return true; }
void c_SetResultToRefWaitHandle::markAsFailed(CObjRef exception) { RefData* ref = m_ref; m_ref = nullptr; tvSetIgnoreRef(make_tv<KindOfNull>(), *ref->tv()); decRefRef(ref); setException(exception.get()); m_child = nullptr; }
void c_SetResultToRefWaitHandle::markAsSucceeded(const Cell& result) { RefData* ref = m_ref; m_ref = nullptr; cellSet(result, *ref->tv()); decRefRef(ref); setResult(result); m_child = nullptr; }
void c_SetResultToRefWaitHandle::markAsSucceeded(const TypedValue* result) { RefData* ref = m_ref; m_ref = nullptr; tvSetIgnoreRef(result, ref->tv()); decRefRef(ref); setResult(result); m_child = nullptr; }
bool Session::gc_prepare(RefData *save_point){ //#ifdef xDEBUG size_t tmpdbg = 0; //#endif for( RefData *iter = (save_point ? save_point : this->gc_first), *iend = this->gc_last->gc_next; iter!=iend; iter=iter->gc_next){ iter->flush_gc_mark(); //#ifdef xDEBUG ++tmpdbg; //#endif } #ifdef DEBUG std::cout << "############ GARBAGE: " << tmpdbg << " was prepared !\n" << std::flush; #endif if (tmpdbg > 1024) return true; return false; }