From 33ac819bd13c6e9d42b36ae8393c37cfb1bb4cde Mon Sep 17 00:00:00 2001 From: Yevgeny Rouban Date: Tue, 19 Aug 2014 18:39:57 +0700 Subject: ART fix oat debug source map operations Several places need to be fixed in OAT debug source map generation (see comments in https://android-review.googlesource.com/#/c/102610/19/compiler/compiled_method.h): 1. Source Maps are deduplicated in Compiler Driver by implicit conversion SrcMapElems to bytes. This implies incorrect operator==. 2. SrcMapElem operator < is peculiar, and cannot be applied to SrcMapElems with negative to_ fields 3. SrcMap.Arrange method is not elegant The fix is to introduce explicit conversion from SrcMapElem to one signed 64-bit value, which is used as a base of two new operators < and ==. They are correct and intuitive. DedupeHashFunc is changed to explicitly convert array elements to byte, so the explicit type conversion from SrcMapElem to byte is used. Minor fix: In Line Table Programs the file index set command is generated only if the index gets new value. Change-Id: I5e2c03404a437254fc2db3485b22bfc1799b39b7 Signed-off-by: Yevgeny Rouban --- compiler/driver/compiler_driver.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/driver/compiler_driver.h') diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h index 87523bf43b..624947d7b1 100644 --- a/compiler/driver/compiler_driver.h +++ b/compiler/driver/compiler_driver.h @@ -766,7 +766,7 @@ class CompilerDriver { size_t hash = 0x811c9dc5; if (array.size() <= kSmallArrayThreshold) { for (auto b : array) { - hash = (hash * 16777619) ^ b; + hash = (hash * 16777619) ^ static_cast(b); } } else { // For larger arrays use the 2 bytes at 6 bytes (the location of a push registers @@ -774,12 +774,12 @@ class CompilerDriver { // values at random. static const size_t kRandomHashCount = 16; for (size_t i = 0; i < 2; ++i) { - uint8_t b = array[i + 6]; + uint8_t b = static_cast(array[i + 6]); hash = (hash * 16777619) ^ b; } for (size_t i = 2; i < kRandomHashCount; ++i) { size_t r = i * 1103515245 + 12345; - uint8_t b = array[r % array.size()]; + uint8_t b = static_cast(array[r % array.size()]); hash = (hash * 16777619) ^ b; } } -- cgit v1.2.3-59-g8ed1b