Skip to content

Commit

Permalink
object layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducasse committed Dec 9, 2024
1 parent d30c349 commit 92b29fc
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

32 - bit architecture 64 - bit architecture
| | | |
00 +---------------+- 00 -+---------------+
00 +===============+= 00 =+===============+
| | | |
04 +- Base header -+ + Base header +
| | | |
Expand All @@ -13,11 +13,11 @@
| slot 3 | | |
20 +---------------+ | slot 2 |
| padding | | |
24 +---------------+- 24 +---------------+
24 +===============+= 24 +---------------+
| | | |
28 +---------------+ | slot 3 |
| | | |
32 +---------------+ 32 -+---------------+
32 +---------------+ 32 =+===============+
| | | |


Expand Down
Binary file modified Part0-Preamble/1-ObjectStructure/figures/ObjectLayout2.pdf
Binary file not shown.
44 changes: 44 additions & 0 deletions Part0-Preamble/1-ObjectStructure/figures/ObjectLayout3-ascii.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

32 - bit architecture 64 - bit architecture
| | | |
00 +---------------+- 00 -+---------------+
| | | |
04 +- Base header -+ + Base header +
| | | |
08 +---------------+ 08 +---------------+
| slot 1 | | |
12 +---------------+ an object | slot 1 |
| slot 2 | with 3 slots | |
16 +---------------+ 16 +---------------+
| slot 3 | | |
20 +---------------+ | slot 2 |
| padding | | |
24 +---------------+- 24 +---------------+
| | | |
28 +---------------+ | slot 3 |
| | | |
32 +---------------+ 32 -+---------------+
| | | |






















| |
Binary file not shown.
2 changes: 1 addition & 1 deletion Part0-Preamble/1-ObjectStructure/objectStructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Objects in Pharo are represented as a contiguous memory region with space for a
- The data zone contains data slots.
Figure *@fig:objectLayout@* illustrates the layout of a 3-slot object in both 32-bit and 64-bit architectures.

![Object layout and alignment on 32-bit and 64-bit architectures. %width=90&anchor=fig:objectLayout](figures/objectLayout.pdf)
![Object layout and alignment on 32-bit and 64-bit architectures. %width=90&anchor=fig:objectLayout](figures/objectLayout2.pdf)

Each object has a mandatory base header that contains common information such as its class, its size, and mutable bits for the Garbage Collector.
When objects are more than 254 words long, they are considered large, and their actual size is stored in an overflow header that precedes the base header.
Expand Down

0 comments on commit 92b29fc

Please sign in to comment.