2018-05-08---- 今日の進捗 - MoarVMの資料を読み解く - CbCで実装するべき場所を考察する ---------- 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)); } ``` ----------