ruby-changes:57954
From: Aaron <ko1@a...>
Date: Fri, 27 Sep 2019 05:58:19 +0900 (JST)
Subject: [ruby-changes:57954] 3cd8f76f7f (master): Introduce a secondary arena
https://git.ruby-lang.org/ruby.git/commit/?id=3cd8f76f7f From 3cd8f76f7f1bc09f9dd6b65eaafe2fd3a990ac60 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Thu, 12 Sep 2019 15:21:18 -0700 Subject: Introduce a secondary arena We'll scan the secondary arena during GC mark. So, we should only allocate "markable" instruction linked list nodes out of the secondary arena. diff --git a/compile.c b/compile.c index ccd2c37..0d3492b 100644 --- a/compile.c +++ b/compile.c @@ -882,7 +882,7 @@ compile_data_alloc_with_arena(struct iseq_compile_data_storage **arena, size_t s https://github.com/ruby/ruby/blob/trunk/compile.c#L882 static void * compile_data_alloc(rb_iseq_t *iseq, size_t size) { - struct iseq_compile_data_storage ** arena = &ISEQ_COMPILE_DATA(iseq)->storage_current; + struct iseq_compile_data_storage ** arena = &ISEQ_COMPILE_DATA(iseq)->node.storage_current; return compile_data_alloc_with_arena(arena, size); } diff --git a/iseq.c b/iseq.c index b943253..b5417cb 100644 --- a/iseq.c +++ b/iseq.c @@ -75,7 +75,8 @@ static void https://github.com/ruby/ruby/blob/trunk/iseq.c#L75 compile_data_free(struct iseq_compile_data *compile_data) { if (compile_data) { - free_arena(compile_data->storage_head); + free_arena(compile_data->node.storage_head); + free_arena(compile_data->insn.storage_head); if (compile_data->ivar_cache_table) { rb_id_table_free(compile_data->ivar_cache_table); } @@ -420,7 +421,7 @@ rb_iseq_memsize(const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/iseq.c#L421 size += sizeof(struct iseq_compile_data); - cur = compile_data->storage_head; + cur = compile_data->node.storage_head; while (cur) { size += cur->size + offsetof(struct iseq_compile_data_storage, buff); cur = cur->next; @@ -558,7 +559,8 @@ prepare_iseq_build(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/iseq.c#L559 RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->mark_ary, rb_ary_tmp_new(3)); RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->catch_table_ary, Qnil); - ISEQ_COMPILE_DATA(iseq)->storage_head = ISEQ_COMPILE_DATA(iseq)->storage_current = new_arena(); + ISEQ_COMPILE_DATA(iseq)->node.storage_head = ISEQ_COMPILE_DATA(iseq)->node.storage_current = new_arena(); + ISEQ_COMPILE_DATA(iseq)->insn.storage_head = ISEQ_COMPILE_DATA(iseq)->insn.storage_current = new_arena(); ISEQ_COMPILE_DATA(iseq)->option = option; ISEQ_COMPILE_DATA(iseq)->ivar_cache_table = NULL; diff --git a/iseq.h b/iseq.h index 711afeb..8bb4f30 100644 --- a/iseq.h +++ b/iseq.h @@ -99,8 +99,14 @@ struct iseq_compile_data { https://github.com/ruby/ruby/blob/trunk/iseq.h#L99 struct iseq_label_data *redo_label; const rb_iseq_t *current_block; struct iseq_compile_data_ensure_node_stack *ensure_node_stack; - struct iseq_compile_data_storage *storage_head; - struct iseq_compile_data_storage *storage_current; + struct { + struct iseq_compile_data_storage *storage_head; + struct iseq_compile_data_storage *storage_current; + } node; + struct { + struct iseq_compile_data_storage *storage_head; + struct iseq_compile_data_storage *storage_current; + } insn; int loopval_popped; /* used by NODE_BREAK */ int last_line; int label_no; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/