* The AOT compiler can load these files during compilation.
* Currently, only the order in which methods were compiled is saved,
* allowing more efficient function ordering in the AOT files.
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
+#include <config.h>
#include <mono/metadata/profiler.h>
#include <mono/metadata/tokentype.h>
#include <mono/metadata/tabledefs.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
+#include <glib.h>
#include <sys/stat.h>
+#ifdef HOST_WIN32
+#include <direct.h>
+#endif
+
struct _MonoProfiler {
GHashTable *images;
};
{
ForeachData *udata = (ForeachData*)user_data;
MonoMethod *method = (MonoMethod*)data;
+ char *name;
if (!mono_method_get_token (method) || mono_class_get_image (mono_method_get_class (method)) != udata->image)
return;
- fprintf (udata->outfile, "%d\n", mono_method_get_token (method));
+ name = mono_method_full_name (method, TRUE);
+ fprintf (udata->outfile, "%s\n", name);
+ g_free (name);
}
static void
tmp = g_strdup_printf ("%s/.mono/aot-profile-data", g_get_home_dir ());
if (!g_file_test (tmp, G_FILE_TEST_IS_DIR)) {
-#ifdef PLATFORM_WIN32
+#ifdef HOST_WIN32
err = mkdir (tmp);
#else
err = mkdir (tmp, 0777);
i = 0;
while (TRUE) {
- outfile_name = g_strdup_printf ("%s/%s-%s-%d", tmp, mono_image_get_name (image), mono_image_get_guid (image), i);
+ outfile_name = g_strdup_printf ("%s/%s-%d", tmp, mono_image_get_name (image), i);
if (!g_file_test (outfile_name, G_FILE_TEST_IS_REGULAR))
break;
outfile = fopen (outfile_name, "w+");
g_assert (outfile);
- fprintf (outfile, "#VER:%d\n", 1);
+ fprintf (outfile, "#VER:%d\n", 2);
data.prof = prof;
data.outfile = outfile;
MonoImage *image = mono_class_get_image (mono_method_get_class (method));
PerImageData *data;
- data = g_hash_table_lookup (prof->images, image);
+ data = (PerImageData *)g_hash_table_lookup (prof->images, image);
if (!data) {
data = g_new0 (PerImageData, 1);
g_hash_table_insert (prof->images, image, data);