Browse Source

Remove flags from `box` that indicate memory access and ability to throw

pull/3587/head
ds5678 3 months ago
parent
commit
b9d6ba7dff
  1. 19
      ICSharpCode.Decompiler/IL/Instructions.cs
  2. 2
      ICSharpCode.Decompiler/IL/Instructions.tt

19
ICSharpCode.Decompiler/IL/Instructions.cs

@ -318,7 +318,6 @@ namespace ICSharpCode.Decompiler.IL @@ -318,7 +318,6 @@ namespace ICSharpCode.Decompiler.IL
set {
ValidateChild(value);
SetChildInstruction(ref this.argument, value, 0);
InvalidateFlags();
}
}
protected sealed override int GetChildCount()
@ -4356,24 +4355,6 @@ namespace ICSharpCode.Decompiler.IL @@ -4356,24 +4355,6 @@ namespace ICSharpCode.Decompiler.IL
set { type = value; InvalidateFlags(); }
}
public override StackType ResultType { get { return StackType.O; } }
protected override InstructionFlags ComputeFlags()
{
var baseFlags = base.ComputeFlags();
if (baseFlags == InstructionFlags.None && Type.Equals(Argument.InferType(null)))
{
return InstructionFlags.None;
}
return baseFlags | InstructionFlags.SideEffect | InstructionFlags.MayThrow;
}
public override InstructionFlags DirectFlags {
get {
if (Flags == InstructionFlags.None)
{
return InstructionFlags.None;
}
return base.DirectFlags | InstructionFlags.SideEffect | InstructionFlags.MayThrow;
}
}
public override void WriteTo(ITextOutput output, ILAstWritingOptions options)
{
WriteILRange(output, options);

2
ICSharpCode.Decompiler/IL/Instructions.tt

@ -266,7 +266,7 @@ @@ -266,7 +266,7 @@
CustomInvariant("CheckTargetSlot();")),
new OpCode("box", "Boxes a value.",
Unary, HasTypeOperand, MemoryAccess, MayThrow, ResultType("O")),
Unary, HasTypeOperand, ResultType("O")),
new OpCode("unbox", "Compute address inside box.",
Unary, HasTypeOperand, MayThrow, ResultType("Ref")),
new OpCode("unbox.any", "Unbox a value.",

Loading…
Cancel
Save