예제 #1
0
        public void TestPerf()
        {
            TypeA typeA = new TypeA();

            for (int i = 0; i < 100; i++)
            {
                typeA.param1.Add("Item " + i.ToString());
                typeA.param2.Add(i);
                typeA.param3.Add(i % 2 == 0);
                typeA.param4.Add(i % 3 == 0);
            }
            TypeB typeB = new TypeB();

            for (int i = 0; i < 100; i++)
            {
                ContainedType inner = new ContainedType();
                inner.param1 = "Item " + i.ToString();
                inner.param2 = i;
                inner.param3 = i % 2 == 0;
                inner.param4 = i % 3 == 0;
                typeB.containedType.Add(inner);
            }
            var model = CreateModel();

            RunTestIssue103(5000, typeA, typeB, model, "Runtime");
            model.CompileInPlace();
            RunTestIssue103(50000, typeA, typeB, model, "CompileInPlace");
            RunTestIssue103(50000, typeA, typeB, model.Compile(), "Compile");
        }
예제 #2
0
        public void TestPerf()
        {
            TypeA typeA = new TypeA();
            for (int i = 0; i < 100; i++)
            {
                typeA.param1.Add("Item " + i.ToString());
                typeA.param2.Add(i);
                typeA.param3.Add(i % 2 == 0);
                typeA.param4.Add(i % 3 == 0);
            }
            TypeB typeB = new TypeB();
            for (int i = 0; i < 100; i++)
            {
                ContainedType inner = new ContainedType();
                inner.param1 = "Item " + i.ToString();
                inner.param2 = i;
                inner.param3 = i % 2 == 0;
                inner.param4 = i % 3 == 0;
                typeB.containedType.Add(inner);
            }
            var model = CreateModel();
            RunTestIssue103(5000, typeA, typeB, model, "Runtime");
            model.CompileInPlace();
            RunTestIssue103(50000, typeA, typeB, model, "CompileInPlace");
            RunTestIssue103(50000, typeA, typeB, model.Compile(), "Compile");
            

        }
예제 #3
0
        public bool CompatableWith(CType type)
        {
            /* In a C program,
             * the declarations referring to the same object or function in different translation units
             * do not have to use the same type.
             * They only have to use sufficiently similar types,
             * formally known as compatible types.
             * Same applies to function calls and lvalue accesses;
             * argument types must be compatible with parameter types and lvalue expression type
             * must be compatible with the object type that is accessed.
             * The types T and U are compatible, if...
             */
            bool equ = false;

            // they are the same type
            equ = equ || this.Equals(type);
            // they are pointer types and are pointing to compatible types
            equ = equ || (TypeClass == CTypeClass.CPointer && type.TypeClass == CTypeClass.CPointer && ContainedType.CompatableWith(type.ContainedType));
            /*they are array types, their element types are compatible, and both have the same size.*/
            equ = equ || (TypeClass == CTypeClass.CArray && type.TypeClass == CTypeClass.CArray && ArraySize == type.ArraySize && ContainedType.CompatableWith(type.ContainedType));
            //one is an enumerated type and the other is that enumeration's underlying type
            equ = equ || ((TypeClass == CTypeClass.CEnum && type.TypeClass == CTypeClass.CInt) || (TypeClass == CTypeClass.CInt && type.TypeClass == CTypeClass.CEnum));

            /* they are function types, and
             * their return types are compatible
             * they both use parameter lists, the number of parameters is the same,
             * and the corresponding parameters have compatible types
             */
            equ = equ || ((TypeClass == CTypeClass.CFunction && type.TypeClass == CTypeClass.CFunction) && FunctionTypesCompatable(type));
            return(equ);
        }
예제 #4
0
 public EmptyDimension(string name, ContainedType containedType)
 {
     ObjectType = DimensionTypeName.EmptyDimension;
     Name       = name;
     Type       = containedType;
 }