Closed Bug 513121 Opened 16 years ago Closed 15 years ago

String doesn't need master/index fields in every instance

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED WONTFIX
Future

People

(Reporter: stejohns, Unassigned)

Details

Currently, every String has a union that contains a Stringp (master) and int32 (index). The master field is only used for dependent strings; the index field is only used by parseIndex/getIntAtom, which is (effectively) only used for interned strings. Since am-I-dependent and am-I-interned are known at String creation time, we could conditionally allocate the extra space for these fields and potentially 4 bytes for a lot of strings.
Not entirely true, unfortunately; the interned bit is set at an existing instance. If we did not, *every* interned string must be copied - you cannot just intern an arbitrary string, but only strings with a master/index field.
I think Steven is arguing that we know whether a string will be interned at the time when it is created. If that's true, then we don't need the ability to change the interned bit of an existing instance.
A savings of four bytes may not matter - the GC size classes are all spaced by 8 bytes, for small objects (and pointer tagging requires this, it's not primarily an artifact of MMgc). So the actual object size would be the same as before even if the logical object size is four bytes smaller. That said, on a 64-bit system, String objects would actually be one word smaller because the master pointer is an 8-bit word at present.
Target Milestone: --- → Future
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Resolution: FIXED → WONTFIX
bulk verifying resolved !fixed issues
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.