* partial progress

* progress

* progress

* progress

* fix

* add another example

* further progress

* formatting fix

* fixes

* undo removal of comment

* example null deref

* comment edit

* progress

* progress

* fix

* add ldlen test

* add unit test for this

* minor edits

* fix test

* edit test

* fix

* bug fix

* updated expected counts

* progress

* translation and tests

* bug fix

* add constrained

* progress

* write warning instead

* bug fix

* fix bug

* undo debug stuff

* typo

* fix

* remove stash markers

* testclass introduction of bug fix

* doc fix

* undo regular control flow from throw through finally

* remove unecessary method

* add ldvirtftn

* remove indent

---------

Co-authored-by: Xiaoyu Liu <lixiaoyu@microsoft.com>
This commit is contained in:
Matthew Jin 2023-03-02 15:46:06 -08:00 коммит произвёл GitHub
Родитель 395e827d56
Коммит 338ae846f0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 25 добавлений и 6 удалений

Просмотреть файл

@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.IO;

Просмотреть файл

@ -67,7 +67,7 @@ namespace Cilsil.Cil.Parsers
// case.
if (!(callArgs[0].Type is Tfun methodType))
{
Log.WriteError("Unexpected arg on stack: expected function");
Log.WriteWarning("Unexpected arg on stack: expected function");
return false;
}
else

Просмотреть файл

@ -199,6 +199,14 @@ namespace Cilsil.Services
programState.PushInstruction(methodBody.Instructions.First(), initNode);
do
{
if (programState.IsTopSnapshotInstructionNull())
{
Log.WriteWarning("Top instruction is null; terminating translation.");
Log.RecordUnfinishedMethod(method.GetCompatibleFullName(),
method.Body.Instructions.Count);
translationUnfinished = true;
break;
}
iterationCount++;
var nextInstruction = programState.PopInstruction();
// Checks if there is a node for the offset that we can reuse.

Просмотреть файл

@ -41,23 +41,25 @@ namespace Cilsil.Utils
new Dictionary<Instruction, ExceptionHandler>();
/// <summary>
/// Maps offsets within try-blocks of try-catch to the corresponding catch handler set.
/// Maps offsets within try-blocks of try-catch to the corresponding catch handler set and
/// the length of the try.
/// </summary>
public readonly Dictionary<int,
(List<ExceptionHandlerNode>, int)> TryOffsetToCatchHandlers;
/// <summary>
/// Maps offsets within try-blocks of try-finally to the corresponding finally handler.
/// Maps offsets within try-blocks of try-finally to the corresponding finally handler and
/// the length of the try.
/// </summary>
public readonly Dictionary<int, (ExceptionHandler, int)> TryOffsetToFinallyHandler;
/// <summary>
/// Maps offsets within catch-blocks to the corresponding catch handler.
/// Maps offsets within catch-blocks to the corresponding catch handler and its length.
/// </summary>
public readonly Dictionary<int, (ExceptionHandlerNode, int)> CatchOffsetToCatchHandler;
/// <summary>
/// Maps offsets within finally-blocks to the corresponding finally handler and the .
/// Maps offsets within finally-blocks to the corresponding finally handler and its length.
/// </summary>
public readonly Dictionary<int, (ExceptionHandler, int)> FinallyOffsetToFinallyHandler;
#endregion

Просмотреть файл

@ -458,6 +458,15 @@ namespace Cilsil.Utils
});
}
/// <summary>
/// Checks null-state of the top snapshot instruction of the stack.
/// </summary>
/// <returns><c>True</c> if instruction null; <c>false</c> otherwise.</returns>
public bool IsTopSnapshotInstructionNull()
{
return InstructionsStack.Peek().Instruction == null;
}
/// <summary>
/// Pops an instruction to be parsed.
/// </summary>