Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/principle.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ To implement this hybrid approach, whenever we access an object's pointer using

<p align="center"><img src="https://github.com/user-attachments/assets/cb286079-a7bd-4ef4-9c07-21eb8eb7fd80" width="60%"></p>

For example, when accessing the `Object` mentioned above, its gcmask is `1010`. After reading field A, the gcmask becomes `1000`. If field C isn't accessed due to type coercion, it will be accounted for during the final GC marking scan.
For example, when accessing the `Object` mentioned above, its gcmask is `1001`. After reading field A, the gcmask becomes `1000`. If field C isn't accessed due to type coercion, it will be accounted for during the final GC marking scan.

Beyond type coercion, out-of-bounds memory references are another common issue. For instance, in the earlier example code `var b *int64 = &echo().B`, both fields A and C belong to memory that cannot be scanned through DWARF types and will also be accounted for during the final scan.

Expand Down Expand Up @@ -164,4 +164,4 @@ Once all objects are scanned, the reference chains along with object counts and
- `runtime.SetFinalizer.obj` (the target object)
- `runtime.SetFinalizer.fn` (the finalizer function)

- **Sub-objects without DWARF type info**: `$sub_objects$`
- **Sub-objects without DWARF type info**: `$sub_objects$`
2 changes: 1 addition & 1 deletion docs/principle_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func echo() *byte {

<p align="center"><img src="https://github.com/user-attachments/assets/cb286079-a7bd-4ef4-9c07-21eb8eb7fd80" width="60%"></p>

例如,上述 `Object` 对象访问时,其 gcmask 是`1010`,读取字段 A 后,gcmask 变成 `1000`,如果字段 C 因为类型强转没有访问到,则在最终扫描的 GC 标记时就会被统计到。
例如,上述 `Object` 对象访问时,其 gcmask 是`1001`,读取字段 A 后,gcmask 变成 `1000`,如果字段 C 因为类型强转没有访问到,则在最终扫描的 GC 标记时就会被统计到。

除了类型强转外,引用内存越界问题也很常见,如上文示例代码`var b *int64 = &echo().B`所示,字段 A 和 C 都属于无法被 DWARF 类型扫描的内存,也会在最终扫描时被统计。

Expand Down