Exemple #1
0
        public FunctionsTable(IMetaDataProvider metaDataProvider)
        {
            this.meta_data_provider = metaDataProvider;
            this.locals             = new Dictionary <Local, Wrapper <Local> > ();
            this.parameters         = new Dictionary <Parameter, Wrapper <Parameter> > ();
            this.fields             = new Dictionary <Field, Wrapper <Field> > ();
            this.pseudo_fields      = new Dictionary <Method, Wrapper <Method> > ();
            this.temp              = new Dictionary <int, Wrapper <int> > ();
            this.strings           = new Dictionary <string, Wrapper <string> > ();
            this.program_constants = new Dictionary <object, Wrapper <object> > ();
            this.method_pointers   = new Dictionary <Method, Wrapper <Method> > ();
            this.binary_operators  = new Dictionary <BinaryOperator, Wrapper <BinaryOperator> > ();
            this.unary_operators   = new Dictionary <UnaryOperator, Wrapper <UnaryOperator> > ();

            this.ValueOf             = For("$Value");
            this.OldValueOf          = For("$OldValue");
            this.StructId            = For("$StructId");
            this.ObjectVersion       = For("$ObjectVersion");
            this.NullValue           = For("$Null");
            this.ElementAddress      = For("$ElementAddress");
            this.Length              = For("$Length");
            this.VoidAddr            = For("$VoidAddr");
            this.UnaryNot            = For("$UnaryNot");
            this.NeZero              = For("$NeZero");
            this.BoxOperator         = For("$Box");
            this.ResultOfCall        = For("$ResultOfCall");
            this.ResultOfLoadElement = For("$ResultOfLoadElement");
            this.ZeroValue           = ForConstant(0, this.meta_data_provider.System_Int32);
        }
Exemple #2
0
        private Wrapper <T> For <T>(T key, Dictionary <T, Wrapper <T> > cache)
        {
            Wrapper <T> wrapper;

            if (!cache.TryGetValue(key, out wrapper))
            {
                wrapper = SymFunction.For(key, ref this.id_gen, this.meta_data_provider);
                cache.Add(key, wrapper);
            }
            return(wrapper);
        }
Exemple #3
0
        public bool IsConstant(SymFunction c, out TypeNode type, out object value)
        {
            var wrapper = c as Wrapper <object>;

            if (wrapper != null && this.program_constants.ContainsKey(wrapper.Item))
            {
                type  = wrapper.Type;
                value = wrapper.Item;
                return(true);
            }

            type  = null;
            value = null;
            return(false);
        }
Exemple #4
0
        public bool IsConstantOrMethod(SymFunction constant)
        {
            var wrapper = constant as Wrapper <object>;

            if (wrapper != null && this.program_constants.ContainsKey(wrapper.Item))
            {
                return(true);
            }

            var wrapper1 = constant as Wrapper <Method>;

            if (wrapper1 != null && this.method_pointers.ContainsKey(wrapper1.Item))
            {
                return(true);
            }

            return(false);
        }