-
-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instruction.Operand contains invalid branch instruction. #42
Comments
Sorry but I don't understand what you think the problem is. Please write the complete IL of the method, and what you think is wrong in which instruction. |
Hi Evain, Now, when i am at IL_0004 and I call instruction.Operand contains array of OpCodes.Nop, instead of the branch instructions br.s IL_001d and br.s IL_0022 needed to create control flow for switch. As IL_0013 points to nop , it is literally valid but invalid in case of processing branch. For switch statement with return , MSIL generates an extra nop instruction. I was thinking if instruction.Operand call can return instructions for IL_0011 and IL_0016 instead of IL_0013 and IL_0018 respectively. |
Sorry but you're wrong here. The switch is properly constructed and contains the appropriate instructions. It doesn't make any sense for the operands to contain something else than the actual jump points in the jump table. And it's invalid in no case at all, if you want to build a CFG for a switch statement, you have to create basic blocks starting at each jump points of the switch and starting at its next instruction. Closing. |
Thanks for the clarification, much appreciated. |
…012.1 (jbevain#42) Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.22473.1 -> To Version 8.0.0-beta.22512.1
Hi Evain,
I decompiled a switch statement that follows:
switch (arg)
{
case 0:
{
return 2;
}
case 1:
{
return 4;
}
default:
{
return 0;
}
}
The result IL contains :
{IL_0004: switch IL_0013,IL_0018}
Followed by :
{IL_0011: br.s IL_001d}
{IL_0013: nop}
Now, instruction.Operand contains nop which is valid but not expected as it should contain the value from IL_0011 which is the switch branch needed to create proper control flow graph.
In this case, is it possible to send the desired OpCode through instruction.Operand ? So that implementer does not have to do an extra simulation on top it.
Regards,
Mehfuz
The text was updated successfully, but these errors were encountered: