本文整理汇总了C++中UlamType::getPackable方法的典型用法代码示例。如果您正苦于以下问题:C++ UlamType::getPackable方法的具体用法?C++ UlamType::getPackable怎么用?C++ UlamType::getPackable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UlamType
的用法示例。
在下文中一共展示了UlamType::getPackable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: genCode
//.........这里部分代码省略.........
//starts out as its default type; references (UAtom) are updated:
m_state.indentUlamCode(fp); //non-const
fp->write(nut->getLocalStorageTypeAsString().c_str()); //for C++ local vars
fp->write(" ");
fp->write(m_state.getTmpVarAsString(nuti, tmpVarNum, TMPBITVAL).c_str());
fp->write(";"); GCNL;
// a reference (including 'self'), returns a UAtom of effective type;
// SINCE effective self type is known only at runtime.
if(m_nodeOf)
{
m_nodeOf->genCodeToStoreInto(fp, uvpass);
assert(!m_state.m_currentObjSymbolsForCodeGen.empty());
cos = m_state.m_currentObjSymbolsForCodeGen.back();
UTI cosuti = cos->getUlamTypeIdx();
stgcos = m_state.m_currentObjSymbolsForCodeGen[0];
bool isself = stgcos->isSelf();
bool issuper = stgcos->isSuper();
bool isaref = m_state.isAltRefType(cosuti) || isself || issuper;
if(isaref)
{
u32 tmpuclass = m_state.getNextTmpVarNumber(); //only for this case
m_state.indentUlamCode(fp);
fp->write("const UlamClass<EC> * ");
fp->write(m_state.getUlamClassTmpVarAsString(tmpuclass).c_str());
fp->write(" = ");
fp->write(cos->getMangledName().c_str());
fp->write(".GetEffectiveSelf();"); GCNL;
//primitive FAILS
m_state.indentUlamCode(fp);
fp->write("if(");
fp->write(m_state.getUlamClassTmpVarAsString(tmpuclass).c_str());
fp->write(" == NULL) FAIL(ILLEGAL_ARGUMENT); //non-class"); GCNL;
//an immediate default quark FAILS
m_state.indentUlamCode(fp);
fp->write("if(");
fp->write(m_state.getUlamClassTmpVarAsString(tmpuclass).c_str());
fp->write("->AsUlamQuark() != NULL) ");
fp->write("FAIL(NOT_AN_ELEMENT); //quark"); GCNL;
m_state.indentUlamCode(fp);
fp->write(m_state.getTmpVarAsString(nuti, tmpVarNum, TMPBITVAL).c_str());
fp->write(".WriteAtom(");
fp->write("((UlamElement<EC> *) ");
fp->write(m_state.getUlamClassTmpVarAsString(tmpuclass).c_str());
fp->write(")->GetDefaultAtom()); //instanceof default element"); GCNL;
}
else if(m_state.isAtom(nuti))
{
u32 tmpuclass = m_state.getNextTmpVarNumber(); //only for this case
m_state.indentUlamCode(fp);
fp->write("const UlamClass<EC> * ");
fp->write(m_state.getUlamClassTmpVarAsString(tmpuclass).c_str());
fp->write(" = ");
fp->write("uc.LookupUlamElementTypeFromContext(");
fp->write(cos->getMangledName().c_str());
fp->write(".GetType()");
fp->write(");"); GCNL;
m_state.indentUlamCode(fp);
fp->write("if(");
fp->write(m_state.getUlamClassTmpVarAsString(tmpuclass).c_str());
fp->write(" == NULL) FAIL(ILLEGAL_ARGUMENT); //non-class"); GCNL;
m_state.indentUlamCode(fp);
fp->write(m_state.getTmpVarAsString(nuti, tmpVarNum, TMPBITVAL).c_str());
fp->write(".WriteAtom(");
fp->write("((UlamElement<EC> *) ");
fp->write(m_state.getUlamClassTmpVarAsString(tmpuclass).c_str());
fp->write(")->GetDefaultAtom()); //instanceof default element"); GCNL;
}
}
if(m_state.isAtom(nuti))
{
// THE READ:
s32 tmpVarNum2 = m_state.getNextTmpVarNumber(); //tmp to read into
TMPSTORAGE rstor = nut->getTmpStorageTypeForTmpVar();
m_state.indentUlamCode(fp);
fp->write("const ");
fp->write(nut->getTmpStorageTypeAsString().c_str()); //for C++ local vars
fp->write(" ");
fp->write(m_state.getTmpVarAsString(nuti, tmpVarNum2, rstor).c_str());
fp->write(" = ");
fp->write(m_state.getTmpVarAsString(nuti, tmpVarNum, TMPBITVAL).c_str());
fp->write(".");
fp->write("read();"); GCNL;
uvpass = UVPass::makePass(tmpVarNum2, rstor, nuti, nut->getPackable(), m_state, 0, cos ? cos->getId() : 0);
}
else //element and uvpass stays the same (a default immediate element).
uvpass = UVPass::makePass(tmpVarNum, TMPBITVAL, nuti, nut->getPackable(), m_state, 0, cos ? cos->getId() : 0); //t3657
m_state.clearCurrentObjSymbolsForCodeGen(); //clear remnant of rhs ?
} //genCode
示例2: makeUlamValuePtr
UlamValue NodeConstantArray::makeUlamValuePtr()
{
UTI nuti = getNodeType();
UlamType * nut = m_state.getUlamTypeByIndex(nuti);
assert(m_constSymbol);
assert(((SymbolConstantValue *) m_constSymbol)->getConstantStackFrameAbsoluteSlotIndex() > 0);
UlamValue absptr = UlamValue::makePtr(((SymbolConstantValue *) m_constSymbol)->getConstantStackFrameAbsoluteSlotIndex(), CNSTSTACK, nuti, nut->getPackable(), m_state, 0, m_constSymbol->getId());
absptr.setUlamValueTypeIdx(PtrAbs);
return absptr;
}