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
The State of AssemblyScript 2018
Search
kazupon
December 14, 2018
Programming
2
960
The State of AssemblyScript 2018
kazupon
December 14, 2018
Tweet
Share
More Decks by kazupon
See All by kazupon
Vapor Revolution
kazupon
2
3k
Vue.js最新動向
kazupon
3
1.5k
Vue 3.4
kazupon
13
4.6k
Vue & Vite Rustify
kazupon
4
2.2k
Vue.jsエコシステム動向2023
kazupon
17
7.6k
Reactivity Transform
kazupon
1
1.3k
わたしのOSS活動
kazupon
1
1k
Vue with Vite
kazupon
2
2.5k
State of Vue I18n
kazupon
3
570
Other Decks in Programming
See All in Programming
shadcn/uiを使ってReactでの開発を加速させよう!
lef237
0
300
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
940
ドメインイベント増えすぎ問題
h0r15h0
2
570
traP の部内 ISUCON とそれを支えるポータル / PISCON Portal
ikura_hamu
0
180
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
7
1.4k
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
300
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
240
React 19でお手軽にCSS-in-JSを自作する
yukukotani
5
560
QA環境で誰でも自由自在に現在時刻を操って検証できるようにした話
kalibora
1
140
PHPカンファレンス 2024|共創を加速するための若手の技術挑戦
weddingpark
0
140
知られざるDMMデータエンジニアの生態 〜かつてツチノコと呼ばれし者〜
takaha4k
1
440
為你自己學 Python
eddie
0
520
Featured
See All Featured
Designing for humans not robots
tammielis
250
25k
Why Our Code Smells
bkeepers
PRO
335
57k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
500
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.6k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Thoughts on Productivity
jonyablonski
68
4.4k
Become a Pro
speakerdeck
PRO
26
5.1k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
Visualization
eitanlees
146
15k
A designer walks into a library…
pauljervisheath
205
24k
Transcript
The State of AssemblyScript 2018 Emscripten & WebAssembly Night #6
2018.12.14 @kazupon
Who am I ?
CTO Vue.js Core Team Vue.js japan users group organizer vue-i18n
author WebAssembly Love ❤ @kazu_pon kazupon kazupon
Introduction
Last a year …
https://qiita.com/chikoski/items/d98ed0a98acfa896869f
https://qiita.com/kazupon/items/37e1ee9db0ca5419c517
One year has passed.
During this time, AssemblyScript evolves little by little.
Today Contents About recently updates of AssemblyScript
ATTENTION !! • AssemblyScript v5 is WIP (Not published in
NPM) • It might be changed in future
What is AssemblyScript?
Compile a strictly-typed subset of TypeScript to WebAssembly
Recently updates from last year
Hot topics •Memory management •AssemblyScript loader •GC Implementation
Memory Management
Kind of allocators • allocator/arena • allocator/tlsf • allocator/buddy •
allocator/system HEAP_BASE (the first 8 byte aligned offset after static) Static Heap Memory
• Accumulates memory with no mechanism to free specific segments
allocator/arena Static Allocated memory.allocate(1024) startOffset offset 64KB (page x) Allocatable Heap region Memory
• Simply increase the memory size, when memory size will
be about to fill. allocator/arena Static Allocated memory.allocate(1024) startOffset offset 64KB Memory memory.grow(2) 128KB
• when memory.reset, resets the counting memory offset to its
initial value and starts all over again. allocator/arena Static Heap memory.reset() startOffset offset 128KB Memory 64KB
allocate / free of memory
• You can use your custom memory allocator ! allocator/system
Memory Layout • String e.g. const str: string = ‘Hello’
Memory Layout • Arrays: All arrays store their contents in
an ArrayBuffer behind the scenes.
Memory Layout • ArrayBuffer layout
AssemblyScript loader
What is it? • Provide some APIs of convenient AssemblyScript
modules loading • Demangles module • Exports to a friendly object structure compatible WebIDL and TypeScript definitions for JS env • Some useful utilities as helper API, to read/write data from/to memory
Demangles module structure add Point thisPtr x (getter/setter) y (getter/setter)
add (method) I8 U8 I16 U16 I32 U32 I64 U64 F32 F64 Static Heap WASM module Demangles module Wrap Wrap Return the pointer Memory Ref newString getString … Utilities
How to use demangles module Static Heap Memory 32 64
0x00010000 p1 0x00010008 thisPtr 0x00010000 x y pass the pointer pass the pointer 0x00000000
Working with strings and arrays • ex: object path parser
Reading/writing basic values to/from memory https://github.com/AssemblyScript/assemblyscript/tree/master/lib/loader#readingwriting-basic-values-tofrom-memory Static Heap Memory FF
FF 0x00010000 ptr: 0x00010000 0x00010001 U8 0x00000000 U16
GC implementation
Experimental !! https://github.com/AssemblyScript/assemblyscript/pull/196
Manually GC release
GC related issues • GC experimentation • GitHub Issue Number:
#89 • Implement reference counting and/or garbage collection • GitHub Issue Number: #16
In future …
Status / Roadmap • Standard library comatibility • TypeScript comatiplity
• WASM features • Managed object runtime https://next.assemblyscript.org/#/development/roadmap
Closing
Closing •AssemblyScript is steadily evolving •Memory management •AssemblyScript loader •GC
Implementation •It has a potential as WASM app implementation language!
Thanks!