const V3NetId V3NtkElaborate::elaborateLTLFormula(V3LTLFormula* const ltlFormula, const uint32_t& rootIndex) { assert (ltlFormula); assert (ltlFormula->isValid(rootIndex)); assert (isMutable()); assert (_ntk); assert (this == ltlFormula->getHandler()); if (ltlFormula->isLeaf(rootIndex)) { V3Formula* const formula = ltlFormula->getFormula(rootIndex); assert (formula); assert (ltlFormula->getHandler() == formula->getHandler()); return dynamic_cast<V3BvNtk*>(ltlFormula->getHandler()->getNtk()) ? elaborateBvFormula(formula, formula->getRoot(), _netHash) : elaborateAigFormula(formula, formula->getRoot(), _netHash); } switch (ltlFormula->getOpType(rootIndex)) { case V3_LTL_T_G : // Currently Support Single Layered LTL assert (1 == ltlFormula->getBranchSize(rootIndex)); assert (ltlFormula->isLeaf(ltlFormula->getBranchIndex(rootIndex, 0))); return elaborateLTLFormula(ltlFormula, ltlFormula->getBranchIndex(rootIndex, 0)); case V3_LTL_T_F : // Currently Support Single Layered LTL assert (1 == ltlFormula->getBranchSize(rootIndex)); assert (ltlFormula->isLeaf(ltlFormula->getBranchIndex(rootIndex, 0))); return elaborateLTLFormula(ltlFormula, ltlFormula->getBranchIndex(rootIndex, 0)); default : Msg(MSG_WAR) << "Verification of General LTL Formula Has NOT Been Supported Yet !!" << endl; } return V3NetUD; }
// Private Member Functions void V3NtkElaborate::elaborate(V3LTLFormula* const ltlFormula) { // Collect Leaf Formula, and Retain Only New Ones V3UI32Set targetNetIdSet; targetNetIdSet.clear(); assert (isMutable()); assert (ltlFormula); ltlFormula->collectLeafFormula(targetNetIdSet); V3NetVec targetNets; targetNets.clear(); targetNets.reserve(targetNetIdSet.size()); if (_p2cMap.size()) for (V3UI32Set::const_iterator it = targetNetIdSet.begin(); it != targetNetIdSet.end(); ++it) { assert ((*it) < _p2cMap.size()); if (V3NetUD != _p2cMap[*it]) continue; targetNets.push_back(V3NetId::makeNetId(*it)); } else for (V3UI32Set::const_iterator it = targetNetIdSet.begin(); it != targetNetIdSet.end(); ++it) targetNets.push_back(V3NetId::makeNetId(*it)); // Create Ntk if NOT Exist, or Augment New Formula Logic to Existing Ntk if (!_ntk) { assert (!_p2cMap.size()); assert (!_c2pMap.size()); assert (!_pOutput.size()); _ntk = elaborateNtk(_handler, targetNets, _p2cMap, _c2pMap, _netHash); assert (_ntk); } else if (targetNets.size()) { attachToNtk(_handler, _ntk, targetNets, _p2cMap, _c2pMap, _netHash); assert (_ntk); } // Reserve Mapping Tables if Needed if (!V3NtkHandler::P2CMapON()) _p2cMap.clear(); if (!V3NtkHandler::C2PMapON()) _c2pMap.clear(); }
PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> StylePropertySet::immutableCopyIfNeeded() const { if (!isMutable()) return toImmutableStylePropertySet(const_cast<StylePropertySet*>(this)); const MutableStylePropertySet* mutableThis = toMutableStylePropertySet(this); return ImmutableStylePropertySet::create(mutableThis->m_propertyVector.data(), mutableThis->m_propertyVector.size(), cssParserMode()); }
// Move the entries to a larger table. FTABLE* FTABLE::larger() { assert(isMutable()); uint32_t oldN = mask+1; uint32_t newMask = (oldN << 1) - 1; FTABLE* ftab = new // placement constructor (new char[sizeof(FTABLE)+(newMask+1)*sizeof(entry_t*)]) FTABLE(getDimension(), nbEntries, newMask, noPartition); base_resetSmall(ftab->table, (newMask+1)*(sizeof(void*)/sizeof(int))); ftab->all = all; for(uint32_t i = 0; i < oldN; ++i) if (table[i]) { cindex_t j = table[i]->id & newMask; while(ftab->table[j]) { j = (j + 1) & newMask; } ftab->table[j] = table[i]; } all.nil(); delete [] ((char*)this); return ftab; }
StylePropertySet* ElementAttributeData::ensureMutableInlineStyle(StyledElement* element) { ASSERT(isMutable()); if (m_inlineStyleDecl && !m_inlineStyleDecl->isMutable()) { m_inlineStyleDecl = m_inlineStyleDecl->copy(); return m_inlineStyleDecl.get(); } return ensureInlineStyle(element); }
StylePropertySet* ElementAttributeData::ensureInlineStyle(StyledElement* element) { ASSERT(isMutable()); if (!m_inlineStyleDecl) { ASSERT(element->isStyledElement()); m_inlineStyleDecl = StylePropertySet::create(strictToCSSParserMode(element->isHTMLElement() && !element->document()->inQuirksMode())); } return m_inlineStyleDecl.get(); }
ElementAttributeData::~ElementAttributeData() { if (isMutable()) { ASSERT(!m_arraySize); delete m_mutableAttributeVector; } else { Attribute* buffer = reinterpret_cast<Attribute*>(&m_attributes); for (unsigned i = 0; i < m_arraySize; ++i) buffer[i].~Attribute(); } }
bool StyleSheetContents::isCacheableForStyleElement() const { // FIXME: Support copying import rules. if (!importRules().isEmpty()) return false; // Until import rules are supported in cached sheets it's not possible for // loading to fail. DCHECK(!didLoadErrorOccur()); // It is not the original sheet anymore. if (isMutable()) return false; if (!hasSyntacticallyValidCSSHeader()) return false; return true; }
const uint32_t V3NtkElaborate::elaborateLTLFormula(V3LTLFormula* const ltlFormula, const bool& l2s) { // Make Sure Mapping Tables are Maintained, or NO properties can be proliferated if (!isMutable() || (_ntk && (!_p2cMap.size()))) return V3NtkUD; // Elaborate LTL Formula into Ntk assert (ltlFormula); assert (_handler == ltlFormula->getHandler()); elaborate(ltlFormula); // Create Formula for this Ntk, and Perform LTL Formula Rewriting if Enabled V3LTLFormula* const formula = ltlFormula->createSuccessor(this); // Currently Support ONLY AG(p) and AF(p) const uint32_t rootIndex = formula->getRoot(); assert (!formula->isLeaf(rootIndex)); V3NetId id = elaborateLTLFormula(formula, rootIndex); if (V3NetUD == id) return V3NtkUD; id = (l2s && V3_LTL_T_F == formula->getOpType(rootIndex)) ? elaborateL2S(id) : ~id; // Record LTL Formula and Set to Output _pOutput.push_back(formula); _ntk->createOutput(id); assert (_pOutput.size() == _ntk->getOutputSize()); return _ntk->getOutputSize() - 1; }
void ElementAttributeData::cloneDataFrom(const ElementAttributeData& sourceData, const Element& sourceElement, Element& targetElement) { // FIXME: Cloned elements could start out with immutable attribute data. ASSERT(isMutable()); const AtomicString& oldID = targetElement.getIdAttribute(); const AtomicString& newID = sourceElement.getIdAttribute(); if (!oldID.isNull() || !newID.isNull()) targetElement.updateId(oldID, newID); const AtomicString& oldName = targetElement.getNameAttribute(); const AtomicString& newName = sourceElement.getNameAttribute(); if (!oldName.isNull() || !newName.isNull()) targetElement.updateName(oldName, newName); clearAttributes(); if (sourceData.isMutable()) mutableAttributeVector() = sourceData.mutableAttributeVector(); else { mutableAttributeVector().reserveInitialCapacity(sourceData.m_arraySize); for (unsigned i = 0; i < sourceData.m_arraySize; ++i) mutableAttributeVector().uncheckedAppend(sourceData.immutableAttributeArray()[i]); } for (unsigned i = 0; i < length(); ++i) { const Attribute& attribute = mutableAttributeVector().at(i); if (targetElement.isStyledElement() && attribute.name() == HTMLNames::styleAttr) { static_cast<StyledElement&>(targetElement).styleAttributeChanged(attribute.value(), StyledElement::DoNotReparseStyleAttribute); continue; } targetElement.attributeChanged(attribute.name(), attribute.value()); } if (targetElement.isStyledElement() && sourceData.m_inlineStyleDecl) { m_inlineStyleDecl = sourceData.m_inlineStyleDecl->immutableCopyIfNeeded(); targetElement.setIsStyleAttributeValid(sourceElement.isStyleAttributeValid()); } }
PassRefPtr<ElementAttributeData> ElementAttributeData::makeMutableCopy() const { ASSERT(!isMutable()); return adoptRef(new MutableElementAttributeData(static_cast<const ImmutableElementAttributeData&>(*this))); }
void ElementAttributeData::clearAttributes() { ASSERT(isMutable()); clearClass(); mutableAttributeVector().clear(); }
void ElementAttributeData::removeAttribute(size_t index) { ASSERT(isMutable()); ASSERT(index < length()); mutableAttributeVector().remove(index); }
void ElementAttributeData::addAttribute(const Attribute& attribute) { ASSERT(isMutable()); mutableAttributeVector().append(attribute); }
const V3NetId V3NtkElaborate::elaborateL2S(const V3NetId& id) { assert (_ntk); assert (_p2cMap.size()); assert (id.id < _ntk->getNetSize()); assert (isMutable()); assert (_shadow.size() == _handler->getNtk()->getLatchSize()); // Create L2S Data Members if NOT Exists V3BvNtk* const bvNtk = dynamic_cast<V3BvNtk*>(_ntk); V3InputVec inputs; inputs.clear(); inputs.reserve(4); V3GateType type; if ((V3NetUD == _saved) || (V3NetUD == _1stSave)) { assert ((V3NetUD == _saved) && (V3NetUD == _1stSave)); _saved = _ntk->createNet(1); _1stSave = _ntk->createNet(1); const V3NetId oracle = _ntk->createNet(1), inSaved = _ntk->createNet(1); inputs.push_back(~_saved); inputs.push_back(~oracle); _ntk->setInput(inSaved, inputs); _ntk->createGate((bvNtk ? BV_AND : AIG_NODE), inSaved); inputs.clear(); inputs.push_back(~inSaved); inputs.push_back(0); _ntk->setInput(_saved, inputs); _ntk->createLatch(_saved); inputs.clear(); _ntk->createInput(oracle); // Set Inputs of _1stSave inputs.push_back(oracle); inputs.push_back(~_saved); _ntk->setInput(_1stSave, inputs); _ntk->createGate((bvNtk ? BV_AND : AIG_NODE), _1stSave); inputs.clear(); } // Create Equivalence Logic and Shadow FF if NOT Exists for (uint32_t i = 0; i < _shadow.size(); ++i) { if (V3NetUD == _shadow[i] && V3NetUD != _p2cMap[_handler->getNtk()->getLatch(i).id]) { assert (V3_FF == _ntk->getGateType(_p2cMap[_handler->getNtk()->getLatch(i).id])); _shadow[i] = _ntk->createNet(_ntk->getNetWidth(_p2cMap[_handler->getNtk()->getLatch(i).id])); // Create Input MUX of Shadow FF V3NetId shadowMux = V3NetUD; if (bvNtk) { inputs.push_back(_p2cMap[_handler->getNtk()->getLatch(i).id]); inputs.push_back(_shadow[i]); inputs.push_back(~_1stSave); type = BV_MUX; shadowMux = elaborateBvGate(bvNtk, type, inputs, _netHash); } else { inputs.push_back(_1stSave); inputs.push_back(_p2cMap[_handler->getNtk()->getLatch(i).id]); inputs.push_back(~_1stSave); inputs.push_back(_shadow[i]); type = AIG_NODE; shadowMux = elaborateAigAndOrAndGate(_ntk, inputs, _netHash); } assert (V3NetUD != shadowMux); inputs.clear(); // Create Shadow FF inputs.clear(); inputs.push_back(shadowMux); const uint32_t width = (bvNtk) ? _ntk->getNetWidth(_p2cMap[_handler->getNtk()->getLatch(i).id]) : 1; if (width > 1) { V3InputVec constInputs(1, bvNtk->hashV3ConstBitVec(v3Int2Str(width) + "'d0")); type = BV_CONST; inputs.push_back(elaborateBvGate(bvNtk, type, constInputs, _netHash)); } else inputs.push_back(0); _ntk->setInput(_shadow[i], inputs); _ntk->createLatch(_shadow[i]); inputs.clear(); // Create Equivalence Gate and Update _shadow if (bvNtk) { inputs.push_back(_p2cMap[_handler->getNtk()->getLatch(i).id]); inputs.push_back(_shadow[i]); type = BV_EQUALITY; _shadow[i] = elaborateBvGate(bvNtk, type, inputs, _netHash); } else { inputs.push_back(_p2cMap[_handler->getNtk()->getLatch(i).id]); inputs.push_back(_shadow[i]); inputs.push_back(~_shadow[i]); inputs.push_back(~_p2cMap[_handler->getNtk()->getLatch(i).id]); _shadow[i] = elaborateAigAndOrAndGate(_ntk, inputs, _netHash); } inputs.clear(); assert (V3NetUD != _shadow[i]); } } // Build LTL Formula Output Logic const V3NetId pLatch = _ntk->createNet(1), in_pLatch = _ntk->createNet(1); inputs.push_back(~pLatch); inputs.push_back(~id); _ntk->setInput(in_pLatch, inputs); _ntk->createGate((bvNtk ? BV_AND : AIG_NODE), in_pLatch); inputs.clear(); inputs.push_back(~in_pLatch); inputs.push_back(0); _ntk->setInput(pLatch, inputs); _ntk->createLatch(pLatch); inputs.clear(); // Build LTL Formula Output V3NetId pId = V3NetUD; inputs.push_back(_saved); inputs.push_back(~pLatch); if (bvNtk) { type = BV_AND; pId = elaborateBvGate(bvNtk, type, inputs, _netHash); } else { type = AIG_NODE; pId = elaborateAigGate(_ntk, type, inputs, _netHash); } assert (V3NetUD != pId); inputs.clear(); // Build LTL Formula Output with Related Latches Only _ntk->newMiscData(); dfsRecurMarkFaninCone(_ntk, id); for (uint32_t i = 0; i < _shadow.size(); ++i) { if (V3NetUD == _shadow[i]) continue; if (!_ntk->isLatestMiscData(_p2cMap[_handler->getNtk()->getLatch(i).id])) continue; inputs.push_back(pId); inputs.push_back(_shadow[i]); if (bvNtk) { type = BV_AND; pId = elaborateBvGate(bvNtk, type, inputs, _netHash); } else { type = AIG_NODE; pId = elaborateAigGate(_ntk, type, inputs, _netHash); } assert (V3NetUD != pId); inputs.clear(); } return pId; }
const V3NetId V3NtkElaborate::elaborateL2S(const V3NetId& id) { assert (_ntk); assert (_p2cMap.size()); assert (id.id < _ntk->getNetSize()); assert (isMutable()); assert (_shadow.size() == _handler->getNtk()->getLatchSize()); // Create L2S Data Members if NOT Exist V3BvNtk* const bvNtk = dynamic_cast<V3BvNtk*>(_ntk); V3InputVec inputs; inputs.clear(); inputs.reserve(4); if (V3NetUD == _saved || V3NetUD == _1stSave || V3NetUD == _inLoop) { assert (V3NetUD == _saved && V3NetUD == _1stSave && V3NetUD == _inLoop); _saved = _ntk->createNet(1); // Create Latch (_saved) for "In the Loop" const V3NetId oracle = _ntk->createNet(1), inSaved = _ntk->createNet(1); inputs.push_back(~_saved); inputs.push_back(~oracle); _ntk->setInput(inSaved, inputs); _ntk->createGate((bvNtk ? BV_AND : AIG_NODE), inSaved); inputs.clear(); inputs.push_back(~inSaved); inputs.push_back(0); _ntk->setInput(_saved, inputs); _ntk->createLatch(_saved); inputs.clear(); _ntk->createInput(oracle); _1stSave = _ntk->createNet(1); // Create Net (_1stSave) for "Loop Start" inputs.push_back(oracle); inputs.push_back(~_saved); _ntk->setInput(_1stSave, inputs); _ntk->createGate((bvNtk ? BV_AND : AIG_NODE), _1stSave); inputs.clear(); _inLoop = _ntk->createNet(1); // Create Net (_inLoop) for "_1stSave || _saved" inputs.push_back(~_1stSave); inputs.push_back(~_saved); _ntk->setInput(_inLoop, inputs); _ntk->createGate((bvNtk ? BV_AND : AIG_NODE), _inLoop); inputs.clear(); _inLoop = ~_inLoop; } // Create Equivalence Logic and Shadow FF if NOT Exist V3NetId ffId; V3GateType type; V3UI32Vec newShadow; newShadow.clear(); for (uint32_t i = 0; i < _shadow.size(); ++i) { ffId = _p2cMap[_handler->getNtk()->getLatch(i).id]; assert (V3_FF == _ntk->getGateType(ffId)); if (V3NetUD == ffId || V3NetUD != _shadow[i]) continue; newShadow.push_back(i); // Create Net for Shadow FF _shadow[i] = _ntk->createNet(_ntk->getNetWidth(ffId)); assert (V3NetUD != _shadow[i]); V3NetId shadowMux = V3NetUD; // Create Input MUX of Shadow FF if (bvNtk) { inputs.push_back(_shadow[i]); inputs.push_back(ffId); inputs.push_back(_1stSave); type = BV_MUX; shadowMux = elaborateBvGate(bvNtk, type, inputs, _netHash); } else { inputs.push_back(_1stSave); inputs.push_back(ffId); inputs.push_back(~_1stSave); inputs.push_back(_shadow[i]); type = AIG_NODE; shadowMux = elaborateAigAndOrAndGate(_ntk, inputs, _netHash); } // Create Shadow FF assert (V3NetUD != shadowMux); inputs.clear(); inputs.push_back(shadowMux); if (_ntk->getNetWidth(ffId) == 1) inputs.push_back(0); else { V3InputVec constInputs(1, bvNtk->hashV3ConstBitVec(v3Int2Str(_ntk->getNetWidth(ffId)) + "'d0")); type = BV_CONST; inputs.push_back(elaborateBvGate(bvNtk, type, constInputs, _netHash)); } _ntk->setInput(_shadow[i], inputs); _ntk->createLatch(_shadow[i]); inputs.clear(); // Create Equivalence Gate and Update _shadow if (bvNtk) { inputs.push_back(ffId); inputs.push_back(_shadow[i]); type = BV_EQUALITY; _shadow[i] = elaborateBvGate(bvNtk, type, inputs, _netHash); } else { inputs.push_back(ffId); inputs.push_back(_shadow[i]); inputs.push_back(~ffId); inputs.push_back(~_shadow[i]); _shadow[i] = elaborateAigAndOrAndGate(_ntk, inputs, _netHash); } assert (V3NetUD != _shadow[i]); assert (1 == _ntk->getNetWidth(_shadow[i])); inputs.clear(); } // Create or Update Net (_looped) for "Loop Found" if NOT Exist if (V3NetUD == _looped) _looped = _saved; for (uint32_t i = 0; i < newShadow.size(); ++i) { assert (V3NetUD != _p2cMap[_handler->getNtk()->getLatch(i).id]); assert (V3NetUD != _shadow[i]); inputs.push_back(_looped); inputs.push_back(_shadow[i]); if (bvNtk) { type = BV_AND; _looped = elaborateBvGate(bvNtk, type, inputs, _netHash); } else { type = AIG_NODE; _looped = elaborateAigGate(_ntk, type, inputs, _netHash); } assert (V3NetUD != _looped); inputs.clear(); } if (V3NetId::makeNetId(0) == ~id) return _looped; // Create Latch (pLatch) for Recording Existence of Violation to id const V3NetId pLatch = _ntk->createNet(1), in_pLatch = _ntk->createNet(1); inputs.push_back(~pLatch); inputs.push_back(id); _ntk->setInput(in_pLatch, inputs); _ntk->createGate((bvNtk ? BV_AND : AIG_NODE), in_pLatch); inputs.clear(); inputs.push_back(~in_pLatch); inputs.push_back(0); _ntk->setInput(pLatch, inputs); _ntk->createLatch(pLatch); inputs.clear(); // Create L2S Property Output (to Witness "_looped && in_pLatch") V3NetId pId = V3NetUD; inputs.push_back(_looped); inputs.push_back(in_pLatch); if (bvNtk) { type = BV_AND; pId = elaborateBvGate(bvNtk, type, inputs, _netHash); } else { type = AIG_NODE; pId = elaborateAigGate(_ntk, type, inputs, _netHash); } assert (V3NetUD != pId); inputs.clear(); return pId; }
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE)); } return m_modifiedKit->toHtml(tmp); } void KitManagerConfigWidget::addConfigWidget(KitConfigWidget *widget) { QTC_ASSERT(widget, return); QTC_ASSERT(!m_widgets.contains(widget), return); QString name = widget->displayName(); QString toolTip = widget->toolTip(); auto action = new QAction(tr("Mark as Mutable"), 0); action->setCheckable(true); action->setChecked(widget->isMutable()); action->setEnabled(!widget->isSticky()); widget->mainWidget()->addAction(action); widget->mainWidget()->setContextMenuPolicy(Qt::ActionsContextMenu); connect(action, &QAction::toggled, this, [this, widget, action] { widget->setMutable(action->isChecked()); emit dirty(); }); m_actions << action; int row = m_layout->rowCount(); m_layout->addWidget(widget->mainWidget(), row, WidgetColumn); if (QWidget *button = widget->buttonWidget()) m_layout->addWidget(button, row, ButtonColumn);
/** * @brief Clone this instance if it is not mutable, otherwise return this */ AnyType cloneIfImmutable() const { if (isMutable() || !mDelegate) return *this; return AnyType(mDelegate->clone()); }
void ElementAttributeData::removeAttribute(size_t index) { ASSERT(isMutable()); ASSERT_WITH_SECURITY_IMPLICATION(index < length()); mutableAttributeVector().remove(index); }
PassRefPtr<ElementAttributeData> ElementAttributeData::makeImmutableCopy() const { ASSERT(isMutable()); void* slot = WTF::fastMalloc(sizeForImmutableElementAttributeDataWithAttributeCount(mutableAttributeVector().size())); return adoptRef(new (slot) ImmutableElementAttributeData(static_cast<const MutableElementAttributeData&>(*this))); }