-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Programmable Label & Jump #11
Comments
bindは一度しかできないという制約を入れるのはありでしょうか。 Label AsmSmallProcedure()
{
Label label;
je(label);
return label;
}
Label label1;
bind(&label1);
Label label2 = AsmSmallProcedure();
link(label2, label1); // 空labelへのlinkは一度だけという制約を入れるかも。 とすることで同等の機能が実現できるという理解はあってますか。 |
ありだと思います.
|
ありがとうございます。ではその方向で実装を考えてみようと思います。制約はAutoGrowでないときに過去のラベルを全て保持しておかないといけなくなりそうなことから入れようかと思ってます。 |
実装してみました。link(label2, label1)はassignL(dstLabel, srcLabel);として定義しました(dstLabelのjmp先をsrcLabelと同じにするという挙動)。 |
ありがとうございます!! 試してみますですー. |
不具合、改善要望ありましたらお願いします。 |
@miura1729 may also benefit from this new feature :) iv/aero change Constellation/iv@c20c577 |
iv/aero change is now heavily tested by iv/lv5 test cases including
And currently there's no regression. Great! |
いきなりヘビーに使っていただいてありがとうございます&今まで面倒くさいやり方しかできなくてすいませんでした。 |
ラベルにリファレンスカウンタを入れて参照回数が0になったら定義済みラベルのリストから削除するようにしてみました。 小さいコードでは殆ど関係ないと思いますが、ある程度ステップ数が大きくてラベルが局所的なものが多いコードではこの修正はあったほうがうれしいでしょうか。 |
おおお, 確かに, local といったスコープがないので label が際限なく増えるのはまずいですね, ありがとうございます, 早速試してみます. |
rich_label branch のものの実装に入れ替え, test が全て通るのを確認しました! |
確認ありがとうございました。 |
declarative な label だけではなく, programmable な Label & Jump の concept と実装を提案します.
例えば, V8 assembler のように,
このようにすることで, asm fragments の module 化や, label の取り回しが便利になり,
例えば, iv/lv5/breaker がやってるように https://github.com/Constellation/iv/blob/master/iv/lv5/breaker/compiler.h#L2966
unique な文字列を生成してというようなやり方よりもより label の取り回しが簡単になるのではないかと考えています. このようにすることで, Label を宣言的でなく扱うことができ, 何かの動的な入力から動的にコードを出力したい場合, 特に JIT compiler にとっては非常に便利です.
また同時に, JSC Macro Assembler のように Jump というものも同時に提案します.
みたいにして記述することができると, 非常に取り回しが便利になるのではないでしょうか.
Label と Jump を組み合わせて,
というようなことができれば, 現在の declarative な label に加えて, programmable な label や jump というのが実現できるのではないかと考えています.
gen.link(&jump, &label)
やgen.link(&jump)
とするか,jump.link(gen, label)
のようにするかについては不明です.The text was updated successfully, but these errors were encountered: