From 36f29ca619fddaef2820b71cf8e908c296a9ce4f Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Wed, 15 Feb 2017 14:30:29 -0800 Subject: [configure.ac] Don't check for getpwnam_r and getpwuid_r on android as AC_CHECK_FUNCS incorrectly detects them on Android. --- configure.ac | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 2ab8cfa00f7..789a903ed29 100644 --- a/configure.ac +++ b/configure.ac @@ -1432,8 +1432,6 @@ if test x$host_win32 = xno; then AC_CHECK_FUNCS(getgrgid_r) AC_CHECK_FUNCS(getgrnam_r) - AC_CHECK_FUNCS(getpwnam_r) - AC_CHECK_FUNCS(getpwuid_r) AC_CHECK_FUNCS(getresuid) AC_CHECK_FUNCS(setresuid) AC_CHECK_FUNCS(kqueue) @@ -1454,6 +1452,11 @@ if test x$host_win32 = xno; then AC_CHECK_FUNCS(sched_setaffinity) AC_CHECK_FUNCS(sched_getcpu) + if test x$platform_android != xyes; then + AC_CHECK_FUNCS(getpwnam_r) + AC_CHECK_FUNCS(getpwuid_r) + fi + dnl **************************************************************** dnl *** Check for sched_setaffinity from glibc versions before *** dnl *** 2.3.4. The older versions of the function only take 2 *** -- cgit v1.2.3 From a6c34bea959fee6a86093a51db6fcb05ce2456b8 Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Wed, 15 Feb 2017 14:31:39 -0800 Subject: [configure.ac] Don't set TARGET_ANDROID when cross compiling to non-android linux. --- configure.ac | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 789a903ed29..c339343805e 100644 --- a/configure.ac +++ b/configure.ac @@ -3317,7 +3317,6 @@ if test "x$host" != "x$target"; then TARGET=ARM; arch_target=arm; AC_DEFINE(TARGET_ARM, 1, [...]) - AC_DEFINE(TARGET_ANDROID, 1, [...]) ACCESS_UNALIGNED="no" CPPFLAGS="$CPPFLAGS -D__ARM_EABI__" # Can't use tls, since it depends on the runtime detection of tls offsets @@ -3330,6 +3329,11 @@ if test "x$host" != "x$target"; then CPPFLAGS="$CPPFLAGS" ;; armv5-*-linux-androideabi*) + AC_DEFINE(TARGET_ANDROID, 1, [...]) + CPPFLAGS="$CPPFLAGS" + ;; + *-linux-androideabi*) + AC_DEFINE(TARGET_ANDROID, 1, [...]) CPPFLAGS="$CPPFLAGS" ;; esac @@ -3349,23 +3353,33 @@ if test "x$host" != "x$target"; then TARGET=X86; arch_target=x86; AC_DEFINE(TARGET_X86, 1, [...]) - AC_DEFINE(TARGET_ANDROID, 1, [...]) CPPFLAGS="$CPPFLAGS" # Can't use tls, since it depends on the runtime detection of tls offsets # in mono-compiler.h with_tls=pthread target_mach=no + + case "$target" in + *-linux-android*) + AC_DEFINE(TARGET_ANDROID, 1, [...]) + ;; + esac ;; x86_64*-linux-*) TARGET=AMD64; arch_target=amd64; AC_DEFINE(TARGET_AMD64, 1, [...]) - AC_DEFINE(TARGET_ANDROID, 1, [...]) CPPFLAGS="$CPPFLAGS" # Can't use tls, since it depends on the runtime detection of tls offsets # in mono-compiler.h with_tls=pthread target_mach=no + + case "$target" in + *-linux-android*) + AC_DEFINE(TARGET_ANDROID, 1, [...]) + ;; + esac ;; x86_64-ps4-freebsd) TARGET=AMD64; @@ -3384,12 +3398,16 @@ if test "x$host" != "x$target"; then TARGET=ARM64; arch_target=arm64; AC_DEFINE(TARGET_ARM64, 1, [...]) - AC_DEFINE(TARGET_ANDROID, 1, [...]) CPPFLAGS="$CPPFLAGS" # Can't use tls, since it depends on the runtime detection of tls offsets # in mono-compiler.h with_tls=pthread target_mach=no + case "$target" in + *-linux-android*) + AC_DEFINE(TARGET_ANDROID, 1, [...]) + ;; + esac ;; aarch64-*) TARGET=ARM64 -- cgit v1.2.3 From e461b821b1b5246ee0854a841bcd1a8f20a254ac Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Fri, 24 Feb 2017 15:52:03 -0800 Subject: [alias-analysis] Ignore addresses taken of volatile variables. Volatile variables should be ignored by AA as, by design, we can't properly tell whether removing indirection is safe or not. This shows up when handling the LMF var in some cases. --- mono/mini/alias-analysis.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mono/mini/alias-analysis.c b/mono/mini/alias-analysis.c index c419dfa2b42..7ff437f9f9d 100644 --- a/mono/mini/alias-analysis.c +++ b/mono/mini/alias-analysis.c @@ -159,10 +159,17 @@ lower_memory_access (MonoCompile *cfg) for (ins = bb->code; ins; ins = ins->next) { handle_instruction: switch (ins->opcode) { - case OP_LDADDR: - g_hash_table_insert (addr_loads, GINT_TO_POINTER (ins->dreg), ins); - if (cfg->verbose_level > 2) { printf ("New address: "); mono_print_ins (ins); } + case OP_LDADDR: { + MonoInst *var = (MonoInst*)ins->inst_p0; + if (var->flags & MONO_INST_VOLATILE) { + if (cfg->verbose_level > 2) { printf ("Found address to volatile var, can't take it: "); mono_print_ins (ins); } + } else { + g_hash_table_insert (addr_loads, GINT_TO_POINTER (ins->dreg), ins); + if (cfg->verbose_level > 2) { printf ("New address: "); mono_print_ins (ins); } + } break; + } + case OP_MOVE: tmp = (MonoInst*)g_hash_table_lookup (addr_loads, GINT_TO_POINTER (ins->sreg1)); /* -- cgit v1.2.3 From f35595be4d04fb572527049972e409ad9ada3383 Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Fri, 24 Feb 2017 16:09:56 -0800 Subject: [jit] Fix LMF codegen on android arm64. Android doesn't have fast tls either, so we must use the jit_tls variant. --- mono/mini/mini-arm64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mono/mini/mini-arm64.c b/mono/mini/mini-arm64.c index 3ad91e31cd0..1884dc1d49d 100644 --- a/mono/mini/mini-arm64.c +++ b/mono/mini/mini-arm64.c @@ -1902,7 +1902,7 @@ mono_arch_create_vars (MonoCompile *cfg) if (cfg->method->save_lmf) { cfg->create_lmf_var = TRUE; cfg->lmf_ir = TRUE; -#ifndef TARGET_MACH +#ifdef HAVE_GET_TLS_ADDR cfg->lmf_ir_mono_lmf = TRUE; #endif } -- cgit v1.2.3 From 34012db8950766dfe02c59c1af4f11824752de2a Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Fri, 24 Feb 2017 16:14:16 -0800 Subject: [jit] Rewrite some logging to work on embedded systems. --- mono/mini/liveness.c | 3 +-- mono/mini/method-to-ir.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/mono/mini/liveness.c b/mono/mini/liveness.c index cdd1c42ef49..cfdc728c0d0 100644 --- a/mono/mini/liveness.c +++ b/mono/mini/liveness.c @@ -231,8 +231,7 @@ analyze_liveness_bb (MonoCompile *cfg, MonoBasicBlock *bb) #ifdef DEBUG_LIVENESS if (cfg->verbose_level > 1) { - printf ("\t"); - mono_print_ins (ins); + mono_print_ins_index (1, ins); } #endif diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index 38ba5a241ec..c1fcd8c4593 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -348,14 +348,19 @@ mono_print_bb (MonoBasicBlock *bb, const char *msg) { int i; MonoInst *tree; + GString *str = g_string_new (""); - printf ("\n%s %d: [IN: ", msg, bb->block_num); + g_string_append_printf (str, "%s %d: [IN: ", msg, bb->block_num); for (i = 0; i < bb->in_count; ++i) - printf (" BB%d(%d)", bb->in_bb [i]->block_num, bb->in_bb [i]->dfn); - printf (", OUT: "); + g_string_append_printf (str, " BB%d(%d)", bb->in_bb [i]->block_num, bb->in_bb [i]->dfn); + g_string_append_printf (str, ", OUT: "); for (i = 0; i < bb->out_count; ++i) - printf (" BB%d(%d)", bb->out_bb [i]->block_num, bb->out_bb [i]->dfn); - printf (" ]\n"); + g_string_append_printf (str, " BB%d(%d)", bb->out_bb [i]->block_num, bb->out_bb [i]->dfn); + g_string_append_printf (str, " ]\n"); + + g_print ("%s", str->str); + g_string_free (str, TRUE); + for (tree = bb->code; tree; tree = tree->next) mono_print_ins_index (-1, tree); } -- cgit v1.2.3