예제 #1
0
        void ScanBaseBlock(BaseBlock bb, int stackStart)
        {
            scanBaseBlockStack.Push(new ScanBaseBlockState(bb, stackStart));
            while (scanBaseBlockStack.Count > 0)
            {
                var state = scanBaseBlockStack.Pop();
                if (blockInfos.ContainsKey(state.bb) || !scopeBlock.IsOurBaseBlock(state.bb))
                {
                    continue;
                }

                var blockInfo = new BlockInfo(state.bb, state.stackStart);
                blockInfos[state.bb] = blockInfo;

                var block = state.bb as Block;
                if (block == null)                      // i.e., if try, filter, or handler block
                // It's not important to know the exact values, so we set them both to 0.
                // Compilers must make sure the stack is empty when entering a try block.
                {
                    blockInfo.stackStart = blockInfo.stackEnd = 0;
                    continue;
                }

                blockInfo.CalculateStackUsage();

                foreach (var target in block.GetTargets())
                {
                    scanBaseBlockStack.Push(new ScanBaseBlockState(target, blockInfo.stackEnd));
                }
            }
        }
예제 #2
0
		void ScanBaseBlock(BaseBlock bb, int stackStart) {
			scanBaseBlockStack.Push(new ScanBaseBlockState(bb, stackStart));
			while (scanBaseBlockStack.Count > 0) {
				var state = scanBaseBlockStack.Pop();
				if (blockInfos.ContainsKey(state.bb) || !scopeBlock.IsOurBaseBlock(state.bb))
					continue;

				var blockInfo = new BlockInfo(state.bb, state.stackStart);
				blockInfos[state.bb] = blockInfo;

				var block = state.bb as Block;
				if (block == null) {	// i.e., if try, filter, or handler block
					// It's not important to know the exact values, so we set them both to 0.
					// Compilers must make sure the stack is empty when entering a try block.
					blockInfo.stackStart = blockInfo.stackEnd = 0;
					continue;
				}

				blockInfo.CalculateStackUsage();

				foreach (var target in block.GetTargets())
					scanBaseBlockStack.Push(new ScanBaseBlockState(target, blockInfo.stackEnd));
			}
		}