Skip to content

Commit 883a6de

Browse files
committed
Merge: nitc/android: rely on Android's native stacktrace, drop MIPS support and temporarily disable the GC
This PR tweaks basic Nit features on Android so it is more practical on the short-middle term. It is better to not handle signals on Android so that it falls back on the Android stacktrace, which is pretty useful for debugging. We might want to handle the signals once we successfully integrate libunwind to the Android apps. Dropping MIPS support saves some compilation time. The related commit can be reverted when supporting MIPS is useful. This PR also deactivates the GC on Android as it is currently broken. Unexpected behaviors happen more frequently when using the Java FFI in a threaded app. There are possible solutions to this problem; newer versions of libgc are tweaked for Android, better compilation configs may help, and double checking the Android lib for objects that should be pinned for use from Java... Pull-Request: #1819 Reviewed-by: Jean Privat <jean@pryen.org>
2 parents a406c14 + 12315c4 commit 883a6de

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

clib/gc_chooser.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#ifdef ANDROID
1919
#include <android/log.h>
2020
#define PRINT_ERROR(...) ((void)__android_log_print(ANDROID_LOG_WARN, "nit", __VA_ARGS__))
21+
22+
// FIXME bring back when the GC is fixed in Android
23+
#undef WITH_LIBGC
2124
#else
2225
#define PRINT_ERROR(...) ((void)fprintf(stderr, __VA_ARGS__))
2326
#endif

src/compiler/abstract_compiler.nit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,12 +853,14 @@ extern void nitni_global_ref_decr( struct nitni_ref *ref );
853853
v.add_decl("int main(int argc, char** argv) \{")
854854
end
855855

856+
v.add "#ifndef ANDROID"
856857
v.add("signal(SIGABRT, sig_handler);")
857858
v.add("signal(SIGFPE, sig_handler);")
858859
v.add("signal(SIGILL, sig_handler);")
859860
v.add("signal(SIGINT, sig_handler);")
860861
v.add("signal(SIGTERM, sig_handler);")
861862
v.add("signal(SIGSEGV, sig_handler);")
863+
v.add "#endif"
862864
v.add("signal(SIGPIPE, SIG_IGN);")
863865

864866
v.add("glob_argc = argc; glob_argv = argv;")

src/compiler/separate_compiler.nit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ class SeparateCompiler
10531053
v.add_abort("type null")
10541054
v.add("\}")
10551055
v.add("if({t}->table_size < 0) \{")
1056-
v.add("PRINT_ERROR(\"Insantiation of a dead type: %s\\n\", {t}->name);")
1056+
v.add("PRINT_ERROR(\"Instantiation of a dead type: %s\\n\", {t}->name);")
10571057
v.add_abort("type dead")
10581058
v.add("\}")
10591059
end

src/platform/android.nit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class AndroidPlatform
3636

3737
redef fun name do return "android"
3838

39-
redef fun supports_libgc do return true
39+
redef fun supports_libgc do return false
4040

4141
redef fun supports_libunwind do return false
4242

@@ -141,7 +141,7 @@ class AndroidToolchain
141141
## Generate Application.mk
142142
dir = "{android_project_root}/jni/"
143143
"""
144-
APP_ABI := armeabi armeabi-v7a x86 mips
144+
APP_ABI := armeabi armeabi-v7a x86
145145
APP_PLATFORM := android-{{{app_target_api}}}
146146
""".write_to_file "{dir}/Application.mk"
147147

0 commit comments

Comments
 (0)