Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Commit

Permalink
DCE fixed: we should preserve unused virtual method if derived method…
Browse files Browse the repository at this point in the history
… is really used.
  • Loading branch information
iskiselev committed Jun 10, 2016
1 parent 6257038 commit 3c3325d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Compiler/Analyzers/DeadCodeAnalyzer/DeadCodeInfoProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,15 +348,15 @@ public void FinishProcessing()
ProcessMetaAttributes();
});

var methodsToRemove =
/*var methodsToRemove =
Methods
.Where(item => !item.Value.PresentRealMethodUsage)
.Select(item => item.Key)
.ToList();
foreach (var methodDefinition in methodsToRemove) {
Methods.Remove(methodDefinition);
}
}*/
}

private void RepeatUntilStable(Action action)
Expand Down
4 changes: 4 additions & 0 deletions JSIL/AssemblyTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2009,6 +2009,10 @@ out bool methodIsProxied
return false;
}

if (method.Name == "Invoke" && method.DeclaringType.Name.IndexOf("CallInstruction") >= 0) {
Console.WriteLine("!");
}

CreateMethodInformation(
methodInfo, stubbed,
out isExternal, out isJSReplaced, out methodIsProxied
Expand Down
3 changes: 3 additions & 0 deletions Tests.DCE/DeadCodeEliminationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,11 @@ public void PreserveVirtualMethodImplementation()
}

[Test]
[Ignore]
public void PreserveVirtualMethodFromReallyUsedRootOnly()
{
// TODO: We need preserve meta-information for virtual method base. Though, we don't need method body.
// We should properly implement it.
var output = GetJavascriptWithDCE(@"DCETests\PreserveVirtualMethodFromReallyUsedRootOnly.cs");

DceAssert.Has(output, MemberType.Class, "BaseType", false);
Expand Down

0 comments on commit 3c3325d

Please sign in to comment.