+2009-09-27 Ivan Maidanski <ivmai@mail.ru>
+
+ * win32_threads.c (GC_get_stack_min, GC_push_stack_for,
+ GC_get_next_stack): Recognize _WIN32_WCE_EMULATION macro (used for
+ WinCE emulation and for custom WinCE 6 devices); add the comment.
+ * win32_threads.c (GC_get_stack_min): Cast pointer to word instead
+ of DWORD.
+ * win32_threads.c (GC_get_next_stack): Don't use and maintain the
+ latest known stack_min value for WinCE (if GC_get_stack_min is
+ defined as a macro); update the comments.
+ * win32_threads.c (GC_wnt): Don't declare for WinCE.
+
2009-09-26 Ivan Maidanski <ivmai@mail.ru>
* Makefile.direct: Document EMPTY_GETENV_RESULTS.
GC_please_stop = FALSE;
}
-#ifdef MSWINCE
+/* Note: -D_WIN32_WCE_EMULATION might to be required for WinCE 6. */
+#if defined(MSWINCE) && !defined(_WIN32_WCE_EMULATION)
/* The VirtualQuery calls below won't work properly on WinCE, but */
/* since each stack is restricted to an aligned 64K region of */
/* virtual memory we can just take the next lowest multiple of 64K. */
-# define GC_get_stack_min(s) \
- ((ptr_t)(((DWORD)(s) - 1) & 0xFFFF0000))
+# define GC_get_stack_min(s) (ptr_t)(((word)(s) - 1) & ~(word)0xFFFF)
#else
- /* A cache holding the results of the last VirtualQuery call. */
+ /* A cache holding the results of the recent VirtualQuery call. */
/* Protected by the allocation lock. */
static ptr_t last_address = 0;
static MEMORY_BASIC_INFORMATION last_info;
if (sp < thread -> stack_base && sp >= thread -> last_stack_min) {
stack_min = sp;
} else {
-# ifdef MSWINCE
+# if defined(MSWINCE) && !defined(_WIN32_WCE_EMULATION)
stack_min = GC_get_stack_min(activation_frame != NULL ?
(ptr_t)activation_frame : thread -> stack_base);
# else
}
GC_ASSERT(current_min > start);
-
-# ifndef MSWINCE
+# if defined(MSWINCE) && !defined(_WIN32_WCE_EMULATION)
+ /* No need to maintain the latest known stack_min. */
+ *lo = GC_get_stack_min(current_min);
+# else
if (current_min > limit && !GC_may_be_in_stack(limit)) {
- /* Skip the rest since the memory region at limit address is */
- /* not a stack (so the lowest address of the found stack would */
- /* be above the limit value anyway). */
+ /* Skip the rest since the memory region at limit address is */
+ /* not a stack (so the lowest address of the found stack would */
+ /* be above the limit value anyway). */
*lo = ADDR_LIMIT;
return;
}
-# endif
- /* Get the minimum address of the found stack by probing its memory */
- /* region starting from the last known minimum (if set). */
- if (*plast_stack_min == ADDR_LIMIT
-# ifndef MSWINCE
- || !GC_may_be_in_stack(*plast_stack_min)
-# endif
- ) {
- /* Unsafe to start from last value. */
- *lo = GC_get_stack_min(current_min);
- } else {
- /* Use last value value to optimize search for min address */
- *lo = GC_get_stack_min(*plast_stack_min);
- }
+ /* Get the minimum address of the found stack by probing its memory */
+ /* region starting from the recent known minimum (if set). */
+ if (*plast_stack_min == ADDR_LIMIT
+ || !GC_may_be_in_stack(*plast_stack_min)) {
+ /* Unsafe to start from last_stack_min value. */
+ *lo = GC_get_stack_min(current_min);
+ } else {
+ /* Use the recent value to optimize search for min address. */
+ *lo = GC_get_stack_min(*plast_stack_min);
+ }
- /* Remember current stack_min value. */
- if (thread != NULL) {
- UNPROTECT_THREAD(thread);
- }
- *plast_stack_min = *lo;
+ /* Remember current stack_min value. */
+ if (thread != NULL) {
+ UNPROTECT_THREAD(thread);
+ }
+ *plast_stack_min = *lo;
+# endif
}
#ifdef PARALLEL_MARK
# endif /* !DONT_USE_SIGNALANDWAIT */
- /* Defined in os_dep.c */
- extern GC_bool GC_wnt;
+# ifndef MSWINCE
+ /* Defined in os_dep.c */
+ GC_bool GC_wnt;
+# endif
# endif /* ! GC_PTHREADS_PARAMARK */