New string intern table without immortal bits.
The old implementation of the intern table stole the lsb to denote
that a string was "immortal" meaning that it was loaded from a dex
file. Before clients can use strings from this table they must be
aware of the bit and clear it before chasing the pointer.
The new intern table separates strings that are interned by a call to
String.intern and strings that are interned by the class loader. This
adds a small cost to each intern call. Fortunately, there is a
payback in the garbage collector as we can scan just the literal
strings during root marking and scan just the user interned strings
before sweeping to clear them. Also we no longer have to special case
walking through reference-containing locations in the intern table.
2 files changed