Always support debugging and profiling.
This eliminates the use of the WITH_DEBUGGER and WITH_PROFILER
conditional compilation flags. We've never shipped a device without
these features, and it's unlikely we ever will. They're not worth
the code clutter they cause.
As usual, since I can't test the x86-atom code I left that alone and
added an item to the TODO list.
Bug 2923442.
Change-Id: I335ebd5193bc86f7641513b1b41c0378839be1fe
diff --git a/vm/Debugger.c b/vm/Debugger.c
index 9402911..918e137 100644
--- a/vm/Debugger.c
+++ b/vm/Debugger.c
@@ -509,13 +509,11 @@
{
// TODO? invoke System.exit() to perform exit processing; ends up
// in System.exitInternal(), which can call JNI exit hook
-#ifdef WITH_PROFILER
LOGI("GC lifetime allocation: %d bytes\n", gDvm.allocProf.allocCount);
if (CALC_CACHE_STATS) {
dvmDumpAtomicCacheStats(gDvm.instanceofCache);
dvmDumpBootClassPath();
}
-#endif
#ifdef PROFILE_FIELD_ACCESS
dvmDumpFieldAccessCounts();
#endif
diff --git a/vm/Dvm.mk b/vm/Dvm.mk
index c624258..2ac52d7 100644
--- a/vm/Dvm.mk
+++ b/vm/Dvm.mk
@@ -31,7 +31,6 @@
#
# Optional features. These may impact the size or performance of the VM.
#
-LOCAL_CFLAGS += -DWITH_PROFILER -DWITH_DEBUGGER
# 0=full cache, 1/2=reduced, 3=no cache
LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0
diff --git a/vm/Globals.h b/vm/Globals.h
index 954bb5d..d0ad110 100644
--- a/vm/Globals.h
+++ b/vm/Globals.h
@@ -598,7 +598,6 @@
enum { kDPOff=0, kDPWarn, kDPErr, kDPAbort } deadlockPredictMode;
#endif
-#ifdef WITH_PROFILER
/*
* When a profiler is enabled, this is incremented. Distinct profilers
* include "dmtrace" method tracing, emulator method tracing, and
@@ -628,7 +627,8 @@
/*
* Pointers to the original methods for things that have been inlined.
* This makes it easy for us to output method entry/exit records for
- * the method calls we're not actually making.
+ * the method calls we're not actually making. (Used by method
+ * profiling.)
*/
Method** inlinedMethods;
@@ -637,7 +637,6 @@
*/
int* executedInstrCounts;
bool instructionCountEnableCount;
-#endif
/*
* Signal catcher thread (for SIGQUIT).
diff --git a/vm/Init.c b/vm/Init.c
index 232b7a6..84cd6c8 100644
--- a/vm/Init.c
+++ b/vm/Init.c
@@ -137,12 +137,8 @@
#endif
dvmFprintf(stderr, "\n");
dvmFprintf(stderr, "Configured with:"
-#ifdef WITH_DEBUGGER
" debugger"
-#endif
-#ifdef WITH_PROFILER
" profiler"
-#endif
#ifdef WITH_MONITOR_TRACKING
" monitor_tracking"
#endif
@@ -1218,10 +1214,8 @@
goto fail;
if (!dvmReflectStartup())
goto fail;
-#ifdef WITH_PROFILER
if (!dvmProfilingStartup())
goto fail;
-#endif
/* make sure we got these [can this go away?] */
assert(gDvm.classJavaLangClass != NULL);
@@ -1456,11 +1450,6 @@
{
assert(!gDvm.zygote);
-#ifndef WITH_DEBUGGER
- LOGI("Debugger support not compiled into VM\n");
- return false;
-#endif
-
/*
* Init JDWP if the debugger is enabled. This may connect out to a
* debugger, passively listen for a debugger, or block waiting for a
@@ -1636,9 +1625,7 @@
dvmDebuggerShutdown();
dvmReflectShutdown();
-#ifdef WITH_PROFILER
dvmProfilingShutdown();
-#endif
dvmJniShutdown();
dvmStringInternShutdown();
dvmExceptionShutdown();
diff --git a/vm/InlineNative.c b/vm/InlineNative.c
index aa9c5cf..d021002 100644
--- a/vm/InlineNative.c
+++ b/vm/InlineNative.c
@@ -692,12 +692,10 @@
*/
bool dvmInlineNativeStartup(void)
{
-#ifdef WITH_PROFILER
gDvm.inlinedMethods =
(Method**) calloc(NELEM(gDvmInlineOpsTable), sizeof(Method*));
if (gDvm.inlinedMethods == NULL)
return false;
-#endif
return true;
}
@@ -707,9 +705,7 @@
*/
void dvmInlineNativeShutdown(void)
{
-#ifdef WITH_PROFILER
free(gDvm.inlinedMethods);
-#endif
}
@@ -741,7 +737,6 @@
assert(opIndex >= 0 && opIndex < NELEM(gDvmInlineOpsTable));
-#ifdef WITH_PROFILER
/*
* Populate the methods table on first use. It's possible the class
* hasn't been resolved yet, so we need to do the full "calling the
@@ -792,6 +787,5 @@
return result;
skip_prof:
-#endif
return (*gDvmInlineOpsTable[opIndex].func)(arg0, arg1, arg2, arg3, pResult);
}
diff --git a/vm/Jni.c b/vm/Jni.c
index 8967f46..5287f46 100644
--- a/vm/Jni.c
+++ b/vm/Jni.c
@@ -3271,7 +3271,7 @@
}
/*
- * Copy a section of a primitive array to a buffer.
+ * Copy a section of a primitive array from a buffer.
*/
#define SET_PRIMITIVE_ARRAY_REGION(_ctype, _jname) \
static void Set##_jname##ArrayRegion(JNIEnv* env, \
diff --git a/vm/Profile.c b/vm/Profile.c
index 92d4001..ca3788a 100644
--- a/vm/Profile.c
+++ b/vm/Profile.c
@@ -19,8 +19,6 @@
*/
#include "Dalvik.h"
-#ifdef WITH_PROFILER // -- include rest of file
-
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
@@ -890,5 +888,3 @@
{
gDvm.allocProf.enabled = false;
}
-
-#endif /*WITH_PROFILER*/
diff --git a/vm/Profile.h b/vm/Profile.h
index afa529d..08bbf61 100644
--- a/vm/Profile.h
+++ b/vm/Profile.h
@@ -127,8 +127,7 @@
/*
* Call these when a method enters or exits.
*/
-#ifdef WITH_PROFILER
-# define TRACE_METHOD_ENTER(_self, _method) \
+#define TRACE_METHOD_ENTER(_self, _method) \
do { \
if (gDvm.activeProfilers != 0) { \
if (gDvm.methodTrace.traceEnabled) \
@@ -137,7 +136,7 @@
dvmEmitEmulatorTrace(_method, METHOD_TRACE_ENTER); \
} \
} while(0);
-# define TRACE_METHOD_EXIT(_self, _method) \
+#define TRACE_METHOD_EXIT(_self, _method) \
do { \
if (gDvm.activeProfilers != 0) { \
if (gDvm.methodTrace.traceEnabled) \
@@ -146,7 +145,7 @@
dvmEmitEmulatorTrace(_method, METHOD_TRACE_EXIT); \
} \
} while(0);
-# define TRACE_METHOD_UNROLL(_self, _method) \
+#define TRACE_METHOD_UNROLL(_self, _method) \
do { \
if (gDvm.activeProfilers != 0) { \
if (gDvm.methodTrace.traceEnabled) \
@@ -155,11 +154,6 @@
dvmEmitEmulatorTrace(_method, METHOD_TRACE_UNROLL); \
} \
} while(0);
-#else
-# define TRACE_METHOD_ENTER(_self, _method) ((void) 0)
-# define TRACE_METHOD_EXIT(_self, _method) ((void) 0)
-# define TRACE_METHOD_UNROLL(_self, _method) ((void) 0)
-#endif
void dvmMethodTraceAdd(struct Thread* self, const Method* method, int action);
void dvmEmitEmulatorTrace(const Method* method, int action);
diff --git a/vm/Thread.c b/vm/Thread.c
index e46715d..e2a4ea5 100644
--- a/vm/Thread.c
+++ b/vm/Thread.c
@@ -2269,7 +2269,6 @@
*/
android_atomic_release_store(THREAD_VMWAIT, &self->status);
-#ifdef WITH_PROFILER
/*
* If we're doing method trace profiling, we don't want threads to exit,
* because if they do we'll end up reusing thread IDs. This complicates
@@ -2294,7 +2293,6 @@
}
}
dvmUnlockMutex(&traceState->startStopLock);
-#endif
dvmLockThreadList(self);
diff --git a/vm/Thread.h b/vm/Thread.h
index b01676c..1457e8c 100644
--- a/vm/Thread.h
+++ b/vm/Thread.h
@@ -234,14 +234,12 @@
int allocLimit;
#endif
-#ifdef WITH_PROFILER
- /* base time for per-thread CPU timing */
+ /* base time for per-thread CPU timing (used by method profiling) */
bool cpuClockBaseSet;
u8 cpuClockBase;
/* memory allocation profiling state */
AllocProfState allocProf;
-#endif
#ifdef WITH_JNI_STACK_CHECK
u4 stackCrc;
diff --git a/vm/alloc/Heap.c b/vm/alloc/Heap.c
index b8f6288..5233d82 100644
--- a/vm/alloc/Heap.c
+++ b/vm/alloc/Heap.c
@@ -224,7 +224,6 @@
*/
static void gcForMalloc(bool collectSoftReferences)
{
-#ifdef WITH_PROFILER
if (gDvm.allocProf.enabled) {
Thread* self = dvmThreadSelf();
gDvm.allocProf.gcCount++;
@@ -232,7 +231,6 @@
self->allocProf.gcCount++;
}
}
-#endif
/* This may adjust the soft limit as a side-effect.
*/
LOGD_HEAP("dvmMalloc initiating GC%s\n",
@@ -478,7 +476,6 @@
}
}
-#ifdef WITH_PROFILER
if (gDvm.allocProf.enabled) {
Thread* self = dvmThreadSelf();
gDvm.allocProf.allocCount++;
@@ -488,12 +485,10 @@
self->allocProf.allocSize += size;
}
}
-#endif
} else {
/* The allocation failed.
*/
-#ifdef WITH_PROFILER
if (gDvm.allocProf.enabled) {
Thread* self = dvmThreadSelf();
gDvm.allocProf.failedAllocCount++;
@@ -503,7 +498,6 @@
self->allocProf.failedAllocSize += size;
}
}
-#endif
}
dvmUnlockHeap();
@@ -662,9 +656,7 @@
verifyRootsAndHeap();
}
-#ifdef WITH_PROFILER
dvmMethodTraceGCBegin();
-#endif
#if WITH_HPROF
@@ -873,9 +865,7 @@
*/
dvmScheduleHeapSourceTrim(5); // in seconds
-#ifdef WITH_PROFILER
dvmMethodTraceGCEnd();
-#endif
LOGV_HEAP("GC finished");
gcHeap->gcRunning = false;
diff --git a/vm/alloc/HeapSource.c b/vm/alloc/HeapSource.c
index ed5f081..7e381c5 100644
--- a/vm/alloc/HeapSource.c
+++ b/vm/alloc/HeapSource.c
@@ -1581,7 +1581,7 @@
*/
if (hs->externalBytesAllocated + n <= hs->externalLimit) {
hs->externalBytesAllocated += n;
-#if defined(WITH_PROFILER) && PROFILE_EXTERNAL_ALLOCATIONS
+#if PROFILE_EXTERNAL_ALLOCATIONS
if (gDvm.allocProf.enabled) {
Thread* self = dvmThreadSelf();
gDvm.allocProf.externalAllocCount++;
@@ -1609,7 +1609,6 @@
static void
gcForExternalAlloc(bool collectSoftReferences)
{
-#ifdef WITH_PROFILER // even if !PROFILE_EXTERNAL_ALLOCATIONS
if (gDvm.allocProf.enabled) {
Thread* self = dvmThreadSelf();
gDvm.allocProf.gcCount++;
@@ -1617,7 +1616,6 @@
self->allocProf.gcCount++;
}
}
-#endif
dvmCollectGarbageInternal(collectSoftReferences, GC_EXTERNAL_ALLOC);
}
@@ -1699,7 +1697,7 @@
LOGE_HEAP("Out of external memory on a %zu-byte allocation.\n", n);
}
-#if defined(WITH_PROFILER) && PROFILE_EXTERNAL_ALLOCATIONS
+#if PROFILE_EXTERNAL_ALLOCATIONS
if (gDvm.allocProf.enabled) {
Thread* self = dvmThreadSelf();
gDvm.allocProf.failedExternalAllocCount++;
@@ -1746,7 +1744,7 @@
hs->externalBytesAllocated = 0;
}
-#if defined(WITH_PROFILER) && PROFILE_EXTERNAL_ALLOCATIONS
+#if PROFILE_EXTERNAL_ALLOCATIONS
if (gDvm.allocProf.enabled) {
Thread* self = dvmThreadSelf();
gDvm.allocProf.externalFreeCount++;
diff --git a/vm/alloc/MarkSweep.c b/vm/alloc/MarkSweep.c
index c76d8af..e0de3df 100644
--- a/vm/alloc/MarkSweep.c
+++ b/vm/alloc/MarkSweep.c
@@ -1027,10 +1027,8 @@
}
*numObjects = ctx.numObjects;
*numBytes = ctx.numBytes;
-#ifdef WITH_PROFILER
if (gDvm.allocProf.enabled) {
gDvm.allocProf.freeCount += ctx.numObjects;
gDvm.allocProf.freeSize += ctx.numBytes;
}
-#endif
}
diff --git a/vm/compiler/Compiler.c b/vm/compiler/Compiler.c
index 2b0ad52..60f060c 100644
--- a/vm/compiler/Compiler.c
+++ b/vm/compiler/Compiler.c
@@ -741,16 +741,7 @@
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;
diff --git a/vm/interp/Interp.c b/vm/interp/Interp.c
index 506a125..9f44a13 100644
--- a/vm/interp/Interp.c
+++ b/vm/interp/Interp.c
@@ -21,9 +21,7 @@
* facilitates switching between them. The standard interpreter may
* use the "fast" or "portable" implementation.
*
- * Some debugger support functions are included here. Ideally their
- * entire existence would be "#ifdef WITH_DEBUGGER", but we're not that
- * aggressive in other parts of the code yet.
+ * Some debugger support functions are included here.
*/
#include "Dalvik.h"
#include "interp/InterpDefs.h"
@@ -44,12 +42,8 @@
*/
bool dvmBreakpointStartup(void)
{
-#ifdef WITH_DEBUGGER
gDvm.breakpointSet = dvmBreakpointSetAlloc();
return (gDvm.breakpointSet != NULL);
-#else
- return true;
-#endif
}
/*
@@ -57,13 +51,10 @@
*/
void dvmBreakpointShutdown(void)
{
-#ifdef WITH_DEBUGGER
dvmBreakpointSetFree(gDvm.breakpointSet);
-#endif
}
-#ifdef WITH_DEBUGGER
/*
* This represents a breakpoint inserted in the instruction stream.
*
@@ -376,7 +367,6 @@
}
}
}
-#endif /*WITH_DEBUGGER*/
/*
@@ -384,7 +374,6 @@
*/
void dvmInitBreakpoints(void)
{
-#ifdef WITH_DEBUGGER
/* quick sanity check */
BreakpointSet* pSet = gDvm.breakpointSet;
dvmBreakpointSetLock(pSet);
@@ -393,9 +382,6 @@
/* generally not good, but we can keep going */
}
dvmBreakpointSetUnlock(pSet);
-#else
- assert(false);
-#endif
}
/*
@@ -414,14 +400,10 @@
*/
void dvmAddBreakAddr(Method* method, unsigned int instrOffset)
{
-#ifdef WITH_DEBUGGER
BreakpointSet* pSet = gDvm.breakpointSet;
dvmBreakpointSetLock(pSet);
dvmBreakpointSetAdd(pSet, method, instrOffset);
dvmBreakpointSetUnlock(pSet);
-#else
- assert(false);
-#endif
}
/*
@@ -436,18 +418,12 @@
*/
void dvmClearBreakAddr(Method* method, unsigned int instrOffset)
{
-#ifdef WITH_DEBUGGER
BreakpointSet* pSet = gDvm.breakpointSet;
dvmBreakpointSetLock(pSet);
dvmBreakpointSetRemove(pSet, method, instrOffset);
dvmBreakpointSetUnlock(pSet);
-
-#else
- assert(false);
-#endif
}
-#ifdef WITH_DEBUGGER
/*
* Get the original opcode from under a breakpoint.
*
@@ -496,7 +472,6 @@
dvmBreakpointSetFlush(pSet, clazz);
dvmBreakpointSetUnlock(pSet);
}
-#endif
/*
* Add a single step event. Currently this is a global item.
@@ -509,7 +484,6 @@
*/
bool dvmAddSingleStep(Thread* thread, int size, int depth)
{
-#ifdef WITH_DEBUGGER
StepControl* pCtrl = &gDvm.stepControl;
if (pCtrl->active && thread != pCtrl->thread) {
@@ -605,10 +579,6 @@
dvmJdwpStepSizeStr(pCtrl->size));
return true;
-#else
- assert(false);
- return false;
-#endif
}
/*
@@ -616,13 +586,9 @@
*/
void dvmClearSingleStep(Thread* thread)
{
-#ifdef WITH_DEBUGGER
UNUSED_PARAMETER(thread);
gDvm.stepControl.active = false;
-#else
- assert(false);
-#endif
}
@@ -1307,9 +1273,7 @@
interpState.debugTrackedRefStart =
dvmReferenceTableEntries(&self->internalLocalRefTable);
#endif
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
interpState.debugIsMethodEntry = true;
-#endif
#if defined(WITH_JIT)
dvmJitCalleeSave(interpState.calleeSave);
/* Initialize the state to kJitNot */
@@ -1380,12 +1344,10 @@
LOGVV("threadid=%d: interp STD\n", self->threadId);
change = (*stdInterp)(self, &interpState);
break;
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER) || defined(WITH_JIT)
case INTERP_DBG:
LOGVV("threadid=%d: interp DBG\n", self->threadId);
change = dvmInterpretDbg(self, &interpState);
break;
-#endif
default:
dvmAbort();
}
diff --git a/vm/interp/Interp.h b/vm/interp/Interp.h
index 1964b57..76d7d29 100644
--- a/vm/interp/Interp.h
+++ b/vm/interp/Interp.h
@@ -49,7 +49,6 @@
bool dvmAddSingleStep(Thread* thread, int size, int depth);
void dvmClearSingleStep(Thread* thread);
-#ifdef WITH_DEBUGGER
/*
* Recover the opcode that was replaced by a breakpoint.
*/
@@ -59,6 +58,5 @@
* Flush any breakpoints associated with methods in "clazz".
*/
void dvmFlushBreakpoints(ClassObject* clazz);
-#endif
#endif /*_DALVIK_INTERP_INTERP*/
diff --git a/vm/interp/InterpDefs.h b/vm/interp/InterpDefs.h
index 6ba9e12..a01ee68 100644
--- a/vm/interp/InterpDefs.h
+++ b/vm/interp/InterpDefs.h
@@ -130,14 +130,10 @@
volatile int* pSelfSuspendCount;
/* Biased base of GC's card table */
u1* cardTable;
-#if defined(WITH_DEBUGGER)
/* points at gDvm.debuggerActive, or NULL if debugger not enabled */
volatile u1* pDebuggerActive;
-#endif
-#if defined(WITH_PROFILER)
/* points at gDvm.activeProfilers */
volatile int* pActiveProfilers;
-#endif
/* ----------------------------------------------------------------------
*/
@@ -167,9 +163,7 @@
int icRechainCount; // Count down to next rechain request
#endif
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
bool debugIsMethodEntry; // used for method entry event triggers
-#endif
#if defined(WITH_TRACKREF_CHECKS)
int debugTrackedRefStart; // tracked refs from prior invocations
#endif
@@ -239,11 +233,7 @@
*/
static inline bool dvmDebuggerOrProfilerActive(void)
{
- return gDvm.debuggerActive
-#if defined(WITH_PROFILER)
- || gDvm.activeProfilers != 0
-#endif
- ;
+ return gDvm.debuggerActive || gDvm.activeProfilers != 0;
}
#if defined(WITH_JIT)
@@ -254,10 +244,8 @@
static inline bool dvmJitDebuggerOrProfilerActive()
{
return gDvmJit.pProfTable != NULL
-#if defined(WITH_PROFILER)
|| gDvm.activeProfilers != 0
-#endif
- ||gDvm.debuggerActive;
+ || gDvm.debuggerActive;
}
#endif
diff --git a/vm/interp/Stack.c b/vm/interp/Stack.c
index 673dc14..0456e50 100644
--- a/vm/interp/Stack.c
+++ b/vm/interp/Stack.c
@@ -518,17 +518,13 @@
//dvmDumpThreadStack(dvmThreadSelf());
if (dvmIsNativeMethod(method)) {
-#ifdef WITH_PROFILER
TRACE_METHOD_ENTER(self, method);
-#endif
/*
* Because we leave no space for local variables, "curFrame" points
* directly at the method arguments.
*/
(*method->nativeFunc)(self->curFrame, pResult, method, self);
-#ifdef WITH_PROFILER
TRACE_METHOD_EXIT(self, method);
-#endif
} else {
dvmInterpret(self, method, pResult);
}
@@ -626,17 +622,13 @@
#endif
if (dvmIsNativeMethod(method)) {
-#ifdef WITH_PROFILER
TRACE_METHOD_ENTER(self, method);
-#endif
/*
* Because we leave no space for local variables, "curFrame" points
* directly at the method arguments.
*/
(*method->nativeFunc)(self->curFrame, pResult, method, self);
-#ifdef WITH_PROFILER
TRACE_METHOD_EXIT(self, method);
-#endif
} else {
dvmInterpret(self, method, pResult);
}
@@ -736,17 +728,13 @@
//dvmDumpThreadStack(dvmThreadSelf());
if (dvmIsNativeMethod(method)) {
-#ifdef WITH_PROFILER
TRACE_METHOD_ENTER(self, method);
-#endif
/*
* Because we leave no space for local variables, "curFrame" points
* directly at the method arguments.
*/
(*method->nativeFunc)(self->curFrame, &retval, method, self);
-#ifdef WITH_PROFILER
TRACE_METHOD_EXIT(self, method);
-#endif
} else {
dvmInterpret(self, method, &retval);
}
diff --git a/vm/mterp/Mterp.c b/vm/mterp/Mterp.c
index 569e49f..dbf5003 100644
--- a/vm/mterp/Mterp.c
+++ b/vm/mterp/Mterp.c
@@ -82,16 +82,12 @@
glue->ppJitProfTable = &gDvmJit.pProfTable;
glue->jitThreshold = gDvmJit.threshold;
#endif
-#if defined(WITH_DEBUGGER)
if (gDvm.jdwpConfigured) {
glue->pDebuggerActive = &gDvm.debuggerActive;
} else {
glue->pDebuggerActive = NULL;
}
-#endif
-#if defined(WITH_PROFILER)
glue->pActiveProfilers = &gDvm.activeProfilers;
-#endif
IF_LOGVV() {
char* desc = dexProtoCopyMethodDescriptor(&glue->method->prototype);
diff --git a/vm/mterp/armv5te/footer.S b/vm/mterp/armv5te/footer.S
index 3212126..2ba5357 100644
--- a/vm/mterp/armv5te/footer.S
+++ b/vm/mterp/armv5te/footer.S
@@ -438,32 +438,16 @@
common_periodicChecks:
ldr r3, [rGLUE, #offGlue_pSelfSuspendCount] @ r3<- &suspendCount
-#if defined(WITH_DEBUGGER)
ldr r1, [rGLUE, #offGlue_pDebuggerActive] @ r1<- &debuggerActive
-#endif
-#if defined(WITH_PROFILER)
ldr r2, [rGLUE, #offGlue_pActiveProfilers] @ r2<- &activeProfilers
-#endif
ldr ip, [r3] @ ip<- suspendCount (int)
-#if defined(WITH_DEBUGGER) && defined(WITH_PROFILER)
cmp r1, #0 @ debugger enabled?
ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
ldr r2, [r2] @ r2<- activeProfilers (int)
orrne ip, ip, r1 @ ip<- suspendCount | debuggerActive
orrs ip, ip, r2 @ ip<- suspend|debugger|profiler; set Z
-#elif defined(WITH_DEBUGGER)
- cmp r1, #0 @ debugger enabled?
- ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
- orrsne ip, ip, r1 @ yes, ip<- suspend | debugger; set Z
- @ (if not enabled, Z was set by test for r1==0, which is what we want)
-#elif defined (WITH_PROFILER)
- ldr r2, [r2] @ r2<- activeProfilers (int)
- orrs ip, ip, r2 @ ip<- suspendCount | activeProfilers
-#else
- cmp ip, #0 @ not ORing anything in; set Z
-#endif
bxeq lr @ all zero, return
@@ -474,11 +458,9 @@
*
* r0 still holds the reentry type.
*/
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
ldr ip, [r3] @ ip<- suspendCount (int)
cmp ip, #0 @ want suspend?
beq 1f @ no, must be debugger/profiler
-#endif
stmfd sp!, {r0, lr} @ preserve r0 and lr
#if defined(WITH_JIT)
@@ -498,8 +480,6 @@
bl dvmCheckSuspendPending @ do full check, suspend if necessary
ldmfd sp!, {r0, lr} @ restore r0 and lr
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
-
/*
* Reload the debugger/profiler enable flags. We're checking to see
* if either of these got set while we were suspended.
@@ -507,19 +487,11 @@
* We can't really avoid the #ifdefs here, because the fields don't
* exist when the feature is disabled.
*/
-#if defined(WITH_DEBUGGER)
ldr r1, [rGLUE, #offGlue_pDebuggerActive] @ r1<- &debuggerActive
cmp r1, #0 @ debugger enabled?
ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
-#else
- mov r1, #0
-#endif
-#if defined(WITH_PROFILER)
ldr r2, [rGLUE, #offGlue_pActiveProfilers] @ r2<- &activeProfilers
ldr r2, [r2] @ r2<- activeProfilers (int)
-#else
- mov r2, #0
-#endif
orrs r1, r1, r2
beq 2f
@@ -530,8 +502,6 @@
mov r1, #1 @ "want switch" = true
b common_gotoBail @ side exit
-#endif /*WITH_DEBUGGER || WITH_PROFILER*/
-
2:
bx lr @ nothing to do, return
diff --git a/vm/mterp/c/OP_BREAKPOINT.c b/vm/mterp/c/OP_BREAKPOINT.c
index 5a1b543..91cd36c 100644
--- a/vm/mterp/c/OP_BREAKPOINT.c
+++ b/vm/mterp/c/OP_BREAKPOINT.c
@@ -1,5 +1,5 @@
HANDLE_OPCODE(OP_BREAKPOINT)
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
{
/*
* Restart this instruction with the original opcode. We do
diff --git a/vm/mterp/c/gotoTargets.c b/vm/mterp/c/gotoTargets.c
index b17fb80..0db6fb7 100644
--- a/vm/mterp/c/gotoTargets.c
+++ b/vm/mterp/c/gotoTargets.c
@@ -546,7 +546,7 @@
#ifdef EASY_GDB
debugSaveArea = saveArea;
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_EXIT(self, curMethod);
#endif
@@ -623,7 +623,7 @@
exception->clazz->descriptor, curMethod->name,
dvmLineNumFromPC(curMethod, pc - curMethod->insns));
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
/*
* Tell the debugger about it.
*
@@ -919,13 +919,13 @@
DUMP_REGS(methodToCall, newFp, true); // show input args
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
if (gDvm.debuggerActive) {
dvmDbgPostLocationEvent(methodToCall, -1,
dvmGetThisPtr(curMethod, fp), DBG_METHOD_ENTRY);
}
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_ENTER(self, methodToCall);
#endif
@@ -946,13 +946,13 @@
*/
(*methodToCall->nativeFunc)(newFp, &retval, methodToCall, self);
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
if (gDvm.debuggerActive) {
dvmDbgPostLocationEvent(methodToCall, -1,
dvmGetThisPtr(curMethod, fp), DBG_METHOD_EXIT);
}
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_EXIT(self, methodToCall);
#endif
diff --git a/vm/mterp/c/header.c b/vm/mterp/c/header.c
index 5e1c5a7..aaf6dab 100644
--- a/vm/mterp/c/header.c
+++ b/vm/mterp/c/header.c
@@ -26,8 +26,6 @@
* portable interpreter(s) and C stubs.
*
* Some defines are controlled by the Makefile, e.g.:
- * WITH_PROFILER
- * WITH_DEBUGGER
* WITH_INSTR_CHECKS
* WITH_TRACKREF_CHECKS
* EASY_GDB
@@ -332,7 +330,6 @@
*
* If we're building without debug and profiling support, we never switch.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
#if defined(WITH_JIT)
# define NEED_INTERP_SWITCH(_current) ( \
(_current == INTERP_STD) ? \
@@ -342,9 +339,6 @@
(_current == INTERP_STD) ? \
dvmDebuggerOrProfilerActive() : !dvmDebuggerOrProfilerActive() )
#endif
-#else
-# define NEED_INTERP_SWITCH(_current) (false)
-#endif
/*
* Check to see if "obj" is NULL. If so, throw an exception. Assumes the
diff --git a/vm/mterp/common/asm-constants.h b/vm/mterp/common/asm-constants.h
index 475b897..5502c44 100644
--- a/vm/mterp/common/asm-constants.h
+++ b/vm/mterp/common/asm-constants.h
@@ -83,9 +83,7 @@
/* globals (sanity check for LDR vs LDRB) */
MTERP_SIZEOF(sizeofGlobal_debuggerActive, gDvm.debuggerActive, 1)
-#if defined(WITH_PROFILER)
MTERP_SIZEOF(sizeofGlobal_activeProfilers, gDvm.activeProfilers, 4)
-#endif
/* MterpGlue fields */
MTERP_OFFSET(offGlue_pc, MterpGlue, pc, 0)
@@ -98,7 +96,6 @@
MTERP_OFFSET(offGlue_interpStackEnd, MterpGlue, interpStackEnd, 32)
MTERP_OFFSET(offGlue_pSelfSuspendCount, MterpGlue, pSelfSuspendCount, 36)
MTERP_OFFSET(offGlue_cardTable, MterpGlue, cardTable, 40)
-#if defined(WITH_DEBUGGER) && defined(WITH_PROFILER)
MTERP_OFFSET(offGlue_pDebuggerActive, MterpGlue, pDebuggerActive, 44)
MTERP_OFFSET(offGlue_pActiveProfilers, MterpGlue, pActiveProfilers, 48)
MTERP_OFFSET(offGlue_entryPoint, MterpGlue, entryPoint, 52)
@@ -111,42 +108,6 @@
MTERP_OFFSET(offGlue_ppJitProfTable, MterpGlue, ppJitProfTable, 80)
MTERP_OFFSET(offGlue_icRechainCount, MterpGlue, icRechainCount, 84)
#endif
-#elif defined(WITH_DEBUGGER)
-MTERP_OFFSET(offGlue_pDebuggerActive, MterpGlue, pDebuggerActive, 44)
-MTERP_OFFSET(offGlue_entryPoint, MterpGlue, entryPoint, 48)
-#if defined(WITH_JIT)
-MTERP_OFFSET(offGlue_pJitProfTable, MterpGlue, pJitProfTable, 56)
-MTERP_OFFSET(offGlue_jitState, MterpGlue, jitState, 60)
-MTERP_OFFSET(offGlue_jitResumeNPC, MterpGlue, jitResumeNPC, 64)
-MTERP_OFFSET(offGlue_jitResumeDPC, MterpGlue, jitResumeDPC, 68)
-MTERP_OFFSET(offGlue_jitThreshold, MterpGlue, jitThreshold, 72)
-MTERP_OFFSET(offGlue_ppJitProfTable, MterpGlue, ppJitProfTable, 76)
-MTERP_OFFSET(offGlue_icRechainCount, MterpGlue, icRechainCount, 80)
-#endif
-#elif defined(WITH_PROFILER)
-MTERP_OFFSET(offGlue_pActiveProfilers, MterpGlue, pActiveProfilers, 44)
-MTERP_OFFSET(offGlue_entryPoint, MterpGlue, entryPoint, 48)
-#if defined(WITH_JIT)
-MTERP_OFFSET(offGlue_pJitProfTable, MterpGlue, pJitProfTable, 56)
-MTERP_OFFSET(offGlue_jitState, MterpGlue, jitState, 60)
-MTERP_OFFSET(offGlue_jitResumeNPC, MterpGlue, jitResumeNPC, 64)
-MTERP_OFFSET(offGlue_jitResumeDPC, MterpGlue, jitResumeDPC, 68)
-MTERP_OFFSET(offGlue_jitThreshold, MterpGlue, jitThreshold, 72)
-MTERP_OFFSET(offGlue_ppJitProfTable, MterpGlue, ppJitProfTable, 76)
-MTERP_OFFSET(offGlue_icRechainCount, MterpGlue, icRechainCount, 80)
-#endif
-#else
-MTERP_OFFSET(offGlue_entryPoint, MterpGlue, entryPoint, 44)
-#if defined(WITH_JIT)
-MTERP_OFFSET(offGlue_pJitProfTable, MterpGlue, pJitProfTable, 52)
-MTERP_OFFSET(offGlue_jitState, MterpGlue, jitState, 56)
-MTERP_OFFSET(offGlue_jitResumeNPC, MterpGlue, jitResumeNPC, 60)
-MTERP_OFFSET(offGlue_jitResumeDPC, MterpGlue, jitResumeDPC, 64)
-MTERP_OFFSET(offGlue_jitThreshold, MterpGlue, jitThreshold, 68)
-MTERP_OFFSET(offGlue_ppJitProfTable, MterpGlue, ppJitProfTable, 72)
-MTERP_OFFSET(offGlue_icRechainCount, MterpGlue, icRechainCount, 76)
-#endif
-#endif
/* make sure all JValue union members are stored at the same offset */
MTERP_OFFSET(offGlue_retval_z, MterpGlue, retval.z, 8)
MTERP_OFFSET(offGlue_retval_i, MterpGlue, retval.i, 8)
diff --git a/vm/mterp/out/InterpAsm-armv4t.S b/vm/mterp/out/InterpAsm-armv4t.S
index 5ce80ff..3593a6e 100644
--- a/vm/mterp/out/InterpAsm-armv4t.S
+++ b/vm/mterp/out/InterpAsm-armv4t.S
@@ -10286,32 +10286,16 @@
common_periodicChecks:
ldr r3, [rGLUE, #offGlue_pSelfSuspendCount] @ r3<- &suspendCount
-#if defined(WITH_DEBUGGER)
ldr r1, [rGLUE, #offGlue_pDebuggerActive] @ r1<- &debuggerActive
-#endif
-#if defined(WITH_PROFILER)
ldr r2, [rGLUE, #offGlue_pActiveProfilers] @ r2<- &activeProfilers
-#endif
ldr ip, [r3] @ ip<- suspendCount (int)
-#if defined(WITH_DEBUGGER) && defined(WITH_PROFILER)
cmp r1, #0 @ debugger enabled?
ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
ldr r2, [r2] @ r2<- activeProfilers (int)
orrne ip, ip, r1 @ ip<- suspendCount | debuggerActive
orrs ip, ip, r2 @ ip<- suspend|debugger|profiler; set Z
-#elif defined(WITH_DEBUGGER)
- cmp r1, #0 @ debugger enabled?
- ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
- orrsne ip, ip, r1 @ yes, ip<- suspend | debugger; set Z
- @ (if not enabled, Z was set by test for r1==0, which is what we want)
-#elif defined (WITH_PROFILER)
- ldr r2, [r2] @ r2<- activeProfilers (int)
- orrs ip, ip, r2 @ ip<- suspendCount | activeProfilers
-#else
- cmp ip, #0 @ not ORing anything in; set Z
-#endif
bxeq lr @ all zero, return
@@ -10322,11 +10306,9 @@
*
* r0 still holds the reentry type.
*/
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
ldr ip, [r3] @ ip<- suspendCount (int)
cmp ip, #0 @ want suspend?
beq 1f @ no, must be debugger/profiler
-#endif
stmfd sp!, {r0, lr} @ preserve r0 and lr
#if defined(WITH_JIT)
@@ -10346,8 +10328,6 @@
bl dvmCheckSuspendPending @ do full check, suspend if necessary
ldmfd sp!, {r0, lr} @ restore r0 and lr
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
-
/*
* Reload the debugger/profiler enable flags. We're checking to see
* if either of these got set while we were suspended.
@@ -10355,19 +10335,11 @@
* We can't really avoid the #ifdefs here, because the fields don't
* exist when the feature is disabled.
*/
-#if defined(WITH_DEBUGGER)
ldr r1, [rGLUE, #offGlue_pDebuggerActive] @ r1<- &debuggerActive
cmp r1, #0 @ debugger enabled?
ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
-#else
- mov r1, #0
-#endif
-#if defined(WITH_PROFILER)
ldr r2, [rGLUE, #offGlue_pActiveProfilers] @ r2<- &activeProfilers
ldr r2, [r2] @ r2<- activeProfilers (int)
-#else
- mov r2, #0
-#endif
orrs r1, r1, r2
beq 2f
@@ -10378,8 +10350,6 @@
mov r1, #1 @ "want switch" = true
b common_gotoBail @ side exit
-#endif /*WITH_DEBUGGER || WITH_PROFILER*/
-
2:
bx lr @ nothing to do, return
diff --git a/vm/mterp/out/InterpAsm-armv5te-vfp.S b/vm/mterp/out/InterpAsm-armv5te-vfp.S
index 6421454..1ae9636 100644
--- a/vm/mterp/out/InterpAsm-armv5te-vfp.S
+++ b/vm/mterp/out/InterpAsm-armv5te-vfp.S
@@ -9824,32 +9824,16 @@
common_periodicChecks:
ldr r3, [rGLUE, #offGlue_pSelfSuspendCount] @ r3<- &suspendCount
-#if defined(WITH_DEBUGGER)
ldr r1, [rGLUE, #offGlue_pDebuggerActive] @ r1<- &debuggerActive
-#endif
-#if defined(WITH_PROFILER)
ldr r2, [rGLUE, #offGlue_pActiveProfilers] @ r2<- &activeProfilers
-#endif
ldr ip, [r3] @ ip<- suspendCount (int)
-#if defined(WITH_DEBUGGER) && defined(WITH_PROFILER)
cmp r1, #0 @ debugger enabled?
ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
ldr r2, [r2] @ r2<- activeProfilers (int)
orrne ip, ip, r1 @ ip<- suspendCount | debuggerActive
orrs ip, ip, r2 @ ip<- suspend|debugger|profiler; set Z
-#elif defined(WITH_DEBUGGER)
- cmp r1, #0 @ debugger enabled?
- ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
- orrsne ip, ip, r1 @ yes, ip<- suspend | debugger; set Z
- @ (if not enabled, Z was set by test for r1==0, which is what we want)
-#elif defined (WITH_PROFILER)
- ldr r2, [r2] @ r2<- activeProfilers (int)
- orrs ip, ip, r2 @ ip<- suspendCount | activeProfilers
-#else
- cmp ip, #0 @ not ORing anything in; set Z
-#endif
bxeq lr @ all zero, return
@@ -9860,11 +9844,9 @@
*
* r0 still holds the reentry type.
*/
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
ldr ip, [r3] @ ip<- suspendCount (int)
cmp ip, #0 @ want suspend?
beq 1f @ no, must be debugger/profiler
-#endif
stmfd sp!, {r0, lr} @ preserve r0 and lr
#if defined(WITH_JIT)
@@ -9884,8 +9866,6 @@
bl dvmCheckSuspendPending @ do full check, suspend if necessary
ldmfd sp!, {r0, lr} @ restore r0 and lr
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
-
/*
* Reload the debugger/profiler enable flags. We're checking to see
* if either of these got set while we were suspended.
@@ -9893,19 +9873,11 @@
* We can't really avoid the #ifdefs here, because the fields don't
* exist when the feature is disabled.
*/
-#if defined(WITH_DEBUGGER)
ldr r1, [rGLUE, #offGlue_pDebuggerActive] @ r1<- &debuggerActive
cmp r1, #0 @ debugger enabled?
ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
-#else
- mov r1, #0
-#endif
-#if defined(WITH_PROFILER)
ldr r2, [rGLUE, #offGlue_pActiveProfilers] @ r2<- &activeProfilers
ldr r2, [r2] @ r2<- activeProfilers (int)
-#else
- mov r2, #0
-#endif
orrs r1, r1, r2
beq 2f
@@ -9916,8 +9888,6 @@
mov r1, #1 @ "want switch" = true
b common_gotoBail @ side exit
-#endif /*WITH_DEBUGGER || WITH_PROFILER*/
-
2:
bx lr @ nothing to do, return
diff --git a/vm/mterp/out/InterpAsm-armv5te.S b/vm/mterp/out/InterpAsm-armv5te.S
index f756471..9b083b2 100644
--- a/vm/mterp/out/InterpAsm-armv5te.S
+++ b/vm/mterp/out/InterpAsm-armv5te.S
@@ -10282,32 +10282,16 @@
common_periodicChecks:
ldr r3, [rGLUE, #offGlue_pSelfSuspendCount] @ r3<- &suspendCount
-#if defined(WITH_DEBUGGER)
ldr r1, [rGLUE, #offGlue_pDebuggerActive] @ r1<- &debuggerActive
-#endif
-#if defined(WITH_PROFILER)
ldr r2, [rGLUE, #offGlue_pActiveProfilers] @ r2<- &activeProfilers
-#endif
ldr ip, [r3] @ ip<- suspendCount (int)
-#if defined(WITH_DEBUGGER) && defined(WITH_PROFILER)
cmp r1, #0 @ debugger enabled?
ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
ldr r2, [r2] @ r2<- activeProfilers (int)
orrne ip, ip, r1 @ ip<- suspendCount | debuggerActive
orrs ip, ip, r2 @ ip<- suspend|debugger|profiler; set Z
-#elif defined(WITH_DEBUGGER)
- cmp r1, #0 @ debugger enabled?
- ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
- orrsne ip, ip, r1 @ yes, ip<- suspend | debugger; set Z
- @ (if not enabled, Z was set by test for r1==0, which is what we want)
-#elif defined (WITH_PROFILER)
- ldr r2, [r2] @ r2<- activeProfilers (int)
- orrs ip, ip, r2 @ ip<- suspendCount | activeProfilers
-#else
- cmp ip, #0 @ not ORing anything in; set Z
-#endif
bxeq lr @ all zero, return
@@ -10318,11 +10302,9 @@
*
* r0 still holds the reentry type.
*/
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
ldr ip, [r3] @ ip<- suspendCount (int)
cmp ip, #0 @ want suspend?
beq 1f @ no, must be debugger/profiler
-#endif
stmfd sp!, {r0, lr} @ preserve r0 and lr
#if defined(WITH_JIT)
@@ -10342,8 +10324,6 @@
bl dvmCheckSuspendPending @ do full check, suspend if necessary
ldmfd sp!, {r0, lr} @ restore r0 and lr
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
-
/*
* Reload the debugger/profiler enable flags. We're checking to see
* if either of these got set while we were suspended.
@@ -10351,19 +10331,11 @@
* We can't really avoid the #ifdefs here, because the fields don't
* exist when the feature is disabled.
*/
-#if defined(WITH_DEBUGGER)
ldr r1, [rGLUE, #offGlue_pDebuggerActive] @ r1<- &debuggerActive
cmp r1, #0 @ debugger enabled?
ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
-#else
- mov r1, #0
-#endif
-#if defined(WITH_PROFILER)
ldr r2, [rGLUE, #offGlue_pActiveProfilers] @ r2<- &activeProfilers
ldr r2, [r2] @ r2<- activeProfilers (int)
-#else
- mov r2, #0
-#endif
orrs r1, r1, r2
beq 2f
@@ -10374,8 +10346,6 @@
mov r1, #1 @ "want switch" = true
b common_gotoBail @ side exit
-#endif /*WITH_DEBUGGER || WITH_PROFILER*/
-
2:
bx lr @ nothing to do, return
diff --git a/vm/mterp/out/InterpAsm-armv7-a-neon.S b/vm/mterp/out/InterpAsm-armv7-a-neon.S
index a08d936..173b478 100644
--- a/vm/mterp/out/InterpAsm-armv7-a-neon.S
+++ b/vm/mterp/out/InterpAsm-armv7-a-neon.S
@@ -9758,32 +9758,16 @@
common_periodicChecks:
ldr r3, [rGLUE, #offGlue_pSelfSuspendCount] @ r3<- &suspendCount
-#if defined(WITH_DEBUGGER)
ldr r1, [rGLUE, #offGlue_pDebuggerActive] @ r1<- &debuggerActive
-#endif
-#if defined(WITH_PROFILER)
ldr r2, [rGLUE, #offGlue_pActiveProfilers] @ r2<- &activeProfilers
-#endif
ldr ip, [r3] @ ip<- suspendCount (int)
-#if defined(WITH_DEBUGGER) && defined(WITH_PROFILER)
cmp r1, #0 @ debugger enabled?
ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
ldr r2, [r2] @ r2<- activeProfilers (int)
orrne ip, ip, r1 @ ip<- suspendCount | debuggerActive
orrs ip, ip, r2 @ ip<- suspend|debugger|profiler; set Z
-#elif defined(WITH_DEBUGGER)
- cmp r1, #0 @ debugger enabled?
- ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
- orrsne ip, ip, r1 @ yes, ip<- suspend | debugger; set Z
- @ (if not enabled, Z was set by test for r1==0, which is what we want)
-#elif defined (WITH_PROFILER)
- ldr r2, [r2] @ r2<- activeProfilers (int)
- orrs ip, ip, r2 @ ip<- suspendCount | activeProfilers
-#else
- cmp ip, #0 @ not ORing anything in; set Z
-#endif
bxeq lr @ all zero, return
@@ -9794,11 +9778,9 @@
*
* r0 still holds the reentry type.
*/
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
ldr ip, [r3] @ ip<- suspendCount (int)
cmp ip, #0 @ want suspend?
beq 1f @ no, must be debugger/profiler
-#endif
stmfd sp!, {r0, lr} @ preserve r0 and lr
#if defined(WITH_JIT)
@@ -9818,8 +9800,6 @@
bl dvmCheckSuspendPending @ do full check, suspend if necessary
ldmfd sp!, {r0, lr} @ restore r0 and lr
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
-
/*
* Reload the debugger/profiler enable flags. We're checking to see
* if either of these got set while we were suspended.
@@ -9827,19 +9807,11 @@
* We can't really avoid the #ifdefs here, because the fields don't
* exist when the feature is disabled.
*/
-#if defined(WITH_DEBUGGER)
ldr r1, [rGLUE, #offGlue_pDebuggerActive] @ r1<- &debuggerActive
cmp r1, #0 @ debugger enabled?
ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
-#else
- mov r1, #0
-#endif
-#if defined(WITH_PROFILER)
ldr r2, [rGLUE, #offGlue_pActiveProfilers] @ r2<- &activeProfilers
ldr r2, [r2] @ r2<- activeProfilers (int)
-#else
- mov r2, #0
-#endif
orrs r1, r1, r2
beq 2f
@@ -9850,8 +9822,6 @@
mov r1, #1 @ "want switch" = true
b common_gotoBail @ side exit
-#endif /*WITH_DEBUGGER || WITH_PROFILER*/
-
2:
bx lr @ nothing to do, return
diff --git a/vm/mterp/out/InterpAsm-armv7-a.S b/vm/mterp/out/InterpAsm-armv7-a.S
index 213c513..15e48a4 100644
--- a/vm/mterp/out/InterpAsm-armv7-a.S
+++ b/vm/mterp/out/InterpAsm-armv7-a.S
@@ -9758,32 +9758,16 @@
common_periodicChecks:
ldr r3, [rGLUE, #offGlue_pSelfSuspendCount] @ r3<- &suspendCount
-#if defined(WITH_DEBUGGER)
ldr r1, [rGLUE, #offGlue_pDebuggerActive] @ r1<- &debuggerActive
-#endif
-#if defined(WITH_PROFILER)
ldr r2, [rGLUE, #offGlue_pActiveProfilers] @ r2<- &activeProfilers
-#endif
ldr ip, [r3] @ ip<- suspendCount (int)
-#if defined(WITH_DEBUGGER) && defined(WITH_PROFILER)
cmp r1, #0 @ debugger enabled?
ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
ldr r2, [r2] @ r2<- activeProfilers (int)
orrne ip, ip, r1 @ ip<- suspendCount | debuggerActive
orrs ip, ip, r2 @ ip<- suspend|debugger|profiler; set Z
-#elif defined(WITH_DEBUGGER)
- cmp r1, #0 @ debugger enabled?
- ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
- orrsne ip, ip, r1 @ yes, ip<- suspend | debugger; set Z
- @ (if not enabled, Z was set by test for r1==0, which is what we want)
-#elif defined (WITH_PROFILER)
- ldr r2, [r2] @ r2<- activeProfilers (int)
- orrs ip, ip, r2 @ ip<- suspendCount | activeProfilers
-#else
- cmp ip, #0 @ not ORing anything in; set Z
-#endif
bxeq lr @ all zero, return
@@ -9794,11 +9778,9 @@
*
* r0 still holds the reentry type.
*/
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
ldr ip, [r3] @ ip<- suspendCount (int)
cmp ip, #0 @ want suspend?
beq 1f @ no, must be debugger/profiler
-#endif
stmfd sp!, {r0, lr} @ preserve r0 and lr
#if defined(WITH_JIT)
@@ -9818,8 +9800,6 @@
bl dvmCheckSuspendPending @ do full check, suspend if necessary
ldmfd sp!, {r0, lr} @ restore r0 and lr
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
-
/*
* Reload the debugger/profiler enable flags. We're checking to see
* if either of these got set while we were suspended.
@@ -9827,19 +9807,11 @@
* We can't really avoid the #ifdefs here, because the fields don't
* exist when the feature is disabled.
*/
-#if defined(WITH_DEBUGGER)
ldr r1, [rGLUE, #offGlue_pDebuggerActive] @ r1<- &debuggerActive
cmp r1, #0 @ debugger enabled?
ldrneb r1, [r1] @ yes, r1<- debuggerActive (boolean)
-#else
- mov r1, #0
-#endif
-#if defined(WITH_PROFILER)
ldr r2, [rGLUE, #offGlue_pActiveProfilers] @ r2<- &activeProfilers
ldr r2, [r2] @ r2<- activeProfilers (int)
-#else
- mov r2, #0
-#endif
orrs r1, r1, r2
beq 2f
@@ -9850,8 +9822,6 @@
mov r1, #1 @ "want switch" = true
b common_gotoBail @ side exit
-#endif /*WITH_DEBUGGER || WITH_PROFILER*/
-
2:
bx lr @ nothing to do, return
diff --git a/vm/mterp/out/InterpAsm-x86.S b/vm/mterp/out/InterpAsm-x86.S
index 563f9ca..2f79476 100644
--- a/vm/mterp/out/InterpAsm-x86.S
+++ b/vm/mterp/out/InterpAsm-x86.S
@@ -9168,7 +9168,6 @@
jne 1f
6:
-#if defined(WITH_DEBUGGER) && defined(WITH_PROFILER)
movl offGlue_pDebuggerActive(%ecx),%eax # eax <- &DebuggerActive
movl offGlue_pActiveProfilers(%ecx),%ecx # ecx <- &ActiveProfilers
testl %eax,%eax # debugger enabled?
@@ -9178,17 +9177,6 @@
orl (%ecx),%eax # eax <- debuggerActive | activeProfilers
GET_GLUE(%ecx) # restore rGLUE
jne 3f # one or both active - switch interp
-#elif defined(WITH_DEBUGGER)
- movl offGlue_pDebuggerActive(%ecx),%eax # eax <- &DebuggerActive
- testl %eax,%eax
- je 5f
- cmpl $0,(%eax) # debugger active?
- jne 3f # switch interp if so
-#elif defined(WITH_PROFILER)
- movl offGlue_pActiveProfilers(%ecx),%eax # eax <- &ActiveProfilers
- cmpl $0,(%eax) # profiler active?
- jne 3f # switch interp if so
-#endif
5:
ret
@@ -9219,11 +9207,7 @@
* Need to check to see if debugger or profiler flags got set
* while we were suspended.
*/
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
- jmp 6b
-#elif
- ret
-#endif
+ jmp 6b
/* Switch interpreters */
/* Note: %ebx contains the 16-bit word offset to be applied to rPC to
diff --git a/vm/mterp/out/InterpC-allstubs.c b/vm/mterp/out/InterpC-allstubs.c
index 3656713..ce6192c 100644
--- a/vm/mterp/out/InterpC-allstubs.c
+++ b/vm/mterp/out/InterpC-allstubs.c
@@ -33,8 +33,6 @@
* portable interpreter(s) and C stubs.
*
* Some defines are controlled by the Makefile, e.g.:
- * WITH_PROFILER
- * WITH_DEBUGGER
* WITH_INSTR_CHECKS
* WITH_TRACKREF_CHECKS
* EASY_GDB
@@ -339,7 +337,6 @@
*
* If we're building without debug and profiling support, we never switch.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
#if defined(WITH_JIT)
# define NEED_INTERP_SWITCH(_current) ( \
(_current == INTERP_STD) ? \
@@ -349,9 +346,6 @@
(_current == INTERP_STD) ? \
dvmDebuggerOrProfilerActive() : !dvmDebuggerOrProfilerActive() )
#endif
-#else
-# define NEED_INTERP_SWITCH(_current) (false)
-#endif
/*
* Check to see if "obj" is NULL. If so, throw an exception. Assumes the
@@ -2818,7 +2812,7 @@
/* File: c/OP_BREAKPOINT.c */
HANDLE_OPCODE(OP_BREAKPOINT)
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
{
/*
* Restart this instruction with the original opcode. We do
@@ -3680,7 +3674,7 @@
#ifdef EASY_GDB
debugSaveArea = saveArea;
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_EXIT(self, curMethod);
#endif
@@ -3757,7 +3751,7 @@
exception->clazz->descriptor, curMethod->name,
dvmLineNumFromPC(curMethod, pc - curMethod->insns));
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
/*
* Tell the debugger about it.
*
@@ -4053,13 +4047,13 @@
DUMP_REGS(methodToCall, newFp, true); // show input args
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
if (gDvm.debuggerActive) {
dvmDbgPostLocationEvent(methodToCall, -1,
dvmGetThisPtr(curMethod, fp), DBG_METHOD_ENTRY);
}
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_ENTER(self, methodToCall);
#endif
@@ -4080,13 +4074,13 @@
*/
(*methodToCall->nativeFunc)(newFp, &retval, methodToCall, self);
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
if (gDvm.debuggerActive) {
dvmDbgPostLocationEvent(methodToCall, -1,
dvmGetThisPtr(curMethod, fp), DBG_METHOD_EXIT);
}
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_EXIT(self, methodToCall);
#endif
diff --git a/vm/mterp/out/InterpC-armv4t.c b/vm/mterp/out/InterpC-armv4t.c
index 55a020d..2e7716b 100644
--- a/vm/mterp/out/InterpC-armv4t.c
+++ b/vm/mterp/out/InterpC-armv4t.c
@@ -33,8 +33,6 @@
* portable interpreter(s) and C stubs.
*
* Some defines are controlled by the Makefile, e.g.:
- * WITH_PROFILER
- * WITH_DEBUGGER
* WITH_INSTR_CHECKS
* WITH_TRACKREF_CHECKS
* EASY_GDB
@@ -339,7 +337,6 @@
*
* If we're building without debug and profiling support, we never switch.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
#if defined(WITH_JIT)
# define NEED_INTERP_SWITCH(_current) ( \
(_current == INTERP_STD) ? \
@@ -349,9 +346,6 @@
(_current == INTERP_STD) ? \
dvmDebuggerOrProfilerActive() : !dvmDebuggerOrProfilerActive() )
#endif
-#else
-# define NEED_INTERP_SWITCH(_current) (false)
-#endif
/*
* Check to see if "obj" is NULL. If so, throw an exception. Assumes the
diff --git a/vm/mterp/out/InterpC-armv5te-vfp.c b/vm/mterp/out/InterpC-armv5te-vfp.c
index 8e58f8b..48b8dbd 100644
--- a/vm/mterp/out/InterpC-armv5te-vfp.c
+++ b/vm/mterp/out/InterpC-armv5te-vfp.c
@@ -33,8 +33,6 @@
* portable interpreter(s) and C stubs.
*
* Some defines are controlled by the Makefile, e.g.:
- * WITH_PROFILER
- * WITH_DEBUGGER
* WITH_INSTR_CHECKS
* WITH_TRACKREF_CHECKS
* EASY_GDB
@@ -339,7 +337,6 @@
*
* If we're building without debug and profiling support, we never switch.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
#if defined(WITH_JIT)
# define NEED_INTERP_SWITCH(_current) ( \
(_current == INTERP_STD) ? \
@@ -349,9 +346,6 @@
(_current == INTERP_STD) ? \
dvmDebuggerOrProfilerActive() : !dvmDebuggerOrProfilerActive() )
#endif
-#else
-# define NEED_INTERP_SWITCH(_current) (false)
-#endif
/*
* Check to see if "obj" is NULL. If so, throw an exception. Assumes the
diff --git a/vm/mterp/out/InterpC-armv5te.c b/vm/mterp/out/InterpC-armv5te.c
index d3c041f..dfadf21 100644
--- a/vm/mterp/out/InterpC-armv5te.c
+++ b/vm/mterp/out/InterpC-armv5te.c
@@ -33,8 +33,6 @@
* portable interpreter(s) and C stubs.
*
* Some defines are controlled by the Makefile, e.g.:
- * WITH_PROFILER
- * WITH_DEBUGGER
* WITH_INSTR_CHECKS
* WITH_TRACKREF_CHECKS
* EASY_GDB
@@ -339,7 +337,6 @@
*
* If we're building without debug and profiling support, we never switch.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
#if defined(WITH_JIT)
# define NEED_INTERP_SWITCH(_current) ( \
(_current == INTERP_STD) ? \
@@ -349,9 +346,6 @@
(_current == INTERP_STD) ? \
dvmDebuggerOrProfilerActive() : !dvmDebuggerOrProfilerActive() )
#endif
-#else
-# define NEED_INTERP_SWITCH(_current) (false)
-#endif
/*
* Check to see if "obj" is NULL. If so, throw an exception. Assumes the
diff --git a/vm/mterp/out/InterpC-armv7-a-neon.c b/vm/mterp/out/InterpC-armv7-a-neon.c
index 77b1fce..adccb2d 100644
--- a/vm/mterp/out/InterpC-armv7-a-neon.c
+++ b/vm/mterp/out/InterpC-armv7-a-neon.c
@@ -33,8 +33,6 @@
* portable interpreter(s) and C stubs.
*
* Some defines are controlled by the Makefile, e.g.:
- * WITH_PROFILER
- * WITH_DEBUGGER
* WITH_INSTR_CHECKS
* WITH_TRACKREF_CHECKS
* EASY_GDB
@@ -339,7 +337,6 @@
*
* If we're building without debug and profiling support, we never switch.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
#if defined(WITH_JIT)
# define NEED_INTERP_SWITCH(_current) ( \
(_current == INTERP_STD) ? \
@@ -349,9 +346,6 @@
(_current == INTERP_STD) ? \
dvmDebuggerOrProfilerActive() : !dvmDebuggerOrProfilerActive() )
#endif
-#else
-# define NEED_INTERP_SWITCH(_current) (false)
-#endif
/*
* Check to see if "obj" is NULL. If so, throw an exception. Assumes the
diff --git a/vm/mterp/out/InterpC-armv7-a.c b/vm/mterp/out/InterpC-armv7-a.c
index 7f46f4f..d40fd7c 100644
--- a/vm/mterp/out/InterpC-armv7-a.c
+++ b/vm/mterp/out/InterpC-armv7-a.c
@@ -33,8 +33,6 @@
* portable interpreter(s) and C stubs.
*
* Some defines are controlled by the Makefile, e.g.:
- * WITH_PROFILER
- * WITH_DEBUGGER
* WITH_INSTR_CHECKS
* WITH_TRACKREF_CHECKS
* EASY_GDB
@@ -339,7 +337,6 @@
*
* If we're building without debug and profiling support, we never switch.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
#if defined(WITH_JIT)
# define NEED_INTERP_SWITCH(_current) ( \
(_current == INTERP_STD) ? \
@@ -349,9 +346,6 @@
(_current == INTERP_STD) ? \
dvmDebuggerOrProfilerActive() : !dvmDebuggerOrProfilerActive() )
#endif
-#else
-# define NEED_INTERP_SWITCH(_current) (false)
-#endif
/*
* Check to see if "obj" is NULL. If so, throw an exception. Assumes the
diff --git a/vm/mterp/out/InterpC-portdbg.c b/vm/mterp/out/InterpC-portdbg.c
index 47b3d7f..e909db4 100644
--- a/vm/mterp/out/InterpC-portdbg.c
+++ b/vm/mterp/out/InterpC-portdbg.c
@@ -33,8 +33,6 @@
* portable interpreter(s) and C stubs.
*
* Some defines are controlled by the Makefile, e.g.:
- * WITH_PROFILER
- * WITH_DEBUGGER
* WITH_INSTR_CHECKS
* WITH_TRACKREF_CHECKS
* EASY_GDB
@@ -339,7 +337,6 @@
*
* If we're building without debug and profiling support, we never switch.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
#if defined(WITH_JIT)
# define NEED_INTERP_SWITCH(_current) ( \
(_current == INTERP_STD) ? \
@@ -349,9 +346,6 @@
(_current == INTERP_STD) ? \
dvmDebuggerOrProfilerActive() : !dvmDebuggerOrProfilerActive() )
#endif
-#else
-# define NEED_INTERP_SWITCH(_current) (false)
-#endif
/*
* Check to see if "obj" is NULL. If so, throw an exception. Assumes the
@@ -1242,12 +1236,10 @@
* Depending on the "mods" associated with event(s) on this address,
* we may or may not actually send a message to the debugger.
*/
-#ifdef WITH_DEBUGGER
if (INST_INST(*pc) == OP_BREAKPOINT) {
LOGV("+++ breakpoint hit at %p\n", pc);
eventFlags |= DBG_BREAKPOINT;
}
-#endif
/*
* If the debugger is single-stepping one of our threads, check to
@@ -1414,8 +1406,6 @@
* This code is executed for every instruction we interpret, so for
* performance we use a couple of #ifdef blocks instead of runtime tests.
*/
-#ifdef WITH_PROFILER
- /* profiler and probably debugger */
bool isEntry = *pIsMethodEntry;
if (isEntry) {
*pIsMethodEntry = false;
@@ -1435,15 +1425,6 @@
int inst = *pc & 0xff;
gDvm.executedInstrCounts[inst]++;
}
-#else
- /* debugger only */
- if (gDvm.debuggerActive) {
- bool isEntry = *pIsMethodEntry;
- updateDebugger(method, pc, fp, isEntry, self);
- if (isEntry)
- *pIsMethodEntry = false;
- }
-#endif
}
/* File: portable/entry.c */
@@ -1459,9 +1440,7 @@
#endif
#if INTERP_TYPE == INTERP_DBG
bool debugIsMethodEntry = false;
-# if defined(WITH_DEBUGGER) || defined(WITH_PROFILER) // implied by INTERP_DBG??
debugIsMethodEntry = interpState->debugIsMethodEntry;
-# endif
#endif
#if defined(WITH_TRACKREF_CHECKS)
int debugTrackedRefStart = interpState->debugTrackedRefStart;
@@ -3194,7 +3173,7 @@
/* File: c/OP_BREAKPOINT.c */
HANDLE_OPCODE(OP_BREAKPOINT)
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
{
/*
* Restart this instruction with the original opcode. We do
@@ -3974,7 +3953,7 @@
#ifdef EASY_GDB
debugSaveArea = saveArea;
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_EXIT(self, curMethod);
#endif
@@ -4051,7 +4030,7 @@
exception->clazz->descriptor, curMethod->name,
dvmLineNumFromPC(curMethod, pc - curMethod->insns));
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
/*
* Tell the debugger about it.
*
@@ -4347,13 +4326,13 @@
DUMP_REGS(methodToCall, newFp, true); // show input args
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
if (gDvm.debuggerActive) {
dvmDbgPostLocationEvent(methodToCall, -1,
dvmGetThisPtr(curMethod, fp), DBG_METHOD_ENTRY);
}
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_ENTER(self, methodToCall);
#endif
@@ -4374,13 +4353,13 @@
*/
(*methodToCall->nativeFunc)(newFp, &retval, methodToCall, self);
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
if (gDvm.debuggerActive) {
dvmDbgPostLocationEvent(methodToCall, -1,
dvmGetThisPtr(curMethod, fp), DBG_METHOD_EXIT);
}
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_EXIT(self, methodToCall);
#endif
@@ -4441,12 +4420,10 @@
*
* TODO: figure out if preserving this makes any sense.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
-# if INTERP_TYPE == INTERP_DBG
+#if INTERP_TYPE == INTERP_DBG
interpState->debugIsMethodEntry = debugIsMethodEntry;
-# else
+#else
interpState->debugIsMethodEntry = false;
-# endif
#endif
/* export state changes */
diff --git a/vm/mterp/out/InterpC-portstd.c b/vm/mterp/out/InterpC-portstd.c
index 165c032..f82c97d 100644
--- a/vm/mterp/out/InterpC-portstd.c
+++ b/vm/mterp/out/InterpC-portstd.c
@@ -33,8 +33,6 @@
* portable interpreter(s) and C stubs.
*
* Some defines are controlled by the Makefile, e.g.:
- * WITH_PROFILER
- * WITH_DEBUGGER
* WITH_INSTR_CHECKS
* WITH_TRACKREF_CHECKS
* EASY_GDB
@@ -339,7 +337,6 @@
*
* If we're building without debug and profiling support, we never switch.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
#if defined(WITH_JIT)
# define NEED_INTERP_SWITCH(_current) ( \
(_current == INTERP_STD) ? \
@@ -349,9 +346,6 @@
(_current == INTERP_STD) ? \
dvmDebuggerOrProfilerActive() : !dvmDebuggerOrProfilerActive() )
#endif
-#else
-# define NEED_INTERP_SWITCH(_current) (false)
-#endif
/*
* Check to see if "obj" is NULL. If so, throw an exception. Assumes the
@@ -1196,9 +1190,7 @@
#endif
#if INTERP_TYPE == INTERP_DBG
bool debugIsMethodEntry = false;
-# if defined(WITH_DEBUGGER) || defined(WITH_PROFILER) // implied by INTERP_DBG??
debugIsMethodEntry = interpState->debugIsMethodEntry;
-# endif
#endif
#if defined(WITH_TRACKREF_CHECKS)
int debugTrackedRefStart = interpState->debugTrackedRefStart;
@@ -2931,7 +2923,7 @@
/* File: c/OP_BREAKPOINT.c */
HANDLE_OPCODE(OP_BREAKPOINT)
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
{
/*
* Restart this instruction with the original opcode. We do
@@ -3711,7 +3703,7 @@
#ifdef EASY_GDB
debugSaveArea = saveArea;
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_EXIT(self, curMethod);
#endif
@@ -3788,7 +3780,7 @@
exception->clazz->descriptor, curMethod->name,
dvmLineNumFromPC(curMethod, pc - curMethod->insns));
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
/*
* Tell the debugger about it.
*
@@ -4084,13 +4076,13 @@
DUMP_REGS(methodToCall, newFp, true); // show input args
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
if (gDvm.debuggerActive) {
dvmDbgPostLocationEvent(methodToCall, -1,
dvmGetThisPtr(curMethod, fp), DBG_METHOD_ENTRY);
}
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_ENTER(self, methodToCall);
#endif
@@ -4111,13 +4103,13 @@
*/
(*methodToCall->nativeFunc)(newFp, &retval, methodToCall, self);
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
if (gDvm.debuggerActive) {
dvmDbgPostLocationEvent(methodToCall, -1,
dvmGetThisPtr(curMethod, fp), DBG_METHOD_EXIT);
}
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_EXIT(self, methodToCall);
#endif
@@ -4178,12 +4170,10 @@
*
* TODO: figure out if preserving this makes any sense.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
-# if INTERP_TYPE == INTERP_DBG
+#if INTERP_TYPE == INTERP_DBG
interpState->debugIsMethodEntry = debugIsMethodEntry;
-# else
+#else
interpState->debugIsMethodEntry = false;
-# endif
#endif
/* export state changes */
diff --git a/vm/mterp/out/InterpC-x86-atom.c b/vm/mterp/out/InterpC-x86-atom.c
index 3b85384..6d088f7 100644
--- a/vm/mterp/out/InterpC-x86-atom.c
+++ b/vm/mterp/out/InterpC-x86-atom.c
@@ -33,8 +33,6 @@
* portable interpreter(s) and C stubs.
*
* Some defines are controlled by the Makefile, e.g.:
- * WITH_PROFILER
- * WITH_DEBUGGER
* WITH_INSTR_CHECKS
* WITH_TRACKREF_CHECKS
* EASY_GDB
@@ -339,7 +337,6 @@
*
* If we're building without debug and profiling support, we never switch.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
#if defined(WITH_JIT)
# define NEED_INTERP_SWITCH(_current) ( \
(_current == INTERP_STD) ? \
@@ -349,9 +346,6 @@
(_current == INTERP_STD) ? \
dvmDebuggerOrProfilerActive() : !dvmDebuggerOrProfilerActive() )
#endif
-#else
-# define NEED_INTERP_SWITCH(_current) (false)
-#endif
/*
* Check to see if "obj" is NULL. If so, throw an exception. Assumes the
@@ -1239,7 +1233,7 @@
/* File: c/OP_BREAKPOINT.c */
HANDLE_OPCODE(OP_BREAKPOINT)
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
{
/*
* Restart this instruction with the original opcode. We do
@@ -1874,7 +1868,7 @@
#ifdef EASY_GDB
debugSaveArea = saveArea;
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_EXIT(self, curMethod);
#endif
@@ -1951,7 +1945,7 @@
exception->clazz->descriptor, curMethod->name,
dvmLineNumFromPC(curMethod, pc - curMethod->insns));
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
/*
* Tell the debugger about it.
*
@@ -2247,13 +2241,13 @@
DUMP_REGS(methodToCall, newFp, true); // show input args
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
if (gDvm.debuggerActive) {
dvmDbgPostLocationEvent(methodToCall, -1,
dvmGetThisPtr(curMethod, fp), DBG_METHOD_ENTRY);
}
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_ENTER(self, methodToCall);
#endif
@@ -2274,13 +2268,13 @@
*/
(*methodToCall->nativeFunc)(newFp, &retval, methodToCall, self);
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
if (gDvm.debuggerActive) {
dvmDbgPostLocationEvent(methodToCall, -1,
dvmGetThisPtr(curMethod, fp), DBG_METHOD_EXIT);
}
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_EXIT(self, methodToCall);
#endif
diff --git a/vm/mterp/out/InterpC-x86.c b/vm/mterp/out/InterpC-x86.c
index ec07691..4882184 100644
--- a/vm/mterp/out/InterpC-x86.c
+++ b/vm/mterp/out/InterpC-x86.c
@@ -33,8 +33,6 @@
* portable interpreter(s) and C stubs.
*
* Some defines are controlled by the Makefile, e.g.:
- * WITH_PROFILER
- * WITH_DEBUGGER
* WITH_INSTR_CHECKS
* WITH_TRACKREF_CHECKS
* EASY_GDB
@@ -339,7 +337,6 @@
*
* If we're building without debug and profiling support, we never switch.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
#if defined(WITH_JIT)
# define NEED_INTERP_SWITCH(_current) ( \
(_current == INTERP_STD) ? \
@@ -349,9 +346,6 @@
(_current == INTERP_STD) ? \
dvmDebuggerOrProfilerActive() : !dvmDebuggerOrProfilerActive() )
#endif
-#else
-# define NEED_INTERP_SWITCH(_current) (false)
-#endif
/*
* Check to see if "obj" is NULL. If so, throw an exception. Assumes the
@@ -1811,7 +1805,7 @@
#ifdef EASY_GDB
debugSaveArea = saveArea;
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_EXIT(self, curMethod);
#endif
@@ -1888,7 +1882,7 @@
exception->clazz->descriptor, curMethod->name,
dvmLineNumFromPC(curMethod, pc - curMethod->insns));
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
/*
* Tell the debugger about it.
*
@@ -2184,13 +2178,13 @@
DUMP_REGS(methodToCall, newFp, true); // show input args
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
if (gDvm.debuggerActive) {
dvmDbgPostLocationEvent(methodToCall, -1,
dvmGetThisPtr(curMethod, fp), DBG_METHOD_ENTRY);
}
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_ENTER(self, methodToCall);
#endif
@@ -2211,13 +2205,13 @@
*/
(*methodToCall->nativeFunc)(newFp, &retval, methodToCall, self);
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
+#if (INTERP_TYPE == INTERP_DBG)
if (gDvm.debuggerActive) {
dvmDbgPostLocationEvent(methodToCall, -1,
dvmGetThisPtr(curMethod, fp), DBG_METHOD_EXIT);
}
#endif
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_PROFILER)
+#if (INTERP_TYPE == INTERP_DBG)
TRACE_METHOD_EXIT(self, methodToCall);
#endif
diff --git a/vm/mterp/portable/debug.c b/vm/mterp/portable/debug.c
index 94f735a..1d06188 100644
--- a/vm/mterp/portable/debug.c
+++ b/vm/mterp/portable/debug.c
@@ -47,12 +47,10 @@
* Depending on the "mods" associated with event(s) on this address,
* we may or may not actually send a message to the debugger.
*/
-#ifdef WITH_DEBUGGER
if (INST_INST(*pc) == OP_BREAKPOINT) {
LOGV("+++ breakpoint hit at %p\n", pc);
eventFlags |= DBG_BREAKPOINT;
}
-#endif
/*
* If the debugger is single-stepping one of our threads, check to
@@ -219,8 +217,6 @@
* This code is executed for every instruction we interpret, so for
* performance we use a couple of #ifdef blocks instead of runtime tests.
*/
-#ifdef WITH_PROFILER
- /* profiler and probably debugger */
bool isEntry = *pIsMethodEntry;
if (isEntry) {
*pIsMethodEntry = false;
@@ -240,13 +236,4 @@
int inst = *pc & 0xff;
gDvm.executedInstrCounts[inst]++;
}
-#else
- /* debugger only */
- if (gDvm.debuggerActive) {
- bool isEntry = *pIsMethodEntry;
- updateDebugger(method, pc, fp, isEntry, self);
- if (isEntry)
- *pIsMethodEntry = false;
- }
-#endif
}
diff --git a/vm/mterp/portable/enddefs.c b/vm/mterp/portable/enddefs.c
index af8606e..30deedc 100644
--- a/vm/mterp/portable/enddefs.c
+++ b/vm/mterp/portable/enddefs.c
@@ -19,12 +19,10 @@
*
* TODO: figure out if preserving this makes any sense.
*/
-#if defined(WITH_PROFILER) || defined(WITH_DEBUGGER)
-# if INTERP_TYPE == INTERP_DBG
+#if INTERP_TYPE == INTERP_DBG
interpState->debugIsMethodEntry = debugIsMethodEntry;
-# else
+#else
interpState->debugIsMethodEntry = false;
-# endif
#endif
/* export state changes */
diff --git a/vm/mterp/portable/entry.c b/vm/mterp/portable/entry.c
index 6b989a2..56649e7 100644
--- a/vm/mterp/portable/entry.c
+++ b/vm/mterp/portable/entry.c
@@ -10,9 +10,7 @@
#endif
#if INTERP_TYPE == INTERP_DBG
bool debugIsMethodEntry = false;
-# if defined(WITH_DEBUGGER) || defined(WITH_PROFILER) // implied by INTERP_DBG??
debugIsMethodEntry = interpState->debugIsMethodEntry;
-# endif
#endif
#if defined(WITH_TRACKREF_CHECKS)
int debugTrackedRefStart = interpState->debugTrackedRefStart;
diff --git a/vm/mterp/x86-atom/TODO.txt b/vm/mterp/x86-atom/TODO.txt
index abeee31..c2e9fc4 100644
--- a/vm/mterp/x86-atom/TODO.txt
+++ b/vm/mterp/x86-atom/TODO.txt
@@ -6,6 +6,8 @@
(hi) "debugger active" test in common_periodicChecks must handle
the case where glue->pDebuggerActive is a NULL pointer (used to
skip a memory load when debugger support is completely disabled)
+(hi) WITH_DEBUGGER and WITH_PROFILER are no longer defined (but are
+ assumed to be enabled)
(md) Correct OP_MONITOR_EXIT (need to adjust PC before throw)
(md) OP_THROW needs to export the PC
diff --git a/vm/mterp/x86/footer.S b/vm/mterp/x86/footer.S
index 800f7d3..d43a662 100644
--- a/vm/mterp/x86/footer.S
+++ b/vm/mterp/x86/footer.S
@@ -283,7 +283,6 @@
jne 1f
6:
-#if defined(WITH_DEBUGGER) && defined(WITH_PROFILER)
movl offGlue_pDebuggerActive(%ecx),%eax # eax <- &DebuggerActive
movl offGlue_pActiveProfilers(%ecx),%ecx # ecx <- &ActiveProfilers
testl %eax,%eax # debugger enabled?
@@ -293,17 +292,6 @@
orl (%ecx),%eax # eax <- debuggerActive | activeProfilers
GET_GLUE(%ecx) # restore rGLUE
jne 3f # one or both active - switch interp
-#elif defined(WITH_DEBUGGER)
- movl offGlue_pDebuggerActive(%ecx),%eax # eax <- &DebuggerActive
- testl %eax,%eax
- je 5f
- cmpl $$0,(%eax) # debugger active?
- jne 3f # switch interp if so
-#elif defined(WITH_PROFILER)
- movl offGlue_pActiveProfilers(%ecx),%eax # eax <- &ActiveProfilers
- cmpl $$0,(%eax) # profiler active?
- jne 3f # switch interp if so
-#endif
5:
ret
@@ -334,11 +322,7 @@
* Need to check to see if debugger or profiler flags got set
* while we were suspended.
*/
-#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
- jmp 6b
-#elif
- ret
-#endif
+ jmp 6b
/* Switch interpreters */
/* Note: %ebx contains the 16-bit word offset to be applied to rPC to
diff --git a/vm/native/dalvik_system_VMDebug.c b/vm/native/dalvik_system_VMDebug.c
index 60086e6..b9f3610 100644
--- a/vm/native/dalvik_system_VMDebug.c
+++ b/vm/native/dalvik_system_VMDebug.c
@@ -118,11 +118,9 @@
char* features[MAX_FEATURE_COUNT];
int idx = 0;
-#ifdef WITH_PROFILER
/* VM responds to DDMS method profiling requests */
features[idx++] = "method-trace-profiling";
features[idx++] = "method-trace-profiling-streaming";
-#endif
#ifdef WITH_HPROF
/* VM responds to DDMS heap dump requests */
features[idx++] = "hprof-heap-dump";
@@ -137,7 +135,6 @@
}
-#ifdef WITH_PROFILER
/* These must match the values in dalvik.system.VMDebug.
*/
enum {
@@ -228,7 +225,6 @@
}
#endif // PROFILE_EXTERNAL_ALLOCATIONS
}
-#endif
/*
* static void startAllocCounting()
@@ -244,11 +240,9 @@
{
UNUSED_PARAMETER(args);
-#ifdef WITH_PROFILER
clearAllocProfStateFields(&gDvm.allocProf, KIND_ALL_COUNTS);
clearAllocProfStateFields(&dvmThreadSelf()->allocProf, KIND_ALL_COUNTS);
dvmStartAllocCounting();
-#endif
RETURN_VOID();
}
@@ -260,9 +254,7 @@
{
UNUSED_PARAMETER(args);
-#ifdef WITH_PROFILER
dvmStopAllocCounting();
-#endif
RETURN_VOID();
}
@@ -272,7 +264,6 @@
static void Dalvik_dalvik_system_VMDebug_getAllocCount(const u4* args,
JValue* pResult)
{
-#ifdef WITH_PROFILER
AllocProfState *allocProf;
unsigned int kind = args[0];
if (kind < (1<<16)) {
@@ -322,9 +313,6 @@
assert(false);
pResult->i = -1;
}
-#else
- RETURN_INT(-1);
-#endif
}
/*
@@ -333,11 +321,9 @@
static void Dalvik_dalvik_system_VMDebug_resetAllocCount(const u4* args,
JValue* pResult)
{
-#ifdef WITH_PROFILER
unsigned int kinds = args[0];
clearAllocProfStateFields(&gDvm.allocProf, kinds & 0xffff);
clearAllocProfStateFields(&dvmThreadSelf()->allocProf, kinds >> 16);
-#endif
RETURN_VOID();
}
@@ -354,7 +340,6 @@
static void Dalvik_dalvik_system_VMDebug_startMethodTracingNative(const u4* args,
JValue* pResult)
{
-#ifdef WITH_PROFILER
StringObject* traceFileStr = (StringObject*) args[0];
Object* traceFd = (Object*) args[1];
int bufferSize = args[2];
@@ -391,9 +376,6 @@
dvmMethodTraceStart(traceFileName != NULL ? traceFileName : "[DDMS]",
fd, bufferSize, flags, (traceFileName == NULL && fd == -1));
free(traceFileName);
-#else
- // throw exception?
-#endif
RETURN_VOID();
}
@@ -407,11 +389,7 @@
{
UNUSED_PARAMETER(args);
-#ifdef WITH_PROFILER
RETURN_BOOLEAN(dvmIsMethodTraceActive());
-#else
- RETURN_BOOLEAN(false);
-#endif
}
/*
@@ -424,11 +402,7 @@
{
UNUSED_PARAMETER(args);
-#ifdef WITH_PROFILER
dvmMethodTraceStop();
-#else
- // throw exception?
-#endif
RETURN_VOID();
}
@@ -442,11 +416,7 @@
{
UNUSED_PARAMETER(args);
-#ifdef WITH_PROFILER
dvmEmulatorTraceStart();
-#else
- // throw exception?
-#endif
RETURN_VOID();
}
@@ -460,11 +430,7 @@
{
UNUSED_PARAMETER(args);
-#ifdef WITH_PROFILER
dvmEmulatorTraceStop();
-#else
- // throw exception?
-#endif
RETURN_VOID();
}
@@ -569,11 +535,7 @@
static void Dalvik_dalvik_system_VMDebug_startInstructionCounting(const u4* args,
JValue* pResult)
{
-#if defined(WITH_PROFILER)
dvmStartInstructionCounting();
-#else
- dvmThrowException("Ljava/lang/UnsupportedOperationException;", NULL);
-#endif
RETURN_VOID();
}
@@ -583,11 +545,7 @@
static void Dalvik_dalvik_system_VMDebug_stopInstructionCounting(const u4* args,
JValue* pResult)
{
-#if defined(WITH_PROFILER)
dvmStopInstructionCounting();
-#else
- dvmThrowException("Ljava/lang/UnsupportedOperationException;", NULL);
-#endif
RETURN_VOID();
}
@@ -603,7 +561,6 @@
static void Dalvik_dalvik_system_VMDebug_getInstructionCount(const u4* args,
JValue* pResult)
{
-#if defined(WITH_PROFILER)
ArrayObject* countArray = (ArrayObject*) args[0];
int* storage;
@@ -611,9 +568,6 @@
sched_yield();
memcpy(storage, gDvm.executedInstrCounts,
kNumDalvikInstructions * sizeof(int));
-#else
- dvmThrowException("Ljava/lang/UnsupportedOperationException;", NULL);
-#endif
RETURN_VOID();
}
@@ -625,12 +579,8 @@
static void Dalvik_dalvik_system_VMDebug_resetInstructionCount(const u4* args,
JValue* pResult)
{
-#if defined(WITH_PROFILER)
sched_yield();
memset(gDvm.executedInstrCounts, 0, kNumDalvikInstructions * sizeof(int));
-#else
- dvmThrowException("Ljava/lang/UnsupportedOperationException;", NULL);
-#endif
RETURN_VOID();
}
diff --git a/vm/oo/Class.c b/vm/oo/Class.c
index e0d002d..cf38f6e 100644
--- a/vm/oo/Class.c
+++ b/vm/oo/Class.c
@@ -1251,9 +1251,7 @@
goto bail;
}
-#ifdef WITH_PROFILER
dvmMethodTraceClassPrepBegin();
-#endif
/*
* Invoke loadClass(). This will probably result in a couple of
@@ -1266,9 +1264,7 @@
dvmCallMethod(self, loadClass, loader, &result, nameObj);
clazz = (ClassObject*) result.l;
-#ifdef WITH_PROFILER
dvmMethodTraceClassPrepEnd();
-#endif
excep = dvmGetException(self);
if (excep != NULL) {
@@ -1371,9 +1367,7 @@
{
Thread* self = dvmThreadSelf();
ClassObject* clazz;
-#ifdef WITH_PROFILER
bool profilerNotified = false;
-#endif
if (loader != NULL) {
LOGVV("#### findClassNoInit(%s,%p,%p)\n", descriptor, loader,
@@ -1403,10 +1397,8 @@
if (clazz == NULL) {
const DexClassDef* pClassDef;
-#ifdef WITH_PROFILER
dvmMethodTraceClassPrepBegin();
profilerNotified = true;
-#endif
#if LOG_CLASS_LOADING
u8 startTime = dvmGetThreadCpuTimeNsec();
@@ -1634,10 +1626,8 @@
}
bail:
-#ifdef WITH_PROFILER
if (profilerNotified)
dvmMethodTraceClassPrepEnd();
-#endif
assert(clazz != NULL || dvmCheckException(self));
return clazz;
}
@@ -4309,10 +4299,8 @@
SET_CLASS_FLAG(clazz, CLASS_ISOPTIMIZED);
}
-#ifdef WITH_DEBUGGER
/* update instruction stream now that verification + optimization is done */
dvmFlushBreakpoints(clazz);
-#endif
if (clazz->status == CLASS_INITIALIZED)
goto bail_unlock;
@@ -4387,12 +4375,10 @@
return false;
}
-#ifdef WITH_PROFILER
u8 startWhen = 0;
if (gDvm.allocProf.enabled) {
startWhen = dvmGetRelativeTimeNsec();
}
-#endif
/*
* We're ready to go, and have exclusive access to the class.
@@ -4486,7 +4472,6 @@
clazz->status = CLASS_INITIALIZED;
LOGVV("Initialized class: %s\n", clazz->descriptor);
-#ifdef WITH_PROFILER
/*
* Update alloc counters. TODO: guard with mutex.
*/
@@ -4497,7 +4482,6 @@
gDvm.allocProf.classInitCount++;
self->allocProf.classInitCount++;
}
-#endif
}
bail_notify:
diff --git a/vm/oo/Object.h b/vm/oo/Object.h
index 7428cef..903450f 100644
--- a/vm/oo/Object.h
+++ b/vm/oo/Object.h
@@ -594,9 +594,8 @@
*/
const RegisterMap* registerMap;
-#ifdef WITH_PROFILER
+ /* set if method was called during method profiling */
bool inProfile;
-#endif
};