mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
gobject: inline G_TYPE_IS() macros within gtype.c
If you take a release build (--buildtype=release) previously of GLib, functions such as g_type_create_instance() would call out to g_type_test_flags() which you can see by disassembling and looking for the call instruction to <g_type_test_flags> via the library ABI. Now that the previous commit allows checking abstract and deprecated flags it makes sense to let the compiler optimize those checks into a single pass. This is only possible if the functions themselves are inlined. Additionally, any time we have the same TypeNode we would want to be able to reuse that node rather than re-locate it.
This commit is contained in:
parent
5de7dd5a4b
commit
ab2fe494a4
@ -155,6 +155,9 @@
|
|||||||
#define g_assert_type_system_initialized() \
|
#define g_assert_type_system_initialized() \
|
||||||
g_assert (static_quark_type_flags)
|
g_assert (static_quark_type_flags)
|
||||||
|
|
||||||
|
/* Make sure G_TYPE_IS_*() macros still end up inlined */
|
||||||
|
#define g_type_test_flags(t,f) _g_type_test_flags(t,f)
|
||||||
|
|
||||||
#define TYPE_FUNDAMENTAL_FLAG_MASK (G_TYPE_FLAG_CLASSED | \
|
#define TYPE_FUNDAMENTAL_FLAG_MASK (G_TYPE_FLAG_CLASSED | \
|
||||||
G_TYPE_FLAG_INSTANTIATABLE | \
|
G_TYPE_FLAG_INSTANTIATABLE | \
|
||||||
G_TYPE_FLAG_DERIVABLE | \
|
G_TYPE_FLAG_DERIVABLE | \
|
||||||
@ -200,6 +203,8 @@ typedef struct _IFaceHolder IFaceHolder;
|
|||||||
|
|
||||||
|
|
||||||
/* --- prototypes --- */
|
/* --- prototypes --- */
|
||||||
|
static inline gboolean _g_type_test_flags (GType type,
|
||||||
|
guint flags);
|
||||||
static inline GTypeFundamentalInfo* type_node_fundamental_info_I (TypeNode *node);
|
static inline GTypeFundamentalInfo* type_node_fundamental_info_I (TypeNode *node);
|
||||||
static void type_add_flags_W (TypeNode *node,
|
static void type_add_flags_W (TypeNode *node,
|
||||||
GTypeFlags flags);
|
GTypeFlags flags);
|
||||||
@ -4005,8 +4010,8 @@ g_type_get_instance_count (GType type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* --- implementation details --- */
|
/* --- implementation details --- */
|
||||||
gboolean
|
static inline gboolean
|
||||||
g_type_test_flags (GType type,
|
_g_type_test_flags (GType type,
|
||||||
guint flags)
|
guint flags)
|
||||||
{
|
{
|
||||||
TypeNode *node;
|
TypeNode *node;
|
||||||
@ -4062,6 +4067,13 @@ g_type_test_flags (GType type,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
(g_type_test_flags) (GType type,
|
||||||
|
guint flags)
|
||||||
|
{
|
||||||
|
return _g_type_test_flags (type, flags);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_type_get_plugin:
|
* g_type_get_plugin:
|
||||||
* @type: #GType to retrieve the plugin for
|
* @type: #GType to retrieve the plugin for
|
||||||
|
Loading…
Reference in New Issue
Block a user