Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

Implemented verification for binary comparison and branching instructions#3474

Merged
jkotas merged 2 commits intodotnet:ILVerifyfrom
Dynatrace:ILVerify-BranchComparisonInstructionsPR
May 3, 2017
Merged

Implemented verification for binary comparison and branching instructions#3474
jkotas merged 2 commits intodotnet:ILVerifyfrom
Dynatrace:ILVerify-BranchComparisonInstructionsPR

Conversation

@mmayr-at
Copy link
Collaborator

@mmayr-at mmayr-at commented May 2, 2017

As the title says I implemented verification for binary comparison and branching instructions according to ECMA-335.

I plan to do further development of ILVerify, so that I can use it to verify rewritten IL code as described in https://github.com/dotnet/coreclr/issues/11173.

@dnfclas
Copy link

dnfclas commented May 2, 2017

@mmayr-at,
Thanks for your contribution.
To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla2.dotnetfoundation.org.

It will cover your contributions to all .NET Foundation-managed open source projects.
Thanks,
.NET Foundation Pull Request Bot

@dnfclas
Copy link

dnfclas commented May 2, 2017

@mmayr-at, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request.

Thanks, .NET Foundation Pull Request Bot

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, modulo a few nits

case ILOpcode.brfalse:
case ILOpcode.brtrue:
{
StackValue value = Pop();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: It would be nice to be consistent about var vs. explicit types within a method.

var value2 = Pop();

CheckIsComparable(value1, value2, opcode);
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: break after } to be consistent with above?


CheckIsComparable(value1, value2, opcode);
break;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We often add assert as default case to make sure that there is nothing failing through the cracks:

default:
      Debug.Assert(false, "Unexpected branch opcode");
      break;

// TODO: Verification rules
switch (opcode)
{
case ILOpcode.br: break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: It may look better with break; on new line.

@jkotas jkotas merged commit e929551 into dotnet:ILVerify May 3, 2017
@jkotas
Copy link
Member

jkotas commented May 3, 2017

Thanks!

@mmayr-at mmayr-at deleted the ILVerify-BranchComparisonInstructionsPR branch May 3, 2017 05:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants