SlideShare a Scribd company logo
A low Overhead Per
Object Write Barrier
for the CogVM
Clément Béra
Introduction
• The CogVM is the standardVM for:
• Pharo
• Squeak
• Newspeak
• Cuis
Introduction
• Working runtime optimizer for Cog’s JIT
• Problem with literal mutability
Problem
• Is it possible to mark any object as read-
only ?
• Smalltalk code to handle mutation
failure
• Overhead
Terminology
• Discussion onVM mailing-list
• Immutable: state cannot change after
object’s initialization
• Write barrier or read-only object
Use-cases
• Modification tracker
• Read-only literals
• Compiler optimizations
• Inconsistent literal modifications
• Others...
This paper
• NOT about framework built using read-
only objects
• Implementation details to limit the
overhead
Feature
• Any object can be marked as read-only,
except:
• Immediate objects
• Context instances
• Objects related to Process scheduling
• Objects internal to the runtime
APIs
• Object >> isReadOnlyObject
• Object >> setIsReadOnlyObject:
• Object >> beWritableObject
• Object >> beReadOnlyObject
Read-only object
• Instance variable store fail
• Primitives mutating a read-only object fail
IV store failure
• Instance variable is not set.
• A call-back is sent:
Primitive failure
• First value of array is not set
Primitive error code
• new error code: #'no modification'
Other details
• Support flags
• Mirror primitives
• Object >> object:setIsReadOnlyObject:
VM compilation option
• VM C compiler flag
• TheVM can be compiled with or without
the feature.
Implementation
• Object representation
• Interpreter support
• JIT support
Implementation
• Most critical part:
• How to keep IV store efficient ?
• Machine code generated by the JIT
• Discussed in the paper...
IV Store details
• Wanted
• to show it,
x86 Assembly Meaning
movl -12(%ebp), %edx
popl %edi
movl %edi, %ds:0x8(%edx)
testl 0x00000003, %edi If the value to store is
immediate, jump after the
store check.jnz after_store
Jump after the store check if
the receiver is young:
compare the young object
space limit with receiver
address
movl 0x00040088, %eax
jb after_store
cmpl %eax, %edx
Load the receiver in %edx.
jnb after_store
cmpl %eax, %edi If the value to store is an old
object, jump after the store
check.
jnz after_store
testb 0x20, %al
movzbl %ds:0x3(%edx), %eax
If the receiver is already in
the remembered table, jump
after the store check.
call store_check_trampoline
Calls the store check
trampoline.
Perform the store in the first
instance variable using both
registers (%edx and %edi)
Load the value to store in
%edi.
after_store: Code following the store.
x86 Assembly Meaning
movl -12(%ebp), %edx
popl %ecx
movl %ecx, %ds:0x8(%edx)
testb 0x03, %cl If the value to store is
immediate, jump after the
store check.jnz after_store
If the receiver is a young
object, jump after the store
check.
movl 0x00040088, %eax
jb after_store
cmpl %eax, %edx
jnb after_store
cmpl %eax, %ecx If the value to store is an old
object, jump after the store
check.
jnz after_store
testb 0x20, %al
movzbl %ds:0x3(%edx), %eax
If the receiver is already in
the remembered table, jump
after the store check.
call store_trampoline
Calls the store check
trampoline.
Perform the store in the first
instance variable using both
registers (%edx and %ecx)
Load the receiver in %edx.
Load the value to store in
%ecx.
movl -12(%ebp), %edx
movl %ds:(%edx), %eax
testl 0x00800000, %eax
jnz store_trampoline
If the receiver is read-only,
jump to the store trampoline.
Restore the receiver (to keep
its register live).
store_trampoline:
after_store: Code following the store.
Evaluation: Slow-down
• Binary trees
• IV Store intensive
• No significant difference
Evaluation: Slow-down
• Pathological case: setter
Evaluation: Slow-down
• At writing time, setter overhead was 17%
• Stack frame creation problem
• Two path compilation
• Now faster than before
Conclusion
• New feature: read-only object
• Overhead is very limited

More Related Content

PDF
Dynamically Composing Collection Operations through Collection Promises
Marcus Denker
 
PDF
JavaScript Execution Context
Juan Medina
 
ODP
JavaScript global object, execution contexts & closures
HDR1001
 
PPTX
Lecture 5 javascript
Mujtaba Haider
 
PPTX
Advanced Javascript
Dhruvin Shah
 
PPTX
node.js errors
LearningTech
 
PPTX
JavaScript Conditional Statements
Marlon Jamera
 
PPTX
Javascript session 01 - Introduction to Javascript
Livingston Samuel
 
Dynamically Composing Collection Operations through Collection Promises
Marcus Denker
 
JavaScript Execution Context
Juan Medina
 
JavaScript global object, execution contexts & closures
HDR1001
 
Lecture 5 javascript
Mujtaba Haider
 
Advanced Javascript
Dhruvin Shah
 
node.js errors
LearningTech
 
JavaScript Conditional Statements
Marlon Jamera
 
Javascript session 01 - Introduction to Javascript
Livingston Samuel
 

What's hot (20)

PPTX
Introduction to JavaScript Programming
Raveendra R
 
PPTX
Automate - Madhu Kanoor, Greg McCullough - ManageIQ Design Summit 2016
ManageIQ
 
ODP
JavaScript Object Oriented Programming Cheat Sheet
HDR1001
 
PPTX
oojs
Imran shaikh
 
PPTX
JavaScript Basics
Bhanuka Uyanage
 
PPTX
JS Event Loop
Saai Vignesh P
 
PPTX
Node.js System: The Approach
Haci Murat Yaman
 
PPTX
Javascript basics for automation testing
Vikas Thange
 
PPTX
JavaScript Basics - GameCraft Training
Radoslav Georgiev
 
DOC
Csharp
Venkat Sanaka
 
PPTX
Javascript conditional statements
nobel mujuji
 
PPT
JavaScript
Reem Alattas
 
PPT
Web development basics (Part-4)
Rajat Pratap Singh
 
PDF
Javantura v2 - Making Java web-apps Groovy - Franjo Žilić
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
PPTX
C# Asynchronous delegates
Prem Kumar Badri
 
PPTX
Intro to Javascript
Anjan Banda
 
PPTX
Javascript
Gita Kriz
 
PPTX
Java tutorial part 4
Mumbai Academisc
 
PDF
JavaScript: Patterns, Part 2
Chris Farrell
 
PDF
JavaScript 101
ygv2000
 
Introduction to JavaScript Programming
Raveendra R
 
Automate - Madhu Kanoor, Greg McCullough - ManageIQ Design Summit 2016
ManageIQ
 
JavaScript Object Oriented Programming Cheat Sheet
HDR1001
 
JavaScript Basics
Bhanuka Uyanage
 
JS Event Loop
Saai Vignesh P
 
Node.js System: The Approach
Haci Murat Yaman
 
Javascript basics for automation testing
Vikas Thange
 
JavaScript Basics - GameCraft Training
Radoslav Georgiev
 
Javascript conditional statements
nobel mujuji
 
JavaScript
Reem Alattas
 
Web development basics (Part-4)
Rajat Pratap Singh
 
Javantura v2 - Making Java web-apps Groovy - Franjo Žilić
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
C# Asynchronous delegates
Prem Kumar Badri
 
Intro to Javascript
Anjan Banda
 
Javascript
Gita Kriz
 
Java tutorial part 4
Mumbai Academisc
 
JavaScript: Patterns, Part 2
Chris Farrell
 
JavaScript 101
ygv2000
 
Ad

Viewers also liked (16)

PDF
HS Diploma0001
Jonathan Hunt
 
DOCX
GK CV-ELV ENGR.
Gopala Krishnan
 
PDF
Why EoMPLS for CE
Anuradha Udunuwara
 
PPTX
CIPR Social media inside
Chartered Institute of Public Relations
 
PDF
Religions
Frank Calberg
 
PDF
OpenPonk modeling platform
ESUG
 
PDF
Multi Chassis LAG for Cloud builders
Juniper Networks (日本)
 
PDF
My Resume
Arajan Nandaniya
 
PDF
Power and Energy Code Profiling in Pharo
ESUG
 
PDF
Lowcode: Extending Smalltalk with C Types to Improve Performance
ESUG
 
PDF
PaaS: An Enabler for IoT in NFV Worlds
OPNFV
 
PPTX
Presentación Pedro Huichilaf - eCommerceDay Santiago 2016
eCommerce Institute
 
PPTX
Presentación Sebastian Ojeda - eCommerce Day Santiago 2016
eCommerce Institute
 
PDF
2017 Resume Tips - Top 10 Resume Tips for 2017
Jessica H. Hernandez, Executive Resume Writer
 
PPTX
REVISÃO OAB XXI Direito administrativo-ERICK ALVES
Esdras Arthur Lopes Pessoa
 
PDF
MPLS-based Metro Ethernet Networks Tutorial by Khatri
Febrian ‎
 
HS Diploma0001
Jonathan Hunt
 
GK CV-ELV ENGR.
Gopala Krishnan
 
Why EoMPLS for CE
Anuradha Udunuwara
 
CIPR Social media inside
Chartered Institute of Public Relations
 
Religions
Frank Calberg
 
OpenPonk modeling platform
ESUG
 
Multi Chassis LAG for Cloud builders
Juniper Networks (日本)
 
My Resume
Arajan Nandaniya
 
Power and Energy Code Profiling in Pharo
ESUG
 
Lowcode: Extending Smalltalk with C Types to Improve Performance
ESUG
 
PaaS: An Enabler for IoT in NFV Worlds
OPNFV
 
Presentación Pedro Huichilaf - eCommerceDay Santiago 2016
eCommerce Institute
 
Presentación Sebastian Ojeda - eCommerce Day Santiago 2016
eCommerce Institute
 
2017 Resume Tips - Top 10 Resume Tips for 2017
Jessica H. Hernandez, Executive Resume Writer
 
REVISÃO OAB XXI Direito administrativo-ERICK ALVES
Esdras Arthur Lopes Pessoa
 
MPLS-based Metro Ethernet Networks Tutorial by Khatri
Febrian ‎
 
Ad

Similar to A low Overhead Per Object Write Barrier for Smalltalk (20)

ZIP
Ruby on the JVM
Kresten Krab Thorup
 
PPTX
Optimizing Java Notes
Adam Feldscher
 
PDF
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
chen yuki
 
PDF
Search at Twitter: Presented by Michael Busch, Twitter
Lucidworks
 
PDF
Sista: Improving Cog’s JIT performance
ESUG
 
PDF
Transactional Memory for Smalltalk
Lukas Renggli
 
PDF
Towards a Scalable Non-Blocking Coding Style
Azul Systems Inc.
 
PDF
Variables in Pharo
Marcus Denker
 
PPTX
Best Practices in Qt Quick/QML - Part I
ICS
 
PDF
Concurrency at the Database Layer
mcwilson1
 
PPT
Efficient Memory and Thread Management in Highly Parallel Java Applications
Phillip Koza
 
PPTX
Javasession10
Rajeev Kumar
 
PPTX
Fm wtm12-v2
Miguel Gamboa
 
PPTX
Javascript omg!
bwullems
 
PDF
Run-time of Node.js : V8 JavaScript Engine
Gary Yeh
 
KEY
MongoDB Command Line Tools
Rainforest QA
 
PPT
Lp seminar
guestdff961
 
PPTX
Safe Wrappers and Sane Policies for Self Protecting JavaScript
Phú Phùng
 
PPTX
SFDC Batch Apex
Sujit Kumar
 
PDF
Object Oriented Exploitation: New techniques in Windows mitigation bypass
Sam Thomas
 
Ruby on the JVM
Kresten Krab Thorup
 
Optimizing Java Notes
Adam Feldscher
 
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
chen yuki
 
Search at Twitter: Presented by Michael Busch, Twitter
Lucidworks
 
Sista: Improving Cog’s JIT performance
ESUG
 
Transactional Memory for Smalltalk
Lukas Renggli
 
Towards a Scalable Non-Blocking Coding Style
Azul Systems Inc.
 
Variables in Pharo
Marcus Denker
 
Best Practices in Qt Quick/QML - Part I
ICS
 
Concurrency at the Database Layer
mcwilson1
 
Efficient Memory and Thread Management in Highly Parallel Java Applications
Phillip Koza
 
Javasession10
Rajeev Kumar
 
Fm wtm12-v2
Miguel Gamboa
 
Javascript omg!
bwullems
 
Run-time of Node.js : V8 JavaScript Engine
Gary Yeh
 
MongoDB Command Line Tools
Rainforest QA
 
Lp seminar
guestdff961
 
Safe Wrappers and Sane Policies for Self Protecting JavaScript
Phú Phùng
 
SFDC Batch Apex
Sujit Kumar
 
Object Oriented Exploitation: New techniques in Windows mitigation bypass
Sam Thomas
 

More from ESUG (20)

PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
ESUG
 
PDF
Directing Generative AI for Pharo Documentation
ESUG
 
PDF
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
ESUG
 
PDF
Integrating Executable Requirements in Prototyping
ESUG
 
PDF
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
ESUG
 
PDF
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
ESUG
 
PDF
Analysing Python Machine Learning Notebooks with Moose
ESUG
 
PDF
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
ESUG
 
PDF
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
ESUG
 
PDF
Package-Aware Approach for Repository-Level Code Completion in Pharo
ESUG
 
PDF
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
ESUG
 
PDF
An Analysis of Inline Method Refactoring
ESUG
 
PDF
Identification of unnecessary object allocations using static escape analysis
ESUG
 
PDF
Control flow-sensitive optimizations In the Druid Meta-Compiler
ESUG
 
PDF
Clean Blocks (IWST 2025, Gdansk, Poland)
ESUG
 
PDF
Encoding for Objects Matters (IWST 2025)
ESUG
 
PDF
Challenges of Transpiling Smalltalk to JavaScript
ESUG
 
PDF
Immersive experiences: what Pharo users do!
ESUG
 
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
Micromaid: A simple Mermaid-like chart generator for Pharo
ESUG
 
Directing Generative AI for Pharo Documentation
ESUG
 
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
ESUG
 
Integrating Executable Requirements in Prototyping
ESUG
 
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
ESUG
 
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
ESUG
 
Analysing Python Machine Learning Notebooks with Moose
ESUG
 
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
ESUG
 
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
ESUG
 
Package-Aware Approach for Repository-Level Code Completion in Pharo
ESUG
 
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
ESUG
 
An Analysis of Inline Method Refactoring
ESUG
 
Identification of unnecessary object allocations using static escape analysis
ESUG
 
Control flow-sensitive optimizations In the Druid Meta-Compiler
ESUG
 
Clean Blocks (IWST 2025, Gdansk, Poland)
ESUG
 
Encoding for Objects Matters (IWST 2025)
ESUG
 
Challenges of Transpiling Smalltalk to JavaScript
ESUG
 
Immersive experiences: what Pharo users do!
ESUG
 
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 

Recently uploaded (20)

PDF
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
PPTX
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
PDF
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
PPTX
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
PPTX
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
PPTX
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
PDF
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
PDF
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PPT
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
PDF
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
QAware GmbH
 
PPTX
Smart Panchayat Raj e-Governance App.pptx
Rohitnikam33
 
PPTX
Role Of Python In Programing Language.pptx
jaykoshti048
 
PPTX
oapresentation.pptx
mehatdhavalrajubhai
 
PDF
Exploring AI Agents in Process Industries
amoreira6
 
PPTX
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
PDF
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
Q-Advise
 
PPTX
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
PPTX
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
QAware GmbH
 
Smart Panchayat Raj e-Governance App.pptx
Rohitnikam33
 
Role Of Python In Programing Language.pptx
jaykoshti048
 
oapresentation.pptx
mehatdhavalrajubhai
 
Exploring AI Agents in Process Industries
amoreira6
 
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
Q-Advise
 
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
Bandai Playdia The Book - David Glotz
BluePanther6
 
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 

A low Overhead Per Object Write Barrier for Smalltalk

  • 1. A low Overhead Per Object Write Barrier for the CogVM Clément Béra
  • 2. Introduction • The CogVM is the standardVM for: • Pharo • Squeak • Newspeak • Cuis
  • 3. Introduction • Working runtime optimizer for Cog’s JIT • Problem with literal mutability
  • 4. Problem • Is it possible to mark any object as read- only ? • Smalltalk code to handle mutation failure • Overhead
  • 5. Terminology • Discussion onVM mailing-list • Immutable: state cannot change after object’s initialization • Write barrier or read-only object
  • 6. Use-cases • Modification tracker • Read-only literals • Compiler optimizations • Inconsistent literal modifications • Others...
  • 7. This paper • NOT about framework built using read- only objects • Implementation details to limit the overhead
  • 8. Feature • Any object can be marked as read-only, except: • Immediate objects • Context instances • Objects related to Process scheduling • Objects internal to the runtime
  • 9. APIs • Object >> isReadOnlyObject • Object >> setIsReadOnlyObject: • Object >> beWritableObject • Object >> beReadOnlyObject
  • 10. Read-only object • Instance variable store fail • Primitives mutating a read-only object fail
  • 11. IV store failure • Instance variable is not set. • A call-back is sent:
  • 12. Primitive failure • First value of array is not set
  • 13. Primitive error code • new error code: #'no modification'
  • 14. Other details • Support flags • Mirror primitives • Object >> object:setIsReadOnlyObject:
  • 15. VM compilation option • VM C compiler flag • TheVM can be compiled with or without the feature.
  • 16. Implementation • Object representation • Interpreter support • JIT support
  • 17. Implementation • Most critical part: • How to keep IV store efficient ? • Machine code generated by the JIT • Discussed in the paper...
  • 18. IV Store details • Wanted • to show it, x86 Assembly Meaning movl -12(%ebp), %edx popl %edi movl %edi, %ds:0x8(%edx) testl 0x00000003, %edi If the value to store is immediate, jump after the store check.jnz after_store Jump after the store check if the receiver is young: compare the young object space limit with receiver address movl 0x00040088, %eax jb after_store cmpl %eax, %edx Load the receiver in %edx. jnb after_store cmpl %eax, %edi If the value to store is an old object, jump after the store check. jnz after_store testb 0x20, %al movzbl %ds:0x3(%edx), %eax If the receiver is already in the remembered table, jump after the store check. call store_check_trampoline Calls the store check trampoline. Perform the store in the first instance variable using both registers (%edx and %edi) Load the value to store in %edi. after_store: Code following the store. x86 Assembly Meaning movl -12(%ebp), %edx popl %ecx movl %ecx, %ds:0x8(%edx) testb 0x03, %cl If the value to store is immediate, jump after the store check.jnz after_store If the receiver is a young object, jump after the store check. movl 0x00040088, %eax jb after_store cmpl %eax, %edx jnb after_store cmpl %eax, %ecx If the value to store is an old object, jump after the store check. jnz after_store testb 0x20, %al movzbl %ds:0x3(%edx), %eax If the receiver is already in the remembered table, jump after the store check. call store_trampoline Calls the store check trampoline. Perform the store in the first instance variable using both registers (%edx and %ecx) Load the receiver in %edx. Load the value to store in %ecx. movl -12(%ebp), %edx movl %ds:(%edx), %eax testl 0x00800000, %eax jnz store_trampoline If the receiver is read-only, jump to the store trampoline. Restore the receiver (to keep its register live). store_trampoline: after_store: Code following the store.
  • 19. Evaluation: Slow-down • Binary trees • IV Store intensive • No significant difference
  • 21. Evaluation: Slow-down • At writing time, setter overhead was 17% • Stack frame creation problem • Two path compilation • Now faster than before
  • 22. Conclusion • New feature: read-only object • Overhead is very limited