Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
The State of AssemblyScript 2018
Search
kazupon
December 14, 2018
Programming
1.1k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
The State of AssemblyScript 2018
kazupon
December 14, 2018
More Decks by kazupon
See All by kazupon
プラグインで拡張される Context をtype-safe にする難しさと設計判断
kazupon
2
3.1k
Oxlint JS plugins
kazupon
1
1.4k
gunshi
kazupon
1
280
Nitro v3
kazupon
2
640
わたしのOSS活動
kazupon
3
670
Vapor Revolution
kazupon
3
4.4k
Vue.js最新動向
kazupon
3
1.7k
Vue 3.4
kazupon
13
5k
Vue & Vite Rustify
kazupon
4
2.5k
Other Decks in Programming
See All in Programming
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
1
300
Claude Code ハーネスDeep Dive – 君はどこまで制御する? -
takateeen_knj
0
680
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
1
2k
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
630
小さなアプリを作って公開するまで
onozaty
0
140
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
4
3.7k
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
930
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
200
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
360
Event is what happens
moro
2
3.9k
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
300
エージェントを使い続けるためのメタワーク / Meta-work for keeping using the agent
rkaga
6
2.2k
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
Tell your own story through comics
letsgokoyo
1
1.1k
New Earth Scene 8
popppiees
4
2.8k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
1
300
4 Signs Your Business is Dying
shpigford
187
23k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
3k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
Automating Front-end Workflow
addyosmani
1370
210k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
610
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
420
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
520
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!