+
+Fri Feb 12 18:36:02 CET 2010 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c, icall-def.h: new icall to check for sufficient
+ stack space.
+
2010-02-12 Mark Probst <mark.probst@gmail.com>
* reflection.c (ensure_complete_type): Check that reflection_info
ICALL(RUNH_3, "InitializeArray", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray)
ICALL(RUNH_4, "RunClassConstructor", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor)
ICALL(RUNH_5, "RunModuleConstructor", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunModuleConstructor)
+ICALL(RUNH_5h, "SufficientExecutionStack", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStack)
ICALL(RUNH_6, "get_OffsetToStringData", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData)
ICALL_TYPE(GCH, "System.Runtime.InteropServices.GCHandle", GCH_1)
}
}
+static MonoBoolean
+ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStack (void)
+{
+ guint8 *stack_addr;
+ guint8 *current;
+ size_t stack_size;
+ /* later make this configurable and per-arch */
+ int min_size = 4096 * 4 * sizeof (void*);
+ mono_thread_get_stack_bounds (&stack_addr, &stack_size);
+ /* if we have no info we are optimistic and assume there is enough room */
+ if (!stack_addr)
+ return TRUE;
+ current = (guint8 *)&stack_addr;
+ if (current > stack_addr) {
+ if ((current - stack_addr) < min_size)
+ return FALSE;
+ } else {
+ if (current - (stack_addr - stack_size) < min_size)
+ return FALSE;
+ }
+ return TRUE;
+}
+
static MonoObject *
ves_icall_System_Object_MemberwiseClone (MonoObject *this)
{