Tweak mergeImpl loop for hoistable classes
commit458d587c25d2bf1a882b308b2d3fa08a74d67c24
authorOwen Yamauchi <oyamauchi@fb.com>
Mon, 8 Oct 2012 22:35:27 +0000 (8 15:35 -0700)
committerSara Golemon <sgolemon@fb.com>
Mon, 15 Oct 2012 19:17:45 +0000 (15 12:17 -0700)
tree43ce980de2c3c6d3c5b2be4c73a118dc5134b52c
parent0a31e406334d34998650c550ed2337c7fb58a72d
Tweak mergeImpl loop for hoistable classes

This loop seems to be a significant source of LLC load misses. To some extent
this is unavoidable, since its working set (all the classes in the universe) is
way too big for cache.

However, we can avoid doing a bunch of the same work repeatedly. The series of
pointer chases (*pre->namedEntity()->clsList()) was the major culprit, and if
all the Unit's classes are unique and defined without failure, we "cache" the
results of those pointer chases and identify them with a marked low-order bit.
We already do something very similar for the non-hoistable classes.

Also, comment a few subtle things that I realized as I worked, including a
presumably deliberate (but safe) race condition.
src/runtime/vm/unit.cpp
src/runtime/vm/unit.h