From 2c32bff60987d38a60a58d4f0123f3783da60a63 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 30 Jan 2019 11:44:42 -0200 Subject: After a "bad collections", avoid switching back back to generational After a major bad collection (one that collects too few objects), next collection will be major again. In that case, avoid switching back to generational mode (as it will have to switch again to incremental to do next major collection). --- lgc.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lgc.h') diff --git a/lgc.h b/lgc.h index 6b1c2861..9ba7ecb0 100644 --- a/lgc.h +++ b/lgc.h @@ -123,7 +123,7 @@ #define LUAI_GENMINORMUL 20 /* wait memory to double before starting new cycle */ -#define LUAI_GCPAUSE 200 /* 200% */ +#define LUAI_GCPAUSE 200 /* ** some gc parameters are stored divided by 4 to allow a maximum value @@ -138,6 +138,13 @@ #define LUAI_GCSTEPSIZE 13 /* 8 KB */ +/* +** Check whether the declared GC mode is generational. While in +** generational mode, the collector can go temporarily to incremental +** mode to improve performance. This is signaled by 'g->lastatomic != 0'. +*/ +#define isdecGCmodegen(g) (g->gckind == KGC_GEN || g->lastatomic != 0) + /* ** Does one step of collection when debt becomes positive. 'pre'/'pos' ** allows some adjustments to be done only when needed. macro -- cgit v1.2.3-55-g6feb