summaryrefslogtreecommitdiff
path: root/pthread_stop_world.c
diff options
context:
space:
mode:
authorivmai <ivmai>2011-03-27 22:19:47 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:57 +0200
commitbfda2d071b53ba9cafff211434812821d969c29d (patch)
tree4e6a71202ef733ab5233e07fa715c849f1593d42 /pthread_stop_world.c
parent2de7add91598ef5ba24e869c15b4003bc57819b1 (diff)
2011-03-27 Ivan Maidanski <ivmai@mail.ru>
* dbg_mlc.c (GC_debug_strdup, GC_debug_free): Output a portability warning if the argument is NULL and GC is in leaks detection mode. * dbg_mlc.c (GC_debug_strndup, GC_debug_wcsdup): New public function definition. * malloc.c (GC_strndup, GC_wcsdup, strndup): Ditto. * mallocx.c (GC_posix_memalign): Ditto. * malloc.c (strdup): Fix string size value; rename "len" to "lb". * mallocx.c: Include errno.h unless WinCE (otherwise include windows.h for Win32 error constants). * win32_threads.c: Define WIN32_LEAN_AND_MEAN and NOSERVICE before windows.h inclusion. * misc.c (GC_init): Register at-exit callback if GC_find_leak (even if GC_FIND_LEAK macro is unset). * pthread_stop_world.c (NACL_STORE_REGS, __nacl_suspend_thread_if_needed, GC_nacl_initialize_gc_thread): Use BCOPY() instead of memcpy(). * pthread_support.c (GC_init_real_syms): Ditto. * doc/README: Update year in copyright. * include/gc.h: Ditto. * doc/README.macros (GC_DEBUG_REPLACEMENT, GC_REQUIRE_WCSDUP): Document new macro. * doc/README.macros (REDIRECT_MALLOC): Update documentation. * include/gc.h (GC_strndup, GC_posix_memalign, GC_debug_strndup): New API function prototype. * include/gc.h (GC_MALLOC, GC_REALLOC): Redirect to GC_debug_malloc/realloc_replacement() if GC_DEBUG_REPLACEMENT. * include/gc.h (GC_STRDUP): Remove redundant parentheses. * include/leak_detector.h (realloc, strdup): Ditto. * include/gc.h (GC_STRNDUP): New API macro. * include/gc.h (GC_NEW, GC_NEW_ATOMIC, GC_NEW_STUBBORN, GC_NEW_UNCOLLECTABLE): Add missing parentheses. * include/gc.h (GC_wcsdup, GC_debug_wcsdup): New API function prototype (only if GC_REQUIRE_WCSDUP). * include/gc.h (GC_WCSDUP): New API macro (only if GC_REQUIRE_WCSDUP). * include/leak_detector.h: Add copyright header; add usage comment; include stdlib.h and string.h after gc.h (unless GC_DONT_INCLUDE_STDLIB). * include/leak_detector.h (malloc, calloc, free, realloc): Undefine symbol before its redefinition. * include/leak_detector.h (strndup, memalign, posix_memalign): Redefine to the corresponding GC function. * include/leak_detector.h (wcsdup): Redefine to GC_WCSDUP (only if GC_REQUIRE_WCSDUP). * include/leak_detector.h (CHECK_LEAKS): Add comment; don't define the macro if already defined.
Diffstat (limited to 'pthread_stop_world.c')
-rw-r--r--pthread_stop_world.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/pthread_stop_world.c b/pthread_stop_world.c
index 53bc3b6..0ef0d22 100644
--- a/pthread_stop_world.c
+++ b/pthread_stop_world.c
@@ -594,9 +594,9 @@ GC_INNER void GC_stop_world(void)
__asm__ __volatile__ ("push %r15"); \
__asm__ __volatile__ ("mov %%esp, %0" \
: "=m" (GC_nacl_gc_thread_self->stop_info.stack_ptr)); \
- memcpy(GC_nacl_gc_thread_self->stop_info.reg_storage, \
- GC_nacl_gc_thread_self->stop_info.stack_ptr, \
- NACL_GC_REG_STORAGE_SIZE * sizeof(ptr_t)); \
+ BCOPY(GC_nacl_gc_thread_self->stop_info.stack_ptr, \
+ GC_nacl_gc_thread_self->stop_info.reg_storage, \
+ NACL_GC_REG_STORAGE_SIZE * sizeof(ptr_t)); \
__asm__ __volatile__ ("naclasp $48, %r15"); \
} while (0)
# elif defined(__i386__)
@@ -608,9 +608,9 @@ GC_INNER void GC_stop_world(void)
__asm__ __volatile__ ("push %edi"); \
__asm__ __volatile__ ("mov %%esp, %0" \
: "=m" (GC_nacl_gc_thread_self->stop_info.stack_ptr)); \
- memcpy(GC_nacl_gc_thread_self->stop_info.reg_storage, \
- GC_nacl_gc_thread_self->stop_info.stack_ptr, \
- NACL_GC_REG_STORAGE_SIZE * sizeof(ptr_t));\
+ BCOPY(GC_nacl_gc_thread_self->stop_info.stack_ptr, \
+ GC_nacl_gc_thread_self->stop_info.reg_storage, \
+ NACL_GC_REG_STORAGE_SIZE * sizeof(ptr_t));\
__asm__ __volatile__ ("add $16, %esp"); \
} while (0)
# else
@@ -655,8 +655,8 @@ GC_INNER void GC_stop_world(void)
GC_nacl_thread_parked[GC_nacl_thread_idx] = 0;
/* Clear out the reg storage for next suspend. */
- memset(GC_nacl_gc_thread_self->stop_info.reg_storage, 0,
- NACL_GC_REG_STORAGE_SIZE * sizeof(ptr_t));
+ BZERO(GC_nacl_gc_thread_self->stop_info.reg_storage,
+ NACL_GC_REG_STORAGE_SIZE * sizeof(ptr_t));
}
}
@@ -678,8 +678,8 @@ GC_INNER void GC_stop_world(void)
int i;
pthread_mutex_lock(&GC_nacl_thread_alloc_lock);
if (!GC_nacl_thread_parking_inited) {
- memset(GC_nacl_thread_parked, 0, sizeof(GC_nacl_thread_parked));
- memset(GC_nacl_thread_used, 0, sizeof(GC_nacl_thread_used));
+ BZERO(GC_nacl_thread_parked, sizeof(GC_nacl_thread_parked));
+ BZERO(GC_nacl_thread_used, sizeof(GC_nacl_thread_used));
GC_nacl_thread_parking_inited = TRUE;
}
GC_ASSERT(GC_nacl_num_gc_threads <= MAX_NACL_GC_THREADS);