X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fsgen-new-bridge.c;h=a1eb82a714fcdbfa72a89003e1eb988869f8a0b9;hb=a884522d6a52a84352b46dd32e946edb9cb3289a;hp=20fdb460adde86c416d941f2625f335516b3e1bb;hpb=4f9c74a2c4dbfed27d09dcb99d4d590a036d6f69;p=mono.git diff --git a/mono/metadata/sgen-new-bridge.c b/mono/metadata/sgen-new-bridge.c index 20fdb460add..a1eb82a714f 100644 --- a/mono/metadata/sgen-new-bridge.c +++ b/mono/metadata/sgen-new-bridge.c @@ -3,38 +3,10 @@ * * Copyright 2011 Novell, Inc (http://www.novell.com) * Copyright 2011 Xamarin Inc (http://www.xamarin.com) - * - * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED - * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. - * - * Permission is hereby granted to use or copy this program - * for any purpose, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - * * Copyright 2001-2003 Ximian, Inc * Copyright 2003-2010 Novell, Inc. * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * Licensed under the MIT license. See LICENSE file in the project root for full license information. */ #include "config.h" @@ -93,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 { @@ -108,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; @@ -120,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. @@ -138,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; @@ -968,7 +952,7 @@ compare_hash_entries (const HashEntry *e1, const HashEntry *e2) DEF_QSORT_INLINE(hash_entries, HashEntry*, compare_hash_entries) -static unsigned long step_1, step_2, step_3, step_4, step_5, step_6; +static gint64 step_1, step_2, step_3, step_4, step_5, step_6; static int fist_pass_links, second_pass_links, sccs_links; static int max_sccs_links = 0;