From: David Given Date: Mon, 23 Jan 2017 22:53:51 +0000 (+0100) Subject: Turns out that my coalescion algorithm was way too conservative; fixed. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=b930ea8773f95533f41d21e6d386220f06cd4eb0;p=ack.git Turns out that my coalescion algorithm was way too conservative; fixed. Mandelbrot allocates now! Very slowly. --- diff --git a/mach/proto/mcg/pass_registerallocator.c b/mach/proto/mcg/pass_registerallocator.c index 5a23d05f5..60a4d2bcb 100644 --- a/mach/proto/mcg/pass_registerallocator.c +++ b/mach/proto/mcg/pass_registerallocator.c @@ -9,7 +9,7 @@ * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.32.5924 */ -static const int DEGREE = 5; +static const int DEGREE = 20; static struct graph interference; static struct graph affinity; @@ -160,19 +160,24 @@ static bool attempt_to_coalesce(void) struct vreg* left = eit.left; struct vreg* right = eit.right; struct neighbour_iterator nit = {}; - static ARRAYOF(struct vreg) combined; + int thisdegree = 0; - combined.count = 0; while (graph_next_neighbour(&interference, left, &nit)) - array_appendu(&combined, nit.data); + { + if (graph_get_vertex_degree(&interference, nit.data) >= DEGREE) + thisdegree++; + } while (graph_next_neighbour(&interference, right, &nit)) - array_appendu(&combined, nit.data); + { + if (graph_get_vertex_degree(&interference, nit.data) >= DEGREE) + thisdegree++; + } - if (combined.count < degree) + if (thisdegree < degree) { vmaster = left; vslave = right; - degree = combined.count; + degree = thisdegree; } } } @@ -325,10 +330,10 @@ static void iterate(void) tracef('R', "R: iterating; interference graph: %d, affinity graph: %d\n", interference.edges.table.size, affinity.edges.table.size); - if (attempt_to_coalesce()) + if (attempt_to_simplify()) continue; - if (attempt_to_simplify()) + if (attempt_to_coalesce()) continue; if (attempt_to_freeze())