gpointer
mono_arch_get_throw_exception (MonoTrampInfo **info, gboolean aot)
{
- static guint8* start;
- static gboolean inited = FALSE;
-
g_assert (!aot);
if (info)
*info = NULL;
- if (inited)
- return start;
-
- start = get_throw_trampoline (FALSE);
-
- inited = TRUE;
-
- return start;
+ return get_throw_trampoline (FALSE);
}
gpointer
-mono_arch_get_throw_exception (MonoTrampInfo **info, gboolean aot)
+mono_arch_get_rethrow_exception (MonoTrampInfo **info, gboolean aot)
{
- static guint8* start;
- static gboolean inited = FALSE;
-
g_assert (!aot);
if (info)
*info = NULL;
- if (inited)
- return start;
-
- start = get_throw_trampoline (TRUE);
-
- inited = TRUE;
-
- return start;
+ return get_throw_trampoline (TRUE);
}
/**
return res;
}
-/* mono_arch_find_jit_info:
+/*
+ * mono_arch_find_jit_info:
*
- * This function is used to gather information from @ctx. It return the
- * MonoJitInfo of the corresponding function, unwinds one stack frame and
- * stores the resulting context into @new_ctx. It also stores a string
- * describing the stack location into @trace (if not NULL), and modifies
- * the @lmf if necessary. @native_offset return the IP offset from the
- * start of the function or -1 if that info is not available.
+ * This function is used to gather information from @ctx, and store it in @frame_info.
+ * It unwinds one stack frame, and stores the resulting context into @new_ctx. @lmf
+ * is modified if needed.
+ * Returns TRUE on success, FALSE otherwise.
*/
-MonoJitInfo *
-mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *res, MonoJitInfo *prev_ji, MonoContext *ctx,
- MonoContext *new_ctx, MonoLMF **lmf, gboolean *managed)
+gboolean
+mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
+ MonoJitInfo *ji, MonoContext *ctx,
+ MonoContext *new_ctx, MonoLMF **lmf,
+ mgreg_t **save_locations,
+ StackFrameInfo *frame)
{
- MonoJitInfo *ji;
int err;
unw_word_t ip;
+ memset (frame, 0, sizeof (StackFrameInfo));
+ frame->ji = ji;
+
*new_ctx = *ctx;
new_ctx->precise_ip = FALSE;
- while (TRUE) {
- err = unw_get_reg (&new_ctx->cursor, UNW_IA64_IP, &ip);
- g_assert (err == 0);
+ if (!ji) {
+ while (TRUE) {
+ err = unw_get_reg (&new_ctx->cursor, UNW_IA64_IP, &ip);
+ g_assert (err == 0);
- /* Avoid costly table lookup during stack overflow */
- if (prev_ji && ((guint8*)ip > (guint8*)prev_ji->code_start && ((guint8*)ip < ((guint8*)prev_ji->code_start) + prev_ji->code_size)))
- ji = prev_ji;
- else
ji = mini_jit_info_table_find (domain, (gpointer)ip, NULL);
- if (managed)
- *managed = FALSE;
-
- /*
- {
- char name[256];
- unw_word_t off;
-
- unw_get_proc_name (&new_ctx->cursor, name, 256, &off);
- printf ("F: %s\n", name);
- }
- */
-
- if (ji != NULL) {
- if (managed)
- if (!ji->method->wrapper_type)
- *managed = TRUE;
-
- break;
+ /*
+ {
+ char name[256];
+ unw_word_t off;
+
+ unw_get_proc_name (&new_ctx->cursor, name, 256, &off);
+ printf ("F: %s\n", name);
+ }
+ */
+
+ if (ji)
+ break;
+
+ /* This is an unmanaged frame, so just unwind through it */
+ /* FIXME: This returns -3 for the __clone2 frame in libc */
+ err = unw_step (&new_ctx->cursor);
+ if (err < 0)
+ break;
+
+ if (err == 0)
+ break;
}
-
- /* This is an unmanaged frame, so just unwind through it */
- /* FIXME: This returns -3 for the __clone2 frame in libc */
- err = unw_step (&new_ctx->cursor);
- if (err < 0)
- break;
-
- if (err == 0)
- break;
}
if (ji) {
+ frame->type = FRAME_TYPE_MANAGED;
+ frame->ji = ji;
+
//print_ctx (new_ctx);
err = unw_step (&new_ctx->cursor);
//print_ctx (new_ctx);
- return ji;
+ return TRUE;
}
else
- return (gpointer)(gssize)-1;
+ return FALSE;
}
/**