summaryrefslogtreecommitdiffstats
path: root/compiler/driver/compiler_driver.h
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2013-09-06 08:44:06 -0700
committerIan Rogers <irogers@google.com>2013-09-06 08:44:06 -0700
commit936bf024b26f84f9332d195a581912e95d9cbe4b (patch)
tree0515558eaba7c10ffd1b86b194c626357408959f /compiler/driver/compiler_driver.h
parent41c65c19c15ffac41089fa9f37502f94c046960d (diff)
downloadandroid_art-936bf024b26f84f9332d195a581912e95d9cbe4b.tar.gz
android_art-936bf024b26f84f9332d195a581912e95d9cbe4b.tar.bz2
android_art-936bf024b26f84f9332d195a581912e95d9cbe4b.zip
Tweak dedupe hash function.
Change-Id: I6c3450e53a3654969aa7627cea1474835bfc52d7
Diffstat (limited to 'compiler/driver/compiler_driver.h')
-rw-r--r--compiler/driver/compiler_driver.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index c5c53e387d..92c9d9fe99 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -457,14 +457,15 @@ class CompilerDriver {
hash = (hash * 16777619) ^ b;
}
} else {
- // For larger arrays use the first 4 bytes and then select a number of other values at
- // random.
+ // For larger arrays use the 2 bytes at 6 bytes (the location of a push registers
+ // instruction field for quick generated code on ARM) and then select a number of other
+ // values at random.
static const size_t kRandomHashCount = 16;
- for (size_t i = 0; i < 4; ++i) {
- uint8_t b = array[i];
+ for (size_t i = 0; i < 2; ++i) {
+ uint8_t b = array[i + 6];
hash = (hash * 16777619) ^ b;
}
- for (size_t i = 4; i < kRandomHashCount; ++i) {
+ for (size_t i = 2; i < kRandomHashCount; ++i) {
size_t r = i * 1103515245 + 12345;
uint8_t b = array[r % array.size()];
hash = (hash * 16777619) ^ b;