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
1k
The State of AssemblyScript 2018
kazupon
December 14, 2018
Tweet
Share
More Decks by kazupon
See All by kazupon
わたしのOSS活動
kazupon
3
480
Vapor Revolution
kazupon
3
3.5k
Vue.js最新動向
kazupon
3
1.5k
Vue 3.4
kazupon
13
4.7k
Vue & Vite Rustify
kazupon
4
2.3k
Vue.jsエコシステム動向2023
kazupon
17
7.8k
Reactivity Transform
kazupon
1
1.4k
わたしのOSS活動
kazupon
1
1k
Vue with Vite
kazupon
2
2.6k
Other Decks in Programming
See All in Programming
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
720
猫と暮らす Google Nest Cam生活🐈 / WebRTC with Google Nest Cam
yutailang0119
0
110
WindowInsetsだってテストしたい
ryunen344
1
240
Select API from Kotlin Coroutine
jmatsu
1
230
git worktree × Claude Code × MCP ~生成AI時代の並列開発フロー~
hisuzuya
1
550
ソフトウェア品質を数字で捉える技術。事業成長を支えるシステム品質の マネジメント
takuya542
1
11k
童醫院敏捷轉型的實踐經驗
cclai999
0
210
都市をデータで見るってこういうこと PLATEAU属性情報入門
nokonoko1203
1
600
技術同人誌をMCP Serverにしてみた
74th
1
630
新メンバーも今日から大活躍!SREが支えるスケールし続ける組織のオンボーディング
honmarkhunt
3
6k
5つのアンチパターンから学ぶLT設計
narihara
1
160
「テストは愚直&&網羅的に書くほどよい」という誤解 / Test Smarter, Not Harder
munetoshi
0
110
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
950
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Raft: Consensus for Rubyists
vanstee
140
7k
Designing Experiences People Love
moore
142
24k
Visualization
eitanlees
146
16k
How to Think Like a Performance Engineer
csswizardry
24
1.7k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.4k
Practical Orchestrator
shlominoach
188
11k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
730
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
How to train your dragon (web standard)
notwaldorf
94
6.1k
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!