[前][次][番号順一覧][スレッド一覧]

ruby-changes:31927

From: ko1 <ko1@a...>
Date: Thu, 5 Dec 2013 17:52:36 +0900 (JST)
Subject: [ruby-changes:31927] ko1:r44006 (trunk): * gc.c: change function names vm_ prefix to objspace_ prefix.

ko1	2013-12-05 17:52:30 +0900 (Thu, 05 Dec 2013)

  New Revision: 44006

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44006

  Log:
    * gc.c: change function names vm_ prefix to objspace_ prefix.
      They are objspace_ functionality.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44005)
+++ ChangeLog	(revision 44006)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Dec  5 17:44:53 2013  Koichi Sasada  <ko1@a...>
+
+	* gc.c: change function names vm_ prefix to objspace_ prefix.
+	  They are objspace_ functionality.
+
 Thu Dec  5 16:11:04 2013  Aman Gupta <ruby@t...>
 
 	* include/ruby/intern.h: add rb_gc_stat() for access to GC.stat
Index: gc.c
===================================================================
--- gc.c	(revision 44005)
+++ gc.c	(revision 44006)
@@ -5528,7 +5528,7 @@ rb_objspace_reachable_objects_from_root( https://github.com/ruby/ruby/blob/trunk/gc.c#L5528
   ------------------------ Extended allocator ------------------------
 */
 
-static void vm_xfree(rb_objspace_t *objspace, void *ptr, size_t size);
+static void objspace_xfree(rb_objspace_t *objspace, void *ptr, size_t size);
 
 static void *
 negative_size_allocation_error_with_gvl(void *ptr)
@@ -5648,7 +5648,7 @@ aligned_free(void *ptr) https://github.com/ruby/ruby/blob/trunk/gc.c#L5648
 }
 
 static inline size_t
-vm_malloc_size(rb_objspace_t *objspace, void *ptr, size_t hint)
+objspace_malloc_size(rb_objspace_t *objspace, void *ptr, size_t hint)
 {
 #ifdef HAVE_MALLOC_USABLE_SIZE
     return malloc_usable_size(ptr);
@@ -5664,7 +5664,7 @@ enum memop_type { https://github.com/ruby/ruby/blob/trunk/gc.c#L5664
 };
 
 static void
-vm_malloc_increase(rb_objspace_t *objspace, void *mem, size_t new_size, size_t old_size, enum memop_type type)
+objspace_malloc_increase(rb_objspace_t *objspace, void *mem, size_t new_size, size_t old_size, enum memop_type type)
 {
     if (new_size > old_size) {
 	ATOMIC_SIZE_ADD(malloc_increase, new_size - old_size);
@@ -5712,7 +5712,7 @@ vm_malloc_increase(rb_objspace_t *objspa https://github.com/ruby/ruby/blob/trunk/gc.c#L5712
 	    }
 	    else {
 #if MALLOC_ALLOCATED_SIZE_CHECK
-		rb_bug("vm_malloc_increase: underflow malloc_params.allocated_size.");
+		rb_bug("objspace_malloc_increase: underflow malloc_params.allocated_size.");
 #endif
 		next_allocated_size = 0;
 	    }
@@ -5751,7 +5751,7 @@ vm_malloc_increase(rb_objspace_t *objspa https://github.com/ruby/ruby/blob/trunk/gc.c#L5751
 }
 
 static inline size_t
-vm_malloc_prepare(rb_objspace_t *objspace, size_t size)
+objspace_malloc_prepare(rb_objspace_t *objspace, size_t size)
 {
     if ((ssize_t)size < 0) {
 	negative_size_allocation_error("negative allocation size (or too big)");
@@ -5766,7 +5766,7 @@ vm_malloc_prepare(rb_objspace_t *objspac https://github.com/ruby/ruby/blob/trunk/gc.c#L5766
 }
 
 static inline void *
-vm_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size)
+objspace_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size)
 {
 #if CALC_EXACT_MALLOC_SIZE
     ((size_t *)mem)[0] = size;
@@ -5785,19 +5785,19 @@ vm_malloc_fixup(rb_objspace_t *objspace, https://github.com/ruby/ruby/blob/trunk/gc.c#L5785
     } while (0)
 
 static void *
-vm_xmalloc(rb_objspace_t *objspace, size_t size)
+objspace_xmalloc(rb_objspace_t *objspace, size_t size)
 {
     void *mem;
 
-    size = vm_malloc_prepare(objspace, size);
+    size = objspace_malloc_prepare(objspace, size);
     TRY_WITH_GC(mem = malloc(size));
-    size = vm_malloc_size(objspace, mem, size);
-    vm_malloc_increase(objspace, mem, size, 0, MEMOP_TYPE_MALLOC);
-    return vm_malloc_fixup(objspace, mem, size);
+    size = objspace_malloc_size(objspace, mem, size);
+    objspace_malloc_increase(objspace, mem, size, 0, MEMOP_TYPE_MALLOC);
+    return objspace_malloc_fixup(objspace, mem, size);
 }
 
 static void *
-vm_xrealloc(rb_objspace_t *objspace, void *ptr, size_t new_size, size_t old_size)
+objspace_xrealloc(rb_objspace_t *objspace, void *ptr, size_t new_size, size_t old_size)
 {
     void *mem;
 
@@ -5805,7 +5805,7 @@ vm_xrealloc(rb_objspace_t *objspace, voi https://github.com/ruby/ruby/blob/trunk/gc.c#L5805
 	negative_size_allocation_error("negative re-allocation size");
     }
 
-    if (!ptr) return vm_xmalloc(objspace, new_size);
+    if (!ptr) return objspace_xmalloc(objspace, new_size);
 
     /*
      * The behavior of realloc(ptr, 0) is implementation defined.
@@ -5813,7 +5813,7 @@ vm_xrealloc(rb_objspace_t *objspace, voi https://github.com/ruby/ruby/blob/trunk/gc.c#L5813
      * see http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_400.htm
      */
     if (new_size == 0) {
-	vm_xfree(objspace, ptr, old_size);
+	objspace_xfree(objspace, ptr, old_size);
 	return 0;
     }
 
@@ -5823,38 +5823,38 @@ vm_xrealloc(rb_objspace_t *objspace, voi https://github.com/ruby/ruby/blob/trunk/gc.c#L5823
     oldsize = ((size_t *)ptr)[0];
 #endif
 
-    old_size = vm_malloc_size(objspace, ptr, old_size);
+    old_size = objspace_malloc_size(objspace, ptr, old_size);
     TRY_WITH_GC(mem = realloc(ptr, new_size));
-    new_size = vm_malloc_size(objspace, mem, new_size);
+    new_size = objspace_malloc_size(objspace, mem, new_size);
 
 #if CALC_EXACT_MALLOC_SIZE
     ((size_t *)mem)[0] = new_size;
     mem = (size_t *)mem + 1;
 #endif
 
-    vm_malloc_increase(objspace, mem, new_size, old_size, MEMOP_TYPE_REALLOC);
+    objspace_malloc_increase(objspace, mem, new_size, old_size, MEMOP_TYPE_REALLOC);
 
     return mem;
 }
 
 static void
-vm_xfree(rb_objspace_t *objspace, void *ptr, size_t old_size)
+objspace_xfree(rb_objspace_t *objspace, void *ptr, size_t old_size)
 {
 #if CALC_EXACT_MALLOC_SIZE
     ptr = ((size_t *)ptr) - 1;
     oldsize = ((size_t*)ptr)[0];
 #endif
-    old_size = vm_malloc_size(objspace, ptr, old_size);
+    old_size = objspace_malloc_size(objspace, ptr, old_size);
 
     free(ptr);
 
-    vm_malloc_increase(objspace, ptr, 0, old_size, MEMOP_TYPE_FREE);
+    objspace_malloc_increase(objspace, ptr, 0, old_size, MEMOP_TYPE_FREE);
 }
 
 void *
 ruby_xmalloc(size_t size)
 {
-    return vm_xmalloc(&rb_objspace, size);
+    return objspace_xmalloc(&rb_objspace, size);
 }
 
 static inline size_t
@@ -5870,26 +5870,26 @@ xmalloc2_size(size_t n, size_t size) https://github.com/ruby/ruby/blob/trunk/gc.c#L5870
 void *
 ruby_xmalloc2(size_t n, size_t size)
 {
-    return vm_xmalloc(&rb_objspace, xmalloc2_size(n, size));
+    return objspace_xmalloc(&rb_objspace, xmalloc2_size(n, size));
 }
 
 static void *
-vm_xcalloc(rb_objspace_t *objspace, size_t count, size_t elsize)
+objspace_xcalloc(rb_objspace_t *objspace, size_t count, size_t elsize)
 {
     void *mem;
     size_t size;
 
     size = xmalloc2_size(count, elsize);
-    size = vm_malloc_prepare(objspace, size);
+    size = objspace_malloc_prepare(objspace, size);
 
     TRY_WITH_GC(mem = calloc(1, size));
-    return vm_malloc_fixup(objspace, mem, size);
+    return objspace_malloc_fixup(objspace, mem, size);
 }
 
 void *
 ruby_xcalloc(size_t n, size_t size)
 {
-    return vm_xcalloc(&rb_objspace, n, size);
+    return objspace_xcalloc(&rb_objspace, n, size);
 }
 
 #ifdef ruby_sized_xrealloc
@@ -5898,7 +5898,7 @@ ruby_xcalloc(size_t n, size_t size) https://github.com/ruby/ruby/blob/trunk/gc.c#L5898
 void *
 ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size)
 {
-    return vm_xrealloc(&rb_objspace, ptr, new_size, old_size);
+    return objspace_xrealloc(&rb_objspace, ptr, new_size, old_size);
 }
 
 void *
@@ -5924,7 +5924,7 @@ void https://github.com/ruby/ruby/blob/trunk/gc.c#L5924
 ruby_sized_xfree(void *x, size_t size)
 {
     if (x) {
-	vm_xfree(&rb_objspace, x, size);
+	objspace_xfree(&rb_objspace, x, size);
     }
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]