SlideShare a Scribd company logo
Wasm Garbage
Collection in JSC
Asumu Takikawa (Igalia)
WebKit Contributors Meeting 2023
Photo credit: https://www.pexels.com/@zydeaosika-2261055/
♺
Motivation of
proposal
Wasm is a target language for
compiling web programs
WASM Garbage Collection in JSC
Wasm MVP great for C/C++/Rust
programs
● Works well for languages without GC/managed runtimes
● But what about programs in languages needing GC?
Key missing piece was Wasm
support for allocatable memory
with GC
GC Proposal
enables those
languages
● Supports allocatable data types
like structs & arrays
● New kinds of reference types
pointing to allocated values
● Type casts & advanced types
● Takes advantage of browser JS
engines’ built-in GC
+GC
https://github.com/WebAssembly/gc/
for the nitty-gritty details
A concrete example
(module
(type $s (struct (field $x i32)
(field $y i32))
(global (ref $s)
(struct.new (i32.const 42)
(i32.const 42)))
(func $get-x (param (ref $s)) (result i32)
(struct.get $s $x (local.get 0))))
New type
declaration
form
A concrete example
(module
(type $s (struct (field $x i32)
(field $y i32))
(global (ref $s)
(struct.new (i32.const 42)
(i32.const 42)))
(func $get-x (param (ref $s)) (result i32)
(struct.get $s $x (local.get 0))))
Globals can
be init with
new types
A concrete example
(module
(type $s (struct (field $x i32)
(field $y i32))
(global (ref $s)
(struct.new (i32.const 42)
(i32.const 42)))
(func $get-x (param (ref $s)) (result i32)
(struct.get $s $x (local.get 0))))
New instructions
to access GC
data
A concrete example
(module
(type $s (struct (field $x i32)
(field $y i32))
(global (ref $s)
(struct.new (i32.const 42)
(i32.const 42)))
(func $get-x (param (ref $s)) (result i32)
(struct.get $s $x (local.get 0))))
Ref types let you
reference GC
values
♺
Progress in JSC
We’re
implementing
Wasm GC for JSC
● WIP implementation underway
● Most features already
implemented
● Should get to shippable state in
a few months
��
What’s implemented & what’s not
✅ Structs/arrays
✅ i31 references
✅ Type hierarchy
✅ Subtyping
✅ Recursive types
✅ Type casts
✅ Locals with non-nullable types
✅ Table initializers
*⃣ JS API support
🅾 Bulk array operations
🅾 Misc other missing instructions
Plus more testing and optimization!
✅ Done
*⃣ Partial
🅾 TODO
To track our progress: ☂
https://bugs.webkit.org/show_
bug.cgi?id=247394
♺
The takeaway
This is an exciting time for Wasm!
● Other browsers have shipped or will ship Wasm GC soon
(the proposal is at phase 4)
● Once JSC also ships, Wasm GC supported in all major
browser engines
● Developers can then target Wasm with Java, OCaml, and
many more languages to come
Future Wasm will likely build further on GC
��
♺
Q & A
Thanks for listening!

More Related Content

PDF
Grails 101
PDF
Clang, Clang: Who's there? WebAssembly!
PPTX
Intro to go web assembly
PDF
Improving Apache Spark Downscaling
PDF
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
PDF
Golang Project Layout and Practice
ODP
Groovy and Grails intro
PDF
A world to win: WebAssembly for the rest of us
Grails 101
Clang, Clang: Who's there? WebAssembly!
Intro to go web assembly
Improving Apache Spark Downscaling
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
Golang Project Layout and Practice
Groovy and Grails intro
A world to win: WebAssembly for the rest of us

Similar to WASM Garbage Collection in JSC (20)

PDF
Core2 Document - Java SCORE Overview.pptx.pdf
PDF
Spark SQL Catalyst Code Optimization using Function Outlining with Kavana Bha...
PDF
Why Gradle?
PDF
TI1220 Lecture 14: Domain-Specific Languages
PPT
Design Patterns
PDF
DIとトレイとによるAndroid開発の効率化
PPTX
Andriy Shalaenko - GO security tips
PDF
Apache Airflow® Best Practices: DAG Writing
PDF
mloc.js 2014 - JavaScript and the browser as a platform for game development
PPT
Tp web
PPT
一种多屏时代的通用 web 应用架构
PDF
Google App Engine: Basic
PPT
Grails Introduction - IJTC 2007
PDF
Gradle in 45min - JBCN2-16 version
PDF
Evolution of Spark APIs
PDF
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
PDF
Enter the gradle
PPTX
GIS_With_Programming_Python_Java (1).pptx
PDF
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
PDF
Groovy On Trading Desk (2010)
Core2 Document - Java SCORE Overview.pptx.pdf
Spark SQL Catalyst Code Optimization using Function Outlining with Kavana Bha...
Why Gradle?
TI1220 Lecture 14: Domain-Specific Languages
Design Patterns
DIとトレイとによるAndroid開発の効率化
Andriy Shalaenko - GO security tips
Apache Airflow® Best Practices: DAG Writing
mloc.js 2014 - JavaScript and the browser as a platform for game development
Tp web
一种多屏时代的通用 web 应用架构
Google App Engine: Basic
Grails Introduction - IJTC 2007
Gradle in 45min - JBCN2-16 version
Evolution of Spark APIs
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Enter the gradle
GIS_With_Programming_Python_Java (1).pptx
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Groovy On Trading Desk (2010)
Ad

More from Igalia (20)

PDF
Life of a Kernel Bug Fix
PDF
Unlocking the Full Potential of WPE to Build a Successful Embedded Product
PDF
Advancing WebDriver BiDi support in WebKit
PDF
Jumping Over the Garden Wall - WPE WebKit on Android
PDF
Collective Funding, Governance and Prioritiation of Browser Engine Projects
PDF
Don't let your motivation go, save time with kworkflow
PDF
Solving the world’s (localization) problems
PDF
The Whippet Embeddable Garbage Collection Library
PDF
Nobody asks "How is JavaScript?"
PDF
Getting more juice out from your Raspberry Pi GPU
PDF
WebRTC support in WebKitGTK and WPEWebKit with GStreamer: Status update
PDF
Demystifying Temporal: A Deep Dive into JavaScript New Temporal API
PDF
CSS :has() Unlimited Power
PDF
Device-Generated Commands in Vulkan
PDF
Current state of Lavapipe: Mesa's software renderer for Vulkan
PDF
Vulkan Video is Open: Application showcase
PDF
Scheme on WebAssembly: It is happening!
PDF
EBC - A new backend compiler for etnaviv
PDF
RISC-V LLVM State of the Union
PDF
Device-Generated Commands in Vulkan
Life of a Kernel Bug Fix
Unlocking the Full Potential of WPE to Build a Successful Embedded Product
Advancing WebDriver BiDi support in WebKit
Jumping Over the Garden Wall - WPE WebKit on Android
Collective Funding, Governance and Prioritiation of Browser Engine Projects
Don't let your motivation go, save time with kworkflow
Solving the world’s (localization) problems
The Whippet Embeddable Garbage Collection Library
Nobody asks "How is JavaScript?"
Getting more juice out from your Raspberry Pi GPU
WebRTC support in WebKitGTK and WPEWebKit with GStreamer: Status update
Demystifying Temporal: A Deep Dive into JavaScript New Temporal API
CSS :has() Unlimited Power
Device-Generated Commands in Vulkan
Current state of Lavapipe: Mesa's software renderer for Vulkan
Vulkan Video is Open: Application showcase
Scheme on WebAssembly: It is happening!
EBC - A new backend compiler for etnaviv
RISC-V LLVM State of the Union
Device-Generated Commands in Vulkan
Ad

Recently uploaded (20)

PPT
What is a Computer? Input Devices /output devices
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
What is a Computer? Input Devices /output devices
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Group 1 Presentation -Planning and Decision Making .pptx
Final SEM Unit 1 for mit wpu at pune .pptx
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Chapter 5: Probability Theory and Statistics
Hindi spoken digit analysis for native and non-native speakers
Zenith AI: Advanced Artificial Intelligence
1 - Historical Antecedents, Social Consideration.pdf
observCloud-Native Containerability and monitoring.pptx
Developing a website for English-speaking practice to English as a foreign la...
Web App vs Mobile App What Should You Build First.pdf
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
A contest of sentiment analysis: k-nearest neighbor versus neural network
O2C Customer Invoices to Receipt V15A.pptx
Module 1.ppt Iot fundamentals and Architecture
Profit Center Accounting in SAP S/4HANA, S4F28 Col11

WASM Garbage Collection in JSC

  • 1. Wasm Garbage Collection in JSC Asumu Takikawa (Igalia) WebKit Contributors Meeting 2023 Photo credit: https://www.pexels.com/@zydeaosika-2261055/
  • 3. Wasm is a target language for compiling web programs
  • 5. Wasm MVP great for C/C++/Rust programs ● Works well for languages without GC/managed runtimes ● But what about programs in languages needing GC?
  • 6. Key missing piece was Wasm support for allocatable memory with GC
  • 7. GC Proposal enables those languages ● Supports allocatable data types like structs & arrays ● New kinds of reference types pointing to allocated values ● Type casts & advanced types ● Takes advantage of browser JS engines’ built-in GC +GC https://github.com/WebAssembly/gc/ for the nitty-gritty details
  • 8. A concrete example (module (type $s (struct (field $x i32) (field $y i32)) (global (ref $s) (struct.new (i32.const 42) (i32.const 42))) (func $get-x (param (ref $s)) (result i32) (struct.get $s $x (local.get 0)))) New type declaration form
  • 9. A concrete example (module (type $s (struct (field $x i32) (field $y i32)) (global (ref $s) (struct.new (i32.const 42) (i32.const 42))) (func $get-x (param (ref $s)) (result i32) (struct.get $s $x (local.get 0)))) Globals can be init with new types
  • 10. A concrete example (module (type $s (struct (field $x i32) (field $y i32)) (global (ref $s) (struct.new (i32.const 42) (i32.const 42))) (func $get-x (param (ref $s)) (result i32) (struct.get $s $x (local.get 0)))) New instructions to access GC data
  • 11. A concrete example (module (type $s (struct (field $x i32) (field $y i32)) (global (ref $s) (struct.new (i32.const 42) (i32.const 42))) (func $get-x (param (ref $s)) (result i32) (struct.get $s $x (local.get 0)))) Ref types let you reference GC values
  • 13. We’re implementing Wasm GC for JSC ● WIP implementation underway ● Most features already implemented ● Should get to shippable state in a few months ��
  • 14. What’s implemented & what’s not ✅ Structs/arrays ✅ i31 references ✅ Type hierarchy ✅ Subtyping ✅ Recursive types ✅ Type casts ✅ Locals with non-nullable types ✅ Table initializers *⃣ JS API support 🅾 Bulk array operations 🅾 Misc other missing instructions Plus more testing and optimization! ✅ Done *⃣ Partial 🅾 TODO
  • 15. To track our progress: ☂ https://bugs.webkit.org/show_ bug.cgi?id=247394
  • 17. This is an exciting time for Wasm! ● Other browsers have shipped or will ship Wasm GC soon (the proposal is at phase 4) ● Once JSC also ships, Wasm GC supported in all major browser engines ● Developers can then target Wasm with Java, OCaml, and many more languages to come Future Wasm will likely build further on GC ��
  • 18. ♺ Q & A Thanks for listening!