Skip to content

Conversation

@ItsMilos
Copy link
Contributor

CIL is very bad right now, but control flow graph seems to pretty good. to get those graphs uncomment that thing in IlOutputFormat.cs FillMethodBody

@coveralls
Copy link

coveralls commented Mar 20, 2025

Pull Request Test Coverage Report for Build 13988197905

Details

  • 5 of 1526 (0.33%) changed or added relevant lines in 31 files are covered.
  • 4 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-3.8%) to 23.407%

Changes Missing Coverage Covered Lines Changed/Added Lines %
Cpp2IL.Core/Cpp2IlCorePlugin.cs 3 4 75.0%
Cpp2IL.Core/InstructionSets/Arm64InstructionSet.cs 0 2 0.0%
Cpp2IL.Core/InstructionSets/ArmV7InstructionSet.cs 0 2 0.0%
Cpp2IL.Core/InstructionSets/NewArmV8InstructionSet.cs 0 2 0.0%
Cpp2IL.Core/InstructionSets/WasmInstructionSet.cs 0 2 0.0%
Cpp2IL.Core/OutputFormats/AsmResolverDummyDllOutputFormat.cs 1 3 33.33%
Cpp2IL.Decompiler/IL/StackOffset.cs 0 2 0.0%
Cpp2IL.Decompiler/LimitReachedException.cs 0 3 0.0%
Cpp2IL.Decompiler/IL/LocalVariable.cs 0 5 0.0%
Cpp2IL.Decompiler/Transforms/ResolveTypeAddresses.cs 0 9 0.0%
Files with Coverage Reduction New Missed Lines %
Cpp2IL.Core/InstructionSets/Arm64InstructionSet.cs 1 0.0%
Cpp2IL.Core/OutputFormats/AsmResolverDummyDllOutputFormat.cs 1 0.53%
Cpp2IL.Core/InstructionSets/X86InstructionSet.cs 2 0.09%
Totals Coverage Status
Change from base Build 13931880968: -3.8%
Covered Lines: 3383
Relevant Lines: 12143

💛 - Coveralls

@ds5678
Copy link
Contributor

ds5678 commented Mar 21, 2025

Hello, thank you for the pull request!

This resolves #223

Copy link
Contributor

@ds5678 ds5678 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave it a first pass. Thank you for working on this.

Comment on lines +19 to +20
public override string Description =>
"Core Cpp2IL plugin containing built-in instruction sets, binaries, and other core functionality.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatter did that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should avoid using automatic formatters on existing files.

Comment on lines +68 to +69
<ProjectReference Include="..\Cpp2IL.Decompiler\Cpp2IL.Decompiler.csproj"/>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sam would need to weigh in on this, but I feel like everything should be in one project.

Comment on lines +66 to +67
Logger.VerboseNewline($"Core plugin loaded in {elapsed.Ticks} ticks ({elapsed.TotalMilliseconds}ms)",
"Core Plugin");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatter did that

Comment on lines +38 to +39
public abstract List<Instruction> GetDecompilerIlFromMethod(MethodAnalysisContext context, out List<object> ilParams);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why decompilation is specific to each instruction set if you're using ISIL?


namespace Cpp2IL.Core.OutputFormats;

public class IlOutputFormat : AsmResolverDllOutputFormat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AsmResolverDllOutputFormatIlRecovery should be modified instead of creating a new output format.

/// <summary>
/// Provides additional context for the decompiler.
/// </summary>
public interface IContext
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDecompilerContext

Comment on lines +1 to +2
using AsmResolver.DotNet;
using AsmResolver.DotNet.Signatures;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these used at all in this file? I was confused to discover that OpCode is not an AsmResolver type. Please use the Sort and remove unnecessary usings tool in your IDE.

/// <summary>
/// Type of the variable.
/// </summary>
public TypeDefinition? Type = type;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised this isn't TypeSignature.

/// <summary>
/// All opcodes. If changing this, also update <see cref="Instruction"/>.
/// </summary>
public enum OpCode // There is some weird stuff in doc comments because i can't use <, >, & (idk why & doesn't work)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels redundant with ISIL.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i didn't use ISIL because compare sets flags, and those flags could be platform specific, and those could be used in non branch instructions so that would be annoying, and ISIL is just weird in many ways and if i changed it i would need to change it in so many places

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i didn't use ISIL

So why is your pull request titled ISIL -> CIL if you don't use ISIL?

/// <summary>
/// Memory operand in the format of [base+addend+index*scale].
/// </summary>
public struct MemoryAddress(object? baseRegister = null, object? indexRegister = null, long addend = 0, int scale = 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are baseRegister and indexRegister always Register or null? If so, they should be typed as Register? to avoid boxing.

@ItsMilos ItsMilos closed this Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants