diff options
author | Moonchild <moonchild@palemoon.org> | 2021-10-14 16:57:01 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-01 15:17:54 +0200 |
commit | 28a3cd1028612b3b577768519d11fa6fbcda6f09 (patch) | |
tree | 61a64f843d3bfed644305987dbe1482d7b39c11a /js/src | |
parent | f987138760b344a8869e319f28400acc438d0553 (diff) | |
download | uxp-28a3cd1028612b3b577768519d11fa6fbcda6f09.tar.gz |
Issue #1053 - First pass Android defines and remove Android Annotation
processors, some Andoid packaging stuff, Eclipse IDE support et al.
Diffstat (limited to 'js/src')
-rw-r--r-- | js/src/ctypes/libffi/src/closures.c | 2 | ||||
-rw-r--r-- | js/src/ds/MemoryProtectionExceptionHandler.cpp | 6 | ||||
-rw-r--r-- | js/src/jit/ExecutableAllocator.h | 2 | ||||
-rw-r--r-- | js/src/jit/arm/Architecture-arm.cpp | 9 | ||||
-rw-r--r-- | js/src/jscntxt.cpp | 61 | ||||
-rw-r--r-- | js/src/jsmath.cpp | 2 | ||||
-rw-r--r-- | js/src/jsnativestack.cpp | 44 | ||||
-rw-r--r-- | js/src/vtune/jitprofiling.c | 7 | ||||
-rw-r--r-- | js/src/wasm/WasmSignalHandlers.cpp | 106 |
9 files changed, 12 insertions, 227 deletions
diff --git a/js/src/ctypes/libffi/src/closures.c b/js/src/ctypes/libffi/src/closures.c index c7863f3d0a..fba4e2a6aa 100644 --- a/js/src/ctypes/libffi/src/closures.c +++ b/js/src/ctypes/libffi/src/closures.c @@ -34,7 +34,7 @@ #include <ffi_common.h> #if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE -# if __gnu_linux__ && !defined(__ANDROID__) +# if __gnu_linux__ /* This macro indicates it may be forbidden to map anonymous memory with both write and execute permission. Code compiled when this option is defined will attempt to map such pages once, but if it diff --git a/js/src/ds/MemoryProtectionExceptionHandler.cpp b/js/src/ds/MemoryProtectionExceptionHandler.cpp index 77df1f0d92..881a0e63d5 100644 --- a/js/src/ds/MemoryProtectionExceptionHandler.cpp +++ b/js/src/ds/MemoryProtectionExceptionHandler.cpp @@ -16,10 +16,6 @@ # include <unistd.h> #endif -#ifdef ANDROID -# include <android/log.h> -#endif - #include "ds/SplayTree.h" #include "threading/LockGuard.h" @@ -125,8 +121,6 @@ ReportCrashIfDebug(const char* aStr) BOOL ret = WriteFile(GetStdHandle(STD_ERROR_HANDLE), aStr, strlen(aStr) + 1, &bytesWritten, nullptr); ::__debugbreak(); -# elif defined(ANDROID) - int ret = __android_log_write(ANDROID_LOG_FATAL, "MOZ_CRASH", aStr); # else ssize_t ret = write(STDERR_FILENO, aStr, strlen(aStr) + 1); # endif diff --git a/js/src/jit/ExecutableAllocator.h b/js/src/jit/ExecutableAllocator.h index 8042ae7a98..c16809c818 100644 --- a/js/src/jit/ExecutableAllocator.h +++ b/js/src/jit/ExecutableAllocator.h @@ -251,7 +251,7 @@ class ExecutableAllocator { __clear_cache(code, reinterpret_cast<char*>(code) + size); } -#elif defined(JS_CODEGEN_ARM) && (defined(__linux__) || defined(ANDROID)) && defined(__GNUC__) +#elif defined(JS_CODEGEN_ARM) && defined(__linux__) && defined(__GNUC__) static void cacheFlush(void* code, size_t size) { void* end = (void*)(reinterpret_cast<char*>(code) + size); diff --git a/js/src/jit/arm/Architecture-arm.cpp b/js/src/jit/arm/Architecture-arm.cpp index 791fa972a7..38939eabff 100644 --- a/js/src/jit/arm/Architecture-arm.cpp +++ b/js/src/jit/arm/Architecture-arm.cpp @@ -15,9 +15,9 @@ #include "jit/arm/Assembler-arm.h" #include "jit/RegisterSets.h" -#if !defined(__linux__) || defined(ANDROID) || defined(JS_SIMULATOR_ARM) -// The Android NDK and B2G do not include the hwcap.h kernel header, and it is not -// defined when building the simulator, so inline the header defines we need. +#if !defined(__linux__) || defined(JS_SIMULATOR_ARM) +// The hwcap.h kernel header is not defined when building the simulator, +// so inline the header defines we need. # define HWCAP_VFP (1 << 6) # define HWCAP_NEON (1 << 12) # define HWCAP_VFPv3 (1 << 13) @@ -209,8 +209,7 @@ InitARMFlags() | HWCAP_FIXUP_FAULT; #else -#if defined(__linux__) || defined(ANDROID) - // This includes Android and B2G. +#if defined(__linux__) bool readAuxv = false; int fd = open("/proc/self/auxv", O_RDONLY); if (fd > 0) { diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index baab36183a..b81f8ebcab 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -17,11 +17,6 @@ #include <ctype.h> #include <stdarg.h> #include <string.h> -#ifdef ANDROID -# include <android/log.h> -# include <fstream> -# include <string> -#endif // ANDROID #include "jsatom.h" #include "jscompartment.h" @@ -1085,60 +1080,10 @@ JSContext::currentlyRunning() const static bool ComputeIsJITBroken() { -#if !defined(ANDROID) + // This used to hold code to exclude specific (mobile) hardware where jit would be + // terribly broken. Effectively a stub but good to keep just in case it's needed + // in the future. return false; -#else // ANDROID - if (getenv("JS_IGNORE_JIT_BROKENNESS")) { - return false; - } - - std::string line; - - // Check for the known-bad kernel version (2.6.29). - std::ifstream osrelease("/proc/sys/kernel/osrelease"); - std::getline(osrelease, line); - __android_log_print(ANDROID_LOG_INFO, "Gecko", "Detected osrelease `%s'", - line.c_str()); - - if (line.npos == line.find("2.6.29")) { - // We're using something other than 2.6.29, so the JITs should work. - __android_log_print(ANDROID_LOG_INFO, "Gecko", "JITs are not broken"); - return false; - } - - // We're using 2.6.29, and this causes trouble with the JITs on i9000. - line = ""; - bool broken = false; - std::ifstream cpuinfo("/proc/cpuinfo"); - do { - if (0 == line.find("Hardware")) { - static const char* const blacklist[] = { - "SCH-I400", // Samsung Continuum - "SGH-T959", // Samsung i9000, Vibrant device - "SGH-I897", // Samsung i9000, Captivate device - "SCH-I500", // Samsung i9000, Fascinate device - "SPH-D700", // Samsung i9000, Epic device - "GT-I9000", // Samsung i9000, UK/Europe device - nullptr - }; - for (const char* const* hw = &blacklist[0]; *hw; ++hw) { - if (line.npos != line.find(*hw)) { - __android_log_print(ANDROID_LOG_INFO, "Gecko", - "Blacklisted device `%s'", *hw); - broken = true; - break; - } - } - break; - } - std::getline(cpuinfo, line); - } while(!cpuinfo.fail() && !cpuinfo.eof()); - - __android_log_print(ANDROID_LOG_INFO, "Gecko", "JITs are %sbroken", - broken ? "" : "not "); - - return broken; -#endif // ifndef ANDROID } static bool diff --git a/js/src/jsmath.cpp b/js/src/jsmath.cpp index 78760583db..64c2da8122 100644 --- a/js/src/jsmath.cpp +++ b/js/src/jsmath.cpp @@ -49,7 +49,7 @@ # undef SystemFunction036 #endif -#if defined(ANDROID) || defined(__DragonFly__) || \ +#if defined(__DragonFly__) || \ defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) # include <stdlib.h> # define HAVE_ARC4RANDOM diff --git a/js/src/jsnativestack.cpp b/js/src/jsnativestack.cpp index 99c2f6654a..34131f9667 100644 --- a/js/src/jsnativestack.cpp +++ b/js/src/jsnativestack.cpp @@ -15,12 +15,7 @@ # include <pthread_np.h> # endif -# if defined(ANDROID) -# include <sys/types.h> -# include <unistd.h> -# endif - -# if defined(XP_LINUX) && !defined(ANDROID) && defined(__GLIBC__) +# if defined(XP_LINUX) && defined(__GLIBC__) # include <dlfcn.h> # include <sys/syscall.h> # include <sys/types.h> @@ -80,7 +75,7 @@ js::GetNativeStackBaseImpl() return static_cast<char*>(st.ss_sp) + st.ss_size; } -#elif defined(XP_LINUX) && !defined(ANDROID) && defined(__GLIBC__) +#elif defined(XP_LINUX) && defined(__GLIBC__) void* js::GetNativeStackBaseImpl() { @@ -154,41 +149,6 @@ js::GetNativeStackBaseImpl() rc = pthread_stackseg_np(pthread_self(), &ss); stackBase = (void*)((size_t) ss.ss_sp - ss.ss_size); stackSize = ss.ss_size; -# elif defined(ANDROID) - if (gettid() == getpid()) { - // bionic's pthread_attr_getstack doesn't tell the truth for the main - // thread (see bug 846670). So we scan /proc/self/maps to find the - // segment which contains the stack. - rc = -1; - - // Put the string on the stack, otherwise there is the danger that it - // has not been decompressed by the the on-demand linker. Bug 1165460. - // - // The volatile keyword should stop the compiler from trying to omit - // the stack copy in the future (hopefully). - volatile char path[] = "/proc/self/maps"; - FILE* fs = fopen((const char*)path, "r"); - - if (fs) { - char line[100]; - unsigned long stackAddr = (unsigned long)&sattr; - while (fgets(line, sizeof(line), fs) != nullptr) { - unsigned long stackStart; - unsigned long stackEnd; - if (sscanf(line, "%lx-%lx ", &stackStart, &stackEnd) == 2 && - stackAddr >= stackStart && stackAddr < stackEnd) { - stackBase = (void*)stackStart; - stackSize = stackEnd - stackStart; - rc = 0; - break; - } - } - fclose(fs); - } - } else - // For non main-threads pthread allocates the stack itself so it tells - // the truth. - rc = pthread_attr_getstack(&sattr, &stackBase, &stackSize); # else // Use the default pthread_attr_getstack() call. Note that this function // differs between libc implementations and could imply /proc access etc. diff --git a/js/src/vtune/jitprofiling.c b/js/src/vtune/jitprofiling.c index 558af0c306..652a2a057e 100644 --- a/js/src/vtune/jitprofiling.c +++ b/js/src/vtune/jitprofiling.c @@ -89,9 +89,6 @@ HINSTANCE m_libHandle = NULL; void* m_libHandle = NULL; #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ -/* default location of JIT profiling agent on Android */ -#define ANDROID_JIT_AGENT_PATH "/data/intel/libittnotify.so" - /* the function pointers */ typedef unsigned int(*TPInitialize)(void); static TPInitialize FUNC_Initialize=NULL; @@ -386,10 +383,6 @@ static int loadiJIT_Funcs() dllName = getenv(NEW_DLL_ENVIRONMENT_VAR); if (!dllName) dllName = getenv(DLL_ENVIRONMENT_VAR); -#ifdef ANDROID - if (!dllName) - dllName = ANDROID_JIT_AGENT_PATH; -#endif if (dllName) { /* Try to load the dll from the PATH... */ diff --git a/js/src/wasm/WasmSignalHandlers.cpp b/js/src/wasm/WasmSignalHandlers.cpp index b45d05ebd2..dae590acba 100644 --- a/js/src/wasm/WasmSignalHandlers.cpp +++ b/js/src/wasm/WasmSignalHandlers.cpp @@ -34,13 +34,6 @@ using JS::GenericNaN; using mozilla::DebugOnly; using mozilla::PodArrayZero; -#if defined(ANDROID) -# include <sys/system_properties.h> -# if defined(MOZ_LINKER) -extern "C" MFBT_API bool IsSignalHandlingBroken(); -# endif -#endif - // For platforms where the signal/exception handler runs on the same // thread/stack as the victim (Unix and Windows), we can use TLS to find any // currently executing wasm code. @@ -260,86 +253,6 @@ class AutoSetHandlingSegFault # endif #endif -#if defined(ANDROID) -// Not all versions of the Android NDK define ucontext_t or mcontext_t. -// Detect this and provide custom but compatible definitions. Note that these -// follow the GLibc naming convention to access register values from -// mcontext_t. -// -// See: https://chromiumcodereview.appspot.com/10829122/ -// See: http://code.google.com/p/android/issues/detail?id=34784 -# if !defined(__BIONIC_HAVE_UCONTEXT_T) -# if defined(__arm__) - -// GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'. -// Old versions of the C library <signal.h> didn't define the type. -# if !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT) -# include <asm/sigcontext.h> -# endif - -typedef struct sigcontext mcontext_t; - -typedef struct ucontext { - uint32_t uc_flags; - struct ucontext* uc_link; - stack_t uc_stack; - mcontext_t uc_mcontext; - // Other fields are not used so don't define them here. -} ucontext_t; - -# elif defined(__mips__) - -typedef struct { - uint32_t regmask; - uint32_t status; - uint64_t pc; - uint64_t gregs[32]; - uint64_t fpregs[32]; - uint32_t acx; - uint32_t fpc_csr; - uint32_t fpc_eir; - uint32_t used_math; - uint32_t dsp; - uint64_t mdhi; - uint64_t mdlo; - uint32_t hi1; - uint32_t lo1; - uint32_t hi2; - uint32_t lo2; - uint32_t hi3; - uint32_t lo3; -} mcontext_t; - -typedef struct ucontext { - uint32_t uc_flags; - struct ucontext* uc_link; - stack_t uc_stack; - mcontext_t uc_mcontext; - // Other fields are not used so don't define them here. -} ucontext_t; - -# elif defined(__i386__) -// x86 version for Android. -typedef struct { - uint32_t gregs[19]; - void* fpregs; - uint32_t oldmask; - uint32_t cr2; -} mcontext_t; - -typedef uint32_t kernel_sigset_t[2]; // x86 kernel uses 64-bit signal masks -typedef struct ucontext { - uint32_t uc_flags; - struct ucontext* uc_link; - stack_t uc_stack; - mcontext_t uc_mcontext; - // Other fields are not used by V8, don't define them here. -} ucontext_t; -enum { REG_EIP = 14 }; -# endif // defined(__i386__) -# endif // !defined(__BIONIC_HAVE_UCONTEXT_T) -#endif // defined(ANDROID) - #if !defined(XP_WIN) # define CONTEXT ucontext_t #endif @@ -977,25 +890,6 @@ ProcessHasSignalHandlers() if (getenv("JS_DISABLE_SLOW_SCRIPT_SIGNALS") || getenv("JS_NO_SIGNALS")) return false; -#if defined(ANDROID) - // Before Android 4.4 (SDK version 19), there is a bug - // https://android-review.googlesource.com/#/c/52333 - // in Bionic's pthread_join which causes pthread_join to return early when - // pthread_kill is used (on any thread). Nobody expects the pthread_cond_wait - // EINTRquisition. - char version_string[PROP_VALUE_MAX]; - PodArrayZero(version_string); - if (__system_property_get("ro.build.version.sdk", version_string) > 0) { - if (atol(version_string) < 19) - return false; - } -# if defined(MOZ_LINKER) - // Signal handling is broken on some android systems. - if (IsSignalHandlingBroken()) - return false; -# endif -#endif - // The interrupt handler allows the main thread to be paused from another // thread (see InterruptRunningJitCode). #if defined(XP_WIN) |