Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcos Henrich <marcos.henrich@xamarin.com>2016-05-16 19:08:39 +0300
committerMarcos Henrich <marcos.henrich@xamarin.com>2016-07-09 00:38:22 +0300
commit3d03fb578db725ede0e512b1ae1924af4d22514c (patch)
treec4521b48910446b080157a1038580538c7b7cf12
parenta9035d9e74a5a8365a6de602b7f5a7a0b3f4fc90 (diff)
[runtime] Adds AOTID
AOTID is a GUID generated by the AOT compiler and stored along with the native code. The AOTID uniquely identifies the generated native assembly. The AOTID is required when we want to map native offsets to IL offsets and the sequence points mapping those values need to be determined.
-rw-r--r--mono/metadata/metadata-internals.h2
-rw-r--r--mono/mini/aot-compiler.c18
-rw-r--r--mono/mini/aot-runtime.c3
-rw-r--r--mono/mini/mini.h2
4 files changed, 25 insertions, 0 deletions
diff --git a/mono/metadata/metadata-internals.h b/mono/metadata/metadata-internals.h
index 96f6a5da7c9..a1b9eb84178 100644
--- a/mono/metadata/metadata-internals.h
+++ b/mono/metadata/metadata-internals.h
@@ -271,6 +271,8 @@ struct _MonoImage {
gpointer aot_module;
+ guint8 aotid[16];
+
/*
* The Assembly this image was loaded from.
*/
diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c
index 7c3fa351cce..efb9e19fa44 100644
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -51,6 +51,7 @@
#include <mono/utils/mono-compiler.h>
#include <mono/utils/mono-time.h>
#include <mono/utils/mono-mmap.h>
+#include <mono/utils/mono-rand.h>
#include <mono/utils/json.h>
#include <mono/utils/mono-threads-coop.h>
@@ -8868,6 +8869,21 @@ emit_extra_methods (MonoAotCompile *acfg)
}
static void
+generate_aotid (guint8* aotid)
+{
+ gpointer *rand_handle;
+ MonoError error;
+
+ mono_rand_open ();
+ rand_handle = mono_rand_init (NULL, 0);
+
+ mono_rand_try_get_bytes (rand_handle, aotid, 16, &error);
+ mono_error_assert_ok (&error);
+
+ mono_rand_close (rand_handle);
+}
+
+static void
emit_exception_info (MonoAotCompile *acfg)
{
int i;
@@ -9360,6 +9376,8 @@ init_aot_file_info (MonoAotCompile *acfg, MonoAotFileInfo *info)
info->nshared_got_entries = acfg->nshared_got_entries;
for (i = 0; i < MONO_AOT_TRAMP_NUM; ++i)
info->tramp_page_code_offsets [i] = acfg->tramp_page_code_offsets [i];
+
+ generate_aotid(&info->aotid);
}
static void
diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c
index d4eb786235e..d60828b0027 100644
--- a/mono/mini/aot-runtime.c
+++ b/mono/mini/aot-runtime.c
@@ -2002,6 +2002,9 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
find_symbol (sofile, globals, "mono_aot_file_info", (gpointer*)&info);
}
+ // Copy aotid to MonoImage
+ memcpy(&assembly->image->aotid, info->aotid, 16);
+
if (version_symbol) {
/* Old file format */
version = atoi (version_symbol);
diff --git a/mono/mini/mini.h b/mono/mini/mini.h
index 25c208c8389..c55c89c0988 100644
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -315,6 +315,8 @@ typedef struct MonoAotFileInfo
guint32 trampoline_size [MONO_AOT_TRAMP_NUM];
/* The offset where the trampolines begin on a trampoline page */
guint32 tramp_page_code_offsets [MONO_AOT_TRAMP_NUM];
+ /* GUID of aot compilation */
+ guint8 aotid[16];
} MonoAotFileInfo;
/* Number of symbols in the MonoAotFileInfo structure */