From ef0061dbcae089f56452bcefa92cb37d26d251a3 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Sun, 2 Mar 2025 22:57:30 +0100 Subject: Minor tweaks --- content/posts/pointer-tagging/index.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'content/posts') diff --git a/content/posts/pointer-tagging/index.md b/content/posts/pointer-tagging/index.md index 3794ade..7835e3d 100644 --- a/content/posts/pointer-tagging/index.md +++ b/content/posts/pointer-tagging/index.md @@ -14,10 +14,10 @@ that can reduce memory footprint and boost performance. Despite having a widespread usage and long history[^tagarch], pointer tagging remains a relatively obscure topic. That's because most of its applications are very low level, -such as operating systems and programming language interpreters. +in operating systems and programming language interpreters. -We will look behind the scenes, analyzing and implementing them, -with a focus on applications in language development. +We will look behind the scenes, analyzing and implementing this technique, +with a focus on its uses in language development. ## Preliminary theory @@ -239,11 +239,17 @@ This is particularly used in languages where double is the dominant number type[ The V8 JavaScript engine uses **pointer compression**[^v8]. Instead of using real addresses, all the allocations are represented by 32-bit offsets in a 4 GiB heap. -By *compressing* the pointer size, the memory footprint is reduced by up to 40%. +By *compressing* the pointer size, the memory footprint can be reduced by up to 40%. ## Tagged union implementation +After all this theory and considerations, we can finally move on to the implementation. +But before delving into the pointer tagging techniques we just described, +let's start from the tagged union representation. +The implementation will be fairly trivial, but it will introduce the value types and +coding style that we will use from now on. + ```c typedef enum { -- cgit v1.2.3