diff --git a/.gitignore b/.gitignore index 66732568..f246770e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,6 @@ -/*.suo -Backend/*.user -Backend/bin -Backend/obj -Console/*.user -Console/bin -Console/obj -Test/bin -Test/obj +*.suo +*.user +bin +obj .vs -/Model/bin -/Model/obj -/CCILoader/bin -/CCILoader/obj /packages -/CCIProvider/bin/Debug -/CCIProvider/obj/Debug diff --git a/Backend/Analyses/TypeInferenceAnalysis.cs b/Backend/Analyses/TypeInferenceAnalysis.cs index b25cde66..5425f796 100644 --- a/Backend/Analyses/TypeInferenceAnalysis.cs +++ b/Backend/Analyses/TypeInferenceAnalysis.cs @@ -43,7 +43,10 @@ public override void Visit(CreateArrayInstruction instruction) public override void Visit(CatchInstruction instruction) { - instruction.Result.Type = instruction.ExceptionType; + if (instruction.HasResult) + { + instruction.Result.Type = instruction.ExceptionType; + } } public override void Visit(CreateObjectInstruction instruction) diff --git a/Backend/Transformations/Disassembler.cs b/Backend/Transformations/Disassembler.cs index 01315de9..92bcc3b5 100644 --- a/Backend/Transformations/Disassembler.cs +++ b/Backend/Transformations/Disassembler.cs @@ -304,7 +304,7 @@ private void ProcessEndFinally(Bytecode.BasicInstruction op) private void ProcessEndFilter(Bytecode.BasicInstruction op) { - stack.Clear(); + //stack.Clear(); ProcessEmptyOperation(op); } @@ -1067,6 +1067,14 @@ private void FillExceptionHandlersStart() exceptionHandlersStart.Add(protectedBlock.Handler.Start, protectedBlock.Handler); //exceptionHandlersEnd.Add(protectedBlock.End, protectedBlock); //exceptionHandlersEnd.Add(protectedBlock.Handler.End, protectedBlock.Handler); + + if (protectedBlock.Handler.Kind == ExceptionHandlerBlockKind.Filter) + { + var filterHandler = protectedBlock.Handler as FilterExceptionHandler; + + exceptionHandlersStart.Add(filterHandler.Handler.Start, filterHandler); + //exceptionHandlersEnd.Add(filterHandler.Handler.End, filterHandler); + } } } @@ -1098,15 +1106,21 @@ private void ProcessExceptionHandling(MethodBody body, IInstruction operation) case ExceptionHandlerBlockKind.Filter: // Push the exception into the stack - var filterException = stack.Push(); var filterBlock = block as FilterExceptionHandler; - instruction = new Tac.FilterInstruction(operation.Offset, filterException, filterBlock.ExceptionType); + var filterException = stack.Push(); + instruction = new Tac.FilterInstruction(operation.Offset, filterException, filterBlock.Handler.ExceptionType); break; case ExceptionHandlerBlockKind.Catch: - // Push the exception into the stack - var catchException = stack.Push(); var catchBlock = block as CatchExceptionHandler; + IVariable catchException = null; + + if (!catchBlock.HasAssociatedFilter) + { + // Push the exception into the stack + catchException = stack.Push(); + } + instruction = new Tac.CatchInstruction(operation.Offset, catchException, catchBlock.ExceptionType); break; diff --git a/CCIProvider/CodeProvider.cs b/CCIProvider/CodeProvider.cs index 1716c962..eee89a50 100644 --- a/CCIProvider/CodeProvider.cs +++ b/CCIProvider/CodeProvider.cs @@ -82,29 +82,32 @@ private void ExtractExceptionInformation(IEnumerable