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

ruby-changes:31904

From: nobu <ko1@a...>
Date: Tue, 3 Dec 2013 23:48:34 +0900 (JST)
Subject: [ruby-changes:31904] nobu:r43983 (trunk): gc.c: use malloc_size

nobu	2013-12-03 23:48:20 +0900 (Tue, 03 Dec 2013)

  New Revision: 43983

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

  Log:
    gc.c: use malloc_size
    
    * configure.in: check malloc_size() available on BSD.
    * gc.c: use malloc_size() with malloc/malloc.h on BSD.

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
    trunk/gc.c
    trunk/internal.h
Index: configure.in
===================================================================
--- configure.in	(revision 43982)
+++ configure.in	(revision 43983)
@@ -1093,6 +1093,7 @@ AC_CHECK_HEADERS( \ https://github.com/ruby/ruby/blob/trunk/configure.in#L1093
   atomic.h \
   malloc.h \
   malloc_np.h \
+  malloc/malloc.h \
   setjmpex.h
 )
 
@@ -1870,6 +1871,7 @@ AC_CHECK_FUNCS(lockf) https://github.com/ruby/ruby/blob/trunk/configure.in#L1871
 AC_CHECK_FUNCS(log2)
 AC_CHECK_FUNCS(lstat)
 AC_CHECK_FUNCS(malloc_usable_size)
+AC_CHECK_FUNCS(malloc_size)
 AC_CHECK_FUNCS(mblen)
 AC_CHECK_FUNCS(memalign)
 AC_CHECK_FUNCS(memrchr)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43982)
+++ ChangeLog	(revision 43983)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Dec  3 23:48:18 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* configure.in: check malloc_size() available on BSD.
+
+	* gc.c: use malloc_size() with malloc/malloc.h on BSD.
+
 Tue Dec  3 23:06:20 2013  Narihiro Nakamura  <authornari@g...>
 
 	* object.c (rb_obj_clone): don't copy FL_WB_PROTECTED of a
Index: gc.c
===================================================================
--- gc.c	(revision 43982)
+++ gc.c	(revision 43983)
@@ -39,12 +39,18 @@ https://github.com/ruby/ruby/blob/trunk/gc.c#L39
 # ifdef _WIN32
 #   define HAVE_MALLOC_USABLE_SIZE
 #   define malloc_usable_size(a) _msize(a)
+# elif defined HAVE_MALLOC_SIZE
+#   define HAVE_MALLOC_USABLE_SIZE
+#   define malloc_usable_size(a) malloc_size(a)
 # endif
-#else
+#endif
+#ifdef HAVE_MALLOC_USABLE_SIZE
 # ifdef HAVE_MALLOC_H
 #  include <malloc.h>
 # elif defined(HAVE_MALLOC_NP_H)
 #  include <malloc_np.h>
+# elif defined(HAVE_MALLOC_MALLOC_H)
+#  include <malloc/malloc.h>
 # endif
 #endif
 
Index: internal.h
===================================================================
--- internal.h	(revision 43982)
+++ internal.h	(revision 43983)
@@ -455,7 +455,7 @@ void rb_objspace_set_event_hook(const rb https://github.com/ruby/ruby/blob/trunk/internal.h#L455
 void rb_gc_writebarrier_remember_promoted(VALUE obj);
 void ruby_gc_set_params(void);
 
-#if HAVE_MALLOC_USABLE_SIZE || defined(_WIN32)
+#if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32)
 #define ruby_sized_xrealloc(ptr, new_size, old_size) ruby_xrealloc(ptr, new_size)
 #define ruby_sized_xfree(ptr, size) ruby_xfree(ptr)
 #define SIZED_REALLOC_N(var,type,n,old_n) REALLOC_N(var, type, n)

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

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