Rework common_periodicChecks.
The function was rewritten to optimize the common path. The control flow
now matches the C version, which tests for debugger/profiler even if the
previous test for suspension came up true.
This also adds a minor optimization on the test for debugger attachment,
allowing us to skip a load from memory if the process is simply not
debuggable. (The optimization isn't yet enabled because a similar change
must be made to the x86 asm code.)
The VM apparently hadn't been built without debugging/profiling support
for a while, so this fixes those places (necessary to be able to test
all forms of the new code).
Bug 2634642.
Change-Id: I096b58c961bb73ee0d128ba776d68dbf29bba924
diff --git a/vm/compiler/Compiler.c b/vm/compiler/Compiler.c
index 9964285..649f6f0 100644
--- a/vm/compiler/Compiler.c
+++ b/vm/compiler/Compiler.c
@@ -724,7 +724,16 @@
dvmLockMutex(&gDvmJit.tableLock);
jitActive = gDvmJit.pProfTable != NULL;
+
+#if defined(WITH_DEBUGGER) && defined(WITH_PROFILER)
jitActivate = !(gDvm.debuggerActive || (gDvm.activeProfilers > 0));
+#elif defined(WITH_DEBUGGER)
+ jitActivate = !gDvm.debuggerActive;
+#elif defined(WITH_PROFILER)
+ jitActivate = !(gDvm.activeProfilers > 0);
+#else
+ jitActivate = true;
+#endif
if (jitActivate && !jitActive) {
gDvmJit.pProfTable = gDvmJit.pProfTableCopy;