diff options
author | Peter Zhu <peter@peterzhu.ca> | 2023-06-13 16:19:33 -0400 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-07-13 09:27:33 -0400 |
commit | 1e7b67f73370056c7521306b9f037b6cbccf640d (patch) | |
tree | 288d284f69cea8935adf323da99f84eff2bb7707 /struct.c | |
parent | fff4773085bd70bf14ace146388dd0b9d80f244a (diff) |
[Feature #19730] Remove transient heap
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7942
Diffstat (limited to 'struct.c')
-rw-r--r-- | struct.c | 34 |
1 files changed, 1 insertions, 33 deletions
@@ -18,7 +18,6 @@ #include "internal/proc.h" #include "internal/struct.h" #include "internal/symbol.h" -#include "transient_heap.h" #include "vm_core.h" #include "builtin.h" @@ -798,39 +797,8 @@ rb_struct_initialize(VALUE self, VALUE values) static VALUE * struct_heap_alloc(VALUE st, size_t len) { - VALUE *ptr = rb_transient_heap_alloc((VALUE)st, sizeof(VALUE) * len); - - if (ptr) { - RSTRUCT_TRANSIENT_SET(st); - return ptr; - } - else { - RSTRUCT_TRANSIENT_UNSET(st); - return ALLOC_N(VALUE, len); - } -} - -#if USE_TRANSIENT_HEAP -void -rb_struct_transient_heap_evacuate(VALUE obj, int promote) -{ - if (RSTRUCT_TRANSIENT_P(obj)) { - const VALUE *old_ptr = rb_struct_const_heap_ptr(obj); - VALUE *new_ptr; - long len = RSTRUCT_LEN(obj); - - if (promote) { - new_ptr = ALLOC_N(VALUE, len); - FL_UNSET_RAW(obj, RSTRUCT_TRANSIENT_FLAG); - } - else { - new_ptr = struct_heap_alloc(obj, len); - } - MEMCPY(new_ptr, old_ptr, VALUE, len); - RSTRUCT(obj)->as.heap.ptr = new_ptr; - } + return ALLOC_N(VALUE, len); } -#endif static VALUE struct_alloc(VALUE klass) |