Implement oom handling for MS.
authorRodrigo Kumpera <kumpera@gmail.com>
Fri, 5 Nov 2010 18:39:14 +0000 (16:39 -0200)
committerRodrigo Kumpera <kumpera@gmail.com>
Wed, 10 Nov 2010 19:35:50 +0000 (17:35 -0200)
commit572913bac4e09240a8a6237765160dbca84f8f55
tree74624108a8b81de714c5535f5d57b4de43d8d163
parent5692f8f46551fcdd3ae3a882ff7daa83cbe26f6a
Implement oom handling for MS.

* sgen-gc.c (collect_nursery): If any object was pinned
after initial pinning, sort the queue so build_nursery_fragments
will see the aditional objects.
If pinning due to OOM happened ask for a major collection.

* sgen-gc.c (major_do_collection): Adjust the pin queue if
OOM happened. Here we have to clean discarded entries before
optimizing the queue or we might end with interior pointers
in the mix.

* sgen-gc.c (sgen_collect_major_no_lock): New function so
major collectors can trigger a collection. They can't
use public API since the gc lock is not meant to be reentrant.

* sgen-major-copy-object.h (copy_object_no_checks): Pin
the object if we can't promote it.

* sgen-marksweep.c (alloc_obj): Return null if we fail
to allocate a block for a given freelist size.

* sgen-marksweep.c (major_alloc_degraded): Ditto.

* sgen-marksweep.c (major_copy_or_mark_object): Handle OOM.

* sgen-marksweep.c (major_alloc_small_pinned_obj): If allocation
fails, try a major collection since this is memory requested by
the runtime and it's much harder to handle failure.
mono/metadata/sgen-gc.c
mono/metadata/sgen-gc.h
mono/metadata/sgen-major-copy-object.h
mono/metadata/sgen-marksweep.c
mono/metadata/sgen-pinning.c