コード例 #1
0
ファイル: CCType.cs プロジェクト: t1lang/t1bootstrap
 internal void CheckAllocNode(CCNodeEntry node)
 {
     foreach (CCType ct in types)
     {
         CCNodeEntry e = ct.allocationNode;
         if (e == null)
         {
             continue;
         }
         if (e.IsDescendentOf(node))
         {
             throw new Exception(string.Format("reference to local instance of type {0} may escape function node {1}", ct, node));
         }
     }
 }
コード例 #2
0
ファイル: CCStruct.cs プロジェクト: t1lang/t1bootstrap
    internal void Merge(int index, CCTypeSet cts)
    {
        /*
         * Escape analysis: we must not write in a field of
         * a structure a value that pertains to a descendent
         * allocator node.
         */
        CCNodeEntry oa = owner.allocationNode;

        if (oa != null)
        {
            foreach (CCType ct in cts)
            {
                if (oa.IsDescendentOf(ct.allocationNode))
                {
                    continue;
                }
                throw new Exception(string.Format("reference to local instance of type {0} may escape through writing in field of type {1}", ct, owner));
            }
        }

        CCTypeSet octs = fields[index];
        CCTypeSet ncts;

        if (octs == null)
        {
            ncts = cts;
        }
        else
        {
            ncts = CCTypeSet.Merge(octs, cts);
        }
        if (!object.ReferenceEquals(octs, ncts))
        {
            SortedSet <CCNode> rn = regNodes[index];
            if (rn != null)
            {
                foreach (CCNode node in rn)
                {
                    node.MarkUpdate();
                }
            }
        }
    }