-
Notifications
You must be signed in to change notification settings - Fork 63
Translate asm.md #183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translate asm.md #183
Conversation
d6effc6
to
5edb575
Compare
363d5f2
to
7d01a9b
Compare
レビューよろしくお願いします。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます。
一通り確認してコメントしました。
src/unsafe/asm.md
Outdated
--> | ||
これは、コンパイラが生成したアセンブリに、NOP (no operation) 命令を挿入します。 | ||
すべての`asm!`呼び出しは、`unsafe`ブロックの中になければいけません。 | ||
インラインアセンブリは任意の命令を挿入でき、本来不変のものを変更できてしまうからです。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
「不変のものを変更できてしまう」は「不変条件を壊してしまう」でしょうか。
必ずしもmutabilityのことだけではないと思うので。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正しました!
このコードは`ebx`がLLVMによって予約されたレジスタであるという制約を回避しています。 | ||
LLVMは、自身がレジスタを完全にコントロールし、 | ||
アセンブリブロックを抜ける前に元の状態を復元しなくてはならないと考えています。 | ||
そのため、コンパイラが`in(reg)`のような汎用レジスタクラスを満たすために使用する場合 **を除いて** `ebx`を入力や出力として利用できません。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
最後の文が抜けているようです。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
すみません、訳文を追加しました。
src/unsafe/asm.md
Outdated
By default, `asm!` assumes that any register not specified as an output will have its contents preserved by the assembly code. The [`clobber_abi`] argument to `asm!` tells the compiler to automatically insert the necessary clobber operands according to the given calling convention ABI: any register which is not fully preserved in that ABI will be treated as clobbered. Multiple `clobber_abi` arguments may be provided and all clobbers from all specified ABIs will be inserted. | ||
--> | ||
デフォルトでは、`asm!`は、出力として指定されていないレジスタはアセンブリコードによって保存される、と考えます。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
「保存される」というよりは「値が維持される(保たれる)」という感じでしょうか?
(保存されるだとアセンブリ中で明示的にどこかに保存される感じがします)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正しました!
Co-authored-by: dalance <dalance@gmail.com>
Co-authored-by: dalance <dalance@gmail.com>
ご対応ありがとうございます。 |
No description provided.