Beispiel #1
0
            void AddTargets(List <BaseBlock> dest, TryHandlerBlock tryHandlerBlock)
            {
                AddTargets(dest, (ScopeBlock)tryHandlerBlock);

                dest.Add(tryHandlerBlock.FilterHandlerBlock);
                AddTargets(dest, tryHandlerBlock.FilterHandlerBlock);

                dest.Add(tryHandlerBlock.HandlerBlock);
                AddTargets(dest, tryHandlerBlock.HandlerBlock);
            }
Beispiel #2
0
        BaseBlocksList createBaseBlockList(List <Block> allBlocks, List <List <ExceptionHandler> > exSorted)
        {
            var bbl = new BaseBlocksList();

            foreach (var block in allBlocks)
            {
                int start = instrToIndex[block.FirstInstr.Instruction];
                int end   = instrToIndex[block.LastInstr.Instruction];
                bbl.add(block, start, end);
            }

            foreach (var exHandlers in exSorted)
            {
                var tryBlock = new TryBlock();
                var tryStart = instrToIndex[exHandlers[0].TryStart];
                var tryEnd   = getInstrIndex(exHandlers[0].TryEnd) - 1;
                tryBlock.BaseBlocks = bbl.replace(tryStart, tryEnd, tryBlock);

                foreach (var exHandler in exHandlers)
                {
                    var tryHandlerBlock = new TryHandlerBlock(exHandler);
                    tryBlock.addTryHandler(tryHandlerBlock);

                    int filterStart = -1, handlerStart = -1, handlerEnd = -1;

                    if (exHandler.FilterStart != null)
                    {
                        filterStart = instrToIndex[exHandler.FilterStart];
                        var end = instrToIndex[exHandler.HandlerStart] - 1;
                        tryHandlerBlock.FilterHandlerBlock.BaseBlocks = bbl.replace(filterStart, end, tryHandlerBlock.FilterHandlerBlock);
                    }

                    handlerStart = instrToIndex[exHandler.HandlerStart];
                    handlerEnd   = getInstrIndex(exHandler.HandlerEnd) - 1;
                    tryHandlerBlock.HandlerBlock.BaseBlocks = bbl.replace(handlerStart, handlerEnd, tryHandlerBlock.HandlerBlock);

                    tryHandlerBlock.BaseBlocks = bbl.replace(filterStart == -1 ? handlerStart : filterStart, handlerEnd, tryHandlerBlock);
                }
            }

            return(bbl);
        }
		public void AddTryHandler(TryHandlerBlock tryHandlerBlock) {
			handlerBlocks.Add(tryHandlerBlock);
		}
		BaseBlocksList CreateBaseBlockList(List<Block> allBlocks, List<List<ExceptionHandler>> exSorted) {
			var bbl = new BaseBlocksList();
			foreach (var block in allBlocks) {
				int start = instrToIndex[block.FirstInstr.Instruction];
				int end = instrToIndex[block.LastInstr.Instruction];
				bbl.Add(block, start, end);
			}

			foreach (var exHandlers in exSorted) {
				var tryBlock = new TryBlock();
				var tryStart = instrToIndex[exHandlers[0].TryStart];
				var tryEnd = GetInstrIndex(exHandlers[0].TryEnd) - 1;
				tryBlock.BaseBlocks = bbl.Replace(tryStart, tryEnd, tryBlock);

				foreach (var exHandler in exHandlers) {
					var tryHandlerBlock = new TryHandlerBlock(exHandler);
					tryBlock.AddTryHandler(tryHandlerBlock);

					int filterStart = -1, handlerStart = -1, handlerEnd = -1;

					if (exHandler.FilterStart != null) {
						filterStart = instrToIndex[exHandler.FilterStart];
						var end = instrToIndex[exHandler.HandlerStart] - 1;
						tryHandlerBlock.FilterHandlerBlock.BaseBlocks = bbl.Replace(filterStart, end, tryHandlerBlock.FilterHandlerBlock);
					}

					handlerStart = instrToIndex[exHandler.HandlerStart];
					handlerEnd = GetInstrIndex(exHandler.HandlerEnd) - 1;
					tryHandlerBlock.HandlerBlock.BaseBlocks = bbl.Replace(handlerStart, handlerEnd, tryHandlerBlock.HandlerBlock);

					tryHandlerBlock.BaseBlocks = bbl.Replace(filterStart == -1 ? handlerStart : filterStart, handlerEnd, tryHandlerBlock);
				}
			}

			return bbl;
		}
Beispiel #5
0
 public void AddTryHandler(TryHandlerBlock tryHandlerBlock)
 {
     handlerBlocks.Add(tryHandlerBlock);
 }
Beispiel #6
0
			void AddTargets(List<BaseBlock> dest, TryHandlerBlock tryHandlerBlock) {
				AddTargets(dest, (ScopeBlock)tryHandlerBlock);

				dest.Add(tryHandlerBlock.FilterHandlerBlock);
				AddTargets(dest, tryHandlerBlock.FilterHandlerBlock);

				dest.Add(tryHandlerBlock.HandlerBlock);
				AddTargets(dest, tryHandlerBlock.HandlerBlock);
			}