* atomic.h (ATOMIC_OR): _InterlockedOr is not available on migw.

* gc.c (rb_gc_set_params): VM_OBJSPACE is disabled on mignw.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-06-12 00:32:32 +00:00
parent 465b0d49d6
commit df3e3768e9
4 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,9 @@
Sun Jun 12 09:32:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* atomic.h (ATOMIC_OR): _InterlockedOr is not available on migw.
* gc.c (rb_gc_set_params): VM_OBJSPACE is disabled on mignw.
Sun Jun 12 01:07:09 2011 Tadayoshi Funaba <tadf@dotrb.org> Sun Jun 12 01:07:09 2011 Tadayoshi Funaba <tadf@dotrb.org>
* ext/date/date_core.c: edited doc. * ext/date/date_core.c: edited doc.

View File

@ -2,13 +2,19 @@
#define RUBY_ATOMIC_H #define RUBY_ATOMIC_H
#ifdef _WIN32 #ifdef _WIN32
#ifdef _MSC_VER
#pragma intrinsic(_InterlockedOr) #pragma intrinsic(_InterlockedOr)
#endif
typedef LONG rb_atomic_t; typedef LONG rb_atomic_t;
# define ATOMIC_SET(var, val) InterlockedExchange(&(var), (val)) # define ATOMIC_SET(var, val) InterlockedExchange(&(var), (val))
# define ATOMIC_INC(var) InterlockedIncrement(&(var)) # define ATOMIC_INC(var) InterlockedIncrement(&(var))
# define ATOMIC_DEC(var) InterlockedDecrement(&(var)) # define ATOMIC_DEC(var) InterlockedDecrement(&(var))
#if defined __GNUC__
# define ATOMIC_OR(var, val) __asm__("lock\n\t" "orl\t%1, %0" : "=m"(var) : "Ir"(val))
#else
# define ATOMIC_OR(var, val) _InterlockedOr(&(var), (val)) # define ATOMIC_OR(var, val) _InterlockedOr(&(var), (val))
#endif
# define ATOMIC_EXCHANGE(var, val) InterlockedExchange(&(var), (val)) # define ATOMIC_EXCHANGE(var, val) InterlockedExchange(&(var), (val))
#elif defined HAVE_GCC_ATOMIC_BUILTINS #elif defined HAVE_GCC_ATOMIC_BUILTINS

9
gc.c
View File

@ -83,7 +83,9 @@ void *alloca ();
#define FREE_MIN 4096 #define FREE_MIN 4096
static unsigned int initial_malloc_limit = GC_MALLOC_LIMIT; static unsigned int initial_malloc_limit = GC_MALLOC_LIMIT;
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
static unsigned int initial_heap_min_slots = HEAP_MIN_SLOTS; static unsigned int initial_heap_min_slots = HEAP_MIN_SLOTS;
#endif
static unsigned int initial_free_min = FREE_MIN; static unsigned int initial_free_min = FREE_MIN;
#define nomem_error GET_VM()->special_exceptions[ruby_error_nomemory] #define nomem_error GET_VM()->special_exceptions[ruby_error_nomemory]
@ -474,6 +476,11 @@ rb_objspace_free(rb_objspace_t *objspace)
} }
free(objspace); free(objspace);
} }
#else
void
rb_gc_set_params(void)
{
}
#endif #endif
/* tiny heap size */ /* tiny heap size */
@ -1091,6 +1098,7 @@ init_heap(rb_objspace_t *objspace)
finalizer_table = st_init_numtable(); finalizer_table = st_init_numtable();
} }
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
static void static void
initial_expand_heap(rb_objspace_t *objspace) initial_expand_heap(rb_objspace_t *objspace)
{ {
@ -1101,6 +1109,7 @@ initial_expand_heap(rb_objspace_t *objspace)
add_heap_slots(objspace, add); add_heap_slots(objspace, add);
} }
} }
#endif
static void static void
set_heaps_increment(rb_objspace_t *objspace) set_heaps_increment(rb_objspace_t *objspace)

View File

@ -532,7 +532,6 @@ native_cond_timeout(rb_thread_cond_t *cond, struct timespec timeout_rel)
now.tv_sec = tv.tv_sec; now.tv_sec = tv.tv_sec;
now.tv_nsec = tv.tv_usec * 1000; now.tv_nsec = tv.tv_usec * 1000;
out:
timeout.tv_sec = now.tv_sec; timeout.tv_sec = now.tv_sec;
timeout.tv_nsec = now.tv_nsec; timeout.tv_nsec = now.tv_nsec;
timeout.tv_sec += timeout_rel.tv_sec; timeout.tv_sec += timeout_rel.tv_sec;