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

ruby-changes:34273

From: nobu <ko1@a...>
Date: Thu, 5 Jun 2014 14:17:02 +0900 (JST)
Subject: [ruby-changes:34273] nobu:r46354 (trunk): configure.in, missing.h: jemalloc mangling

nobu	2014-06-05 14:16:46 +0900 (Thu, 05 Jun 2014)

  New Revision: 46354

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

  Log:
    configure.in, missing.h: jemalloc mangling
    
    * configure.in (with-jemalloc): also check for header, for ABIs
      which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF
      platforms.  [ruby-core:62939] [Feature #9113]
    * include/ruby/missing.h: include alternative malloc header to
      replace memory management functions.
    * dln.c, io.c, parse.y, st.c: undef malloc family before
      re-definition to suppress warnings.

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
    trunk/dln.c
    trunk/include/ruby/missing.h
    trunk/io.c
    trunk/parse.y
    trunk/st.c
Index: include/ruby/missing.h
===================================================================
--- include/ruby/missing.h	(revision 46353)
+++ include/ruby/missing.h	(revision 46354)
@@ -21,6 +21,9 @@ extern "C" { https://github.com/ruby/ruby/blob/trunk/include/ruby/missing.h#L21
 #include "ruby/config.h"
 #include <stddef.h>
 #include <math.h> /* for INFINITY and NAN */
+#ifdef RUBY_ALTERNATIVE_MALLOC_HEADER
+# include RUBY_ALTERNATIVE_MALLOC_HEADER
+#endif
 #ifdef RUBY_EXTCONF_H
 #include RUBY_EXTCONF_H
 #endif
Index: configure.in
===================================================================
--- configure.in	(revision 46353)
+++ configure.in	(revision 46354)
@@ -1177,8 +1177,22 @@ AC_ARG_WITH([jemalloc], https://github.com/ruby/ruby/blob/trunk/configure.in#L1177
   [AS_HELP_STRING([--with-jemalloc],[use jemalloc allocator])],
   [with_jemalloc=yes], [with_jemalloc=no])
 AS_IF([test "x$with_jemalloc" = xyes],[
-  AC_CHECK_LIB([jemalloc],[malloc_conf],[LIBS="-ljemalloc $LIBS"],
-    [AC_MSG_ERROR([jemalloc requested but not found])])])
+  AC_CHECK_LIB([jemalloc],[malloc_conf],[], [with_jemalloc=no])
+  AS_IF([test "x$with_jemalloc" != xyes],[
+    AC_CHECK_HEADER(jemalloc/jemalloc.h, [
+      AC_DEFINE(RUBY_ALTERNATIVE_MALLOC_HEADER, [<jemalloc/jemalloc.h>])
+      AC_DEFINE(JEMALLOC_MANGLE)
+      with_jemalloc=yes
+    ])
+  ])
+  AS_IF([test "x$with_jemalloc" = xyes],
+    [
+      ac_cv_func_malloc_usable_size=yes
+      LIBS="-ljemalloc $LIBS"
+    ],
+    [AC_MSG_ERROR([jemalloc requested but not found])
+  ])
+])
 
 dnl check for large file stuff
 mv confdefs.h confdefs1.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46353)
+++ ChangeLog	(revision 46354)
@@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jun  5 14:16:41 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* configure.in (with-jemalloc): also check for header, for ABIs
+	  which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF
+	  platforms.  [ruby-core:62939] [Feature #9113]
+
+	* include/ruby/missing.h: include alternative malloc header to
+	  replace memory management functions.
+
+	* dln.c, io.c, parse.y, st.c: undef malloc family before
+	  re-definition to suppress warnings.
+
 Thu Jun  5 12:52:18 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
 
 	* man/ruby.1: remove rubyforge entry.
Index: io.c
===================================================================
--- io.c	(revision 46353)
+++ io.c	(revision 46354)
@@ -21,6 +21,7 @@ https://github.com/ruby/ruby/blob/trunk/io.c#L21
 #include <errno.h>
 #include "ruby_atomic.h"
 
+#undef free
 #define free(x) xfree(x)
 
 #if defined(DOSISH) || defined(__CYGWIN__)
Index: st.c
===================================================================
--- st.c	(revision 46353)
+++ st.c	(revision 46354)
@@ -73,6 +73,10 @@ static const struct st_hash_type type_st https://github.com/ruby/ruby/blob/trunk/st.c#L73
 static void rehash(st_table *);
 
 #ifdef RUBY
+#undef malloc
+#undef realloc
+#undef calloc
+#undef free
 #define malloc xmalloc
 #define calloc xcalloc
 #define realloc xrealloc
Index: parse.y
===================================================================
--- parse.y	(revision 46353)
+++ parse.y	(revision 46354)
@@ -35,6 +35,10 @@ https://github.com/ruby/ruby/blob/trunk/parse.y#L35
 #define YYREALLOC(ptr, size)	rb_parser_realloc(parser, (ptr), (size))
 #define YYCALLOC(nelem, size)	rb_parser_calloc(parser, (nelem), (size))
 #define YYFREE(ptr)		rb_parser_free(parser, (ptr))
+#undef malloc
+#undef realloc
+#undef calloc
+#undef free
 #define malloc	YYMALLOC
 #define realloc	YYREALLOC
 #define calloc	YYCALLOC
Index: dln.c
===================================================================
--- dln.c	(revision 46353)
+++ dln.c	(revision 46354)
@@ -47,6 +47,7 @@ void *xcalloc(); https://github.com/ruby/ruby/blob/trunk/dln.c#L47
 void *xrealloc();
 #endif
 
+#undef free
 #define free(x) xfree(x)
 
 #include <stdio.h>

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

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