From 612cad5d202cec168bcbfec0f148a577dbd98e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lourens=20Naud=C3=A9?= Date: Wed, 3 Jul 2019 00:29:33 +0100 Subject: [PATCH] Let struct dump_config in objspace fit in a single cache line Let dump_config boolean members roots and full_heap be bit flags instead Closes: https://github.com/ruby/ruby/pull/2274 --- ext/objspace/objspace_dump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c index 602cbadef5..7dcee589bf 100644 --- a/ext/objspace/objspace_dump.c +++ b/ext/objspace/objspace_dump.c @@ -27,12 +27,12 @@ struct dump_config { VALUE type; FILE *stream; VALUE string; - int roots; const char *root_category; VALUE cur_obj; VALUE cur_obj_klass; size_t cur_obj_references; - int full_heap; + unsigned int roots: 1; + unsigned int full_heap: 1; }; PRINTF_ARGS(static void dump_append(struct dump_config *, const char *, ...), 2, 3); @@ -368,7 +368,7 @@ root_obj_i(const char *category, VALUE obj, void *data) dump_append(dc, ", \"%#"PRIxVALUE"\"", obj); dc->root_category = category; - dc->roots++; + dc->roots = 1; } static VALUE