Skip to content

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

Merged
merged 35 commits into from
Dec 18, 2023
Merged

Translate asm.md #183

merged 35 commits into from
Dec 18, 2023

Conversation

kdnakt
Copy link
Contributor

@kdnakt kdnakt commented Sep 2, 2023

No description provided.

@kdnakt kdnakt changed the title [WIP] Translate asm.md Translate asm.md Oct 16, 2023
@kdnakt
Copy link
Contributor Author

kdnakt commented Oct 16, 2023

レビューよろしくお願いします。

Copy link
Contributor

@dalance dalance left a comment

Choose a reason for hiding this comment

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

ありがとうございます。
一通り確認してコメントしました。

-->
これは、コンパイラが生成したアセンブリに、NOP (no operation) 命令を挿入します。
すべての`asm!`呼び出しは、`unsafe`ブロックの中になければいけません。
インラインアセンブリは任意の命令を挿入でき、本来不変のものを変更できてしまうからです。
Copy link
Contributor

Choose a reason for hiding this comment

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

「不変のものを変更できてしまう」は「不変条件を壊してしまう」でしょうか。
必ずしもmutabilityのことだけではないと思うので。

Copy link
Contributor Author

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`を入力や出力として利用できません。
Copy link
Contributor

Choose a reason for hiding this comment

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

最後の文が抜けているようです。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

すみません、訳文を追加しました。

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!`は、出力として指定されていないレジスタはアセンブリコードによって保存される、と考えます。
Copy link
Contributor

Choose a reason for hiding this comment

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

「保存される」というよりは「値が維持される(保たれる)」という感じでしょうか?
(保存されるだとアセンブリ中で明示的にどこかに保存される感じがします)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

修正しました!

kdnakt and others added 3 commits December 2, 2023 21:40
Co-authored-by: dalance <dalance@gmail.com>
Co-authored-by: dalance <dalance@gmail.com>
@dalance
Copy link
Contributor

dalance commented Dec 18, 2023

ご対応ありがとうございます。
問題なさそうなのでマージします。

@dalance dalance merged commit d451747 into rust-lang-ja:master Dec 18, 2023
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy