Browse Source

Fixed C++/CLI generated stackalloc

fixed #592
partially fixes #569
pull/587/head
LordJZ 10 years ago
parent
commit
5f2097ade6
  1. 17
      ICSharpCode.Decompiler/ILAst/ILAstOptimizer.cs

17
ICSharpCode.Decompiler/ILAst/ILAstOptimizer.cs

@ -676,13 +676,16 @@ namespace ICSharpCode.Decompiler.ILAst @@ -676,13 +676,16 @@ namespace ICSharpCode.Decompiler.ILAst
switch (expr.Code) {
case ILCode.Localloc:
{
ILExpression arg0 = args[0];
ILExpression expr2 = expr;
DivideOrMultiplyBySize(ref expr2, ref arg0, ((PointerType)expr.InferredType).ElementType, true);
// expr shouldn't change
if (expr2 != expr)
throw new InvalidOperationException();
args[0] = arg0;
PointerType type = expr.InferredType as PointerType;
if (type != null) {
ILExpression arg0 = args[0];
ILExpression expr2 = expr;
DivideOrMultiplyBySize(ref expr2, ref arg0, type.ElementType, true);
// expr shouldn't change
if (expr2 != expr)
throw new InvalidOperationException();
args[0] = arg0;
}
break;
}
case ILCode.Add:

Loading…
Cancel
Save