• Kevin Modzelewski's avatar
    Rearrange things to improve our ability to inline common cases · 2c4ab499
    Kevin Modzelewski authored
    We seem to be spending a fair amount of time doing unnecessary work
    for simple calls like boxInt and createList, which are generated
    by irgen and reduce to calling new BoxedInt / BoxedList.  The
    operator new calls tp_alloc, so we get some indirect function calls,
    and then tp_alloc does some checking about its caller, and then we
    check to see what size object to create, and how to initialize it.
    
    I created a DEFAULT_CLASS_SIMPLE macro to go with DEFAULT_CLASS,
    that should help with these things.  I (manually) inlined all of those
    functions into the operator new.
    
    I also moved the small arena bucket selection function (SmallArena::alloc)
    into the header file so that it can get inlined, since the allocation size
    is often known at compile time and we can statically resolve to a bucket.
    
    Putting these together means that boxInt and createList are much tighter.
    2c4ab499
types.h 19.3 KB