[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #1173: Symbols held in GC-roots are sometimes col
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #1173: Symbols held in GC-roots are sometimes collected in "symbol-gc" mode |
Date: |
Sun, 21 Aug 2016 14:36:49 -0000 |
#1173: Symbols held in GC-roots are sometimes collected in "symbol-gc" mode
-----------------------------+-------------------
Reporter: felix | Owner:
Type: defect | Status: new
Priority: major | Milestone: 5.0
Component: core libraries | Version: 4.9.x
Resolution: | Keywords:
-----------------------------+-------------------
Comment (by sjamaan):
The reason the original version doesn't work seems to be because the weak
table's displacement code might run out of space, and simply not insert
the symbol in the table.
The fixed version dispenses with the weak table, and instead changes
buckets to weakly refer to their symbol. After a GC, it scans the symbol
table, and updates the weak references if their targets are forwarded. If
the result isn't in the new heap or permanent, it can be discarded.
This implementation is rather slow, because I had to move the scanning of
the symbol table to be done even for minor GCs, because symbols can be
purely stack-allocated and unreferenced by anything except the symbol
table, yet still need to be preserved: this happens when the symbol gets a
global definition or a property list.
We can speed this up by changing the code for `set!` and `putprop` to
"touch" the symbol table, so these symbols are put on the mutation stack,
for example. Alternatively, we could make a separate stack of "symbols to
persist", but that's a bit ugly.
If we add this "touch symbol" code, it probably also needs to remove the
`C_SPECIALBLOCK_BIT` on the bucket containing the symbol. That way, the
symbol is preserved on the next major GC even if there's nothing
referencing it. Then, the original symbol table scanning code in the GC
can be restored again, which means the performance should be the same as
it originally was.
--
Ticket URL: <http://bugs.call-cc.org/ticket/1173#comment:9>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.
- Re: [Chicken-janitors] #1173: Symbols held in GC-roots are sometimes collected in "symbol-gc" mode, Chicken Trac, 2016/08/20
- Re: [Chicken-janitors] #1173: Symbols held in GC-roots are sometimes collected in "symbol-gc" mode,
Chicken Trac <=
- Re: [Chicken-janitors] #1173: Symbols held in GC-roots are sometimes collected in "symbol-gc" mode, Chicken Trac, 2016/08/21
- Re: [Chicken-janitors] #1173: Symbols held in GC-roots are sometimes collected in "symbol-gc" mode, Chicken Trac, 2016/08/21
- Re: [Chicken-janitors] #1173: Symbols held in GC-roots are sometimes collected in "symbol-gc" mode, Chicken Trac, 2016/08/21
- Re: [Chicken-janitors] #1173: Symbols held in GC-roots are sometimes collected in "symbol-gc" mode, Chicken Trac, 2016/08/22
- Re: [Chicken-janitors] #1173: Symbols held in GC-roots are sometimes collected in "symbol-gc" mode, Chicken Trac, 2016/08/25