Skip to content

Conversation

@radekdoulik
Copy link
Member

Fixes remaining issue mentioned in #120613

This fixes offset calculation of This and other special cased arguments.

Without that fix, we ended writing the this argument value to a wrong address.

Fixes remaining issue mentioned in dotnet#120613

This fixes offset calculation of This and other special cased arguments.

Without that fix, we ended writing the this argument value to a wrong offset.
@radekdoulik radekdoulik added this to the 11.0.0 milestone Oct 13, 2025
Copilot AI review requested due to automatic review settings October 13, 2025 13:40
@radekdoulik radekdoulik added arch-wasm WebAssembly architecture area-VM-coreclr labels Oct 13, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes offset calculation of special arguments (this pointer, return buffer, etc.) in the WASM target by introducing TARGET_REGISTER_SIZE to handle the difference between WASM's stack slot size and pointer size. On WASM, registers don't exist so arguments that would be in registers on other architectures are placed on the stack after the transition block, requiring different size calculations.

  • Introduces TARGET_REGISTER_SIZE macro that uses INTERP_STACK_SLOT_SIZE for WASM and TARGET_POINTER_SIZE for other targets
  • Updates GetOffsetOfArgumentRegisters() to handle WASM like AMD64 Windows ABI by placing arguments after the transition block
  • Replaces all TARGET_POINTER_SIZE usage with TARGET_REGISTER_SIZE in offset calculations for special arguments

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

@radekdoulik
Copy link
Member Author

I wonder whether it would be cleaner to replace the parts (of the arg iterator and transition block) mentioning registers on wasm.

@radekdoulik radekdoulik enabled auto-merge (squash) October 13, 2025 14:17
@jkotas
Copy link
Member

jkotas commented Oct 13, 2025

I wonder whether it would be cleaner to replace the parts (of the arg iterator and transition block) mentioning registers on wasm.

I think it would be cleaner to decouple the arg iterator and wasm calling convention from the interpreter implementation details. I understand that this coupling is path of the least resistance at the moment, but I am not sure whether it is going to work well once we have AOT-compiled code in the picture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-VM-coreclr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants