* so there is only one wrapper of a given type, or inlining their contents into their
* callers.
*/
-
- /*
- * FIXME: This depends on the fact that different wrappers have different
- * names.
- */
-
for (i = 0; i < acfg->image->tables [MONO_TABLE_METHOD].rows; ++i) {
MonoMethod *method;
guint32 token = MONO_TOKEN_METHOD_DEF | (i + 1);
(method->flags & METHOD_ATTRIBUTE_ABSTRACT))
skip = TRUE;
- if (method->is_generic || method->klass->generic_container)
- skip = TRUE;
-
/* Skip methods which can not be handled by get_runtime_invoke () */
sig = mono_method_signature (method);
if (!sig)
if ((sig->ret->type == MONO_TYPE_PTR) ||
(sig->ret->type == MONO_TYPE_TYPEDBYREF))
skip = TRUE;
+ if (mono_class_is_open_constructed_type (sig->ret))
+ skip = TRUE;
for (j = 0; j < sig->param_count; j++) {
if (sig->params [j]->type == MONO_TYPE_TYPEDBYREF)
skip = TRUE;
+ if (mono_class_is_open_constructed_type (sig->params [j]))
+ skip = TRUE;
}
#ifdef MONO_ARCH_DYN_CALL_SUPPORTED
return FALSE;
}
+static void
+add_types_from_method_header (MonoAotCompile *acfg, MonoMethod *method);
+
/*
* add_generic_class:
*
continue;
}
- if (mono_method_is_generic_sharable_full (method, FALSE, FALSE, use_gsharedvt))
+ if (mono_method_is_generic_sharable_full (method, FALSE, FALSE, use_gsharedvt)) {
/* Already added */
+ add_types_from_method_header (acfg, method);
continue;
+ }
if (method->is_generic)
/* FIXME: */
/*
* sanitize_symbol:
*
- * Modify SYMBOL so it only includes characters permissible in symbols.
+ * Return a modified version of S which only includes characters permissible in symbols.
*/
-static void
-sanitize_symbol (char *symbol)
+static char*
+sanitize_symbol (MonoAotCompile *acfg, char *s)
{
- int i, len = strlen (symbol);
+ gboolean process = FALSE;
+ int i, len;
+ GString *gs;
+ char *res;
+
+ if (!s)
+ return s;
+ len = strlen (s);
for (i = 0; i < len; ++i)
- if (!isalnum (symbol [i]) && (symbol [i] != '_'))
- symbol [i] = '_';
+ if (!(s [i] <= 0x7f && (isalnum (s [i]) || s [i] == '_')))
+ process = TRUE;
+ if (!process)
+ return s;
+
+ gs = g_string_sized_new (len);
+ for (i = 0; i < len; ++i) {
+ guint8 c = s [i];
+ if (c <= 0x7f && (isalnum (c) || c == '_')) {
+ g_string_append_c (gs, c);
+ } else if (c > 0x7f) {
+ /* multi-byte utf8 */
+ g_string_append_printf (gs, "_0x%x", c);
+ i ++;
+ c = s [i];
+ while (c >> 6 == 0x2) {
+ g_string_append_printf (gs, "%x", c);
+ i ++;
+ c = s [i];
+ }
+ g_string_append_printf (gs, "_");
+ i --;
+ } else {
+ g_string_append_c (gs, '_');
+ }
+ }
+
+ res = mono_mempool_strdup (acfg->mempool, gs->str);
+ g_string_free (gs, TRUE);
+ return res;
}
static char*
int i;
encode_method_ref (acfg, info->method, p, &p);
- encode_value (info->entries->len, p, &p);
- for (i = 0; i < info->entries->len; ++i) {
- MonoRuntimeGenericContextInfoTemplate *template = g_ptr_array_index (info->entries, i);
+ encode_value (info->num_entries, p, &p);
+ for (i = 0; i < info->num_entries; ++i) {
+ MonoRuntimeGenericContextInfoTemplate *template = &info->entries [i];
encode_value (template->info_type, p, &p);
switch (mini_rgctx_info_type_to_patch_info_type (template->info_type)) {
get_plt_entry_debug_sym (MonoAotCompile *acfg, MonoJumpInfo *ji, GHashTable *cache)
{
char *debug_sym = NULL;
+ char *s;
switch (ji->type) {
case MONO_PATCH_INFO_METHOD:
debug_sym = g_strdup_printf ("plt__jit_icall_%s", ji->data.name);
break;
case MONO_PATCH_INFO_CLASS_INIT:
- debug_sym = g_strdup_printf ("plt__class_init_%s", mono_type_get_name (&ji->data.klass->byval_arg));
- sanitize_symbol (debug_sym);
+ s = mono_type_get_name (&ji->data.klass->byval_arg);
+ debug_sym = g_strdup_printf ("plt__class_init_%s", s);
+ g_free (s);
break;
case MONO_PATCH_INFO_RGCTX_FETCH:
debug_sym = g_strdup_printf ("plt__rgctx_fetch_%d", acfg->label_generator ++);
break;
}
- return debug_sym;
+ return sanitize_symbol (acfg, debug_sym);
}
/*
* the runtime will not see AOT methods during AOT compilation,so it
* does not need to support them by creating a fake GOT etc.
*/
- cfg = mini_method_compile (method, acfg->opts, mono_get_root_domain (), FALSE, TRUE, 0);
+ cfg = mini_method_compile (method, acfg->opts, mono_get_root_domain (), acfg->aot_opts.full_aot ? (JIT_FLAG_AOT|JIT_FLAG_FULL_AOT) : (JIT_FLAG_AOT), 0);
mono_loader_clear_error ();
if (cfg->exception_type == MONO_EXCEPTION_GENERIC_SHARING_FAILED) {
*/
opts = g_strdup ("-instcombine -simplifycfg");
//opts = g_strdup ("-simplifycfg -domtree -domfrontier -scalarrepl -instcombine -simplifycfg -domtree -domfrontier -scalarrepl -simplify-libcalls -instcombine -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -domfrontier -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -iv-users -indvars -loop-deletion -loop-simplify -lcssa -loop-unroll -instcombine -memdep -gvn -memdep -memcpyopt -sccp -instcombine -domtree -memdep -dse -adce -simplifycfg -preverify -domtree -verify");
- opts = g_strdup ("-targetlibinfo -no-aa -basicaa -notti -instcombine -simplifycfg -sroa -domtree -early-cse -lazy-value-info -correlated-propagation -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -indvars -loop-idiom -loop-deletion -loop-unroll -memdep -gvn -memdep -memcpyopt -sccp -instcombine -lazy-value-info -correlated-propagation -domtree -memdep -dse -adce -simplifycfg -instcombine -strip-dead-prototypes -preverify -domtree -verify");
+ /* The dse pass is disabled because of #13734 and #17616 */
+ opts = g_strdup ("-targetlibinfo -no-aa -basicaa -notti -instcombine -simplifycfg -sroa -domtree -early-cse -lazy-value-info -correlated-propagation -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -indvars -loop-idiom -loop-deletion -loop-unroll -memdep -gvn -memdep -memcpyopt -sccp -instcombine -lazy-value-info -correlated-propagation -domtree -memdep -adce -simplifycfg -instcombine -strip-dead-prototypes -preverify -domtree -verify");
#if 1
command = g_strdup_printf ("%sopt -f %s -o \"%s.opt.bc\" \"%s.bc\"", acfg->aot_opts.llvm_path, opts, acfg->tmpbasename, acfg->tmpbasename);
printf ("Executing opt: %s\n", command);
if (!method) {
printf ("Failed to load method 0x%x from '%s'.\n", token, image->name);
+ printf ("Run with MONO_LOG_LEVEL=debug for more information.\n");
exit (1);
}
user_data [1] = acfg;
user_data [2] = frag;
- handle = mono_create_thread (NULL, 0, (gpointer)compile_thread_main, user_data, 0, NULL);
+ handle = mono_threads_create_thread ((gpointer)compile_thread_main, user_data, 0, 0, NULL);
g_ptr_array_add (threads, handle);
}
g_free (methods);
#elif defined(sparc) && SIZEOF_VOID_P == 8
#define AS_OPTIONS "-xarch=v9"
#elif defined(TARGET_X86) && defined(TARGET_MACH) && !defined(__native_client_codegen__)
-#define AS_OPTIONS "-arch i386 -W"
+#define AS_OPTIONS "-arch i386"
#else
#define AS_OPTIONS ""
#endif
TV_DECLARE (atv);
TV_DECLARE (btv);
-#if !defined(MONO_ARCH_GSHAREDVT_SUPPORTED) || (!defined(MONO_EXTENSIONS) && !defined(MONOTOUCH))
+#if !defined(MONO_ARCH_GSHAREDVT_SUPPORTED) || !defined(ENABLE_GSHAREDVT)
if (opts & MONO_OPT_GSHAREDVT) {
fprintf (stderr, "-O=gsharedvt not supported on this platform.\n");
exit (1);
if (acfg->aot_opts.dwarf_debug && acfg->aot_opts.asm_only && acfg->aot_opts.gnu_asm) {
/*
* CLANG supports GAS .file/.loc directives, so emit line number information this way
+ * FIXME: CLANG only emits line number info for .loc directives followed by assembly, not
+ * .byte directives.
*/
- acfg->gas_line_numbers = TRUE;
+ //acfg->gas_line_numbers = TRUE;
}
if (!acfg->aot_opts.nodebug || acfg->aot_opts.dwarf_debug) {
img_writer_emit_start (acfg->w);
if (acfg->dwarf)
- mono_dwarf_writer_emit_base_info (acfg->dwarf, mono_unwind_get_cie_program ());
+ mono_dwarf_writer_emit_base_info (acfg->dwarf, g_path_get_basename (acfg->image->name), mono_unwind_get_cie_program ());
if (acfg->thumb_mixed) {
char symbol [256];