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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-06-05 05:16:46 +00:00
Родитель 3105141c7d
Коммит 6ab08d2e8d
7 изменённых файлов: 41 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,15 @@
Thu Jun 5 14:16:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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@gmail.com>
* man/ruby.1: remove rubyforge entry.

Просмотреть файл

@ -1177,8 +1177,22 @@ AC_ARG_WITH([jemalloc],
[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

1
dln.c
Просмотреть файл

@ -47,6 +47,7 @@ void *xcalloc();
void *xrealloc();
#endif
#undef free
#define free(x) xfree(x)
#include <stdio.h>

Просмотреть файл

@ -21,6 +21,9 @@ extern "C" {
#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

1
io.c
Просмотреть файл

@ -21,6 +21,7 @@
#include <errno.h>
#include "ruby_atomic.h"
#undef free
#define free(x) xfree(x)
#if defined(DOSISH) || defined(__CYGWIN__)

Просмотреть файл

@ -35,6 +35,10 @@
#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

4
st.c
Просмотреть файл

@ -73,6 +73,10 @@ static const struct st_hash_type type_strcasehash = {
static void rehash(st_table *);
#ifdef RUBY
#undef malloc
#undef realloc
#undef calloc
#undef free
#define malloc xmalloc
#define calloc xcalloc
#define realloc xrealloc