From a594497d6bf6767ce613921d81be8efd96a23c0a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 26 May 2023 19:41:17 +0200 Subject: [PATCH 1/2] do not call solution.GetComponent inside BurstBulbItemsProvider ctor --- .../AddDiscardAttribute/AddDiscardBulbItemsProvider.cs | 5 +++-- .../CallGraph/BurstCodeAnalysis/BurstBulbItemsProvider.cs | 4 ++-- .../ShowBurstCalls/ShowBurstCallsCodeVisionProviders.cs | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/BurstCodeAnalysis/AddDiscardAttribute/AddDiscardBulbItemsProvider.cs b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/BurstCodeAnalysis/AddDiscardAttribute/AddDiscardBulbItemsProvider.cs index b27601512d..eaaa76454a 100644 --- a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/BurstCodeAnalysis/AddDiscardAttribute/AddDiscardBulbItemsProvider.cs +++ b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/BurstCodeAnalysis/AddDiscardAttribute/AddDiscardBulbItemsProvider.cs @@ -3,6 +3,7 @@ using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Resources; using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.CallGraph; +using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.BurstCodeAnalysis.ContextSystem; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.TextControl; @@ -11,8 +12,8 @@ namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Feature.Services.CallGraph.Bu [SolutionComponent] public class AddDiscardBulbItemsProvider : BurstBulbItemsProvider { - public AddDiscardBulbItemsProvider(ISolution solution) - : base(solution) + public AddDiscardBulbItemsProvider(ISolution solution, BurstContextProvider burstContextProvider) + : base(solution, burstContextProvider) { } diff --git a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/BurstCodeAnalysis/BurstBulbItemsProvider.cs b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/BurstCodeAnalysis/BurstBulbItemsProvider.cs index 7dc1e57cfd..246d63d88f 100644 --- a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/BurstCodeAnalysis/BurstBulbItemsProvider.cs +++ b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/BurstCodeAnalysis/BurstBulbItemsProvider.cs @@ -10,9 +10,9 @@ public abstract class BurstBulbItemsProvider : SimpleCallGraphBulbItemsProviderB { private readonly BurstContextProvider myBurstContextProvider; - protected BurstBulbItemsProvider(ISolution solution) : base(solution) + protected BurstBulbItemsProvider(ISolution solution, BurstContextProvider burstContextProvider) : base(solution) { - myBurstContextProvider = solution.GetComponent(); + myBurstContextProvider = burstContextProvider; } protected override bool CheckCallGraph(IMethodDeclaration methodDeclaration, IReadOnlyCallGraphContext context) { diff --git a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/BurstCodeAnalysis/ShowBurstCalls/ShowBurstCallsCodeVisionProviders.cs b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/BurstCodeAnalysis/ShowBurstCalls/ShowBurstCallsCodeVisionProviders.cs index 8ee1004325..1e659b4333 100644 --- a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/BurstCodeAnalysis/ShowBurstCalls/ShowBurstCallsCodeVisionProviders.cs +++ b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/BurstCodeAnalysis/ShowBurstCalls/ShowBurstCallsCodeVisionProviders.cs @@ -3,6 +3,7 @@ using JetBrains.ProjectModel; using JetBrains.ReSharper.Daemon; using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.CallGraph; +using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.BurstCodeAnalysis.ContextSystem; using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.ContextSystem; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.TextControl; @@ -14,8 +15,8 @@ public class ShowBurstCallsBulbItemsProvider : BurstBulbItemsProvider { private readonly SolutionAnalysisConfiguration myConfiguration; - public ShowBurstCallsBulbItemsProvider(ISolution solution, SolutionAnalysisConfiguration configuration) - : base(solution) + public ShowBurstCallsBulbItemsProvider(ISolution solution, BurstContextProvider burstContextProvider, SolutionAnalysisConfiguration configuration) + : base(solution, burstContextProvider) { myConfiguration = configuration; } From ecc2f15612afbbaec612342e61586b7945c79880 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 26 May 2023 19:47:31 +0200 Subject: [PATCH 2/2] do not call solution.GetComponent inside PerformanceCriticalBulbItemsProvider ctor --- .../AddExpensiveCommentBulbItemsProvider.cs | 4 ++-- .../AddDisableCommentBulbItemsProvider.cs | 4 +++- .../PerformanceCriticalBulbItemsProvider.cs | 4 ++-- .../ShowExpensiveCalls/ShowExpensiveCallsBulbItemsProvider.cs | 3 ++- .../ShowPerformanceCriticalCallsBulbItemsProvider.cs | 3 ++- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/AddExpensiveComment/AddExpensiveCommentBulbItemsProvider.cs b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/AddExpensiveComment/AddExpensiveCommentBulbItemsProvider.cs index 945c08246e..f47d53db9d 100644 --- a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/AddExpensiveComment/AddExpensiveCommentBulbItemsProvider.cs +++ b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/AddExpensiveComment/AddExpensiveCommentBulbItemsProvider.cs @@ -15,8 +15,8 @@ public class AddExpensiveCommentBulbItemsProvider : PerformanceCriticalBulbItems { private readonly ExpensiveInvocationContextProvider myExpensiveContextProvider; - public AddExpensiveCommentBulbItemsProvider(ExpensiveInvocationContextProvider expensiveContextProvider, ISolution solution) - : base(solution) + public AddExpensiveCommentBulbItemsProvider(ExpensiveInvocationContextProvider expensiveContextProvider, PerformanceCriticalContextProvider performanceCriticalContextProvider, ISolution solution) + : base(solution, performanceCriticalContextProvider) { myExpensiveContextProvider = expensiveContextProvider; } diff --git a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/AddPerformanceAnalysisDisableComment/AddDisableCommentBulbItemsProvider.cs b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/AddPerformanceAnalysisDisableComment/AddDisableCommentBulbItemsProvider.cs index 017354866f..a8782d05f8 100644 --- a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/AddPerformanceAnalysisDisableComment/AddDisableCommentBulbItemsProvider.cs +++ b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/AddPerformanceAnalysisDisableComment/AddDisableCommentBulbItemsProvider.cs @@ -3,6 +3,7 @@ using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Resources; using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.CallGraph; +using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.PerformanceCriticalCodeAnalysis.ContextSystem; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.TextControl; @@ -11,7 +12,8 @@ namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Feature.Services.CallGraph.Pe [SolutionComponent] public sealed class AddDisableCommentBulbItemsProvider : PerformanceCriticalBulbItemsProvider { - public AddDisableCommentBulbItemsProvider(ISolution solution) : base(solution) + public AddDisableCommentBulbItemsProvider(ISolution solution, PerformanceCriticalContextProvider performanceCriticalContextProvider) + : base(solution, performanceCriticalContextProvider) { } diff --git a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/PerformanceCriticalBulbItemsProvider.cs b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/PerformanceCriticalBulbItemsProvider.cs index 31969fc4d9..ec7f3dfeb4 100644 --- a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/PerformanceCriticalBulbItemsProvider.cs +++ b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/PerformanceCriticalBulbItemsProvider.cs @@ -10,10 +10,10 @@ public abstract class PerformanceCriticalBulbItemsProvider : SimpleCallGraphBulb { private readonly PerformanceCriticalContextProvider myPerformanceCriticalContextProvider; - protected PerformanceCriticalBulbItemsProvider(ISolution solution) + protected PerformanceCriticalBulbItemsProvider(ISolution solution, PerformanceCriticalContextProvider performanceCriticalContextProvider) : base(solution) { - myPerformanceCriticalContextProvider = solution.GetComponent(); + myPerformanceCriticalContextProvider = performanceCriticalContextProvider; } protected override bool CheckCallGraph(IMethodDeclaration methodDeclaration, IReadOnlyCallGraphContext context) diff --git a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/ShowExpensiveCalls/ShowExpensiveCallsBulbItemsProvider.cs b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/ShowExpensiveCalls/ShowExpensiveCallsBulbItemsProvider.cs index 87e56d92c3..da4ea3d96b 100644 --- a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/ShowExpensiveCalls/ShowExpensiveCallsBulbItemsProvider.cs +++ b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/ShowExpensiveCalls/ShowExpensiveCallsBulbItemsProvider.cs @@ -19,7 +19,8 @@ public class ShowExpensiveCallsBulbItemsProvider : PerformanceCriticalBulbItemsP public ShowExpensiveCallsBulbItemsProvider( ExpensiveInvocationContextProvider expensiveContextProvider, SolutionAnalysisConfiguration configuration, - ISolution solution) : base(solution) + PerformanceCriticalContextProvider performanceCriticalContextProvider, + ISolution solution) : base(solution, performanceCriticalContextProvider) { myExpensiveContextProvider = expensiveContextProvider; myConfiguration = configuration; diff --git a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/ShowPerformanceCriticalCalls/ShowPerformanceCriticalCallsBulbItemsProvider.cs b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/ShowPerformanceCriticalCalls/ShowPerformanceCriticalCallsBulbItemsProvider.cs index 292f3ab685..49c59319c5 100644 --- a/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/ShowPerformanceCriticalCalls/ShowPerformanceCriticalCallsBulbItemsProvider.cs +++ b/resharper/resharper-unity/src/Unity/CSharp/Feature/Services/CallGraph/PerformanceAnalysis/ShowPerformanceCriticalCalls/ShowPerformanceCriticalCallsBulbItemsProvider.cs @@ -4,6 +4,7 @@ using JetBrains.ReSharper.Daemon; using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.CallGraph; using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.ContextSystem; +using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.PerformanceCriticalCodeAnalysis.ContextSystem; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.TextControl; @@ -14,7 +15,7 @@ public class ShowPerformanceCriticalCallsBulbItemsProvider : PerformanceCritical { private readonly SolutionAnalysisConfiguration myConfiguration; - public ShowPerformanceCriticalCallsBulbItemsProvider(SolutionAnalysisConfiguration configuration, ISolution solution) : base(solution) + public ShowPerformanceCriticalCallsBulbItemsProvider(SolutionAnalysisConfiguration configuration, PerformanceCriticalContextProvider performanceCriticalContextProvider, ISolution solution) : base(solution, performanceCriticalContextProvider) { myConfiguration = configuration; }