Emit `conv.i` in pointer interop only when necessary
- Dominant language
- C#
- Stars
- 451
- Forks
- 49
- Avg merge
- 13h 59m
- Merged PRs (30d)
- 6
Description
After implementing #354, we now have a feature that calls C# functions with `CPtr`, `VoidPtr`, and `FuncPtr` in their signatures. To call them, it will always emit a `conv.i` instruction.
This instruction is not always required (actually, in most cases it isn't): it should only be emitted when the value on stack is _not_ a pointer.
We should fix that, and only emit it when necessary. See `TODO[#491]` when implementing.
Contributor guide
Research direction
Search the repository for TODO[#491] and inspect the code that emits calls for CPtr, VoidPtr, and FuncPtr signatures. Trace how the stack value's pointer status is determined, then verify that conv.i is emitted only for non-pointer values using any existing compiler tests or a focused regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100