From: Andi McClure Date: Tue, 17 May 2016 17:23:02 +0000 (-0400) Subject: Add some comments in new/old gc bridges X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=30967bc73c90561ccba64e20ee7db710cbe03926;p=mono.git Add some comments in new/old gc bridges --- diff --git a/mono/metadata/sgen-new-bridge.c b/mono/metadata/sgen-new-bridge.c index 462680a63fe..a1eb82a714f 100644 --- a/mono/metadata/sgen-new-bridge.c +++ b/mono/metadata/sgen-new-bridge.c @@ -65,9 +65,11 @@ typedef struct { /* + * Bridge data for a single managed object + * * FIXME: Optimizations: * - * Don't allocate a scrs array for just one source. Most objects have + * Don't allocate a srcs array for just one source. Most objects have * just one source, so use the srcs pointer itself. */ typedef struct _HashEntry { @@ -80,10 +82,12 @@ typedef struct _HashEntry { struct _HashEntry *forwarded_to; } dfs1; struct { + // Index in sccs array of SCC this object was folded into int scc_index; } dfs2; } v; + // "Source" managed objects pointing at this destination DynPtrArray srcs; } HashEntry; @@ -92,12 +96,19 @@ typedef struct { double weight; } HashEntryWithAccounting; +// The graph of managed objects/HashEntries is reduced to a graph of strongly connected components typedef struct _SCC { int index; int api_index; + + // How many bridged objects does this SCC hold references to? int num_bridge_entries; + gboolean flag; + /* + * Index in global sccs array of SCCs holding pointers to this SCC + * * New and old xrefs are typically mutually exclusive. Only when TEST_NEW_XREFS is * enabled we do both, and compare the results. This should only be done for * debugging, obviously. @@ -110,6 +121,7 @@ typedef struct _SCC { #endif } SCC; +// Maps managed objects to corresponding HashEntry stricts static SgenHashTable hash_table = SGEN_HASH_TABLE_INIT (INTERNAL_MEM_BRIDGE_HASH_TABLE, INTERNAL_MEM_BRIDGE_HASH_TABLE_ENTRY, sizeof (HashEntry), mono_aligned_addr_hash, NULL); static guint32 current_time; diff --git a/mono/metadata/sgen-old-bridge.c b/mono/metadata/sgen-old-bridge.c index a93cc7734ad..d33d5d86815 100644 --- a/mono/metadata/sgen-old-bridge.c +++ b/mono/metadata/sgen-old-bridge.c @@ -41,11 +41,12 @@ typedef struct { DynArray array; } DynSCCArray; - /* + * Bridge data for a single managed object + * * FIXME: Optimizations: * - * Don't allocate a scrs array for just one source. Most objects have + * Don't allocate a srcs array for just one source. Most objects have * just one source, so use the srcs pointer itself. */ typedef struct _HashEntry { @@ -56,8 +57,10 @@ typedef struct _HashEntry { int finishing_time; + // "Source" managed objects pointing at this destination DynPtrArray srcs; + // Index in sccs array of SCC this object was folded into int scc_index; } HashEntry; @@ -66,13 +69,19 @@ typedef struct { double weight; } HashEntryWithAccounting; +// The graph of managed objects/HashEntries is reduced to a graph of strongly connected components typedef struct _SCC { int index; int api_index; + + // How many bridged objects does this SCC hold references to? int num_bridge_entries; + + // Index in global sccs array of SCCs holding pointers to this SCC DynIntArray xrefs; /* these are incoming, not outgoing */ } SCC; +// Maps managed objects to corresponding HashEntry stricts static SgenHashTable hash_table = SGEN_HASH_TABLE_INIT (INTERNAL_MEM_OLD_BRIDGE_HASH_TABLE, INTERNAL_MEM_OLD_BRIDGE_HASH_TABLE_ENTRY, sizeof (HashEntry), mono_aligned_addr_hash, NULL); static int current_time;