Ejemplo n.º 1
0
        private DependencyPTGDomain BindCallerCallee(InterProceduralCallInfo callInfo, out VariableRangeDomain initializedRanges)
        {
            initializedRanges = new VariableRangeDomain();

            var calleeDepDomain = new DependencyPTGDomain();

            calleeDepDomain.Dependencies.IsTop = callInfo.CallerState.Dependencies.IsTop;
            // Bind parameters with arguments
            var body = MethodBodyProvider.Instance.GetBody(callInfo.Callee);

            for (int i = 0; i < body.Parameters.Count(); i++)
            {
                var arg = callInfo.CallArguments[i];

                var param = body.Parameters[i];

                arg   = AdaptIsReference(arg);
                param = AdaptIsReference(param);

                if (callInfo.CallerState.HasTraceables(arg))
                {
                    calleeDepDomain.AssignTraceables(param, callInfo.CallerState.GetTraceables(arg));
                }
                if (callInfo.CallerState.HasOutputTraceables(arg))
                {
                    calleeDepDomain.AddOutputTraceables(param, callInfo.CallerState.GetOutputTraceables(arg));
                }
                if (callInfo.CallerState.HasOutputControlTraceables(arg))
                {
                    calleeDepDomain.AddOutputControlTraceables(param, callInfo.CallerState.GetOutputControlTraceables(arg));
                }

                initializedRanges.AssignValue(param, callInfo.VariableRanges.GetValue(arg));

                // DIEGODIEGO: Do I need this?
                callInfo.ScopeData.PropagateCopy(arg, param);
            }
            calleeDepDomain.Dependencies.A1_Escaping = callInfo.CallerState.Dependencies.A1_Escaping;

            calleeDepDomain.Dependencies.A2_References = callInfo.CallerState.Dependencies.A2_References;

            calleeDepDomain.Dependencies.A3_Fields        = callInfo.CallerState.Dependencies.A3_Fields;
            calleeDepDomain.Dependencies.ControlVariables = callInfo.CallerState.Dependencies.ControlVariables;
            //calleeDepDomain.Dependencies.ControlTraceables = callInfo.CallerState.Dependencies.ControlTraceables;

            //calleeDepDomain.Dependencies.A1_Escaping.UnionWith(callInfo.CallerState.Dependencies.A1_Escaping);
            //calleeDepDomain.Dependencies.A3_Clousures.UnionWith(callInfo.CallerState.Dependencies.A3_Clousures);
            return(calleeDepDomain);
        }
Ejemplo n.º 2
0
        private DependencyPTGDomain BindCallerCallee(InterProceduralCallInfo callInfo)
        {
            var calleeDepDomain = new DependencyPTGDomain();

            calleeDepDomain.Dependencies.IsTop = callInfo.CallerState.Dependencies.IsTop;
            // Bind parameters with arguments
            for (int i = 0; i < callInfo.CallArguments.Count(); i++)
            {
                var arg   = callInfo.CallArguments[i];
                var param = callInfo.Callee.Body.Parameters[i];

                arg   = AdaptIsReference(arg);
                param = AdaptIsReference(param);

                if (callInfo.CallerState.HasTraceables(arg))
                {
                    calleeDepDomain.AssignTraceables(param, callInfo.CallerState.GetTraceables(arg));
                }
                if (callInfo.CallerState.HasOutputTraceables(arg))
                {
                    calleeDepDomain.AddOutputTraceables(param, callInfo.CallerState.GetOutputTraceables(arg));
                }
                if (callInfo.CallerState.HasOutputControlTraceables(arg))
                {
                    calleeDepDomain.AddOutputControlTraceables(param, callInfo.CallerState.GetOutputControlTraceables(arg));
                }
            }
            calleeDepDomain.Dependencies.A1_Escaping = callInfo.CallerState.Dependencies.A1_Escaping;

            calleeDepDomain.Dependencies.A2_References = callInfo.CallerState.Dependencies.A2_References;

            calleeDepDomain.Dependencies.A3_Fields        = callInfo.CallerState.Dependencies.A3_Fields;
            calleeDepDomain.Dependencies.ControlVariables = callInfo.CallerState.Dependencies.ControlVariables;
            //calleeDepDomain.Dependencies.A1_Escaping.UnionWith(callInfo.CallerState.Dependencies.A1_Escaping);
            //calleeDepDomain.Dependencies.A3_Clousures.UnionWith(callInfo.CallerState.Dependencies.A3_Clousures);
            return(calleeDepDomain);
        }