mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
introduce USE_TRANSIENT_HEAP to enable/disable theap.
* include/ruby/ruby.h: intrdocue `USE_TRANSIENT_HEAP` macro to enable/disable transient heap. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
dcd0346265
commit
c39797e872
9 changed files with 107 additions and 21 deletions
6
struct.c
6
struct.c
|
@ -661,15 +661,16 @@ struct_heap_alloc(VALUE st, size_t len)
|
|||
VALUE *ptr = rb_transient_heap_alloc((VALUE)st, sizeof(VALUE) * len);
|
||||
|
||||
if (ptr) {
|
||||
FL_SET_RAW(st, RSTRUCT_TRANSIENT_FLAG);
|
||||
RSTRUCT_TRANSIENT_SET(st);
|
||||
return ptr;
|
||||
}
|
||||
else {
|
||||
FL_UNSET_RAW(st, RSTRUCT_TRANSIENT_FLAG);
|
||||
RSTRUCT_TRANSIENT_UNSET(st);
|
||||
return ALLOC_N(VALUE, len);
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_TRANSIENT_HEAP
|
||||
void
|
||||
rb_struct_transient_heap_evacuate(VALUE obj, int promote)
|
||||
{
|
||||
|
@ -689,6 +690,7 @@ rb_struct_transient_heap_evacuate(VALUE obj, int promote)
|
|||
RSTRUCT(obj)->as.heap.ptr = new_ptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
struct_alloc(VALUE klass)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue