Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Scala to WebAssembly #scala_waiwai
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Rikito Taniguchi
February 27, 2024
1.9k
0
Share
Scala to WebAssembly #scala_waiwai
https://scala-tokyo.connpass.com/event/307069/
Rikito Taniguchi
February 27, 2024
More Decks by Rikito Taniguchi
See All by Rikito Taniguchi
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
150
Capture Checking / Separation Checking 入門
tanishiking
0
520
Implementing and Evaluating a High-Level Language with WasmGC and the Wasm Component Model: Scala’s Case
tanishiking
0
700
Scala meets WebAssembly
tanishiking
0
930
Why Wasm+WASI for Scala
tanishiking
0
130
Scala to WebAssembly: Exploring the How and Why
tanishiking
1
1.9k
Scala Days Madrid 2023 参加レポート
tanishiking
0
100
Tooling for Scala3
tanishiking
0
430
API-Based Code Search
tanishiking
0
97
Featured
See All Featured
Producing Creativity
orderedlist
PRO
348
40k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
490
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
270
We Are The Robots
honzajavorek
0
210
GitHub's CSS Performance
jonrohan
1032
470k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
200
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
320
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
350
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
510
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
680
KATA
mclloyd
PRO
35
15k
Transcript
Scala to WebAssembly: How and Why Scala わいわい勉強会 #2 tanishiking
What is WebAssembly (Wasm)? - ブラウザで実行可能な、高速・安全・ポータブルで、 サイズとロードが高効率なプログラム形式 - 最近は WASI
(WebAssembly System Interface) によりブラウ ザ外でも活躍 - 様々な言語から Wasm へコンパイル可能 - C/C++, Rust, Go, Kotlin, Dart, Swift, OCaml, Haskell, etc…
Scala -> Wasm へコンパイラバックエンド開発中 https://github.com/scala-js/scala-js/issues/4928
Why Wasm is important for Scala? ブラウザでScalaを実行するだけなら Scala.js があるじゃん? •
高効率なロードと実行・安全性 • (将来的に) ブラウザ外での活用 ◦ Cloud computing (Spin, kruslet) ◦ Edge computing (Cloudflare Workers, fastly edge) ◦ Plugin systems (Istio plugin, shopify function) ◦ Smart Contract (Ethereum Wasm, Near Protocol) • Wasm Component で他言語との interop
https://www.youtube.com/watch?v=QsOHofFJpig 実はかなり前から検討はされていた (2019/06)
Lack of Garbage Collection JVMと違ってWasm(Engine)にGCはない(なかった) GC言語をWasmにポートするには • VM自体をWasmに変換してその上でプログラムを実行 ◦ Ruby,
Python, JS (QuickJS), Java (CheerPJ) ◦ VMを含んでいるので Wasm module が巨大 • GCコードをWasm moduleに組み込む ◦ Swift, Java(TeaVM), AssemblyScript, Go(?) ◦ (実装によるが)非効率・is GC portable?・ホスト環境(JSなど)を介した参 照をトラックできない
WasmGC WebAssembly に GC managed なデータ構造を導入する proposal。Wasm EngineがGC管理してくれる V8, SpiderMonkey,
JavaScriptCore(未リリース?) などで実。 wasmtime などの pure WASI runtime も実装中 Kotlin, Dart OCaml, Java(j2cl)
Demo (時間あれば)
将来の展望 • まずはブラウザで動くWasmに変換を目指す ◦ Scala.js の標準ライブラリは JS 資産利用のまま • (pure)
WASI サポート ◦ そもそも pure Wasm runtime がまだ WasmGC 未対応 ◦ Scala の標準ライブラリもWASIスタックの上で再実装 ◦ 各種 third party library も WASI 向けに再実装する必要がある... ▪ 直接 WASI利用しなければそれほど難しくないはず...(?)
参考 • A new way to bring garbage collected programming
languages efficiently to WebAssembly • Scala.js and WebAssembly, a tale of the dangers of the sea - Sébastien Doeraene • n月刊ラムダノート Vol.4