[前][次][番号順一覧][スレッド一覧]

ruby-changes:57956

From: Aaron <ko1@a...>
Date: Fri, 27 Sep 2019 05:58:20 +0900 (JST)
Subject: [ruby-changes:57956] 451776f13d (master): Pass in arena to allocator

https://git.ruby-lang.org/ruby.git/commit/?id=451776f13d

From 451776f13d24b0121b2bdfbe4eaafe7c74069c72 Mon Sep 17 00:00:00 2001
From: Aaron Patterson <tenderlove@r...>
Date: Thu, 12 Sep 2019 15:02:23 -0700
Subject: Pass in arena to allocator

This is so we can configure a new arena later

diff --git a/compile.c b/compile.c
index 51b7b9f..ccd2c37 100644
--- a/compile.c
+++ b/compile.c
@@ -841,11 +841,10 @@ calc_padding(void *ptr, size_t size) https://github.com/ruby/ruby/blob/trunk/compile.c#L841
 #endif /* STRICT_ALIGNMENT */
 
 static void *
-compile_data_alloc(rb_iseq_t *iseq, size_t size)
+compile_data_alloc_with_arena(struct iseq_compile_data_storage **arena, size_t size)
 {
     void *ptr = 0;
-    struct iseq_compile_data_storage *storage =
-	ISEQ_COMPILE_DATA(iseq)->storage_current;
+    struct iseq_compile_data_storage *storage = *arena;
 #ifdef STRICT_ALIGNMENT
     size_t padding = calc_padding((void *)&storage->buff[storage->pos], size);
 #else
@@ -862,7 +861,7 @@ compile_data_alloc(rb_iseq_t *iseq, size_t size) https://github.com/ruby/ruby/blob/trunk/compile.c#L861
 	}
 	storage->next = (void *)ALLOC_N(char, alloc_size +
 					offsetof(struct iseq_compile_data_storage, buff));
-	storage = ISEQ_COMPILE_DATA(iseq)->storage_current = storage->next;
+	storage = *arena = storage->next;
 	storage->next = 0;
 	storage->pos = 0;
 	storage->size = alloc_size;
@@ -880,6 +879,13 @@ compile_data_alloc(rb_iseq_t *iseq, size_t size) https://github.com/ruby/ruby/blob/trunk/compile.c#L879
     return ptr;
 }
 
+static void *
+compile_data_alloc(rb_iseq_t *iseq, size_t size)
+{
+    struct iseq_compile_data_storage ** arena = &ISEQ_COMPILE_DATA(iseq)->storage_current;
+    return compile_data_alloc_with_arena(arena, size);
+}
+
 static INSN *
 compile_data_alloc_insn(rb_iseq_t *iseq)
 {
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]