summaryrefslogtreecommitdiff
path: root/transient_heap.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-30 22:01:17 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-30 22:01:17 +0000
commit873d57347fca4fc7f407c2bca45f90797ab6f864 (patch)
tree984633263d735f6ead2991ea6f6b8a71e1ed68ed /transient_heap.c
parent437392232a142b9e56d7d6daa1e595dacb00c9db (diff)
downloadruby-873d57347fca4fc7f407c2bca45f90797ab6f864.tar.gz
support theap for T_OBJECT.
* variable.c: now instance variable space has theap supports. obj_ivar_heap_alloc() tries to acquire memory from theap. * debug_counter.h: add some counters for theap. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transient_heap.c')
-rw-r--r--transient_heap.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/transient_heap.c b/transient_heap.c
index e9a2460d88..c1d8dbc97d 100644
--- a/transient_heap.c
+++ b/transient_heap.c
@@ -353,7 +353,8 @@ rb_transient_heap_alloc(VALUE obj, size_t req_size)
struct transient_heap* theap = transient_heap_get();
size_t size = ROUND_UP(req_size + sizeof(struct transient_alloc_header), TRANSIENT_HEAP_ALLOC_ALIGN);
- TH_ASSERT(RB_TYPE_P(obj, T_ARRAY)); /* supported types */
+ TH_ASSERT(RB_TYPE_P(obj, T_ARRAY) ||
+ RB_TYPE_P(obj, T_OBJECT)); /* supported types */
if (size > TRANSIENT_HEAP_ALLOC_MAX) {
if (TRANSIENT_HEAP_DEBUG >= 3) fprintf(stderr, "rb_transient_heap_alloc: [too big: %ld] %s\n", (long)size, rb_obj_info(obj));
@@ -557,6 +558,14 @@ transient_heap_ptr(VALUE obj, int error)
ptr = NULL;
}
break;
+ case T_OBJECT:
+ if (ROBJ_TRANSIENT_P(obj)) {
+ ptr = ROBJECT_IVPTR(obj);
+ }
+ else {
+ ptr = NULL;
+ }
+ break;
default:
if (error) {
rb_bug("transient_heap_ptr: unknown obj %s\n", rb_obj_info(obj));
@@ -659,11 +668,10 @@ transient_heap_block_evacuate(struct transient_heap* theap, struct transient_hea
switch (BUILTIN_TYPE(obj)) {
case T_ARRAY:
-#if TRANSIENT_HEAP_DEBUG_DONT_PROMOTE
- rb_ary_transient_heap_evacuate(obj, FALSE);
-#else
- rb_ary_transient_heap_evacuate(obj, TRUE);
-#endif
+ rb_ary_transient_heap_evacuate(obj, !TRANSIENT_HEAP_DEBUG_DONT_PROMOTE);
+ break;
+ case T_OBJECT:
+ rb_obj_transient_heap_evacuate(obj, !TRANSIENT_HEAP_DEBUG_DONT_PROMOTE);
break;
default:
rb_bug("unsupporeted");