Skip to content

Methods for getting indices and making loads and stores#500

Merged
pardeike merged 3 commits intopardeike:masterfrom
LoganDark:local-index
Oct 4, 2022
Merged

Methods for getting indices and making loads and stores#500
pardeike merged 3 commits intopardeike:masterfrom
LoganDark:local-index

Conversation

@LoganDark
Copy link
Copy Markdown
Contributor

Adds these extension methods on CodeInstruction:

  • LocalIndex, which returns the operand of any ldloc/ldloca/stloc, even the short forms or the fixed forms (i.e. ldloc.s or ldloc.1)

  • ArgIndex, which does the same but for ldarg/ldarga/starg

Adds these static helper methods to CodeInstruction:

  • LoadLocal, which allows you to produce an optimal load from an index, optionally loading the address

  • StoreLocal, which allows you to produce an optional store to an index

  • LoadArg, which allows you to produce an optimal load from an argument, optionally loading the address

  • StoreArg, which allows you to produce an optimal store to an argument

All of the methods are annotated with doc comments and include links to their counterparts via <seealso> references.

Please let me know if I got the names, documentation, or code style (I'm used to OTB) incorrect.

Adds these extension methods on CodeInstruction:

- LocalIndex, which returns the operand of any ldloc/ldloca/stloc, even
  the short forms or the fixed forms (i.e. ldloc.s or ldloc.1)

- ArgIndex, which does the same but for ldarg/ldarga/starg

Adds these static helper methods to CodeInstruction:

- LoadLocal, which allows you to produce an optimal load from an index,
  optionally loading the address

- StoreLocal, which allows you to produce an optional store to an index

- LoadArg, which allows you to produce an optimal load from an argument,
  optionally loading the address

- StoreArg, which allows you to produce an optimal store to an argument

All of the methods are annotated with doc comments and include links to
their counterparts via `<seealso>` references.
@LoganDark
Copy link
Copy Markdown
Contributor Author

LoganDark commented Oct 3, 2022

Marking as draft since I forgot to look into CodeMatch stuff

@LoganDark LoganDark marked this pull request as draft October 3, 2022 17:58
@LoganDark LoganDark marked this pull request as ready for review October 3, 2022 18:28
This adds four new static methods to CodeMatch:

- LoadsLocal which matches any local load (ldloc family)
- StoresLocal which matches any local store (stloc family)
- LoadsArgument which matches any argument load (ldarg family)
- StoresArgument which matches any argument store (starg family)

Matching specific indices can be done with the predicate and checking
the instruction LocalIndex or ArgIndex
@LoganDark LoganDark requested a review from pardeike October 3, 2022 18:49
@pardeike
Copy link
Copy Markdown
Owner

pardeike commented Oct 3, 2022

Almost done. Just the last rename. Code quality is great.

@LoganDark
Copy link
Copy Markdown
Contributor Author

Almost done. Just the last rename. Code quality is great.

What do you mean the last rename? I don't see any comments that I didn't address with my force-push. :)

@pardeike
Copy link
Copy Markdown
Owner

pardeike commented Oct 4, 2022

Extensions.cs:505

@LoganDark
Copy link
Copy Markdown
Contributor Author

Extensions.cs:505

There's no comment there. What did you want it changed to? ArgumentIndex?

I'm having trouble getting feedback on this one but I think this is
what we want?
@pardeike
Copy link
Copy Markdown
Owner

pardeike commented Oct 4, 2022 via email

@LoganDark
Copy link
Copy Markdown
Contributor Author

Yeah, as you see in my screenshot it shows Pending for me.

I can't actually see your screenshot (uh, did you post it somewhere?) but it says pending review because I re-requested after addressing your comments.

(If you sent a screenshot over email as an attachment, GitHub didn't put it in your comment.)

Does this look good to merge now?

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