mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
437392232a
commit
873d57347f
6 changed files with 170 additions and 59 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue