From: Andy McFadden Date: Wed, 5 Aug 2009 22:20:27 +0000 (-0700) Subject: Switch to in the VM. X-Git-Tag: android-x86-2.2~767 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=d51370ff814e88b63baa3b1f5300b6560330c12d;p=android-x86%2Fdalvik.git Switch to in the VM. We were using an enum that made the compiler unhappy on MacOS X. This switches us to using when it's available. The size of a "bool" is either sizeof(_Bool) or sizeof(enum bool), and the assembly sources dislike ambiguity, so this also changes gDvm.debuggerActive to always be a single byte. The ARM and x86 code was already assuming that -- held over from when enums were variable-width, and never fixed because we get the right answer on little-endian platforms -- so it doesn't look like we need to change anything in mterp. --- diff --git a/vm/Common.h b/vm/Common.h index 4b357e2e1..d0c021d50 100644 --- a/vm/Common.h +++ b/vm/Common.h @@ -97,11 +97,15 @@ typedef union JValue { } JValue; /* - * Some systems might have this in . + * The definition uses _Bool, a type known to the compiler. */ -#ifndef __bool_true_false_are_defined +#ifdef HAVE_STDBOOL_H +# include /* C99 */ +#else +# ifndef __bool_true_false_are_defined typedef enum { false=0, true=!false } bool; -#define __bool_true_false_are_defined 1 +# define __bool_true_false_are_defined 1 +# endif #endif #define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0]))) diff --git a/vm/Globals.h b/vm/Globals.h index 5b69f029e..2ac118709 100644 --- a/vm/Globals.h +++ b/vm/Globals.h @@ -498,9 +498,12 @@ struct DvmGlobals { /* * JDWP debugger support. + * + * Note "debuggerActive" is accessed from mterp, so its storage size and + * meaning must not be changed without updating the assembly sources. */ bool debuggerConnected; /* debugger or DDMS is connected */ - bool debuggerActive; /* debugger is making requests */ + u1 debuggerActive; /* debugger is making requests */ JdwpState* jdwpState; /* diff --git a/vm/mterp/common/asm-constants.h b/vm/mterp/common/asm-constants.h index 5c37af621..716df3dbb 100644 --- a/vm/mterp/common/asm-constants.h +++ b/vm/mterp/common/asm-constants.h @@ -82,7 +82,7 @@ */ /* globals (sanity check for LDR vs LDRB) */ -MTERP_SIZEOF(sizeofGlobal_debuggerActive, gDvm.debuggerActive, MTERP_SMALL_ENUM) +MTERP_SIZEOF(sizeofGlobal_debuggerActive, gDvm.debuggerActive, 1) #if defined(WITH_PROFILER) MTERP_SIZEOF(sizeofGlobal_activeProfilers, gDvm.activeProfilers, 4) #endif