mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
gc.c: define objspace functions always
* gc.c (rb_objspace_alloc, rb_objspace_free): define always regardless ENABLE_VM_OBJSPACE, and free heap pages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
70b2af3b21
commit
abbd388431
3 changed files with 12 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
|||
Tue Sep 15 19:38:55 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* gc.c (rb_objspace_alloc, rb_objspace_free): define always
|
||||
regardless ENABLE_VM_OBJSPACE, and free heap pages.
|
||||
|
||||
Tue Sep 15 15:15:41 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (rb_w32_sysinit, rb_w32_readdir): compare by
|
||||
|
|
11
gc.c
11
gc.c
|
@ -1256,11 +1256,14 @@ RVALUE_WHITE_P(VALUE obj)
|
|||
--------------------------- ObjectSpace -----------------------------
|
||||
*/
|
||||
|
||||
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
||||
rb_objspace_t *
|
||||
rb_objspace_alloc(void)
|
||||
{
|
||||
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
||||
rb_objspace_t *objspace = calloc(1, sizeof(rb_objspace_t));
|
||||
#else
|
||||
rb_objspace_t *objspace = &rb_objspace;
|
||||
#endif
|
||||
malloc_limit = gc_params.malloc_limit_min;
|
||||
|
||||
return objspace;
|
||||
|
@ -1303,9 +1306,11 @@ rb_objspace_free(rb_objspace_t *objspace)
|
|||
objspace->eden_heap.pages = NULL;
|
||||
}
|
||||
free_stack_chunks(&objspace->mark_stack);
|
||||
#if !(defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE)
|
||||
if (objspace == &rb_objspace) return;
|
||||
#endif
|
||||
free(objspace);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
heap_pages_expand_sorted(rb_objspace_t *objspace)
|
||||
|
@ -3662,7 +3667,6 @@ pop_mark_stack_chunk(mark_stack_t *stack)
|
|||
stack->index = stack->limit;
|
||||
}
|
||||
|
||||
#if (defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE) || (RGENGC_CHECK_MODE >= 4)
|
||||
static void
|
||||
free_stack_chunks(mark_stack_t *stack)
|
||||
{
|
||||
|
@ -3675,7 +3679,6 @@ free_stack_chunks(mark_stack_t *stack)
|
|||
chunk = next;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
push_mark_stack(mark_stack_t *stack, VALUE data)
|
||||
|
|
6
vm.c
6
vm.c
|
@ -1861,9 +1861,7 @@ ruby_vm_destruct(rb_vm_t *vm)
|
|||
|
||||
if (vm) {
|
||||
rb_thread_t *th = vm->main_thread;
|
||||
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
||||
struct rb_objspace *objspace = vm->objspace;
|
||||
#endif
|
||||
vm->main_thread = 0;
|
||||
if (th) {
|
||||
rb_fiber_reset_root_local_storage(th->self);
|
||||
|
@ -1872,11 +1870,9 @@ ruby_vm_destruct(rb_vm_t *vm)
|
|||
rb_vm_living_threads_init(vm);
|
||||
ruby_vm_run_at_exit_hooks(vm);
|
||||
rb_vm_gvl_destroy(vm);
|
||||
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
||||
if (objspace) {
|
||||
rb_objspace_free(objspace);
|
||||
}
|
||||
#endif
|
||||
/* after freeing objspace, you *can't* use ruby_xfree() */
|
||||
ruby_mimfree(vm);
|
||||
ruby_current_vm = 0;
|
||||
|
@ -2800,9 +2796,7 @@ Init_BareVM(void)
|
|||
rb_thread_set_current_raw(th);
|
||||
|
||||
vm_init2(vm);
|
||||
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
||||
vm->objspace = rb_objspace_alloc();
|
||||
#endif
|
||||
ruby_current_vm = vm;
|
||||
|
||||
Init_native_thread();
|
||||
|
|
Loading…
Add table
Reference in a new issue