summaryrefslogtreecommitdiffstats
path: root/vm/Common.h
diff options
context:
space:
mode:
authorCarl Shapiro <cshapiro@google.com>2011-04-08 13:11:58 -0700
committerCarl Shapiro <cshapiro@google.com>2011-04-08 13:11:58 -0700
commitae188c676c681e47a93ade7fdf0144099b470e03 (patch)
tree0d7242995ffc8cfd11e484334786841ddc7bc2b5 /vm/Common.h
parenta72475036290f55cd578dd15f65922dd01fbd3ce (diff)
downloadandroid_dalvik-ae188c676c681e47a93ade7fdf0144099b470e03.tar.gz
android_dalvik-ae188c676c681e47a93ade7fdf0144099b470e03.tar.bz2
android_dalvik-ae188c676c681e47a93ade7fdf0144099b470e03.zip
Compile the garbage collector and heap profiler as C++.
Change-Id: I25d8fa821987a3dd6d7109d07fd42dbf2fe0e589
Diffstat (limited to 'vm/Common.h')
-rw-r--r--vm/Common.h69
1 files changed, 10 insertions, 59 deletions
diff --git a/vm/Common.h b/vm/Common.h
index 7d8424ed9..0ec9ec4ff 100644
--- a/vm/Common.h
+++ b/vm/Common.h
@@ -24,8 +24,16 @@
# define LOG_TAG "dalvikvm"
#endif
+#include <stdbool.h>
+#include <stdint.h>
#include <stdio.h>
#include <assert.h>
+#include <endian.h>
+#include "utils/Log.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
#if !defined(NDEBUG) && defined(WITH_DALVIK_ASSERT)
# undef assert
@@ -67,8 +75,6 @@
/*
* These match the definitions in the VM specification.
*/
-#ifdef HAVE_STDINT_H
-# include <stdint.h> /* C99 */
typedef uint8_t u1;
typedef uint16_t u2;
typedef uint32_t u4;
@@ -77,16 +83,6 @@ typedef int8_t s1;
typedef int16_t s2;
typedef int32_t s4;
typedef int64_t s8;
-#else
-typedef unsigned char u1;
-typedef unsigned short u2;
-typedef unsigned int u4;
-typedef unsigned long long u8;
-typedef signed char s1;
-typedef signed short s2;
-typedef signed int s4;
-typedef signed long long s8;
-#endif
/*
* Storage for primitive types and object references.
@@ -108,55 +104,10 @@ typedef union JValue {
void* l;
} JValue;
-/*
- * The <stdbool.h> definition uses _Bool, a type known to the compiler.
- */
-#ifdef HAVE_STDBOOL_H
-# include <stdbool.h> /* C99 */
-#else
-# ifndef __bool_true_false_are_defined
-typedef enum { false=0, true=!false } bool;
-# define __bool_true_false_are_defined 1
-# endif
-#endif
-
#define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0])))
-
-#if defined(HAVE_ENDIAN_H)
-# include <endian.h>
-#else /*not HAVE_ENDIAN_H*/
-# define __BIG_ENDIAN 4321
-# define __LITTLE_ENDIAN 1234
-# if defined(HAVE_LITTLE_ENDIAN)
-# define __BYTE_ORDER __LITTLE_ENDIAN
-# else
-# define __BYTE_ORDER __BIG_ENDIAN
-# endif
-#endif /*not HAVE_ENDIAN_H*/
-
-
-#if 0
-/*
- * Pretend we have the Android logging macros. These are replaced by the
- * Android logging implementation.
- */
-#define ANDROID_LOG_DEBUG 3
-#define LOGV(...) LOG_PRI(2, 0, __VA_ARGS__)
-#define LOGD(...) LOG_PRI(3, 0, __VA_ARGS__)
-#define LOGI(...) LOG_PRI(4, 0, __VA_ARGS__)
-#define LOGW(...) LOG_PRI(5, 0, __VA_ARGS__)
-#define LOGE(...) LOG_PRI(6, 0, __VA_ARGS__)
-#define MIN_LOG_LEVEL 2
-
-#define LOG_PRI(priority, tag, ...) do { \
- if (priority >= MIN_LOG_LEVEL) { \
- dvmFprintf(stdout, "%s:%-4d ", __FILE__, __LINE__); \
- dvmFprintf(stdout, __VA_ARGS__); \
- } \
- } while(0)
-#else
-# include "utils/Log.h"
+#ifdef __cplusplus
+}
#endif
#endif /*_DALVIK_COMMON*/