Cell lookupCnsHelper(StringData* nm, bool error) { auto const cns = lookupCnsImpl(nm); if (LIKELY(cns != nullptr)) { Cell c1; cellDup(*cns, c1); return c1; } // Undefined constants. if (error) { raise_error("Undefined constant '%s'", nm->data()); } else { raise_notice(Strings::UNDEFINED_CONSTANT, nm->data(), nm->data()); Cell c1; c1.m_data.pstr = const_cast<StringData*>(nm); c1.m_type = KindOfPersistentString; return c1; } not_reached(); }
Cell lookupCnsUHelperPersistent(rds::Handle tv_handle, StringData* nm, StringData* fallback) { assertx(rds::isPersistentHandle(tv_handle)); // Lookup qualified name in thread-local constants. auto cns = lookupCnsImpl(nm); // Try cache handle for unqualified name. auto const tv = &rds::handleToRef<TypedValue>(tv_handle); if (UNLIKELY(!cns && tv->m_type != KindOfUninit)) { cns = tv; } if (LIKELY(cns != nullptr)) { Cell c1; cellDup(*cns, c1); return c1; } return lookupCnsHelper(fallback, false); }
Cell lookupCnsUHelperNormal(rds::Handle tv_handle, StringData* nm, StringData* fallback) { assertx(rds::isNormalHandle(tv_handle)); // Lookup qualified name in thread-local constants. auto cns = lookupCnsImpl(nm); // Try cache handle for unqualified name. if (UNLIKELY(!cns && rds::isHandleInit(tv_handle, rds::NormalTag{}))) { cns = &rds::handleToRef<TypedValue>(tv_handle); assertx(cns->m_type != KindOfUninit); } if (LIKELY(cns != nullptr)) { Cell c1; cellDup(*cns, c1); return c1; } // Lookup unqualified name in thread-local constants. return lookupCnsHelper(fallback, false); }