Skip to content

Instantly share code, notes, and snippets.

@baobao
Last active December 7, 2018 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baobao/a3609fd6e62f19fefaf998eaab04fb14 to your computer and use it in GitHub Desktop.
Save baobao/a3609fd6e62f19fefaf998eaab04fb14 to your computer and use it in GitHub Desktop.
.method public hidebysig
instance int32 Main (
int32 piyo,
int32 bar,
int32 foo,
int32 hoge,
int32 piyopiyo
) cil managed
{
.maxstack 8
// 第1引数をスタックに乗せる
IL_0000: ldarg.1
// 第2引数をスタックに乗せる
IL_0001: ldarg.2
// スタックに乗っている2つの値を加算した結果をスタックに乗せる
IL_0002: add
// 第3引数をスタックに乗せる
IL_0003: ldarg.3
// スタックに乗っている第1引数と第2引数の加算値と第3引数を加算した結果をスタックに乗せる
IL_0004: add
// 第4引数からは変数名で取得するようだ
IL_0005: ldarg.s hoge
IL_0007: add
IL_0008: ldarg.s piyopiyo
IL_000a: add
// スタックに乗っている値を返す
IL_0003: ret
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment