Skip to content

Commit

Permalink
Merge pull request #3252 from xmcclure/tarjan-opt-basic
Browse files Browse the repository at this point in the history
Cleanup on gc bridge to support future optimizations
  • Loading branch information
xmcclure committed Jul 8, 2016
2 parents a9035d9 + 31e1a2a commit 0a8d5a0
Show file tree
Hide file tree
Showing 8 changed files with 430 additions and 431 deletions.
3 changes: 3 additions & 0 deletions mono/metadata/metadata.h
Expand Up @@ -301,7 +301,10 @@ typedef struct {

struct _MonoArrayType {
MonoClass *eklass;
// Number of dimensions of the array
uint8_t rank;

// Arrays recording known upper and lower index bounds for each dimension
uint8_t numsizes;
uint8_t numlobounds;
int *sizes;
Expand Down
2 changes: 2 additions & 0 deletions mono/metadata/sgen-bridge-internals.h
Expand Up @@ -45,6 +45,8 @@ typedef struct {
void (*register_finalized_object) (GCObject *object);
void (*describe_pointer) (GCObject *object);
void (*enable_accounting) (void);

// Optional-- used for debugging
void (*set_dump_prefix) (const char *prefix);

/*
Expand Down
25 changes: 16 additions & 9 deletions mono/metadata/sgen-bridge.h
Expand Up @@ -9,20 +9,23 @@
* unreachable objects. We use it in monodroid to do garbage collection across
* the Mono and Java heaps.
*
* The client can designate some objects as "bridged", which means that they
* participate in the bridge processing step once SGen considers them
* The client (Monodroid) can designate some objects as "bridged", which means
* that they participate in the bridge processing step once SGen considers them
* unreachable, i.e., dead. Bridged objects must be registered for
* finalization.
*
* When SGen is done marking, it puts together a list of all dead bridged
* objects and then does a strongly connected component analysis over their
* object graph. That graph will usually contain non-bridged objects, too.
* objects. This is passed to the bridge processor, which does an analysis to
* simplify the graph: It replaces strongly-connected components with single
* nodes, and then removes any nodes corresponding to components which do not
* contain bridged objects.
*
* The output of the SCC analysis is passed to the `cross_references()`
* callback. It is expected to set the `is_alive` flag on those strongly
* connected components that it wishes to be kept alive. Only bridged objects
* will be reported to the callback, i.e., non-bridged objects are removed from
* the callback graph.
* The output of the SCC analysis is passed to the client's `cross_references()`
* callback. This consists of 2 arrays, an array of SCCs (MonoGCBridgeSCC),
* and an array of "xrefs" (edges between SCCs, MonoGCBridgeXRef). Edges are
* encoded as pairs of "API indices", ie indexes in the SCC array. The client
* is expected to set the `is_alive` flag on those strongly connected components
* that it wishes to be kept alive.
*
* In monodroid each bridged object has a corresponding Java mirror object. In
* the bridge callback it reifies the Mono object graph in the Java heap so that
Expand All @@ -37,6 +40,10 @@
* point all links to bridged objects that don't have `is_alive` set are nulled.
* Note that weak links to non-bridged objects reachable from bridged objects
* are not nulled. This might be considered a bug.
*
* There are three different implementations of the bridge processor, each of
* which implements 8 callbacks (see SgenBridgeProcessor). The implementations
* differ in the algorithm they use to compute the "simplified" SCC graph.
*/

#ifndef _MONO_SGEN_BRIDGE_H_
Expand Down

0 comments on commit 0a8d5a0

Please sign in to comment.