diff options
author | 2016-02-05 16:51:53 +0000 | |
---|---|---|
committer | 2016-02-05 17:11:54 +0000 | |
commit | b331febbab8e916680faba722cc84b66b84218a3 (patch) | |
tree | 35f985b021e476914bfe91492da23fee218014a7 /runtime/stack_map.h | |
parent | 586996afc905518ed926e4680aab67bedabec9b7 (diff) |
Revert "Revert "Implement on-stack replacement for arm/arm64/x86/x86_64.""
This reverts commit bd89a5c556324062b7d841843b039392e84cfaf4.
Change-Id: I08d190431520baa7fcec8fbdb444519f25ac8d44
Diffstat (limited to 'runtime/stack_map.h')
-rw-r--r-- | runtime/stack_map.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/runtime/stack_map.h b/runtime/stack_map.h index 84185ce49f..97eb805501 100644 --- a/runtime/stack_map.h +++ b/runtime/stack_map.h @@ -1195,6 +1195,35 @@ class CodeInfo { return StackMap(); } + StackMap GetOsrStackMapForDexPc(uint32_t dex_pc, const StackMapEncoding& encoding) const { + size_t e = GetNumberOfStackMaps(); + if (e == 0) { + // There cannot be OSR stack map if there is no stack map. + return StackMap(); + } + // Walk over all stack maps. If two consecutive stack maps are identical, then we + // have found a stack map suitable for OSR. + for (size_t i = 0; i < e - 1; ++i) { + StackMap stack_map = GetStackMapAt(i, encoding); + if (stack_map.GetDexPc(encoding) == dex_pc) { + StackMap other = GetStackMapAt(i + 1, encoding); + if (other.GetDexPc(encoding) == dex_pc && + other.GetNativePcOffset(encoding) == stack_map.GetNativePcOffset(encoding)) { + DCHECK_EQ(other.GetDexRegisterMapOffset(encoding), + stack_map.GetDexRegisterMapOffset(encoding)); + DCHECK(!stack_map.HasInlineInfo(encoding)); + if (i < e - 2) { + // Make sure there are not three identical stack maps following each other. + DCHECK_NE(stack_map.GetNativePcOffset(encoding), + GetStackMapAt(i + 2, encoding).GetNativePcOffset(encoding)); + } + return stack_map; + } + } + } + return StackMap(); + } + StackMap GetStackMapForNativePcOffset(uint32_t native_pc_offset, const StackMapEncoding& encoding) const { // TODO: Safepoint stack maps are sorted by native_pc_offset but catch stack |