diff --git a/Cpp2IL.Core/ProcessingLayers/CallAnalysisProcessingLayer.cs b/Cpp2IL.Core/ProcessingLayers/CallAnalysisProcessingLayer.cs index e83af639..ac399291 100644 --- a/Cpp2IL.Core/ProcessingLayers/CallAnalysisProcessingLayer.cs +++ b/Cpp2IL.Core/ProcessingLayers/CallAnalysisProcessingLayer.cs @@ -68,29 +68,28 @@ private static void InjectAttribute(ApplicationAnalysisContext appContext) AttributeInjectionUtils.AddZeroParameterAttribute(m, deduplicatedMethodConstructor); } - m.Analyze(); + var convertedIsil = appContext.InstructionSet.GetIsilFromMethod(m); - if (m.ConvertedIsil is { Count: 0 }) + if (convertedIsil is { Count: 0 }) { if ((m.MethodAttributes & MethodAttributes.Abstract) == 0) { AttributeInjectionUtils.AddZeroParameterAttribute(m, analysisNotSupportedConstructor); } - m.ReleaseAnalysisData(); continue; } - if (m.ConvertedIsil.Any(i => i.OpCode == InstructionSetIndependentOpCode.Invalid)) + if (convertedIsil.Any(i => i.OpCode == InstructionSetIndependentOpCode.Invalid)) { AttributeInjectionUtils.AddZeroParameterAttribute(m, invalidInstructionsConstructor); } - if (m.ConvertedIsil.Any(i => i.OpCode == InstructionSetIndependentOpCode.NotImplemented)) + if (convertedIsil.Any(i => i.OpCode == InstructionSetIndependentOpCode.NotImplemented)) { AttributeInjectionUtils.AddZeroParameterAttribute(m, unimplementedInstructionsConstructor); } - foreach (var instruction in m.ConvertedIsil) + foreach (var instruction in convertedIsil) { if (instruction.OpCode != InstructionSetIndependentOpCode.Call && instruction.OpCode != InstructionSetIndependentOpCode.CallNoReturn) { @@ -126,8 +125,6 @@ private static void InjectAttribute(ApplicationAnalysisContext appContext) unknownCalls[m] = unknownCalls.GetOrDefault(m, 0) + 1; } } - - m.ReleaseAnalysisData(); } if(Cpp2IlApi.LowMemoryMode) diff --git a/Cpp2IL.Core/ProcessingLayers/NativeMethodDetectionProcessingLayer.cs b/Cpp2IL.Core/ProcessingLayers/NativeMethodDetectionProcessingLayer.cs index d03d40c0..0b8a2630 100644 --- a/Cpp2IL.Core/ProcessingLayers/NativeMethodDetectionProcessingLayer.cs +++ b/Cpp2IL.Core/ProcessingLayers/NativeMethodDetectionProcessingLayer.cs @@ -55,15 +55,14 @@ private static void AnalyzeMethod(ApplicationAnalysisContext appContext, MethodA if (m.UnderlyingPointer == 0) return; - m.Analyze(); + var convertedIsil = appContext.InstructionSet.GetIsilFromMethod(m); - if (m.ConvertedIsil is { Count: 0 }) + if (convertedIsil is { Count: 0 }) { - m.ReleaseAnalysisData(); return; } - foreach (var instruction in m.ConvertedIsil) + foreach (var instruction in convertedIsil) { if (instruction.OpCode == InstructionSetIndependentOpCode.Call) { @@ -80,8 +79,6 @@ private static void AnalyzeMethod(ApplicationAnalysisContext appContext, MethodA } } } - - m.ReleaseAnalysisData(); } private static bool TryGetAddressFromInstruction(InstructionSetIndependentInstruction instruction, out ulong address)