Remove the private CLZ implementation in the GC.

This was a hold over from a time when the compiler did not properly
support the CLZ intrinsic.

Change-Id: I224481868c8d6fd3e0382d9cde3a2ffd02cfd39c
diff --git a/vm/Common.h b/vm/Common.h
index 19de943..7d8424e 100644
--- a/vm/Common.h
+++ b/vm/Common.h
@@ -45,6 +45,8 @@
 #define ALIGN_UP_TO_PAGE_SIZE(p) ALIGN_UP(p, SYSTEM_PAGE_SIZE)
 #define ALIGN_DOWN_TO_PAGE_SIZE(p) ALIGN_DOWN(p, SYSTEM_PAGE_SIZE)
 
+#define CLZ(x) __builtin_clz(x)
+
 /*
  * If "very verbose" logging is enabled, make it equivalent to LOGV.
  * Otherwise, make it disappear.
diff --git a/vm/Dvm.mk b/vm/Dvm.mk
index 91d6b41..89d81d8 100644
--- a/vm/Dvm.mk
+++ b/vm/Dvm.mk
@@ -117,7 +117,6 @@
 	TestCompability.c \
 	Thread.c \
 	UtfString.c \
-	alloc/clz.c.arm \
 	alloc/Alloc.c \
 	alloc/CardTable.c \
 	alloc/HeapBitmap.c.arm \
diff --git a/vm/alloc/Copying.c b/vm/alloc/Copying.c
index 3c41057..02eab93 100644
--- a/vm/alloc/Copying.c
+++ b/vm/alloc/Copying.c
@@ -24,7 +24,6 @@
 #include "alloc/HeapInternal.h"
 #include "alloc/HeapSource.h"
 #include "alloc/Verify.h"
-#include "alloc/clz.h"
 
 /*
  * A "mostly copying", generational, garbage collector.
diff --git a/vm/alloc/HeapBitmap.c b/vm/alloc/HeapBitmap.c
index 25283b8..15ba15c 100644
--- a/vm/alloc/HeapBitmap.c
+++ b/vm/alloc/HeapBitmap.c
@@ -16,7 +16,6 @@
 
 #include "Dalvik.h"
 #include "HeapBitmap.h"
-#include "clz.h"
 #include <sys/mman.h>   /* for PROT_* */
 
 /*
diff --git a/vm/alloc/MarkSweep.c b/vm/alloc/MarkSweep.c
index ce9bc90..ae57080 100644
--- a/vm/alloc/MarkSweep.c
+++ b/vm/alloc/MarkSweep.c
@@ -15,7 +15,6 @@
  */
 
 #include "Dalvik.h"
-#include "alloc/clz.h"
 #include "alloc/CardTable.h"
 #include "alloc/HeapBitmap.h"
 #include "alloc/HeapBitmapInlines.h"
diff --git a/vm/alloc/TEST/HeapBitmapTest/Makefile b/vm/alloc/TEST/HeapBitmapTest/Makefile
index fe31b24..969eb63 100644
--- a/vm/alloc/TEST/HeapBitmapTest/Makefile
+++ b/vm/alloc/TEST/HeapBitmapTest/Makefile
@@ -10,12 +10,9 @@
 out/main.o: main.c ../../HeapBitmap.h
 	$(CC) $(CFLAGS) -c $< -o $@ -I ../..
 
-out/HeapBitmap.o: ../../HeapBitmap.c ../../HeapBitmap.h ../../clz.h include/cutils/ashmem.h include/Dalvik.h
+out/HeapBitmap.o: ../../HeapBitmap.c ../../HeapBitmap.h include/cutils/ashmem.h include/Dalvik.h
 	$(CC) $(CFLAGS) -c $< -o $@ -I ../.. -I include
 
-out/clz.o: ../../clz.c ../../clz.h
-	$(CC) $(CFLAGS) -c $< -o $@ -I ../..
-
 out/hbtest: out/main.o out/HeapBitmap.o out/clz.o
 	$(CC) $^ -o $@
 
diff --git a/vm/alloc/Visit.c b/vm/alloc/Visit.c
index 6229d51..a17eea8 100644
--- a/vm/alloc/Visit.c
+++ b/vm/alloc/Visit.c
@@ -15,7 +15,6 @@
  */
 
 #include "Dalvik.h"
-#include "alloc/clz.h"
 #include "alloc/HeapInternal.h"
 #include "alloc/Visit.h"
 #include "alloc/VisitInlines.h"
diff --git a/vm/alloc/clz.c b/vm/alloc/clz.c
deleted file mode 100644
index 3488975..0000000
--- a/vm/alloc/clz.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "clz.h"
-
-/*
- * Implementation of CLZ; intended to mimic gcc's __builtin_clz.
- *
- * Returns the number of leading zero bits, starting at the most
- * significant bit position.  If the argument is zero, the result is
- * undefined.
- *
- * (For best results, this file should always be compiled for ARM, not THUMB.)
- */
-int dvmClzImpl(unsigned int x)
-{
-#ifdef HAVE_BUILTIN_CLZ
-    /*
-     * This file was compiled with flags that allow it to use the built-in
-     * CLZ (e.g. ARM mode for ARMv5 or later).
-     */
-    return __builtin_clz(x);
-#else
-    /*
-     * Built-in version not available.
-     */
-    if (!x) return 32;
-    int e = 31;
-    if (x&0xFFFF0000)   { e -=16; x >>=16; }
-    if (x&0x0000FF00)   { e -= 8; x >>= 8; }
-    if (x&0x000000F0)   { e -= 4; x >>= 4; }
-    if (x&0x0000000C)   { e -= 2; x >>= 2; }
-    if (x&0x00000002)   { e -= 1; }
-    return e;
-#endif
-}
diff --git a/vm/alloc/clz.h b/vm/alloc/clz.h
deleted file mode 100644
index 77fa6d4..0000000
--- a/vm/alloc/clz.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Implementation of clz(), which returns the number of leading zero bits,
- * starting at the most significant bit position.  If the argument is zero,
- * the result is undefined.
- *
- * On some platforms, gcc provides a __builtin_clz() function that uses
- * an optimized implementation (e.g. the CLZ instruction on ARM).
- *
- * This gets a little tricky for ARM, because it's only available in ARMv5
- * and above, and even on ARMv5 it's not available for THUMB code.  So we
- * need to tailor this for every source file.
- */
-#ifndef _DALVIK_CLZ
-
-#if defined(__arm__) && !defined(__thumb__)
-# include <machine/cpu-features.h>
-# if defined(__ARM_HAVE_CLZ)
-#  define CLZ(x) __builtin_clz(x)
-#  define HAVE_BUILTIN_CLZ
-# endif
-#endif
-
-#ifndef HAVE_BUILTIN_CLZ
-# define CLZ(x) dvmClzImpl(x)
-int dvmClzImpl(unsigned int x);
-#endif
-
-#endif // _DALVIK_CLZ