SlideShare uma empresa Scribd logo
1 de 32
Baixar para ler offline
Dart VM の紹介
Outline


Dart VM 1.1



Dart2js 1.1



Dart VM の特長
2014/02/22 Dart Flight School 2014 Tokyo
nothingcosmos <nothingcosmos@gmail.com>
自己紹介


Twitter:nothingcosmos



名前 : 坂頂佑樹 所属 :



趣味 :OSS のコードを弄る



Blog:http://nothingcosmos.blog52.fc2.com/



Dart VM Advent Calender 2012
http://nothingcosmos.github.io/DartVM/index.html



Dart VM のソースコードリーディング
Dart VM のゴール
Dart VM 1.1


Dart VM とは、 JVM 、 V8 みたいなもの。



Dart のコードを JIT コンパイルして高速に実行可能



対応アーキテクチャは、 x86/x64/arm/mips



対応 OS は、 Linux/Windows/MacOS/Android



ここ半年で ARM + Android 対応完了



V8 より高速だが、 2 倍はいかない。
一時期はほぼ 2 倍差をつけたけど、その後
V8 が怒濤の追い込み。。
今は V8 の 40 ~ 50% 速いくらい
Computer Language Benchmark Games
x86 Ubuntu™ Intel® Q6600® one core
Dart / Java7

IO が List<int>
結構遅い

Java なのに GMP 使ってる
BigInteger 同士だと等速
Dart は簡易 regex engine のみ
ブラウザ搭載時に
Irregexp に置き換え
ここ 1 年くらいの Dart VM


2013/01 arm mips の skeleton を追加。 Typed array の高速な実装を追加



2013/02 mixin を追加開始



2013/03 Field type feedback 最適化を追加し、全体的に 30% 程度性能向上



2013/04 ARM と MIPS の simulator 上のコンパイル、動作確認



2013/06 On-Stack Replacement の追加



2013/07 NEON 対応。 Mirror の高速化



2013/08 Profile Guided Code Positioning の追加



2013/09 ARM 対応ほぼ完了。 vm service を追加開始



2013/10 Constant Blinding の追加。



2013/11 Dart 1.0 リリース



2013/12 Field 操作の mutable 化



2014/01 Dart 1.1 リリース
dart2js 1.1


Dart で開発されている、 Dart から JavaScript への変換
Dart VM がないブラウザでも動作可能



高速化中、手書きの JavaScript V8 と等速、ちょい速いくらい。



Dart 1.0 より、ベンチマークの Richard が 25% アップ。
http://news.dartlang.org/2014/01/dart-11-features-up-to-25-faster.html



いろいろと最適化を追加して高速化と出力 js の圧縮を頑張っている



ベンチマークは Octane や Dromaeo や Box2D っぽい。
Dart2js Tracer Benchmark
https://www.dartlang.org/performance/

SsaLoadElimination

type_graph_inferrer
Dart VM の特長
ここから VM の雑学


JIT コンパイル



Dart VM Architecture と Isolate



Snapshot と高速起動



Message passing と Event Driven



Optional Typing & Generics & Checked Mode



Dartium
Dart VM と JIT コンパイル (1)


インタプリタなし、 2 段階の JIT コンパイル



IRHydra がわかりやすい。
http://mrale.ph/irhydra/2/#demo-4

Entrypoint である mainscript を
SingleThreading で
JIT コンパイルしてから実行する

関数呼び出し fibo を見つける
fibo はまだコンパイルしていないため、
fibo 関数を JIT コンパイルする
Dart VM と JIT コンパイル (2)


最初の JIT コンパイルは、
どんな型でも動くように汎用コンパイル



型情報の収集を埋込

fibo 関数を JIT コンパイルした後、
fibo 関数の実行に戻る

fibo 関数を再帰的に実行
コンパイル済みの汎用コードを実行する
Dart VM と JIT コンパイル (3)


何度も実行される関数は、最適化 JIT コンパイル
収集した型情報を利用し、
型を特殊化してコンパイル、高速に実行可能
fibo 関数を何度も実行すると、
fibo 関数の最適化 JIT コンパイルが走る。
汎用的な fibo から、最適化した fibo に置き換え

Heap が足りなくなったら、
全体の動作を止めて、 GC を実行し、
heap を確保する。
Dart

Dart VM Architecture
Dart の世界
Debugger で
追える境界

sdk/lib/io

NativeSymbol
C++/Asm
OS/Kernel

sdk/lib
patch_class

VM の境界
Native Extensions
シンボルを定義

runtime/lib/*.cc
runtime/bin/*.cc
IO_NATIVES

BOOTSTRAP_
NATIVES

runtime/lib
runtime/bin
I/O や Network
を非同期に実行

runtime/platform

runtime/
include

runtime/vm
runtime/vm/os

OS(Linux, Windows,
MacOS, Android)

ISA(arch)
ia32/x64/arm/mips

VM が担当する
計算やリソース管理
Dart VM Isolate

Isolate 横断

BOOTSTRAP_NATIVES
Dart レイヤから C++ への binding/Native Extentions

JITCompiler のみ
インタプリタ無し

intrinsifier/runtime_entry

compiler

GC
Isolate ごとに
GC と heap

object
pool/code
heap
isolate

port_map
Message
Passing は
port 経由

dart
context

runtime
stubs
Dart_Api
include
Isolate 単位に独立
Single Threading で
動作する

thread_pool
OS の Process

VM の共有リソース
Isolate Spawn
ここより上の Dart のレイヤーには
Lock が存在しない

intrinsifier/runtime_entry
runtime
stubs

dart
context
object
pool/code

compiler
GC

heap

runtime
stubs
compiler
GC

isolate
Thread
port_map

isolate 間は port 経由で
message passing

dart
context
object
pool/code
heap

Spawn した
Isolate

Dart_Api
include

isolate
Lock は不要
独立して実行

Thread

thread_pool
OS の Process 共有リソースでは Lock するが、
非常に少ない。
Dart VM の特長
ここから VM の雑学


JIT コンパイル



Dart VM Architecture と Isolate



Snapshot と高速起動



Message passing と Event Driven



Optional Typing & Generics & Checked Mode



Dartium
Dart Snapshot


Dart VM の object の serialize/deserialize 機能
圧縮率と速度優先
アーキテクチャ非互換 (x86-x64-ARM 間の相互変換は不可能 )



起動の高速化



MessagePassing の際の serialize/deserialize にも使用する。
serialize した object を port 経由で送受信する。



自分の作ったライブラリもあらかじめ snapshot できる。



大体 JSON と同じだけど、追加で VM の内部 object も対象。
VM 起動の高速化


Dart VM は make の際に、 2 回 build を行う。
1 回目は dart_no_snapshot を build し、 SDK の core を読み込み起動。
core の dart src を scan し、 snapshot 、 snapshot_buffer[] に書き出し。



2 回目で snapshot_buffer[] を取り込んで dart を build する。 +400kbyte
dart は Core の I/O と Scan を skip できるので、起動時間が短縮できる。
--time-bootstrap オプションで比較可能。



bootstrap が短縮、 100,000micros -> 100micros



Core の dart src を read して scan vs. binary から直接 deserialize
bootstrap の短縮
fibo(40) の実行時間 (ms)

130ms
540
dart_no_snapshot

410
fibo
time

20ms

起動時のオー
430 バーヘッドが 1/6
scan が 100ms
410 から 0.1ms に

dart

0

100

200

300

400

500

600
Isolate 間の MessagePassing
SnapshotWriter
serialize

SnapshotReader
deserialize

Isolate
Message
HandlerTask

Isolate
Message
Handler

Message
Handler

Thread

Message
HandlerTask
Thread

port_map
相手の Isolate に
message を送る
ReceivePort を
全部 mapping してある
Isolate の StartUp(1)
main が終わったら、
MessageHandler で
EventLoop

Task が
Thread を生成
1 個だけ
Isolate の初期化

Main script
Async micro task
残っている限り
仕事し続ける。

Isolate
Message
HandlerTask

Message
Handler

Thread
thread
pool

dart.cc の
main() 関数

port_map

並行して
Message
Receive
Isolate の StartUp(2)
main が終わったら、
MessageHandler で
EventLoop

Main script
async task が
残っている限り
仕事し続ける。

Isolate
Message
HandlerTask

Message
Handler

Thread

Message
Receive

port_map

Unhandled exception:
type 'double' is not a subtype of type 'int' of 'num'.
#0
func (file:///syntax/lib/diff/future.dart:28:13)
#1
main (file:///syntax/lib/diff/future.dart:33:7)
#2
_startIsolate.isolateStartHandler (dart:isolate-patch/isolate_patch.dart:216)
#3
_RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:115)
MessageHandler and EventLoop


https://www.dartlang.org/articles/event­loop/



Async 系の microtask は mainscript が
終了後に実行する。

2.streamFibo
3.scheduleMicroTask
5.run microTask

1.main の起動
6.async task

4.main 終了
MessageHandler and EventLoop

#4
#5
#6
#7
#8
#9
#10
#11
#12
#13

Stream.forEach.<anonymous closure> (dart:async/stream.dart:473)
2.streamFibo
_rootRunUnary (dart:async/zone.dart:695)
_RootZone.runUnary (dart:async/zone.dart:834)
_BaseZone.runUnaryGuarded (dart:async/zone.dart:546)
3.Loop
_BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
_DelayedData.perform (dart:async/stream_impl.dart:585)
_StreamImplEvents.handleNext (dart:async/stream_impl.dart:701)
_PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:661)
_asyncRunCallback (dart:async/schedule_microtask.dart:18)
_RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:119)

仮にここの async で error になったら
EventLoop And Zone


Zone は RootZone から parent が fork して
木構造でつながる。



scheduleMicrotask で 1Thrad で順次実行
Zone の木構造を辿り実行

zone

root_zone

zone
Dart VM の特長
ここから VM の雑学


JIT コンパイル



Dart VM Architecture と Isolate



Snapshot と高速起動



Message passing と Event Driven



Optional Typing & Generics & Checked Mode



Dartium
Dart Optional Typing


Dart には production mode と checked mode がある。



Dart には 3 つのフェーズがある。




compile フェーズ。 script 実行前の jit compile 時に error/warning 検出





analyzer フェーズ。 IDE による error/warning の検出
runtime フェーズ。実行時の型情報を validation する。

checked mode では、 compile フェーズで型エラー /warning を無視しない。
compile 時に型情報の validation 命令を挿入し、実行時に assert する。



Dart の型は、 type annotation による validation と割り切っている。
validation のタイミングは上記 3 つ。 runtime に影響を与えない。
Dart Optional Typing


Dart の型の違反は、基本的に warning 扱い



何が error で何が warning かは、他の言語と比較すると結構曖昧かも。
Breaking on exception:
type 'double' is not a subtype of type 'int' of 'num'.

int sum = 100 + 100.0;

int num = 100.0;

IDE/ コンパイル時に warning と分かるし、
binaryoperator(+) の 2 引数の validation 命令を
JIT コンパイル時に挿入する。
実行時に validation されて warning

こちらは = の assign に validation 版の命令を
JIT コンパイル時に挿入する。
実行時に validation されて warning

Breaking on exception:
type 'double' is not a subtype of type 'int' of 'num'.
Dart Generics


Class の Reified Generics のみ ( 型パラメータを保存する領域あり )
Generics を使用した場合のみ、 Class のインスタンスを new する際に、
型パラメータを保存する命令を挿入する。
TypeArguments っていう IR が存在する。



型パラメータは、実行時にいつでも参照できる。



Method generics は存在しない。



型パラメータを参照するのは、 checked mode のみ。
Generics の型パラメータも validation される。
Dartium
dartium
標準化された API を
IDL から自動生成
dartium 連携用

native
symbol

Web IDL
Auto-generated library
sdk/lib/html

dart runtime

sdk/lib

dartium で定義された
シンボルを Native Extensions
を使用して直接呼出て連携する。

runtime/
include

dartium からの制御は
include で定義された
API 経由で
dart runtime に指示
Dartium の binding

dartium/src/third_party/WebKit/Source/bindings/dart
dartium/src/third_party/WebKit/Source/bindings/v8

Bindings (Dart API)

JavaScript
V8

Dart VM

Dart のページを読み込んだ場合のみ起動
VM の遅延ローディング
今後の予想


Chrome に Dart VM を搭載するのでは。早ければ 2015 年?
WebKit から Blink になりましたし、邪魔する人はいないはず



まずは Oilpan(GC for Blink) でメモリリークを解消してから?
http://goo.gl/gCugZ4



ARM + Android 上でも動くため、
モバイルの Chrome にも問題なく搭載できるのでは?



モバイル最速の VM かもだけど、
V8 と Dart VM の同時起動はメモリ食いそう。。

Mais conteúdo relacionado

Mais procurados

Node.jsv0.8からv4.xへのバージョンアップ ~大規模Push通知基盤の運用事例~
Node.jsv0.8からv4.xへのバージョンアップ ~大規模Push通知基盤の運用事例~Node.jsv0.8からv4.xへのバージョンアップ ~大規模Push通知基盤の運用事例~
Node.jsv0.8からv4.xへのバージョンアップ ~大規模Push通知基盤の運用事例~Recruit Technologies
 
java.lang.OutOfMemoryError #渋谷java
java.lang.OutOfMemoryError #渋谷javajava.lang.OutOfMemoryError #渋谷java
java.lang.OutOfMemoryError #渋谷javaYuji Kubota
 
Zynq VIPを利用したテストベンチ
Zynq VIPを利用したテストベンチZynq VIPを利用したテストベンチ
Zynq VIPを利用したテストベンチMr. Vengineer
 
組み込みスクリプト言語Mrubyを利用したwebサーバの機能拡張支援機構
組み込みスクリプト言語Mrubyを利用したwebサーバの機能拡張支援機構組み込みスクリプト言語Mrubyを利用したwebサーバの機能拡張支援機構
組み込みスクリプト言語Mrubyを利用したwebサーバの機能拡張支援機構Ryosuke MATSUMOTO
 
Wardenで学ぶコンテナの基礎
Wardenで学ぶコンテナの基礎Wardenで学ぶコンテナの基礎
Wardenで学ぶコンテナの基礎Hiroaki_UKAJI
 
Zynq MPSoC勉強会 Codec編
Zynq MPSoC勉強会 Codec編Zynq MPSoC勉強会 Codec編
Zynq MPSoC勉強会 Codec編Tetsuya Morizumi
 
JVM のいろはにほ #javajo
JVM のいろはにほ #javajoJVM のいろはにほ #javajo
JVM のいろはにほ #javajoYuji Kubota
 
負荷がたかいいんだから~♪(仮)
負荷がたかいいんだから~♪(仮)負荷がたかいいんだから~♪(仮)
負荷がたかいいんだから~♪(仮)Yohei Hamada
 
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)Mr. Vengineer
 
Serf / Consul 入門 ~仕事を楽しくしよう~
Serf / Consul 入門 ~仕事を楽しくしよう~Serf / Consul 入門 ~仕事を楽しくしよう~
Serf / Consul 入門 ~仕事を楽しくしよう~Masahito Zembutsu
 
仮想化環境での利用者公平性
仮想化環境での利用者公平性仮想化環境での利用者公平性
仮想化環境での利用者公平性Takuya ASADA
 
「前回の COMSTAR ネタに刺激されてしまったので、オレも COMSTAR を使ってみた。」(仮)
「前回の COMSTAR ネタに刺激されてしまったので、オレも COMSTAR を使ってみた。」(仮)「前回の COMSTAR ネタに刺激されてしまったので、オレも COMSTAR を使ってみた。」(仮)
「前回の COMSTAR ネタに刺激されてしまったので、オレも COMSTAR を使ってみた。」(仮)Kazuyuki Sato
 
ゲームインフラコンテナ実践導入
ゲームインフラコンテナ実践導入ゲームインフラコンテナ実践導入
ゲームインフラコンテナ実践導入Hiroki Tamiya
 
GraalVMを3つの主機能から眺めてみよう(Oracle Groundbreakers APAC Virtual Tour 2020 講演資料)
GraalVMを3つの主機能から眺めてみよう(Oracle Groundbreakers APAC Virtual Tour 2020 講演資料)GraalVMを3つの主機能から眺めてみよう(Oracle Groundbreakers APAC Virtual Tour 2020 講演資料)
GraalVMを3つの主機能から眺めてみよう(Oracle Groundbreakers APAC Virtual Tour 2020 講演資料)NTT DATA Technology & Innovation
 
Open-FCoE_osc2011tokyofall_20111119
Open-FCoE_osc2011tokyofall_20111119Open-FCoE_osc2011tokyofall_20111119
Open-FCoE_osc2011tokyofall_20111119metamd
 
自動でできるかな?
自動でできるかな?自動でできるかな?
自動でできるかな?_norin_
 

Mais procurados (20)

Node.jsv0.8からv4.xへのバージョンアップ ~大規模Push通知基盤の運用事例~
Node.jsv0.8からv4.xへのバージョンアップ ~大規模Push通知基盤の運用事例~Node.jsv0.8からv4.xへのバージョンアップ ~大規模Push通知基盤の運用事例~
Node.jsv0.8からv4.xへのバージョンアップ ~大規模Push通知基盤の運用事例~
 
java.lang.OutOfMemoryError #渋谷java
java.lang.OutOfMemoryError #渋谷javajava.lang.OutOfMemoryError #渋谷java
java.lang.OutOfMemoryError #渋谷java
 
LXDのすすめ
LXDのすすめLXDのすすめ
LXDのすすめ
 
Zynq VIPを利用したテストベンチ
Zynq VIPを利用したテストベンチZynq VIPを利用したテストベンチ
Zynq VIPを利用したテストベンチ
 
組み込みスクリプト言語Mrubyを利用したwebサーバの機能拡張支援機構
組み込みスクリプト言語Mrubyを利用したwebサーバの機能拡張支援機構組み込みスクリプト言語Mrubyを利用したwebサーバの機能拡張支援機構
組み込みスクリプト言語Mrubyを利用したwebサーバの機能拡張支援機構
 
UE4におけるLoadingとGCのProfilingと最適化手法
UE4におけるLoadingとGCのProfilingと最適化手法UE4におけるLoadingとGCのProfilingと最適化手法
UE4におけるLoadingとGCのProfilingと最適化手法
 
Wardenで学ぶコンテナの基礎
Wardenで学ぶコンテナの基礎Wardenで学ぶコンテナの基礎
Wardenで学ぶコンテナの基礎
 
Zynq MPSoC勉強会 Codec編
Zynq MPSoC勉強会 Codec編Zynq MPSoC勉強会 Codec編
Zynq MPSoC勉強会 Codec編
 
JVM のいろはにほ #javajo
JVM のいろはにほ #javajoJVM のいろはにほ #javajo
JVM のいろはにほ #javajo
 
負荷がたかいいんだから~♪(仮)
負荷がたかいいんだから~♪(仮)負荷がたかいいんだから~♪(仮)
負荷がたかいいんだから~♪(仮)
 
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)
 
Serf / Consul 入門 ~仕事を楽しくしよう~
Serf / Consul 入門 ~仕事を楽しくしよう~Serf / Consul 入門 ~仕事を楽しくしよう~
Serf / Consul 入門 ~仕事を楽しくしよう~
 
仮想化環境での利用者公平性
仮想化環境での利用者公平性仮想化環境での利用者公平性
仮想化環境での利用者公平性
 
VyOSでMPLS
VyOSでMPLSVyOSでMPLS
VyOSでMPLS
 
「前回の COMSTAR ネタに刺激されてしまったので、オレも COMSTAR を使ってみた。」(仮)
「前回の COMSTAR ネタに刺激されてしまったので、オレも COMSTAR を使ってみた。」(仮)「前回の COMSTAR ネタに刺激されてしまったので、オレも COMSTAR を使ってみた。」(仮)
「前回の COMSTAR ネタに刺激されてしまったので、オレも COMSTAR を使ってみた。」(仮)
 
ゲームインフラコンテナ実践導入
ゲームインフラコンテナ実践導入ゲームインフラコンテナ実践導入
ゲームインフラコンテナ実践導入
 
GraalVMを3つの主機能から眺めてみよう(Oracle Groundbreakers APAC Virtual Tour 2020 講演資料)
GraalVMを3つの主機能から眺めてみよう(Oracle Groundbreakers APAC Virtual Tour 2020 講演資料)GraalVMを3つの主機能から眺めてみよう(Oracle Groundbreakers APAC Virtual Tour 2020 講演資料)
GraalVMを3つの主機能から眺めてみよう(Oracle Groundbreakers APAC Virtual Tour 2020 講演資料)
 
ドリコムのインフラCI
ドリコムのインフラCIドリコムのインフラCI
ドリコムのインフラCI
 
Open-FCoE_osc2011tokyofall_20111119
Open-FCoE_osc2011tokyofall_20111119Open-FCoE_osc2011tokyofall_20111119
Open-FCoE_osc2011tokyofall_20111119
 
自動でできるかな?
自動でできるかな?自動でできるかな?
自動でできるかな?
 

Destaque

Aspergillosis Patients Support Meeting June 2011 - Nigel Clayton
Aspergillosis Patients Support Meeting June 2011 - Nigel ClaytonAspergillosis Patients Support Meeting June 2011 - Nigel Clayton
Aspergillosis Patients Support Meeting June 2011 - Nigel ClaytonGraham Atherton
 
Introduction to Chemical Bonding
Introduction to Chemical BondingIntroduction to Chemical Bonding
Introduction to Chemical BondingBryan Nozaleda
 
Anielle And Melissa Pitch
Anielle And Melissa PitchAnielle And Melissa Pitch
Anielle And Melissa Pitchsalesianas2011
 
Kcm 03 10 (1)
Kcm 03 10 (1)Kcm 03 10 (1)
Kcm 03 10 (1)bweis1
 
Makalah tik
Makalah tikMakalah tik
Makalah tikJay
 
PP Eurocall Conference 2015
PP Eurocall  Conference 2015PP Eurocall  Conference 2015
PP Eurocall Conference 2015Anke Berns
 
Musica E Sport Roma
Musica E Sport RomaMusica E Sport Roma
Musica E Sport Romavivifris
 
6 oct esport i valors
6 oct esport i valors6 oct esport i valors
6 oct esport i valorsxaviruiz74
 
The Woodlands Real Estate Market Update 2013
The Woodlands Real Estate Market Update 2013The Woodlands Real Estate Market Update 2013
The Woodlands Real Estate Market Update 2013Tanya Lavoie Bugbee
 
Aspergillosis Patient Support Meeting March 2011 - Jane Mabey Gilsenan
Aspergillosis Patient Support Meeting March 2011 - Jane Mabey GilsenanAspergillosis Patient Support Meeting March 2011 - Jane Mabey Gilsenan
Aspergillosis Patient Support Meeting March 2011 - Jane Mabey GilsenanGraham Atherton
 
Minggu 1 pendahuluan
Minggu 1   pendahuluanMinggu 1   pendahuluan
Minggu 1 pendahuluanahmadmaurits
 
Terminkalender
TerminkalenderTerminkalender
TerminkalenderAnke Berns
 
Lecture 13 unemployment
Lecture 13 unemploymentLecture 13 unemployment
Lecture 13 unemploymentGale Pooley
 
Daniel goodwin real estate law 140914
Daniel goodwin   real estate law 140914Daniel goodwin   real estate law 140914
Daniel goodwin real estate law 140914Gale Pooley
 

Destaque (20)

Aspergillosis Patients Support Meeting June 2011 - Nigel Clayton
Aspergillosis Patients Support Meeting June 2011 - Nigel ClaytonAspergillosis Patients Support Meeting June 2011 - Nigel Clayton
Aspergillosis Patients Support Meeting June 2011 - Nigel Clayton
 
Introduction to Chemical Bonding
Introduction to Chemical BondingIntroduction to Chemical Bonding
Introduction to Chemical Bonding
 
Anielle And Melissa Pitch
Anielle And Melissa PitchAnielle And Melissa Pitch
Anielle And Melissa Pitch
 
Dhvm
DhvmDhvm
Dhvm
 
Kcm 03 10 (1)
Kcm 03 10 (1)Kcm 03 10 (1)
Kcm 03 10 (1)
 
Makalah tik
Makalah tikMakalah tik
Makalah tik
 
A Terra vista do céu !
A Terra vista do céu !A Terra vista do céu !
A Terra vista do céu !
 
PP Eurocall Conference 2015
PP Eurocall  Conference 2015PP Eurocall  Conference 2015
PP Eurocall Conference 2015
 
Musica E Sport Roma
Musica E Sport RomaMusica E Sport Roma
Musica E Sport Roma
 
6 oct esport i valors
6 oct esport i valors6 oct esport i valors
6 oct esport i valors
 
Oil economics 1
Oil economics 1Oil economics 1
Oil economics 1
 
The Woodlands Real Estate Market Update 2013
The Woodlands Real Estate Market Update 2013The Woodlands Real Estate Market Update 2013
The Woodlands Real Estate Market Update 2013
 
Tprgroup
TprgroupTprgroup
Tprgroup
 
Aspergillosis Patient Support Meeting March 2011 - Jane Mabey Gilsenan
Aspergillosis Patient Support Meeting March 2011 - Jane Mabey GilsenanAspergillosis Patient Support Meeting March 2011 - Jane Mabey Gilsenan
Aspergillosis Patient Support Meeting March 2011 - Jane Mabey Gilsenan
 
Minggu 1 pendahuluan
Minggu 1   pendahuluanMinggu 1   pendahuluan
Minggu 1 pendahuluan
 
AR Browsers
AR BrowsersAR Browsers
AR Browsers
 
Terminkalender
TerminkalenderTerminkalender
Terminkalender
 
Lecture 13 unemployment
Lecture 13 unemploymentLecture 13 unemployment
Lecture 13 unemployment
 
About me
About meAbout me
About me
 
Daniel goodwin real estate law 140914
Daniel goodwin   real estate law 140914Daniel goodwin   real estate law 140914
Daniel goodwin real estate law 140914
 

Semelhante a 2014 dart flight school in Tokyo

Rubyで創るOpenFlowネットワーク - LLまつり
Rubyで創るOpenFlowネットワーク - LLまつりRubyで創るOpenFlowネットワーク - LLまつり
Rubyで創るOpenFlowネットワーク - LLまつりYuya Rin
 
2014 1018 OSC-Fall Tokyo NETMF
2014 1018 OSC-Fall Tokyo NETMF2014 1018 OSC-Fall Tokyo NETMF
2014 1018 OSC-Fall Tokyo NETMFAtomu Hidaka
 
MaxScaleを触ってみた
MaxScaleを触ってみたMaxScaleを触ってみた
MaxScaleを触ってみたFujishiro Takuya
 
Xilinx SDSoC(2016.2)解体新書ソフトウェア編
Xilinx SDSoC(2016.2)解体新書ソフトウェア編Xilinx SDSoC(2016.2)解体新書ソフトウェア編
Xilinx SDSoC(2016.2)解体新書ソフトウェア編Mr. Vengineer
 
JTF2020 クロスコンパイルだけが能ではない組み込みLinuxシステムのCI/CDインフラ構築
JTF2020 クロスコンパイルだけが能ではない組み込みLinuxシステムのCI/CDインフラ構築JTF2020 クロスコンパイルだけが能ではない組み込みLinuxシステムのCI/CDインフラ構築
JTF2020 クロスコンパイルだけが能ではない組み込みLinuxシステムのCI/CDインフラ構築yaegashi
 
CMake multiplatform build-tool
CMake multiplatform build-toolCMake multiplatform build-tool
CMake multiplatform build-toolNaruto TAKAHASHI
 
Docker ComposeでMastodonが必要なものを梱包する話
Docker ComposeでMastodonが必要なものを梱包する話Docker ComposeでMastodonが必要なものを梱包する話
Docker ComposeでMastodonが必要なものを梱包する話Masahito Zembutsu
 
SCUGJ第18回勉強会:よろしい、ならばVMMだ
SCUGJ第18回勉強会:よろしい、ならばVMMだSCUGJ第18回勉強会:よろしい、ならばVMMだ
SCUGJ第18回勉強会:よろしい、ならばVMMだwind06106
 
JavaScript.Next
JavaScript.NextJavaScript.Next
JavaScript.Nextdynamis
 
Apache cloudstack4.0インストール
Apache cloudstack4.0インストールApache cloudstack4.0インストール
Apache cloudstack4.0インストールYasuhiro Arai
 
Cell/B.E. プログラミング事始め
Cell/B.E. プログラミング事始めCell/B.E. プログラミング事始め
Cell/B.E. プログラミング事始めYou&I
 
オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)
オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)
オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)NTT DATA Technology & Innovation
 
Dalvik仮想マシンのアーキテクチャ 改訂版
Dalvik仮想マシンのアーキテクチャ 改訂版Dalvik仮想マシンのアーキテクチャ 改訂版
Dalvik仮想マシンのアーキテクチャ 改訂版Takuya Matsunaga
 

Semelhante a 2014 dart flight school in Tokyo (20)

Dart 1.1
Dart 1.1Dart 1.1
Dart 1.1
 
DartVM on Android
DartVM on AndroidDartVM on Android
DartVM on Android
 
Rubyで創るOpenFlowネットワーク - LLまつり
Rubyで創るOpenFlowネットワーク - LLまつりRubyで創るOpenFlowネットワーク - LLまつり
Rubyで創るOpenFlowネットワーク - LLまつり
 
Source Code of Dart
Source Code of DartSource Code of Dart
Source Code of Dart
 
2014 1018 OSC-Fall Tokyo NETMF
2014 1018 OSC-Fall Tokyo NETMF2014 1018 OSC-Fall Tokyo NETMF
2014 1018 OSC-Fall Tokyo NETMF
 
MaxScaleを触ってみた
MaxScaleを触ってみたMaxScaleを触ってみた
MaxScaleを触ってみた
 
Xilinx SDSoC(2016.2)解体新書ソフトウェア編
Xilinx SDSoC(2016.2)解体新書ソフトウェア編Xilinx SDSoC(2016.2)解体新書ソフトウェア編
Xilinx SDSoC(2016.2)解体新書ソフトウェア編
 
JTF2020 クロスコンパイルだけが能ではない組み込みLinuxシステムのCI/CDインフラ構築
JTF2020 クロスコンパイルだけが能ではない組み込みLinuxシステムのCI/CDインフラ構築JTF2020 クロスコンパイルだけが能ではない組み込みLinuxシステムのCI/CDインフラ構築
JTF2020 クロスコンパイルだけが能ではない組み込みLinuxシステムのCI/CDインフラ構築
 
CMake multiplatform build-tool
CMake multiplatform build-toolCMake multiplatform build-tool
CMake multiplatform build-tool
 
Docker ComposeでMastodonが必要なものを梱包する話
Docker ComposeでMastodonが必要なものを梱包する話Docker ComposeでMastodonが必要なものを梱包する話
Docker ComposeでMastodonが必要なものを梱包する話
 
Let's play with Goldfish
Let's play with GoldfishLet's play with Goldfish
Let's play with Goldfish
 
Dart VM Performance
Dart VM PerformanceDart VM Performance
Dart VM Performance
 
SCUGJ第18回勉強会:よろしい、ならばVMMだ
SCUGJ第18回勉強会:よろしい、ならばVMMだSCUGJ第18回勉強会:よろしい、ならばVMMだ
SCUGJ第18回勉強会:よろしい、ならばVMMだ
 
Gingerbread
GingerbreadGingerbread
Gingerbread
 
Open VZ
Open VZOpen VZ
Open VZ
 
JavaScript.Next
JavaScript.NextJavaScript.Next
JavaScript.Next
 
Apache cloudstack4.0インストール
Apache cloudstack4.0インストールApache cloudstack4.0インストール
Apache cloudstack4.0インストール
 
Cell/B.E. プログラミング事始め
Cell/B.E. プログラミング事始めCell/B.E. プログラミング事始め
Cell/B.E. プログラミング事始め
 
オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)
オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)
オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)
 
Dalvik仮想マシンのアーキテクチャ 改訂版
Dalvik仮想マシンのアーキテクチャ 改訂版Dalvik仮想マシンのアーキテクチャ 改訂版
Dalvik仮想マシンのアーキテクチャ 改訂版
 

Último

TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Danieldanielhu54
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 

Último (9)

TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 

2014 dart flight school in Tokyo

  • 1. Dart VM の紹介 Outline  Dart VM 1.1  Dart2js 1.1  Dart VM の特長 2014/02/22 Dart Flight School 2014 Tokyo nothingcosmos <nothingcosmos@gmail.com>
  • 2. 自己紹介  Twitter:nothingcosmos  名前 : 坂頂佑樹 所属 :  趣味 :OSS のコードを弄る  Blog:http://nothingcosmos.blog52.fc2.com/  Dart VM Advent Calender 2012 http://nothingcosmos.github.io/DartVM/index.html  Dart VM のソースコードリーディング
  • 4. Dart VM 1.1  Dart VM とは、 JVM 、 V8 みたいなもの。  Dart のコードを JIT コンパイルして高速に実行可能  対応アーキテクチャは、 x86/x64/arm/mips  対応 OS は、 Linux/Windows/MacOS/Android  ここ半年で ARM + Android 対応完了  V8 より高速だが、 2 倍はいかない。 一時期はほぼ 2 倍差をつけたけど、その後 V8 が怒濤の追い込み。。 今は V8 の 40 ~ 50% 速いくらい
  • 5. Computer Language Benchmark Games x86 Ubuntu™ Intel® Q6600® one core Dart / Java7 IO が List<int> 結構遅い Java なのに GMP 使ってる BigInteger 同士だと等速 Dart は簡易 regex engine のみ ブラウザ搭載時に Irregexp に置き換え
  • 6. ここ 1 年くらいの Dart VM  2013/01 arm mips の skeleton を追加。 Typed array の高速な実装を追加  2013/02 mixin を追加開始  2013/03 Field type feedback 最適化を追加し、全体的に 30% 程度性能向上  2013/04 ARM と MIPS の simulator 上のコンパイル、動作確認  2013/06 On-Stack Replacement の追加  2013/07 NEON 対応。 Mirror の高速化  2013/08 Profile Guided Code Positioning の追加  2013/09 ARM 対応ほぼ完了。 vm service を追加開始  2013/10 Constant Blinding の追加。  2013/11 Dart 1.0 リリース  2013/12 Field 操作の mutable 化  2014/01 Dart 1.1 リリース
  • 7. dart2js 1.1  Dart で開発されている、 Dart から JavaScript への変換 Dart VM がないブラウザでも動作可能  高速化中、手書きの JavaScript V8 と等速、ちょい速いくらい。  Dart 1.0 より、ベンチマークの Richard が 25% アップ。 http://news.dartlang.org/2014/01/dart-11-features-up-to-25-faster.html  いろいろと最適化を追加して高速化と出力 js の圧縮を頑張っている  ベンチマークは Octane や Dromaeo や Box2D っぽい。
  • 9. Dart VM の特長 ここから VM の雑学  JIT コンパイル  Dart VM Architecture と Isolate  Snapshot と高速起動  Message passing と Event Driven  Optional Typing & Generics & Checked Mode  Dartium
  • 10. Dart VM と JIT コンパイル (1)  インタプリタなし、 2 段階の JIT コンパイル  IRHydra がわかりやすい。 http://mrale.ph/irhydra/2/#demo-4 Entrypoint である mainscript を SingleThreading で JIT コンパイルしてから実行する 関数呼び出し fibo を見つける fibo はまだコンパイルしていないため、 fibo 関数を JIT コンパイルする
  • 11. Dart VM と JIT コンパイル (2)  最初の JIT コンパイルは、 どんな型でも動くように汎用コンパイル  型情報の収集を埋込 fibo 関数を JIT コンパイルした後、 fibo 関数の実行に戻る fibo 関数を再帰的に実行 コンパイル済みの汎用コードを実行する
  • 12. Dart VM と JIT コンパイル (3)  何度も実行される関数は、最適化 JIT コンパイル 収集した型情報を利用し、 型を特殊化してコンパイル、高速に実行可能 fibo 関数を何度も実行すると、 fibo 関数の最適化 JIT コンパイルが走る。 汎用的な fibo から、最適化した fibo に置き換え Heap が足りなくなったら、 全体の動作を止めて、 GC を実行し、 heap を確保する。
  • 13. Dart Dart VM Architecture Dart の世界 Debugger で 追える境界 sdk/lib/io NativeSymbol C++/Asm OS/Kernel sdk/lib patch_class VM の境界 Native Extensions シンボルを定義 runtime/lib/*.cc runtime/bin/*.cc IO_NATIVES BOOTSTRAP_ NATIVES runtime/lib runtime/bin I/O や Network を非同期に実行 runtime/platform runtime/ include runtime/vm runtime/vm/os OS(Linux, Windows, MacOS, Android) ISA(arch) ia32/x64/arm/mips VM が担当する 計算やリソース管理
  • 14. Dart VM Isolate Isolate 横断 BOOTSTRAP_NATIVES Dart レイヤから C++ への binding/Native Extentions JITCompiler のみ インタプリタ無し intrinsifier/runtime_entry compiler GC Isolate ごとに GC と heap object pool/code heap isolate port_map Message Passing は port 経由 dart context runtime stubs Dart_Api include Isolate 単位に独立 Single Threading で 動作する thread_pool OS の Process VM の共有リソース
  • 15. Isolate Spawn ここより上の Dart のレイヤーには Lock が存在しない intrinsifier/runtime_entry runtime stubs dart context object pool/code compiler GC heap runtime stubs compiler GC isolate Thread port_map isolate 間は port 経由で message passing dart context object pool/code heap Spawn した Isolate Dart_Api include isolate Lock は不要 独立して実行 Thread thread_pool OS の Process 共有リソースでは Lock するが、 非常に少ない。
  • 16. Dart VM の特長 ここから VM の雑学  JIT コンパイル  Dart VM Architecture と Isolate  Snapshot と高速起動  Message passing と Event Driven  Optional Typing & Generics & Checked Mode  Dartium
  • 17. Dart Snapshot  Dart VM の object の serialize/deserialize 機能 圧縮率と速度優先 アーキテクチャ非互換 (x86-x64-ARM 間の相互変換は不可能 )  起動の高速化  MessagePassing の際の serialize/deserialize にも使用する。 serialize した object を port 経由で送受信する。  自分の作ったライブラリもあらかじめ snapshot できる。  大体 JSON と同じだけど、追加で VM の内部 object も対象。
  • 18. VM 起動の高速化  Dart VM は make の際に、 2 回 build を行う。 1 回目は dart_no_snapshot を build し、 SDK の core を読み込み起動。 core の dart src を scan し、 snapshot 、 snapshot_buffer[] に書き出し。  2 回目で snapshot_buffer[] を取り込んで dart を build する。 +400kbyte dart は Core の I/O と Scan を skip できるので、起動時間が短縮できる。 --time-bootstrap オプションで比較可能。  bootstrap が短縮、 100,000micros -> 100micros  Core の dart src を read して scan vs. binary から直接 deserialize
  • 19. bootstrap の短縮 fibo(40) の実行時間 (ms) 130ms 540 dart_no_snapshot 410 fibo time 20ms 起動時のオー 430 バーヘッドが 1/6 scan が 100ms 410 から 0.1ms に dart 0 100 200 300 400 500 600
  • 21. Isolate の StartUp(1) main が終わったら、 MessageHandler で EventLoop Task が Thread を生成 1 個だけ Isolate の初期化 Main script Async micro task 残っている限り 仕事し続ける。 Isolate Message HandlerTask Message Handler Thread thread pool dart.cc の main() 関数 port_map 並行して Message Receive
  • 22. Isolate の StartUp(2) main が終わったら、 MessageHandler で EventLoop Main script async task が 残っている限り 仕事し続ける。 Isolate Message HandlerTask Message Handler Thread Message Receive port_map Unhandled exception: type 'double' is not a subtype of type 'int' of 'num'. #0 func (file:///syntax/lib/diff/future.dart:28:13) #1 main (file:///syntax/lib/diff/future.dart:33:7) #2 _startIsolate.isolateStartHandler (dart:isolate-patch/isolate_patch.dart:216) #3 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:115)
  • 23. MessageHandler and EventLoop  https://www.dartlang.org/articles/event­loop/  Async 系の microtask は mainscript が 終了後に実行する。 2.streamFibo 3.scheduleMicroTask 5.run microTask 1.main の起動 6.async task 4.main 終了
  • 24. MessageHandler and EventLoop #4 #5 #6 #7 #8 #9 #10 #11 #12 #13 Stream.forEach.<anonymous closure> (dart:async/stream.dart:473) 2.streamFibo _rootRunUnary (dart:async/zone.dart:695) _RootZone.runUnary (dart:async/zone.dart:834) _BaseZone.runUnaryGuarded (dart:async/zone.dart:546) 3.Loop _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333) _DelayedData.perform (dart:async/stream_impl.dart:585) _StreamImplEvents.handleNext (dart:async/stream_impl.dart:701) _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:661) _asyncRunCallback (dart:async/schedule_microtask.dart:18) _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:119) 仮にここの async で error になったら
  • 25. EventLoop And Zone  Zone は RootZone から parent が fork して 木構造でつながる。  scheduleMicrotask で 1Thrad で順次実行 Zone の木構造を辿り実行 zone root_zone zone
  • 26. Dart VM の特長 ここから VM の雑学  JIT コンパイル  Dart VM Architecture と Isolate  Snapshot と高速起動  Message passing と Event Driven  Optional Typing & Generics & Checked Mode  Dartium
  • 27. Dart Optional Typing  Dart には production mode と checked mode がある。  Dart には 3 つのフェーズがある。   compile フェーズ。 script 実行前の jit compile 時に error/warning 検出   analyzer フェーズ。 IDE による error/warning の検出 runtime フェーズ。実行時の型情報を validation する。 checked mode では、 compile フェーズで型エラー /warning を無視しない。 compile 時に型情報の validation 命令を挿入し、実行時に assert する。  Dart の型は、 type annotation による validation と割り切っている。 validation のタイミングは上記 3 つ。 runtime に影響を与えない。
  • 28. Dart Optional Typing  Dart の型の違反は、基本的に warning 扱い  何が error で何が warning かは、他の言語と比較すると結構曖昧かも。 Breaking on exception: type 'double' is not a subtype of type 'int' of 'num'. int sum = 100 + 100.0; int num = 100.0; IDE/ コンパイル時に warning と分かるし、 binaryoperator(+) の 2 引数の validation 命令を JIT コンパイル時に挿入する。 実行時に validation されて warning こちらは = の assign に validation 版の命令を JIT コンパイル時に挿入する。 実行時に validation されて warning Breaking on exception: type 'double' is not a subtype of type 'int' of 'num'.
  • 29. Dart Generics  Class の Reified Generics のみ ( 型パラメータを保存する領域あり ) Generics を使用した場合のみ、 Class のインスタンスを new する際に、 型パラメータを保存する命令を挿入する。 TypeArguments っていう IR が存在する。  型パラメータは、実行時にいつでも参照できる。  Method generics は存在しない。  型パラメータを参照するのは、 checked mode のみ。 Generics の型パラメータも validation される。
  • 30. Dartium dartium 標準化された API を IDL から自動生成 dartium 連携用 native symbol Web IDL Auto-generated library sdk/lib/html dart runtime sdk/lib dartium で定義された シンボルを Native Extensions を使用して直接呼出て連携する。 runtime/ include dartium からの制御は include で定義された API 経由で dart runtime に指示
  • 31. Dartium の binding dartium/src/third_party/WebKit/Source/bindings/dart dartium/src/third_party/WebKit/Source/bindings/v8 Bindings (Dart API) JavaScript V8 Dart VM Dart のページを読み込んだ場合のみ起動 VM の遅延ローディング
  • 32. 今後の予想  Chrome に Dart VM を搭載するのでは。早ければ 2015 年? WebKit から Blink になりましたし、邪魔する人はいないはず  まずは Oilpan(GC for Blink) でメモリリークを解消してから? http://goo.gl/gCugZ4  ARM + Android 上でも動くため、 モバイルの Chrome にも問題なく搭載できるのでは?  モバイル最速の VM かもだけど、 V8 と Dart VM の同時起動はメモリ食いそう。。