Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Voorhees <mrvoorhe@users.noreply.github.com>2019-04-12 09:18:08 +0300
committerMarek Safar <marek.safar@gmail.com>2019-04-12 09:18:08 +0300
commite9ed848a9b2cf91e43c7fbc7ccc81db0e9bcf2de (patch)
tree577b7f5a95535ed2e07730b14f86c850180aad1b /test/Mono.Linker.Tests
parente68def107b7aeb347951bdf7e7064b5c32df36d0 (diff)
Mark instance method bodies lazily (#502)
Instance method bodies do not need to be marked until an instance of the type could exist. Any instance methods that were marked on types that are never instantiated will be converted to a throw. * A number of existing tests needed to be updated to avoid lazy body marking * Add a new CodeOptimization to allow disabling this mechanism. Reasoning was, (1) it's simple to support an option. (2) It may be helpful if it causes problems. (3) I could see using this option to make writing certain tests easier. * Marking of some small bodies will not be deferred. The idea is that the size cost of some methods is less than converting them to a throw. So we might as well leave them alone. See `IsWorthConvertingToThrow` * Factored out `MarkAndCacheNotSupportedCtorString` since I need to call it from multiple places now. * Expose the `RewriteBody*` methods in CodeRewriterStep for overriding. A few motivations for this. (1) We have a runtime that doesn't support exceptions. When we target that runtime we will need to override `ConvertToThrow` with something else. (2) I will likely override all of the `RewriteBody*` methods so that I can record which bodies are changed and hook it up to logging mechanisms that we have. Note. This PR has a test that depends on https://github.com/mono/linker/pull/501 . That PR will need to land first and I will need to rebase after that lands. There will be 1 failing test until that happens.
Diffstat (limited to 'test/Mono.Linker.Tests')
-rw-r--r--test/Mono.Linker.Tests/TestCases/TestDatabase.cs5
-rw-r--r--test/Mono.Linker.Tests/TestCases/TestSuites.cs6
2 files changed, 11 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests/TestCases/TestDatabase.cs b/test/Mono.Linker.Tests/TestCases/TestDatabase.cs
index e5e9085f2..17e380783 100644
--- a/test/Mono.Linker.Tests/TestCases/TestDatabase.cs
+++ b/test/Mono.Linker.Tests/TestCases/TestDatabase.cs
@@ -125,6 +125,11 @@ namespace Mono.Linker.Tests.TestCases
{
return NUnitCasesBySuiteName ("CommandLine");
}
+
+ public static IEnumerable<TestCaseData> UnreachableBodyTests ()
+ {
+ return NUnitCasesBySuiteName ("UnreachableBody");
+ }
public static TestCaseCollector CreateCollector ()
{
diff --git a/test/Mono.Linker.Tests/TestCases/TestSuites.cs b/test/Mono.Linker.Tests/TestCases/TestSuites.cs
index 994448f68..210442e28 100644
--- a/test/Mono.Linker.Tests/TestCases/TestSuites.cs
+++ b/test/Mono.Linker.Tests/TestCases/TestSuites.cs
@@ -144,6 +144,12 @@ namespace Mono.Linker.Tests.TestCases
Run (testCase);
}
+ [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.UnreachableBodyTests))]
+ public void UnreachableBodyTests (TestCase testCase)
+ {
+ Run (testCase);
+ }
+
protected virtual void Run (TestCase testCase)
{
var runner = new TestRunner (new ObjectFactory ());