Move offsets array from interface data member to TypeNode

We need to assign offsets when the interface is not yet instantiated.
This commit is contained in:
Benjamin Otte 2010-02-11 21:08:57 +01:00
parent 61b649cffd
commit fd3923aba2

View File

@ -240,6 +240,7 @@ struct _TypeNode
GData *global_gdata; GData *global_gdata;
union { union {
GAtomicArray iface_entries; /* for !iface types */ GAtomicArray iface_entries; /* for !iface types */
GAtomicArray offsets;
} _prot; } _prot;
GType *prerequisites; GType *prerequisites;
GType supers[1]; /* flexible array */ GType supers[1]; /* flexible array */
@ -316,7 +317,6 @@ struct _IFaceData
GClassFinalizeFunc dflt_finalize; GClassFinalizeFunc dflt_finalize;
gconstpointer dflt_data; gconstpointer dflt_data;
gpointer dflt_vtable; gpointer dflt_vtable;
GAtomicArray offsets;
}; };
struct _ClassData struct _ClassData
@ -555,7 +555,7 @@ lookup_iface_entry_I (volatile IFaceEntries *entries,
return NULL; return NULL;
G_ATOMIC_ARRAY_DO_TRANSACTION G_ATOMIC_ARRAY_DO_TRANSACTION
(&iface_node->data->iface.offsets, guint8, (&iface_node->_prot.offsets, guint8,
entry = NULL; entry = NULL;
offsets = transaction_data; offsets = transaction_data;
@ -1242,7 +1242,7 @@ iface_node_has_available_offset_L (TypeNode *iface_node,
{ {
guint8 *offsets; guint8 *offsets;
offsets = G_ATOMIC_ARRAY_GET_LOCKED (&iface_node->data->iface.offsets, guint8); offsets = G_ATOMIC_ARRAY_GET_LOCKED (&iface_node->_prot.offsets, guint8);
if (offsets == NULL) if (offsets == NULL)
return TRUE; return TRUE;
@ -1293,7 +1293,7 @@ iface_node_set_offset_L (TypeNode *iface_node,
int new_size, old_size; int new_size, old_size;
int i; int i;
old_offsets = G_ATOMIC_ARRAY_GET_LOCKED (&iface_node->data->iface.offsets, guint8); old_offsets = G_ATOMIC_ARRAY_GET_LOCKED (&iface_node->_prot.offsets, guint8);
if (old_offsets == NULL) if (old_offsets == NULL)
old_size = 0; old_size = 0;
else else
@ -1305,7 +1305,7 @@ iface_node_set_offset_L (TypeNode *iface_node,
} }
new_size = MAX (old_size, offset + 1); new_size = MAX (old_size, offset + 1);
offsets = _g_atomic_array_copy (&iface_node->data->iface.offsets, offsets = _g_atomic_array_copy (&iface_node->_prot.offsets,
0, new_size - old_size); 0, new_size - old_size);
/* Mark new area as unused */ /* Mark new area as unused */
@ -1314,7 +1314,7 @@ iface_node_set_offset_L (TypeNode *iface_node,
offsets[offset] = index + 1; offsets[offset] = index + 1;
_g_atomic_array_update (&iface_node->data->iface.offsets, offsets); _g_atomic_array_update (&iface_node->_prot.offsets, offsets);
} }
static void static void