diff --git a/ChangeLog b/ChangeLog index 6cf3852e82..1914a90836 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Jan 31 21:27:43 2012 Narihiro Nakamura + + * configure.in (HEAP_ALIGN_LOG): HEAP_ALIGN_LOG should be page + size in OpenBSD. [ruby-core:42158][Bug #5901] + + * gc.c : avoid to redefine. + Tue Jan 31 14:27:22 2012 Nobuyoshi Nakada * test/ruby/envutil.rb (EnvUtil.invoke_ruby): yield also child pid diff --git a/configure.in b/configure.in index 085dfcfa20..2b56b749d4 100644 --- a/configure.in +++ b/configure.in @@ -1292,6 +1292,29 @@ main() { CFLAGS="$save_CFLAGS"]) AC_DEFINE_UNQUOTED(GC_MARK_STACKFRAME_WORD, $rb_cv_gc_mark_stackframe_word) +AS_CASE(["$target_os"], +[openbsd*], [ + AC_CACHE_CHECK(for heap align log on openbsd, rb_cv_page_size_log, + [rb_cv_page_size_log=no + for page_log in 12 13; do + AC_TRY_RUN([ +#include +#include + +int +main() { + if ((int)log2((double)sysconf(_SC_PAGESIZE)) != $page_log) return 1; + return 0; +} + ], + rb_cv_page_size_log="$page_log"; break) + done]) + if test $rb_cv_page_size_log != no; then + AC_DEFINE_UNQUOTED(HEAP_ALIGN_LOG, $rb_cv_page_size_log) + else + AC_DEFINE_UNQUOTED(HEAP_ALIGN_LOG, 12) + fi +]) dnl Checks for library functions. AC_TYPE_GETGROUPS diff --git a/gc.c b/gc.c index f52b5fc348..2c49f96363 100644 --- a/gc.c +++ b/gc.c @@ -536,8 +536,10 @@ rb_objspace_free(rb_objspace_t *objspace) } #endif -/* tiny heap size: 16KB */ +#ifndef HEAP_ALIGN_LOG +/* default tiny heap size: 16KB */ #define HEAP_ALIGN_LOG 14 +#endif #define HEAP_ALIGN (1UL << HEAP_ALIGN_LOG) #define HEAP_ALIGN_MASK (~(~0UL << HEAP_ALIGN_LOG)) #define REQUIRED_SIZE_BY_MALLOC (sizeof(size_t) * 5)