Skip to content

Commit

Permalink
[mini] Add GC Unsafe transitions in mono_pmip (dotnet#57290)
Browse files Browse the repository at this point in the history
Add a new mono_pmip_u that doesn't do the transition.

The intent is that Mono developers in the debugger can call still call
mono_pmip_u if the thread state machine is in a broken state.

Co-authored-by: lambdageek <lambdageek@users.noreply.github.com>
  • Loading branch information
monojenkins and lambdageek committed Aug 13, 2021
1 parent e617017 commit f8c3777
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/mono/mono/mini/mini-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,23 @@ find_tramp (gpointer key, gpointer value, gpointer user_data)
ud->method = (MonoMethod*)key;
}

static char*
mono_get_method_from_ip_u (void *ip);

/* debug function */
char*
mono_get_method_from_ip (void *ip)
{
char *result;
MONO_ENTER_GC_UNSAFE;
result = mono_get_method_from_ip_u (ip);
MONO_EXIT_GC_UNSAFE;
return result;
}

/* debug function */
static char*
mono_get_method_from_ip_u (void *ip)
{
MonoJitInfo *ji;
MonoMethod *method;
Expand Down Expand Up @@ -272,6 +286,12 @@ mono_pmip (void *ip)
return mono_get_method_from_ip (ip);
}

G_GNUC_UNUSED char *
mono_pmip_u (void *ip)
{
return mono_get_method_from_ip_u (ip);
}

/**
* mono_print_method_from_ip:
* \param ip an instruction pointer address
Expand Down
1 change: 1 addition & 0 deletions src/mono/mono/mini/mini-runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ const char*mono_ji_type_to_string (MonoJumpInfoType type);
void mono_print_ji (const MonoJumpInfo *ji);
MONO_API void mono_print_method_from_ip (void *ip);
MONO_API char *mono_pmip (void *ip);
MONO_API char *mono_pmip_u (void *ip);
MONO_API int mono_ee_api_version (void);
gboolean mono_debug_count (void);

Expand Down

0 comments on commit f8c3777

Please sign in to comment.