From bc8c201f1a2129b17177a61025d762a400575c57 Mon Sep 17 00:00:00 2001 From: Marcos Henrich Date: Tue, 21 Jun 2016 11:36:29 +0100 Subject: [PATCH] [runtime] AOTID is now properly stored. --- mono/mini/aot-compiler.c | 2 ++ mono/mini/mini-llvm.c | 18 +++++++++++++++++- mono/mini/mini.h | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c index 6bfed9f47ef..4ce201e75f1 100644 --- a/mono/mini/aot-compiler.c +++ b/mono/mini/aot-compiler.c @@ -9521,6 +9521,8 @@ emit_aot_file_info (MonoAotCompile *acfg, MonoAotFileInfo *info) for (i = 0; i < MONO_AOT_TRAMP_NUM; ++i) emit_int32 (acfg, info->tramp_page_code_offsets [i]); + emit_bytes (acfg, info->aotid, 16); + if (acfg->aot_opts.static_link) { emit_global_inner (acfg, acfg->static_linking_symbol, FALSE); emit_alignment (acfg, sizeof (gpointer)); diff --git a/mono/mini/mini-llvm.c b/mono/mini/mini-llvm.c index e2f963bff04..bc7b1765b71 100644 --- a/mono/mini/mini-llvm.c +++ b/mono/mini/mini-llvm.c @@ -8389,6 +8389,19 @@ llvm_array_from_uints (LLVMTypeRef el_type, guint32 *values, int nvalues) return res; } +static LLVMValueRef +llvm_array_from_bytes (guint8 *values, int nvalues) +{ + int i; + LLVMValueRef res, *vals; + + vals = g_new0 (LLVMValueRef, nvalues); + for (i = 0; i < nvalues; ++i) + vals [i] = LLVMConstInt (LLVMInt8Type (), values [i], FALSE); + res = LLVMConstArray (LLVMInt8Type (), vals, nvalues); + g_free (vals); + return res; +} /* * mono_llvm_emit_aot_file_info: * @@ -8452,7 +8465,7 @@ emit_aot_file_info (MonoLLVMModule *module) info = &module->aot_info; /* Create an LLVM type to represent MonoAotFileInfo */ - nfields = 2 + MONO_AOT_FILE_INFO_NUM_SYMBOLS + 15 + 5; + nfields = 2 + MONO_AOT_FILE_INFO_NUM_SYMBOLS + 16 + 5; eltypes = g_new (LLVMTypeRef, nfields); tindex = 0; eltypes [tindex ++] = LLVMInt32Type (); @@ -8467,6 +8480,7 @@ emit_aot_file_info (MonoLLVMModule *module) eltypes [tindex ++] = LLVMArrayType (LLVMInt32Type (), MONO_AOT_TABLE_NUM); for (i = 0; i < 4; ++i) eltypes [tindex ++] = LLVMArrayType (LLVMInt32Type (), MONO_AOT_TRAMP_NUM); + eltypes [tindex ++] = LLVMArrayType (LLVMInt8Type (), 16); g_assert (tindex == nfields); file_info_type = LLVMStructCreateNamed (module->context, "MonoAotFileInfo"); LLVMStructSetBody (file_info_type, eltypes, nfields, FALSE); @@ -8589,6 +8603,8 @@ emit_aot_file_info (MonoLLVMModule *module) fields [tindex ++] = llvm_array_from_uints (LLVMInt32Type (), info->trampoline_got_offset_base, MONO_AOT_TRAMP_NUM); fields [tindex ++] = llvm_array_from_uints (LLVMInt32Type (), info->trampoline_size, MONO_AOT_TRAMP_NUM); fields [tindex ++] = llvm_array_from_uints (LLVMInt32Type (), info->tramp_page_code_offsets, MONO_AOT_TRAMP_NUM); + + fields [tindex ++] = llvm_array_from_bytes (info->aotid, 16); g_assert (tindex == nfields); LLVMSetInitializer (info_var, LLVMConstNamedStruct (file_info_type, fields, nfields)); diff --git a/mono/mini/mini.h b/mono/mini/mini.h index c55c89c0988..531078a3c49 100644 --- a/mono/mini/mini.h +++ b/mono/mini/mini.h @@ -125,7 +125,7 @@ #endif /* Version number of the AOT file format */ -#define MONO_AOT_FILE_VERSION 134 +#define MONO_AOT_FILE_VERSION 135 //TODO: This is x86/amd64 specific. #define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6)) -- 2.25.1