Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@martindevans
Copy link
Contributor

I'm using WACS to parse WASM files and read the instructions. The Global Get/Set instructions aren't very useful without these exposed!

Copilot AI review requested due to automatic review settings June 1, 2025 23:47
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 exposes the GlobalIdx property for Global Get/Set instructions in order to make them accessible for WASM file parsing. Key changes include:

  • Changing the private GlobalIdx field to a public property in InstGlobalGet.
  • Applying the same change in InstGlobalSet.
  • Removing excess whitespace at the file's end.

public InstGlobalGet() : base(ByteCode.GlobalGet, +1) { }

private GlobalIdx Index;
public GlobalIdx Index { get; private set; }
Copy link

Copilot AI Jun 1, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding XML documentation for the public Index property in InstGlobalGet to clarify its purpose and usage.

Copilot uses AI. Check for mistakes.
public InstGlobalSet() : base(ByteCode.GlobalSet, -1) { }

private GlobalIdx Index;
public GlobalIdx Index { get; private set; }
Copy link

Copilot AI Jun 1, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding XML documentation for the public Index property in InstGlobalSet to ensure consistency and clarity in its usage.

Copilot uses AI. Check for mistakes.
@kelnishi
Copy link
Owner

Instruction immediates should not be directly accessible. Changing these to a property will drastically impact execution performance. If you just need the value for inspecting the wasm bytecode, adding a getter to access the private field is a better option.

@kelnishi kelnishi closed this Jun 23, 2025
@martindevans
Copy link
Contributor Author

Thanks for the feedback. I'll open another PR with a GetIndex() function instead.

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.

2 participants