Replace String.charAt() with HIR.
Replace String.charAt() with HArrayLength, HBoundsCheck and
HArrayGet. This allows GVN on the HArrayLength and BCE on
the HBoundsCheck as well as using the infrastructure for
HArrayGet, i.e. better handling of constant indexes than
the old intrinsic and using the HArm64IntermediateAddress.
Bug: 28330359
Change-Id: I32bf1da7eeafe82537a60416abf6ac412baa80dc
diff --git a/runtime/stack_map.h b/runtime/stack_map.h
index 7c50f97..4647d67 100644
--- a/runtime/stack_map.h
+++ b/runtime/stack_map.h
@@ -19,6 +19,7 @@
#include "base/bit_vector.h"
#include "base/bit_utils.h"
+#include "dex_file.h"
#include "memory_region.h"
#include "leb128.h"
@@ -892,7 +893,11 @@
total_bit_size_ += MinimumBitsToStore(method_index_max);
dex_pc_bit_offset_ = dchecked_integral_cast<uint8_t>(total_bit_size_);
- total_bit_size_ += MinimumBitsToStore(1 /* kNoDexPc */ + dex_pc_max);
+ // Note: We're not encoding the dex pc if there is none. That's the case
+ // for an intrinsified native method, such as String.charAt().
+ if (dex_pc_max != DexFile::kDexNoIndex) {
+ total_bit_size_ += MinimumBitsToStore(1 /* kNoDexPc */ + dex_pc_max);
+ }
invoke_type_bit_offset_ = dchecked_integral_cast<uint8_t>(total_bit_size_);
total_bit_size_ += MinimumBitsToStore(invoke_type_max);