# HG changeset patch # User Takahiro SHIMIZU # Date 1527587099 -32400 # Node ID f5dac10540d78d0eba1cf576bcabc81f6fc6e9c8 # Parent 8c7be076e6e6f40614a28a8e77d3f3ad02706edb auto-Update generated slides by script diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/16/memo.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/16/memo.txt Tue May 29 18:44:59 2018 +0900 @@ -0,0 +1,110 @@ + MVMSpeshFactsが主に使われている構造体 + + 宣言元はfacts.h + +```c + struct MVMSpeshFacts { + /* Flags indicating things we know. */ + MVMint32 flags; + + /* The number of usages it has. */ + MVMint32 usages; + + /* Known type, if any. */ + MVMObject *type; + + /* Known type post-decontainerization, if any. */ + MVMObject *decont_type; + + /* Known value, if any. */ + union { + MVMObject *o; + MVMint64 i; + MVMnum64 n; + MVMString *s; + } value; + + /* The instruction that writes the register (noting we're in SSA form, so + * this is unique). */ + MVMSpeshIns *writer; + + /* The deoptimization index in effect at the point of declaration, or -1 + * if none yet. */ + MVMint32 deopt_idx; + + /* The log guard the facts depend on, if any. */ + MVMuint32 log_guard; + + /* Has the instruction that wrote this value been deleted? */ + MVMuint32 dead_writer; + }; +``` + +fact のflag一覧 + +```c +/* Various fact flags. */ +#define MVM_SPESH_FACT_KNOWN_TYPE 1 /* Has a known type. */ +#define MVM_SPESH_FACT_KNOWN_VALUE 2 /* Has a known value. */ +#define MVM_SPESH_FACT_DECONTED 4 /* Know it's decontainerized. */ +#define MVM_SPESH_FACT_CONCRETE 8 /* Know it's a concrete object. */ +#define MVM_SPESH_FACT_TYPEOBJ 16 /* Know it's a type object. */ +#define MVM_SPESH_FACT_KNOWN_DECONT_TYPE 32 /* Has a known type after decont. */ +#define MVM_SPESH_FACT_DECONT_CONCRETE 64 /* Is concrete after decont. */ +#define MVM_SPESH_FACT_DECONT_TYPEOBJ 128 /* Is a type object after decont. */ +#define MVM_SPESH_FACT_FROM_LOG_GUARD 256 /* Depends on a guard being met. */ +#define MVM_SPESH_FACT_HASH_ITER 512 /* Is an iter over hashes. */ +#define MVM_SPESH_FACT_ARRAY_ITER 1024 /* Is an iter over arrays + (mutually exclusive with HASH_ITER, but neither of them is nece ssarily set) */ +#define MVM_SPESH_FACT_KNOWN_BOX_SRC 2048 /* We know what register this value was boxed from */ +#define MVM_SPESH_FACT_MERGED_WITH_LOG_GUARD 4096 /* These facts were merged at a PHI node, but at least one of the incoming facts had a "from log guard" flag set, so we'll have to look for that fact and increment its uses if we u se this here fact. */ +#define MVM_SPESH_FACT_RW_CONT 8192 /* Known to be an rw container */ + +void MVM_spesh_facts_discover(MVMThreadContext *tc, MVMSpeshGraph *g, MVMSpeshPlanned *p); +void MVM_spesh_facts_depend(MVMThreadContext *tc, MVMSpeshGraph *g, + MVMSpeshFacts *target, MVMSpeshFacts *source); + +``` + + +`spesh/graph.h`の箇所 + +``` +/* An instruction in the spesh graph. */ +struct MVMSpeshIns { + /* Instruction information. */ + const MVMOpInfo *info; + + /* Operand information. */ + MVMSpeshOperand *operands; + + /* Previous and next instructions, within a basic block boundary. */ + MVMSpeshIns *prev; + MVMSpeshIns *next; + + /* Any annotations on the instruction. */ + MVMSpeshAnn *annotations; +}; + +``` + +`core/interp.h` + +``` +/* Information about an opcode. */ +struct MVMOpInfo { + MVMuint16 opcode; + const char *name; + char mark[2]; + MVMuint16 num_operands; + MVMuint8 pure; + MVMuint8 deopt_point; + MVMuint8 logged; + MVMuint8 no_inline; + MVMuint8 jittivity; + MVMuint8 uses_hll; + MVMuint8 operands[MVM_MAX_OPERANDS]; +}; + + +``` diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/18/memo.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/18/memo.txt Tue May 29 18:44:59 2018 +0900 @@ -0,0 +1,52 @@ + +moar.h + + +l.41あたり + +```c + /* Sized types. */ + typedef int8_t MVMint8; + typedef uint8_t MVMuint8; + typedef int16_t MVMint16; + typedef uint16_t MVMuint16; + typedef int32_t MVMint32; + typedef uint32_t MVMuint32; + typedef int64_t MVMint64; + typedef uint64_t MVMuint64; + typedef float MVMnum32; + typedef double MVMnum64; +``` + +ただのtypes のSizedのフラグ + +src/core/ops.h でdefineされている + + +ただの変数 + +``` +/* This file is generated from src/core/oplist by tools/update_ops.p6. */ + +/* Op name defines. */ +#define MVM_OP_no_op 0 +#define MVM_OP_const_i8 1 +#define MVM_OP_const_i16 2 +#define MVM_OP_const_i32 3 +#define MVM_OP_const_i64 4 +#define MVM_OP_const_n32 5 +#define MVM_OP_const_n64 6 +#define MVM_OP_const_s 7 +#define MVM_OP_set 8 +#define MVM_OP_extend_u8 9 +#define MVM_OP_extend_u16 10 +#define MVM_OP_extend_u32 11 +#define MVM_OP_extend_i8 12 +#define MVM_OP_extend_i16 13 +#define MVM_OP_extend_i32 14 +#define MVM_OP_trunc_u8 15 +#define MVM_OP_trunc_u16 16 +``` + +`ops.h`は874行でそれぞれの数に対してdefineされている. +わりと厳しい diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/18/zip.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/18/zip.txt Tue May 29 18:44:59 2018 +0900 @@ -0,0 +1,244 @@ +2018-05-14---- +今日の進捗 + +# MoarVMのJIT +* [Docs](https://github.com/MoarVM/MoarVM/tree/master/docs)を見る + +# Lego +* MoarMVのJITはLegoと呼ばれているらしい + +# DynASM +* Dynamic Assemler + * http://luajit.org/dynasm.html +* [luajit](http://luajit.org/)プロジェクトで作られているもの +* MoarVMには `3rdparty`ディレクトリ以下に展開されている +* x86アーキテクチャのJITコンパイル用のアセンブラのようなものらしい + * luaが`dasc`と呼ばれるCに近いアセンブラをCを出力する前に実行 + * Cのヘッダーの `#include` している部分を機械語にランタイムで翻訳 +* [GitHubのcommit](https://github.com/MoarVM/MoarVM/commit/372d0582ab90d4ddfc43553bbebe4e553a42278d) + +# DynASM + + +- To get you started, here is a simple code snippet to be pre-processed. The lines starting with '|' (the pipe symbol) are for DynASM: + +``` + if (ptr != NULL) { + | mov eax, foo+17 + | mov edx, [eax+esi*2+0x20] + | add ebx, [ecx+bar(ptr, 9)] + } +``` + +- After pre-processing you get: + +``` + if (ptr != NULL) { + dasm_put(Dst, 123, foo+17, bar(ptr, 9)); + } +``` + + + +---------- +2018-05-15---- +# ゼミ + +- 論文自体は昔のもの +- MoarVMどこが遅いのか? JITがアレ? +- 直接バイナリを吐かない理由は? + +- Comon Lisp Cに変換して生成したオブジェクトを作る + - その他の最適化はCコンパイラに投げる + - 京都で開発された 京都CommonLisp + - Lisp中でread evalループを持っていた + - interpretするルーチンがLISPで書かれている + - -->普段はCコンパイラが呼ばれない + - stack をlistの管理で行う + +- JITが遅いならCbCの入る場所がなさそう + +- 直接アセンブラを書いても良さそう + - MoarVMからCbCを吐く + +- 帯域脱出が問題 + - スタックの管理ならCbCでいけるかもしれない + - MoarVMの + +- 行き先を渡す +- 厳しいなら構造体にいれてあげる + - diコンテナ + - 見かけ上関数呼び出しっぽく書ける + +- Cの再実装 + - 比較して見る + - 頻度の高いif文を先に持っていって再構築 + +- CbC側を書き換えるのをどうするか + +---------- +2018-05-16---- + MVMSpeshFactsが主に使われている構造体 + + 宣言元はfacts.h + +```c + struct MVMSpeshFacts { + /* Flags indicating things we know. */ + MVMint32 flags; + + /* The number of usages it has. */ + MVMint32 usages; + + /* Known type, if any. */ + MVMObject *type; + + /* Known type post-decontainerization, if any. */ + MVMObject *decont_type; + + /* Known value, if any. */ + union { + MVMObject *o; + MVMint64 i; + MVMnum64 n; + MVMString *s; + } value; + + /* The instruction that writes the register (noting we're in SSA form, so + * this is unique). */ + MVMSpeshIns *writer; + + /* The deoptimization index in effect at the point of declaration, or -1 + * if none yet. */ + MVMint32 deopt_idx; + + /* The log guard the facts depend on, if any. */ + MVMuint32 log_guard; + + /* Has the instruction that wrote this value been deleted? */ + MVMuint32 dead_writer; + }; +``` + +fact のflag一覧 + +```c +/* Various fact flags. */ +#define MVM_SPESH_FACT_KNOWN_TYPE 1 /* Has a known type. */ +#define MVM_SPESH_FACT_KNOWN_VALUE 2 /* Has a known value. */ +#define MVM_SPESH_FACT_DECONTED 4 /* Know it's decontainerized. */ +#define MVM_SPESH_FACT_CONCRETE 8 /* Know it's a concrete object. */ +#define MVM_SPESH_FACT_TYPEOBJ 16 /* Know it's a type object. */ +#define MVM_SPESH_FACT_KNOWN_DECONT_TYPE 32 /* Has a known type after decont. */ +#define MVM_SPESH_FACT_DECONT_CONCRETE 64 /* Is concrete after decont. */ +#define MVM_SPESH_FACT_DECONT_TYPEOBJ 128 /* Is a type object after decont. */ +#define MVM_SPESH_FACT_FROM_LOG_GUARD 256 /* Depends on a guard being met. */ +#define MVM_SPESH_FACT_HASH_ITER 512 /* Is an iter over hashes. */ +#define MVM_SPESH_FACT_ARRAY_ITER 1024 /* Is an iter over arrays + (mutually exclusive with HASH_ITER, but neither of them is nece ssarily set) */ +#define MVM_SPESH_FACT_KNOWN_BOX_SRC 2048 /* We know what register this value was boxed from */ +#define MVM_SPESH_FACT_MERGED_WITH_LOG_GUARD 4096 /* These facts were merged at a PHI node, but at least one of the incoming facts had a "from log guard" flag set, so we'll have to look for that fact and increment its uses if we u se this here fact. */ +#define MVM_SPESH_FACT_RW_CONT 8192 /* Known to be an rw container */ + +void MVM_spesh_facts_discover(MVMThreadContext *tc, MVMSpeshGraph *g, MVMSpeshPlanned *p); +void MVM_spesh_facts_depend(MVMThreadContext *tc, MVMSpeshGraph *g, + MVMSpeshFacts *target, MVMSpeshFacts *source); + +``` + + +`spesh/graph.h`の箇所 + +``` +/* An instruction in the spesh graph. */ +struct MVMSpeshIns { + /* Instruction information. */ + const MVMOpInfo *info; + + /* Operand information. */ + MVMSpeshOperand *operands; + + /* Previous and next instructions, within a basic block boundary. */ + MVMSpeshIns *prev; + MVMSpeshIns *next; + + /* Any annotations on the instruction. */ + MVMSpeshAnn *annotations; +}; + +``` + +`core/interp.h` + +``` +/* Information about an opcode. */ +struct MVMOpInfo { + MVMuint16 opcode; + const char *name; + char mark[2]; + MVMuint16 num_operands; + MVMuint8 pure; + MVMuint8 deopt_point; + MVMuint8 logged; + MVMuint8 no_inline; + MVMuint8 jittivity; + MVMuint8 uses_hll; + MVMuint8 operands[MVM_MAX_OPERANDS]; +}; + + +``` + +---------- +2018-05-18---- + +moar.h + + +l.41あたり + +```c + /* Sized types. */ + typedef int8_t MVMint8; + typedef uint8_t MVMuint8; + typedef int16_t MVMint16; + typedef uint16_t MVMuint16; + typedef int32_t MVMint32; + typedef uint32_t MVMuint32; + typedef int64_t MVMint64; + typedef uint64_t MVMuint64; + typedef float MVMnum32; + typedef double MVMnum64; +``` + +ただのtypes のSizedのフラグ + +src/core/ops.h でdefineされている + + +ただの変数 + +``` +/* This file is generated from src/core/oplist by tools/update_ops.p6. */ + +/* Op name defines. */ +#define MVM_OP_no_op 0 +#define MVM_OP_const_i8 1 +#define MVM_OP_const_i16 2 +#define MVM_OP_const_i32 3 +#define MVM_OP_const_i64 4 +#define MVM_OP_const_n32 5 +#define MVM_OP_const_n64 6 +#define MVM_OP_const_s 7 +#define MVM_OP_set 8 +#define MVM_OP_extend_u8 9 +#define MVM_OP_extend_u16 10 +#define MVM_OP_extend_u32 11 +#define MVM_OP_extend_i8 12 +#define MVM_OP_extend_i16 13 +#define MVM_OP_extend_i32 14 +#define MVM_OP_trunc_u8 15 +#define MVM_OP_trunc_u16 16 +``` + +---------- diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/19/memo.txt diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/19/slide.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/19/slide.md Tue May 29 18:44:59 2018 +0900 @@ -0,0 +1,27 @@ +title: Perl入学式 +author: Takahiro Shimizu +profile: +lang: Japanese + +## SSID + +- `perl-entrance` + +## PW + +- `metacpan` + +# 研究目的 +- Perl5の後継言語として開発されているPerl6はMoarVMと呼ばれるVMを搭載している. +- Perl6はMoarVM,JVM,JavaScript上で動くRakudoと呼ばれる実装と,コンパイラ開発者用のサブセットであるNQPが主な実装となっている. +- 現在Perl6及びMoarVMは全体的な速度がPerl5と比較し低下しており,実務として利用できるレベルに達していない. +- さらにPerl6の実装自体巨大なcase-switch文など見通しが悪くなっている. +- この問題を解決するために現在当研究室で開発している継続を中心にしたContinuation based Cを用いて改良を行う +- CbCの設計理念からVMの実装と親和性が高い事も推測できる為,実際にCbCを用いてどのようにVMが実装できるかを検証する + +# 今週の進捗 +* foo + * puyohoge + +# 来週の予定 + diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/21/memo.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/21/memo.txt Tue May 29 18:44:59 2018 +0900 @@ -0,0 +1,75 @@ +VMMを用いて重要サービス + +- 多くの計算機では重要サービスが動作している +- 仮想計算機モニタ(VMM) + - OSへの通信要求を補足 + - 代理実行 + - 結果を返却 +- レジスタ値をもとに通信要求の内容を取得 + - レジスタ値で出来るのか + - レジスタ終了後のPCをシステムコール終了後のものにする +- ハイパーコール Xenのprocy Interface +- VMMの処理流れ + - socketやcloseを経由してFDを判別 + + 保護対象VMではシステムコール終了処理から再開する + - 代理実行処理が**事象待ち**を含むかどうか + +- socketとcloseの繰り返しでタイムスタンプを生成している + +1ms OSのスケジューラの感覚 + +特定されるプロセスがあるとダメなのでは...? + + +---- +# キャッシュファイルシステムによる下位キャッシュのアクセスの局所性の改善によるVM I/O性能の向上 + + + - 物理HDDへはページキャッシュが二重になっている + + - 下位キャッシュには最近使われていないデータ要求が溜まっている + - LRUが効果的に機能しない + + - 本来ならページキャッシュを変えていくのが望ましいが,今回は手前だけを実装する + - 先行研究 + - Chace FS + - missとhitを厳格にゲストFSでくくる為に強い局所性を持ち,I/O性能を高めている + - LFU Cache FS + - キャッシュ格納対象を動的に拡張 + - ホットスポットが既知でなくても実現される + - 時間的に局所性が高まっている + - ページキャッシュ内に実装することで性能が向上するのではないか + + - キャッシュの公平性は? + - 今現在は考えていない + +--- + +# オンライン処理とバッチ処理が混在する環境におけるディスクI/O制御方式 + +- オンライン処理とバッチ処理は異なる計算機とすることが多い +- オンライン処理とバッチ処理で計算機資源を十分に利用しないケースが多い + +- 計算機資源の利用効率向上を期待している + - バッチ処理ではdiscへのアクセスが多いが,オンライン処理では低い + + ===> 計算機資源をフラットにしたい + +- ディスクドライバはI/O要求を並列して処理できない + - オンライン処理では1,000バイト以下のものが多い + +- オンライン処理では同時実行処理が増えるとwriteシステムコールが発生し,待機される + +- I/O要求を細分化しキューにいれて順次処理を行う +- ディスクビジー率と処理時間の関係をシュミレーションする + + +- バッチ処理ではCPU優先制御が機能しているが,I/O制御を加えたほうが時間が大幅に減少している + +--- +# GearsOSのAgdaによる記述と検証 + + +--- + diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/22/memo.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/22/memo.txt Tue May 29 18:44:59 2018 +0900 @@ -0,0 +1,102 @@ +# Approximateネットワークに対する速性と計算精度の最適化基盤 + +- 2000年くらいから計算機は高速化を考えてきたが,クロックや消費電力などの問題があった +- そろそろこのトレードオフだけでは辛くなってきた + +- ムーア時代 + - 性能/電力効率を探求 +- 厳密さ + - 数の丸め誤差 + - 複数の出力が解となるアプリ ==> Perfect Executionは不要 +- ニューラルネットワークをアナログ演算回路で実現している + +- 昨今 + - 不真面目な計算機*真面目なネットワーク +- データ通信帯域が増加するにつれてエラー訂正がレイテンシを低下させてしまう +- Approximate Network + - 帯域10倍 + - 遅延増えない + - エラー放置 +- アプリによってビット誤りの許容が異なる + - ビットの保護する場所が変動する + - 保護するビットをマスクしてあげることで,エラーを考慮しない部分と見ていく +- 正しくない実行結果が出力されるパターンの近くを探索しない + +- OpenTunerによる探索空間を定義している + + + +# 大規模ソフトウェアにおけるコンパイル時間の定量的分析と高速化手法の提案 + +- 90%以上がコンパイラで締められている +- edit-compile-testのサイクルで開発を行っているので厳しい +- Incrementaal BuilDing + - GNU Make + - Ninja + - CMake +- ccache + - key-value-storeで管理している +- WebKit + - ほぼ毎日大規模ファイルをコンパイルする必要が出てきている +- コンパイラ単体のスループットを上げる必要がある + - 同一ヘッダーファイルのコンパイルが2千件行われている +- 再利用時には一貫性が保たれている必要がある +- Hello Worldのコンパイルが最大8.7倍 + +=> もともと並列性の高いものをターゲットにした場合 + --> オーバーヘッドを考える事はあまり無いのではないのか + +# Christie + +- ファイルシステムの問題点 + - 型がない + - トランザクションが提供されてない + - SQLですら厳しい + - 分散環境でアクセス方式が定まってない +- Christie + - Linda +- Christieの + +- ファイルシステムの型 + - 不整合時にどうするかの処理を付けないといけない +- annotationを使ったput/takeのもの + +- unixファイルシステムは木構造の名前管理構造を持っている + - ファイル自体もi-nodeを使った木構造が導入されている +- トランザクションの失敗の扱いを上手い具合にする + + + + +- メモリ自信のハードエラーは提案論文が少ない + +# カーネル内部データのプロセス間分離による堅牢性の向上 + +## Kernel Failure + +- エラー伝搬が発生するとKernel Failureを引き起こす可能性がある +- プロセスコンテキストに閉じて発生する +- プロセスローカルデータ(単一のプロセスコンテキストで使用されるデータ) + - カーネル内で共有するデータにエラーが伝搬した場合修復が難しい +- プロセスを強制終了させることでプログセスコンテキストを切り離す事ができる +- Software failer +- 'プロセスローカルエラー' + + +# 耐ビザンチン障害性を持つ分散合意手法の調査 + +- 決済システムなどでブロックチェーン技術が利用されている +- PoW +- PBFT ( Practical Byzantine Fault Tol) + - http://pmg.csail.mit.edu/papers/osdi99.pdf +- "スループット" +- rsocketをもちいた場合 + +[[Perl6]] + +* 具体的に遅い箇所を計測した方がいい +* どうやって計測を図るか +* コンパイラ構成論の資料を読んでオブジェクトパターンを理解しておく + +- Key Value Store + diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/25/memo.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/25/memo.txt Tue May 29 18:44:59 2018 +0900 @@ -0,0 +1,6 @@ +Perl6 + +- [助成金貰って高速化](http://news.perlfoundation.org/2017/11/perl-6-performance-and-reliabi-4.html) + - インライン展開周り + - インラインclosureが実装された + - dead codeを削除 diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/26/memo.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/26/memo.txt Tue May 29 18:44:59 2018 +0900 @@ -0,0 +1,3 @@ + +marking +- distributed snapshot diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/27/memo.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/27/memo.txt Tue May 29 18:44:59 2018 +0900 @@ -0,0 +1,3 @@ +- trap_swi + - システムコール + diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/28/memo.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/28/memo.txt Tue May 29 18:44:59 2018 +0900 @@ -0,0 +1,45 @@ +マシンを変えたからgccでコンパイルしようとすると厳しい + + +compiling 3rdparty/libuv/src/unix/fsevents.o +compiling 3rdparty/libuv/src/unix/timer.o +compiling 3rdparty/libuv/src/unix/tty.o +compiling 3rdparty/libuv/src/unix/udp.o +/Users/anatofuz/.plenv/versions/5.24.4/bin/perl5.24.4 build/mk-moar-pc.pl pkgconfig/moar.pc +In file included from /System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32, + from /System/Library/Frameworks/Security.framework/Headers/Security.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:27, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:22, + from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39, + from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:23, + from 3rdparty/libuv/src/unix/darwin-proctitle.c:33: +/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope + char bytes[kAuthorizationExternalFormLength]; + ^~~~~ +In file included from /System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32, + from /System/Library/Frameworks/Security.framework/Headers/Security.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:27, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:22, + from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39, + from 3rdparty/libuv/src/unix/fsevents.c:49: +/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope + char bytes[kAuthorizationExternalFormLength]; + ^~~~~ +In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:21, + from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9, + from /System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11, + from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35, + from 3rdparty/libuv/src/unix/darwin-proctitle.c:33: +/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:391:15: error: expected identifier or '(' before '^' token + typedef void (^CGPathApplyBlock)(const CGPathElement * element); + ^ +/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:393:53: error: unknown type name 'CGPathApplyBlock' + CG_EXTERN void CGPathApplyWithBlock(CGPathRef path, CGPathApplyBlock CF_NOESCAPE block) + ^~~~~~~~~~~~~~~~ +make: *** [3rdparty/libuv/src/unix/fsevents.o] Error 1 +make: *** Waiting for unfinished jobs.... +make: *** [3rdparty/libuv/src/unix/darwin-proctitle.o] Error 1 diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/29/memo.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/29/memo.txt Tue May 29 18:44:59 2018 +0900 @@ -0,0 +1,152 @@ + ❯ lldb -- /Users/anatofuz/workspace/cr/Basic/build_perl6/bin/moar nqp.moarvm examples/hello_world.nqp [13:52:54] +(lldb) target create "/Users/anatofuz/workspace/cr/Basic/build_perl6/bin/moar" +Current executable set to '/Users/anatofuz/workspace/cr/Basic/build_perl6/bin/moar' (x86_64). +(lldb) settings set -- target.run-args "nqp.moarvm" "examples/hello_world.nqp" +(lldb) b add_bb_facts +Breakpoint 1: where = libmoar.dylib`add_bb_facts + 32 at facts.c:362, address = 0x0000000000118540 +(lldb) c +error: invalid process +(lldb) run +Process 8479 launched: '/Users/anatofuz/workspace/cr/Basic/build_perl6/bin/moar' (x86_64) +Process 8479 stopped +* thread #2, stop reason = breakpoint 1.1 + frame #0: 0x00000001001bb540 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:362 + 359 MVMint32 i, is_phi; + 360 + 361 /* Look for instructions that provide or propagate facts. */ +-> 362 MVMSpeshIns *ins = bb->first_ins; + 363 while (ins) { + 364 /* See if there's deopt and logged annotations. Sync cur_deopt_idx + 365 * and, for logged+deopt-one, add logged facts and guards. */ +Target 0: (moar) stopped. +(lldb) bt +* thread #2, stop reason = breakpoint 1.1 + * frame #0: 0x00000001001bb540 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:362 + frame #1: 0x00000001001bb503 libmoar.dylib`MVM_spesh_facts_discover(tc=0x0000000100802e30, g=0x0000000100f4efe0, p=0x0000000100f514d0) at facts.c:659 + frame #2: 0x00000001001b4eb7 libmoar.dylib`MVM_spesh_candidate_add(tc=0x0000000100802e30, p=0x0000000100f514d0) at candidate.c:61 + frame #3: 0x00000001001cf991 libmoar.dylib`worker(tc=0x0000000100802e30, callsite=0x00000001006c9150, args=0x0000000000000000) at worker.c:16 + frame #4: 0x000000010014e8e2 libmoar.dylib`invoke_handler(tc=0x0000000100802e30, invokee=0x0000000102014840, callsite=0x00000001006c9150, args=0x0000000000000000) at MVMCFunction.c:9 + frame #5: 0x00000001000e8494 libmoar.dylib`thread_initial_invoke(tc=0x0000000100802e30, data=0x0000000100802050) at threads.c:59 + frame #6: 0x00000001000aefee libmoar.dylib`MVM_interp_run(tc=0x0000000100802e30, initial_invoke=(libmoar.dylib`thread_initial_invoke at threads.c:50), invoke_data=0x0000000100802050) at interp.c:93 + frame #7: 0x00000001000e7a35 libmoar.dylib`start_thread(data=0x0000000100802050) at threads.c:87 + frame #8: 0x00007fff7b9fe661 libsystem_pthread.dylib`_pthread_body + 340 + frame #9: 0x00007fff7b9fe50d libsystem_pthread.dylib`_pthread_start + 377 + frame #10: 0x00007fff7b9fdbf9 libsystem_pthread.dylib`thread_start + 13 + +(lldb) n +Process 8479 stopped +* thread #2, stop reason = step over + frame #0: 0x00000001001bb579 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:370 + 367 MVMSpeshAnn *ann_deopt_one = NULL; + 368 MVMSpeshAnn *ann_logged = NULL; + 369 MVMint32 is_deopt_ins = 0; +-> 370 while (ann) { + 371 switch (ann->type) { + 372 case MVM_SPESH_ANN_DEOPT_ONE_INS: + 373 ann_deopt_one = ann; +Target 0: (moar) stopped. +(lldb) +Process 8479 stopped +* thread #2, stop reason = step over + frame #0: 0x00000001001bb620 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:385 + 382 } + 383 ann = ann->next; + 384 } +-> 385 if (ann_deopt_one && ann_logged) + 386 log_facts(tc, g, bb, ins, p, ann_deopt_one, ann_logged); + 387 + 388 /* Look through operands for reads and writes. */ +Target 0: (moar) stopped. +(lldb) l + 389 is_phi = ins->info->opcode == MVM_SSA_PHI; + 390 for (i = 0; i < ins->info->num_operands; i++) { + 391 /* Reads need usage tracking; if the read is after a deopt point + 392 * relative to the write then give it an extra usage bump. */ + 393 if ((is_phi && i > 0) + 394 || (!is_phi && (ins->info->operands[i] & MVM_operand_rw_mask) == MVM_operand_read_reg)) { + 395 MVMSpeshFacts *facts = &(g->facts[ins->operands[i].reg.orig][ins->operands[i].reg.i]); +(lldb) l + 396 facts->usages += facts->deopt_idx == cur_deopt_idx ? 1 : 2; + 397 } + 398 + 399 /* Writes need the current deopt index and the writing instruction + 400 * to be specified. A write that's on a deopt instruction bumps + 401 * the usage too. */ + 402 if ((is_phi && i == 0) +(lldb) n +Process 8479 stopped +* thread #2, stop reason = step over + frame #0: 0x00000001001bb65b libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:389 + 386 log_facts(tc, g, bb, ins, p, ann_deopt_one, ann_logged); + 387 + 388 /* Look through operands for reads and writes. */ +-> 389 is_phi = ins->info->opcode == MVM_SSA_PHI; + 390 for (i = 0; i < ins->info->num_operands; i++) { + 391 /* Reads need usage tracking; if the read is after a deopt point + 392 * relative to the write then give it an extra usage bump. */ +Target 0: (moar) stopped. +(lldb) p MVM_SSA_PHI +error: use of undeclared identifier 'MVM_SSA_PHI' +(lldb) nexr +error: 'nexr' is not a valid command. +error: Unrecognized command 'nexr'. +(lldb) n +Process 8479 stopped +* thread #2, stop reason = step over + frame #0: 0x00000001001bb677 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:390 + 387 + 388 /* Look through operands for reads and writes. */ + 389 is_phi = ins->info->opcode == MVM_SSA_PHI; +-> 390 for (i = 0; i < ins->info->num_operands; i++) { + 391 /* Reads need usage tracking; if the read is after a deopt point + 392 * relative to the write then give it an extra usage bump. */ + 393 if ((is_phi && i > 0) +Target 0: (moar) stopped. +(lldb) p is_phi +(MVMint32) $14 = 0 +(lldb) p ins +(MVMSpeshIns *) $15 = 0x0000000102115e60 +(lldb) p *ins +(MVMSpeshIns) $16 = { + info = 0x00000001005757c0 + operands = 0x0000000000000000 + prev = 0x0000000000000000 + next = 0x0000000000000000 + annotations = 0x0000000000000000 +} +(lldb) p *ins->info +(MVMOpInfo) $17 = { + opcode = 0 + name = 0x00000001002def92 "no_op" + mark = { + [0] = ' ' + [1] = ' ' + } + num_operands = 0 + pure = '\0' + deopt_point = '\0' + logged = '\0' + no_inline = '\0' + jittivity = '\0' + uses_hll = '\0' + operands = ([0] = '\0', [1] = '\0', [2] = '\0', [3] = '\0', [4] = '\0', [5] = '\0', [6] = '\0', [7] = '\0') +} + + +* profilingの箇所を見ていく + +* perlスクリプトをperl6に移植する +* markdownのparserみたいなのを書き換えてみるなど +* タイトループを早くするのか,ここのハッシュを早くするのか,オブジェクトのオペレーションを早くするのか… +* 手近な場所をとにかく見ていきたい + +* native codeをやるのかvmをやるのか + +* bytecode interpureter, gc関連を書き直すという手もある + +* gcc vs clang + +* llvm側でtail coll呼び出す時はフラグを見ている + * code grarであるというフラグを渡している感じ + +* script言語--> 上手く並列化出来ない diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/29/slide.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/29/slide.md Tue May 29 18:44:59 2018 +0900 @@ -0,0 +1,146 @@ +title: CbCによるMoarVMの改良 +author: Takahiro Shimizu +profile: +lang: Japanese + + +# 研究目的 +- Perl5の後継言語として開発されているPerl6はMoarVMと呼ばれるVMを搭載している. +- Perl6はMoarVM,JVM,JavaScript上で動くRakudoと呼ばれる実装と,コンパイラ開発者用のサブセットであるNQPが主な実装となっている. +- 現在Perl6及びMoarVMは全体的な速度がPerl5と比較し低下しており,実務として利用できるレベルに達していない. +- さらにPerl6の実装自体巨大なswitch-case文など見通しが悪くなっている. +- この問題を解決するために現在当研究室で開発している継続を中心にしたContinuation based Cを用いて改良を行う +- CbCの設計理念からVMの実装と親和性が高い事も推測できる為,実際にCbCを用いてどのようにVMが実装できるかを検証する + +# 今週の進捗 + +* Perl6のnqpで遊んでいました +* いくつか記事を発見しました +* perl5の `perl-build` モジュールにPull Request送りました +* lldbでMoarVMを読んでいました + +# Perl6の過去の研究 + +* ある程度高速化はされているらしい +* [助成金貰って高速化が検討されていた](http://news.perlfoundation.org/2017/11/perl-6-performance-and-reliabi-4.html) + * インライン展開周り + * インラインclosureが実装された + * dead codeを削除 + * ...etc + + +# MoarVMのオペコード +* `src/core/ops.h` で定義されている +* `add_bb_facts` ではこのオペコードを使いswitch文を生成している +* トータル868個ほどのオペコードが設定されている + +``` + 4 #define MVM_OP_no_op 0 + 5 #define MVM_OP_const_i8 1 + 6 #define MVM_OP_const_i16 2 + 7 #define MVM_OP_const_i32 3 + 8 #define MVM_OP_const_i64 4 + 9 #define MVM_OP_const_n32 5 + 10 #define MVM_OP_const_n64 6 + 11 #define MVM_OP_const_s 7 + 12 #define MVM_OP_set 8 + 13 #define MVM_OP_extend_u8 9 + 14 #define MVM_OP_extend_u16 10 + 15 #define MVM_OP_extend_u32 11 +``` + +# debug用のMoarVM + +* gccでデバッグしよとすると相変わらず死ぬ + +``` +...skipping... + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:22 + from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39, + from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:23, + from 3rdparty/libuv/src/unix/darwin-proctitle.c:33: +/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope + char bytes[kAuthorizationExternalFormLength]; + ^~~~~ +In file included from /System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32, + from /System/Library/Frameworks/Security.framework/Headers/Security.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:27, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:22 + from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39, + from 3rdparty/libuv/src/unix/fsevents.c:49: +/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope + char bytes[kAuthorizationExternalFormLength]; + ^~~~~ +In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:21, + from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9, + from /System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11, + from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35, + from 3rdparty/libuv/src/unix/darwin-proctitle.c:33: +/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:391:15: error: expected identifier or '(' before '^' token + typedef void (^CGPathApplyBlock)(const CGPathElement * element); + ^ +/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:393:53: error: unknown type name 'CGPathApplyBlock' + CG_EXTERN void CGPathApplyWithBlock(CGPathRef path, CGPathApplyBlock CF_NOESCAPE block) + ^~~~~~~~~~~~~~~~ +make: *** [3rdparty/libuv/src/unix/fsevents.o] Error 1 +make: *** Waiting for unfinished jobs.... +make: *** [3rdparty/libuv/src/unix/darwin-proctitle.o] Error 1 +``` + +# やるべきこと + +* 具体的に遅い箇所を計測した方がいい +* どうやって計測を図るか +* コンパイラ構成論の資料を読んでオブジェクトパターンを理解しておく + + +# perl6の小ネタ + +* スマートマッチャー演算子 `~~` + +``` +> 'hoge' ~~ Str +True +``` + +* 継承一覧を取り出すには `.^mro` + +``` +> 'hoge'.^mro +((Str) (Cool) (Any) (Mu)) +> +``` + +* `^name` か `.WHAT` でクラスを取得できる + +``` +> 'hoge'.^name +Str +``` + +* `my @env_path = qx/echo $PATH/.split(':'); # Unix-based systems` + * `q:x` か `qq:x` でシェルを実行できる + +``` + my @env_path = qx/echo $PATH/.split(':') + [/usr/local/opt/qt/bin /Users/anatofuz/src/google-cloud-sdk/bin /Users/anatofuz/.pyenv/versions/3.6.5/bin /Users/anatofuz/.pyenv/shims /Users/anatofuz/.pyenv/bin /Users/anatofuz/.nodebrew/current/bin /Users/anatofuz/.rbenv/shims /usr/local/opt/gpg-agent/bin /Users/anatofuz/.plenv/shims /Users/anatofuz/.plenv/bin /usr/local/bin /usr/local/sbin /usr/bin /bin /usr/sbin /sbin /Library/TeX/texbin /opt/X11/bin /usr/local/opt/qt/bin /Users/anatofuz/src/google-cloud-sdk/bin /Users/anatofuz/.pyenv/versions/3.6.5/bin /Users/anatofuz/.pyenv/shims /Users/anatofuz/.pyenv/bin /Users/anatofuz/.nodebrew/current/bin /Users/anatofuz/.rbenv/shims /usr/local/opt/gpg-agent/bin /Users/anatofuz/.plenv/shims /Users/anatofuz/.plenv/bin /Users/anatofuz/workspace/go/bin /Users/anatofuz/workspace/go/bin + ] +``` + +# perl-build + +* plenvで使用しているモジュール +* cpanからPerlの最新バージョンを取得する +* search.cpanがshut downするのでmeta.cpanに移行したがhttps通信になったのでtarが入手できなくなった +* その部分のパッチを書いて送りました + + +# 来週の予定 + +* 明日から仙台に行ってきます + * 日曜日には戻ってきます +* OSCのネタとスライドをそろそろ作成していきます + * cbc周りの情報がほしい!! diff -r 8c7be076e6e6 -r f5dac10540d7 slides/2018/05/29/zip.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/29/zip.txt Tue May 29 18:44:59 2018 +0900 @@ -0,0 +1,311 @@ +2018-05-22---- +# Approximateネットワークに対する速性と計算精度の最適化基盤 + +- 2000年くらいから計算機は高速化を考えてきたが,クロックや消費電力などの問題があった +- そろそろこのトレードオフだけでは辛くなってきた + +- ムーア時代 + - 性能/電力効率を探求 +- 厳密さ + - 数の丸め誤差 + - 複数の出力が解となるアプリ ==> Perfect Executionは不要 +- ニューラルネットワークをアナログ演算回路で実現している + +- 昨今 + - 不真面目な計算機*真面目なネットワーク +- データ通信帯域が増加するにつれてエラー訂正がレイテンシを低下させてしまう +- Approximate Network + - 帯域10倍 + - 遅延増えない + - エラー放置 +- アプリによってビット誤りの許容が異なる + - ビットの保護する場所が変動する + - 保護するビットをマスクしてあげることで,エラーを考慮しない部分と見ていく +- 正しくない実行結果が出力されるパターンの近くを探索しない + +- OpenTunerによる探索空間を定義している + + + +# 大規模ソフトウェアにおけるコンパイル時間の定量的分析と高速化手法の提案 + +- 90%以上がコンパイラで締められている +- edit-compile-testのサイクルで開発を行っているので厳しい +- Incrementaal BuilDing + - GNU Make + - Ninja + - CMake +- ccache + - key-value-storeで管理している +- WebKit + - ほぼ毎日大規模ファイルをコンパイルする必要が出てきている +- コンパイラ単体のスループットを上げる必要がある + - 同一ヘッダーファイルのコンパイルが2千件行われている +- 再利用時には一貫性が保たれている必要がある +- Hello Worldのコンパイルが最大8.7倍 + +=> もともと並列性の高いものをターゲットにした場合 + --> オーバーヘッドを考える事はあまり無いのではないのか + +# Christie + +- ファイルシステムの問題点 + - 型がない + - トランザクションが提供されてない + - SQLですら厳しい + - 分散環境でアクセス方式が定まってない +- Christie + - Linda +- Christieの + +- ファイルシステムの型 + - 不整合時にどうするかの処理を付けないといけない +- annotationを使ったput/takeのもの + +- unixファイルシステムは木構造の名前管理構造を持っている + - ファイル自体もi-nodeを使った木構造が導入されている +- トランザクションの失敗の扱いを上手い具合にする + + + + +- メモリ自信のハードエラーは提案論文が少ない + +# カーネル内部データのプロセス間分離による堅牢性の向上 + +## Kernel Failure + +- エラー伝搬が発生するとKernel Failureを引き起こす可能性がある +- プロセスコンテキストに閉じて発生する +- プロセスローカルデータ(単一のプロセスコンテキストで使用されるデータ) + - カーネル内で共有するデータにエラーが伝搬した場合修復が難しい +- プロセスを強制終了させることでプログセスコンテキストを切り離す事ができる +- Software failer +- 'プロセスローカルエラー' + + +# 耐ビザンチン障害性を持つ分散合意手法の調査 + +- 決済システムなどでブロックチェーン技術が利用されている +- PoW +- PBFT ( Practical Byzantine Fault Tol) + - http://pmg.csail.mit.edu/papers/osdi99.pdf +- "スループット" +- rsocketをもちいた場合 + +[[Perl6]] + +* 具体的に遅い箇所を計測した方がいい +* どうやって計測を図るか +* コンパイラ構成論の資料を読んでオブジェクトパターンを理解しておく + +- Key Value Store + + +---------- +2018-05-25---- +Perl6 + +- [助成金貰って高速化](http://news.perlfoundation.org/2017/11/perl-6-performance-and-reliabi-4.html) + - インライン展開周り + - インラインclosureが実装された + - dead codeを削除 + +---------- +2018-05-26---- + +marking +- distributed snapshot + +---------- +2018-05-27---- +- trap_swi + - システムコール + + +---------- +2018-05-28---- +マシンを変えたからgccでコンパイルしようとすると厳しい + + +compiling 3rdparty/libuv/src/unix/fsevents.o +compiling 3rdparty/libuv/src/unix/timer.o +compiling 3rdparty/libuv/src/unix/tty.o +compiling 3rdparty/libuv/src/unix/udp.o +/Users/anatofuz/.plenv/versions/5.24.4/bin/perl5.24.4 build/mk-moar-pc.pl pkgconfig/moar.pc +In file included from /System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32, + from /System/Library/Frameworks/Security.framework/Headers/Security.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:27, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:22, + from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39, + from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:23, + from 3rdparty/libuv/src/unix/darwin-proctitle.c:33: +/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope + char bytes[kAuthorizationExternalFormLength]; + ^~~~~ +In file included from /System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32, + from /System/Library/Frameworks/Security.framework/Headers/Security.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:27, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:22, + from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39, + from 3rdparty/libuv/src/unix/fsevents.c:49: +/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope + char bytes[kAuthorizationExternalFormLength]; + ^~~~~ +In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:21, + from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9, + from /System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11, + from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35, + from 3rdparty/libuv/src/unix/darwin-proctitle.c:33: +/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:391:15: error: expected identifier or '(' before '^' token + typedef void (^CGPathApplyBlock)(const CGPathElement * element); + ^ +/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:393:53: error: unknown type name 'CGPathApplyBlock' + CG_EXTERN void CGPathApplyWithBlock(CGPathRef path, CGPathApplyBlock CF_NOESCAPE block) + ^~~~~~~~~~~~~~~~ +make: *** [3rdparty/libuv/src/unix/fsevents.o] Error 1 +make: *** Waiting for unfinished jobs.... +make: *** [3rdparty/libuv/src/unix/darwin-proctitle.o] Error 1 + +---------- +2018-05-29---- + ❯ lldb -- /Users/anatofuz/workspace/cr/Basic/build_perl6/bin/moar nqp.moarvm examples/hello_world.nqp [13:52:54] +(lldb) target create "/Users/anatofuz/workspace/cr/Basic/build_perl6/bin/moar" +Current executable set to '/Users/anatofuz/workspace/cr/Basic/build_perl6/bin/moar' (x86_64). +(lldb) settings set -- target.run-args "nqp.moarvm" "examples/hello_world.nqp" +(lldb) b add_bb_facts +Breakpoint 1: where = libmoar.dylib`add_bb_facts + 32 at facts.c:362, address = 0x0000000000118540 +(lldb) c +error: invalid process +(lldb) run +Process 8479 launched: '/Users/anatofuz/workspace/cr/Basic/build_perl6/bin/moar' (x86_64) +Process 8479 stopped +* thread #2, stop reason = breakpoint 1.1 + frame #0: 0x00000001001bb540 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:362 + 359 MVMint32 i, is_phi; + 360 + 361 /* Look for instructions that provide or propagate facts. */ +-> 362 MVMSpeshIns *ins = bb->first_ins; + 363 while (ins) { + 364 /* See if there's deopt and logged annotations. Sync cur_deopt_idx + 365 * and, for logged+deopt-one, add logged facts and guards. */ +Target 0: (moar) stopped. +(lldb) bt +* thread #2, stop reason = breakpoint 1.1 + * frame #0: 0x00000001001bb540 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:362 + frame #1: 0x00000001001bb503 libmoar.dylib`MVM_spesh_facts_discover(tc=0x0000000100802e30, g=0x0000000100f4efe0, p=0x0000000100f514d0) at facts.c:659 + frame #2: 0x00000001001b4eb7 libmoar.dylib`MVM_spesh_candidate_add(tc=0x0000000100802e30, p=0x0000000100f514d0) at candidate.c:61 + frame #3: 0x00000001001cf991 libmoar.dylib`worker(tc=0x0000000100802e30, callsite=0x00000001006c9150, args=0x0000000000000000) at worker.c:16 + frame #4: 0x000000010014e8e2 libmoar.dylib`invoke_handler(tc=0x0000000100802e30, invokee=0x0000000102014840, callsite=0x00000001006c9150, args=0x0000000000000000) at MVMCFunction.c:9 + frame #5: 0x00000001000e8494 libmoar.dylib`thread_initial_invoke(tc=0x0000000100802e30, data=0x0000000100802050) at threads.c:59 + frame #6: 0x00000001000aefee libmoar.dylib`MVM_interp_run(tc=0x0000000100802e30, initial_invoke=(libmoar.dylib`thread_initial_invoke at threads.c:50), invoke_data=0x0000000100802050) at interp.c:93 + frame #7: 0x00000001000e7a35 libmoar.dylib`start_thread(data=0x0000000100802050) at threads.c:87 + frame #8: 0x00007fff7b9fe661 libsystem_pthread.dylib`_pthread_body + 340 + frame #9: 0x00007fff7b9fe50d libsystem_pthread.dylib`_pthread_start + 377 + frame #10: 0x00007fff7b9fdbf9 libsystem_pthread.dylib`thread_start + 13 + +(lldb) n +Process 8479 stopped +* thread #2, stop reason = step over + frame #0: 0x00000001001bb579 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:370 + 367 MVMSpeshAnn *ann_deopt_one = NULL; + 368 MVMSpeshAnn *ann_logged = NULL; + 369 MVMint32 is_deopt_ins = 0; +-> 370 while (ann) { + 371 switch (ann->type) { + 372 case MVM_SPESH_ANN_DEOPT_ONE_INS: + 373 ann_deopt_one = ann; +Target 0: (moar) stopped. +(lldb) +Process 8479 stopped +* thread #2, stop reason = step over + frame #0: 0x00000001001bb620 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:385 + 382 } + 383 ann = ann->next; + 384 } +-> 385 if (ann_deopt_one && ann_logged) + 386 log_facts(tc, g, bb, ins, p, ann_deopt_one, ann_logged); + 387 + 388 /* Look through operands for reads and writes. */ +Target 0: (moar) stopped. +(lldb) l + 389 is_phi = ins->info->opcode == MVM_SSA_PHI; + 390 for (i = 0; i < ins->info->num_operands; i++) { + 391 /* Reads need usage tracking; if the read is after a deopt point + 392 * relative to the write then give it an extra usage bump. */ + 393 if ((is_phi && i > 0) + 394 || (!is_phi && (ins->info->operands[i] & MVM_operand_rw_mask) == MVM_operand_read_reg)) { + 395 MVMSpeshFacts *facts = &(g->facts[ins->operands[i].reg.orig][ins->operands[i].reg.i]); +(lldb) l + 396 facts->usages += facts->deopt_idx == cur_deopt_idx ? 1 : 2; + 397 } + 398 + 399 /* Writes need the current deopt index and the writing instruction + 400 * to be specified. A write that's on a deopt instruction bumps + 401 * the usage too. */ + 402 if ((is_phi && i == 0) +(lldb) n +Process 8479 stopped +* thread #2, stop reason = step over + frame #0: 0x00000001001bb65b libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:389 + 386 log_facts(tc, g, bb, ins, p, ann_deopt_one, ann_logged); + 387 + 388 /* Look through operands for reads and writes. */ +-> 389 is_phi = ins->info->opcode == MVM_SSA_PHI; + 390 for (i = 0; i < ins->info->num_operands; i++) { + 391 /* Reads need usage tracking; if the read is after a deopt point + 392 * relative to the write then give it an extra usage bump. */ +Target 0: (moar) stopped. +(lldb) p MVM_SSA_PHI +error: use of undeclared identifier 'MVM_SSA_PHI' +(lldb) nexr +error: 'nexr' is not a valid command. +error: Unrecognized command 'nexr'. +(lldb) n +Process 8479 stopped +* thread #2, stop reason = step over + frame #0: 0x00000001001bb677 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:390 + 387 + 388 /* Look through operands for reads and writes. */ + 389 is_phi = ins->info->opcode == MVM_SSA_PHI; +-> 390 for (i = 0; i < ins->info->num_operands; i++) { + 391 /* Reads need usage tracking; if the read is after a deopt point + 392 * relative to the write then give it an extra usage bump. */ + 393 if ((is_phi && i > 0) +Target 0: (moar) stopped. +(lldb) p is_phi +(MVMint32) $14 = 0 +(lldb) p ins +(MVMSpeshIns *) $15 = 0x0000000102115e60 +(lldb) p *ins +(MVMSpeshIns) $16 = { + info = 0x00000001005757c0 + operands = 0x0000000000000000 + prev = 0x0000000000000000 + next = 0x0000000000000000 + annotations = 0x0000000000000000 +} +(lldb) p *ins->info +(MVMOpInfo) $17 = { + opcode = 0 + name = 0x00000001002def92 "no_op" + mark = { + [0] = ' ' + [1] = ' ' + } + num_operands = 0 + pure = '\0' + deopt_point = '\0' + logged = '\0' + no_inline = '\0' + jittivity = '\0' + uses_hll = '\0' + operands = ([0] = '\0', [1] = '\0', [2] = '\0', [3] = '\0', [4] = '\0', [5] = '\0', [6] = '\0', [7] = '\0') +} + + +----------