Skip to content
  • Christian Hergert's avatar
    gtype: improve get_type fast path · e924f777
    Christian Hergert authored and Philip Withnall's avatar Philip Withnall committed
    The -fstack-protector-strong used in many distributions by default has a
    rather drastic slowdown of the fast path in generated _get_type()
    functions using G_DEFINE_* macros. The amount can vary by architecture,
    GCC version, and compiler flags.
    
    To work around this, and ensure a higher probability that our fast-path
    will match what we had previously, we need to break out the slow-path
    (registering the type) into a secondary function that is not a candidate
    for inlining.
    
    This ensures that the common case (type registered, return the GType id)
    is the hot path and handled in the prologue of the generated assembly even
    when -fstack-protector-strong is enabled.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=795180
    e924f777