예제 #1
0
        private void AddLoadElemImplementation(List <InstructionNode> instructionNodes, VirtualCallInstructionNode virtualNodeCall, IndexedArgument objectArgument)
        {
            var callOpCode      = Instruction.Create(CodeGroups.AllOpcodes.First(x => x.Code == Code.Ldelem_Ref));
            var loadElementNode = new LdElemInstructionNode(callOpCode, virtualNodeCall.Method);

            AddImplementation(instructionNodes, virtualNodeCall, loadElementNode);
        }
예제 #2
0
        public override bool IsLoadNodeMatching(InstructionNode instructionNode)
        {
            LdElemInstructionNode loadNode = instructionNode as LdElemInstructionNode;

            if (loadNode == null)
            {
                return(false);
            }
            var loadIndexArgs = loadNode.DataFlowBackRelated.Where(x => x.ArgIndex == 1).SelectMany(x => x.Argument.GetDataOriginNodes()).ToArray();

            if (!loadIndexArgs.Any(y => HaveEquivilentIndexNode(y, _IndexArgs)))
            {
                return(false);
            }
            var loadArrayArgs = loadNode.DataFlowBackRelated.Where(x => x.ArgIndex == 0).SelectMany(x => x.Argument.GetDataOriginNodes()).ToArray();

            if (!HaveEquivilentObjectNode(loadArrayArgs, ObjectNodes))
            {
                return(false);
            }
            return(true);
        }