TypeMapLevel


#1

Can anyone give a brief overview of TypeMapLevel? I hit one in a m.specializations field of a m::Method. The fieldnames of TypeMapLevel seem a bit inscrutable, and from the couple of comments in julia.h I’m not really getting it.


#2

The TypeMapLevels form a trie-like structure. The TypeMapLevel at depth N splits the trie based on the type of argument in position N. In the code and header file this N is also called an “offset”.

The field arg1 I think is misnamed at this point — it’s just a hash table that maps the type at position N to the right child node (either a TypeMapEntry or another TypeMapLevel). targ is the same but for types of the form Type{T}. linear is a linked list of entries, used when it’s not worth doing any more trie splitting, and for types that can’t be hashed. The any field is used when the type at position N is Any.


#4

The field arg1 I think is misnamed at this point

I read it as “one argument”, as in “a tree-split over one argument that has a single possible type” (no subtypes). But I agree this isn’t the most straightforward name anymore.