Repository navigation
Commit d474353
authored
Address slot members by byte offset (#8811)
* Keep slot values freelist-eligible
Member cells now sit in the object allocation ahead of the extension
header, so a slot read is one pointer instead of a boxed slice. A
value stored in a slot is not marked published. With threading, only
the value that leaves the slot is, so its free can wait out a reader.
Without threading a slot read is a single incref.
Assisted-by: Grok:4.7
* Address slot members by byte offset
A slot member's offset is the byte distance from the object to its
inline pointer cell. Loads and stores, including the specialized
instructions, use that address. A relative C offset is resolved by
adding the object header and the type's basic size.
Assisted-by: Grok:4.7
* Keep base slot offsets stable on subclasses
Cell 0 sits directly in front of the extension header. Further slots
extend away from the object, so a member offset computed for a base
class still addresses the same cell on a subclass.
Assisted-by: Grok:4.7
* Pack slot cells flush against the extension header
On 32-bit targets an odd slot count is not a multiple of ObjExt's
alignment. The padding now sits in front of the cells, so cell 0
stays immediately before the header. The non-threading slot load is
also the function's return value.
Assisted-by: Grok:4.7
* Place weakref lists in front of slot cells
A subclass that adds a weakref list no longer inserts it between
ObjExt and the object, so inherited member offsets stay valid.
Assisted-by: Grok:4.71 parent e56dfa1 commit d474353
8 files changed
Lines changed: 210 additions & 114 deletions
File tree
- crates
- capi/src
- vm/src
- builtins
- object
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
136 | 135 | | |
137 | 136 | | |
138 | 137 | | |
139 | | - | |
140 | 138 | | |
141 | 139 | | |
142 | 140 | | |
| |||
147 | 145 | | |
148 | 146 | | |
149 | 147 | | |
150 | | - | |
151 | | - | |
| 148 | + | |
| 149 | + | |
152 | 150 | | |
153 | 151 | | |
154 | | - | |
| 152 | + | |
155 | 153 | | |
156 | 154 | | |
157 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
359 | | - | |
360 | | - | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | | - | |
419 | | - | |
| 418 | + | |
| 419 | + | |
420 | 420 | | |
421 | | - | |
| 421 | + | |
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
| |||
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
439 | | - | |
440 | | - | |
441 | | - | |
| 439 | + | |
442 | 440 | | |
443 | 441 | | |
444 | 442 | | |
| |||
468 | 466 | | |
469 | 467 | | |
470 | 468 | | |
471 | | - | |
| 469 | + | |
472 | 470 | | |
473 | 471 | | |
474 | 472 | | |
| |||
566 | 564 | | |
567 | 565 | | |
568 | 566 | | |
569 | | - | |
| 567 | + | |
570 | 568 | | |
571 | 569 | | |
572 | 570 | | |
| |||
589 | 587 | | |
590 | 588 | | |
591 | 589 | | |
592 | | - | |
| 590 | + | |
593 | 591 | | |
594 | 592 | | |
595 | 593 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2782 | 2782 | | |
2783 | 2783 | | |
2784 | 2784 | | |
2785 | | - | |
| 2785 | + | |
2786 | 2786 | | |
2787 | 2787 | | |
2788 | 2788 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6291 | 6291 | | |
6292 | 6292 | | |
6293 | 6293 | | |
6294 | | - | |
| 6294 | + | |
6295 | 6295 | | |
6296 | 6296 | | |
6297 | 6297 | | |
| |||
6381 | 6381 | | |
6382 | 6382 | | |
6383 | 6383 | | |
6384 | | - | |
| 6384 | + | |
6385 | 6385 | | |
6386 | 6386 | | |
6387 | 6387 | | |
| |||
0 commit comments