Skip to content

Commit

Permalink
[mono][aot] Make the names of some of the aotconst variables more des…
Browse files Browse the repository at this point in the history
…criptive. (#84673)
  • Loading branch information
vargaz committed Apr 12, 2023
1 parent 5117e1f commit 279c65a
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions src/mono/mono/mini/mini-llvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1912,6 +1912,15 @@ create_builder (EmitContext *ctx)

return builder;
}
static char*
ji_type_to_string_lower (MonoJumpInfoType type)
{
char *name = g_strdup (mono_ji_type_to_string (type));
size_t len = strlen (name);
for (size_t i = 0; i < len; ++i)
name [i] = GINT_TO_CHAR (tolower (name [i]));
return name;
}

static char*
get_aotconst_name (MonoJumpInfoType type, gconstpointer data, int got_offset)
Expand All @@ -1937,18 +1946,30 @@ get_aotconst_name (MonoJumpInfoType type, gconstpointer data, int got_offset)
case MONO_PATCH_INFO_GC_NURSERY_START:
case MONO_PATCH_INFO_GC_NURSERY_BITS:
case MONO_PATCH_INFO_INTERRUPTION_REQUEST_FLAG:
name = g_strdup_printf ("%s", mono_ji_type_to_string (type));
len = strlen (name);
for (size_t i = 0; i < len; ++i)
name [i] = GINT_TO_CHAR (tolower (name [i]));
name = ji_type_to_string_lower (type);
break;
default:
name = g_strdup_printf ("%s_%d", mono_ji_type_to_string (type), got_offset);
len = strlen (name);
for (size_t i = 0; i < len; ++i)
name [i] = GINT_TO_CHAR (tolower (name [i]));
case MONO_PATCH_INFO_METHOD:
case MONO_PATCH_INFO_METHOD_RGCTX: {
MonoMethod *method = (MonoMethod*)data;
char *typestr = ji_type_to_string_lower (type);
char *n = g_strdup (method->name);
len = strlen (n);
for (size_t i = 0; i < len; ++i) {
if (!isalnum (n [i]))
n [i] = '_';
}
name = g_strdup_printf ("%s_%s_%d", typestr, n, got_offset);
g_free (typestr);
g_free (n);
break;
}
default: {
char *typestr = ji_type_to_string_lower (type);
name = g_strdup_printf ("%s_%d", typestr, got_offset);
g_free (typestr);
break;
}
}

return name;
}
Expand Down

0 comments on commit 279c65a

Please sign in to comment.