当前位置: 首页>>代码示例>>C++>>正文


C++ UlamType::getUlamTypeImmediateMangledName方法代码示例

本文整理汇总了C++中UlamType::getUlamTypeImmediateMangledName方法的典型用法代码示例。如果您正苦于以下问题:C++ UlamType::getUlamTypeImmediateMangledName方法的具体用法?C++ UlamType::getUlamTypeImmediateMangledName怎么用?C++ UlamType::getUlamTypeImmediateMangledName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UlamType的用法示例。


在下文中一共展示了UlamType::getUlamTypeImmediateMangledName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: genCode

  // this is the auto local variable's node, created at parse time,
  // for Conditional-As case.
  void NodeVarRefAs::genCode(File * fp, UVPass & uvpass)
  {
    assert(!m_state.m_currentObjSymbolsForCodeGen.empty());
    // the uvpass comes from NodeControl, and still has the POS obtained
    // during the condition statement for As..unorthodox, but necessary.

    // before shadowing the lhs of the h/as-conditional variable with its auto,
    // let's load its storage from the currentSelfSymbol:
    Symbol * stgcos = m_state.m_currentObjSymbolsForCodeGen[0];
    UTI stgcosuti = stgcos->getUlamTypeIdx();
    UlamType * stgcosut = m_state.getUlamTypeByIndex(stgcosuti);
    ULAMTYPE stgetyp = stgcosut->getUlamTypeEnum();
    ULAMCLASSTYPE stgclasstype = stgcosut->getUlamClassType();

    assert((stgetyp == UAtom) || (stgetyp == Class)); //lhs

    if(stgcos->isSelf())
      return genCodeRefAsSelf(fp, uvpass);

    s32 tmpVarStg = m_state.getNextTmpVarNumber();

    // can't let Node::genCodeReadIntoTmpVar do this for us: need a ref.
    assert(m_state.m_currentObjSymbolsForCodeGen.size() == 1);
    m_state.indentUlamCode(fp);
    fp->write(stgcosut->getUlamTypeImmediateMangledName().c_str());
    fp->write("<EC> & "); //here it is!! brilliant
    fp->write(m_state.getTmpVarAsString(stgcosuti, tmpVarStg, TMPBITVAL).c_str());
    fp->write(" = ");
    fp->write(stgcos->getMangledName().c_str());
    fp->write("; //c++ reference to immediate"); GCNL;

    // now we have our pos in tmpVarPos, and our T in tmpVarStg
    // time to shadow 'self' with auto local variable:
    UTI vuti = m_varSymbol->getUlamTypeIdx();
    UlamType * vut = m_state.getUlamTypeByIndex(vuti);
    ULAMCLASSTYPE vclasstype = vut->getUlamClassType();

    m_state.indentUlamCode(fp);
    fp->write(vut->getLocalStorageTypeAsString().c_str()); //for C++ local vars, ie non-data members
    fp->write(" ");

    fp->write(m_varSymbol->getMangledName().c_str());
    fp->write("(");
    fp->write(m_state.getTmpVarAsString(stgcosuti, tmpVarStg, TMPBITVAL).c_str());

    if(stgetyp == UAtom)
      {
	fp->write(", 0u + T::ATOM_FIRST_STATE_BIT, "); //position as super quark (e.g. t3639, t3709, t3675, t3408, t3336); as element t3249, t3255, t3637; as atom ref t3908

	//note: needs effective self of the atom, not simply the RHS type.
	fp->write(m_state.getHiddenContextArgName());
	fp->write(".LookupUlamElementTypeFromContext(");
	fp->write(m_state.getTmpVarAsString(stgcosuti, tmpVarStg, TMPBITVAL).c_str()); //t3636
	fp->write(".GetType())");
	if(vclasstype == UC_QUARK)
	  fp->write(", UlamRef<EC>::ELEMENTAL"); //becomes elemental, t3835
      }
    else if((stgclasstype == UC_ELEMENT))
      {
	if(stgcosut->isReference())
	  {
	    fp->write(", 0u, "); //t3655
	    fp->write(stgcos->getMangledName().c_str()); //stg
	    fp->write(".GetEffectiveSelf()"); //Sat Jun 18 17:30:20 2016
	  }
	else
	  {
	    fp->write(", 0u + T::ATOM_FIRST_STATE_BIT, &"); //t3586, t3589, t3637
	    //must be same as look up for elements only Sat Jun 18 17:30:17 2016
	    fp->write(m_state.getTheInstanceMangledNameByIndex(stgcosuti).c_str());
	  }
	if(vclasstype == UC_QUARK)
	  fp->write(", UlamRef<EC>::ELEMENTAL"); //stays elemental
      }
    else if((stgclasstype == UC_TRANSIENT))
      {
	// transient can be another transient or a quark, not an element
	fp->write(", 0u, ");
	if(stgcosut->isReference())
	  {
	    fp->write(stgcos->getMangledName().c_str()); //stg
	    fp->write(".GetEffectiveSelf()"); //t3824
	  }
	else
	  {
	    fp->write("&"); //t3822
	    fp->write(m_state.getTheInstanceMangledNameByIndex(stgcosuti).c_str());
	  }
	if(vclasstype == UC_QUARK)
	  fp->write(", UlamRef<EC>::CLASSIC"); //stays classic
      }
    else if((stgclasstype == UC_QUARK))
      {
	// quark can be another quark, not an element, nor transient
	fp->write(", 0u, ");
	if(stgcosut->isReference())
	  {
	    fp->write(stgcos->getMangledName().c_str()); //stg
//.........这里部分代码省略.........
开发者ID:elenasa,项目名称:ULAM,代码行数:101,代码来源:NodeVarRefAs.cpp


注:本文中的UlamType::getUlamTypeImmediateMangledName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。