| 1 | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file |
| 2 | // for details. All rights reserved. Use of this source code is governed by a |
| 3 | // BSD-style license that can be found in the LICENSE file. |
| 4 | |
| 5 | #ifndef RUNTIME_VM_REVERSE_PC_LOOKUP_CACHE_H_ |
| 6 | #define RUNTIME_VM_REVERSE_PC_LOOKUP_CACHE_H_ |
| 7 | |
| 8 | #include "vm/allocation.h" |
| 9 | #include "vm/globals.h" |
| 10 | #include "vm/raw_object.h" |
| 11 | #include "vm/tagged_pointer.h" |
| 12 | |
| 13 | namespace dart { |
| 14 | |
| 15 | class IsolateGroup; |
| 16 | |
| 17 | // This class provides mechanism to find Code and CompressedStackMaps |
| 18 | // objects corresponding to the given PC. |
| 19 | // Can only be used in AOT runtime with bare instructions. |
| 20 | class ReversePc : public AllStatic { |
| 21 | public: |
| 22 | // Looks for Code object corresponding to |pc| in the |
| 23 | // given isolate |group| and vm isolate group. |
| 24 | static CodePtr Lookup(IsolateGroup* group, uword pc, bool is_return_address); |
| 25 | |
| 26 | static const UntaggedCompressedStackMaps::Payload* FindStackMap( |
| 27 | IsolateGroup* group, |
| 28 | uword pc, |
| 29 | bool is_return_address, |
| 30 | uword* code_start, |
| 31 | const UntaggedCompressedStackMaps::Payload** global_table); |
| 32 | |
| 33 | private: |
| 34 | static const UntaggedCompressedStackMaps::Payload* FindStackMapInGroup( |
| 35 | IsolateGroup* group, |
| 36 | uword pc, |
| 37 | bool is_return_address, |
| 38 | uword* code_start, |
| 39 | const UntaggedCompressedStackMaps::Payload** global_table); |
| 40 | |
| 41 | static CodePtr FindCodeInGroup(IsolateGroup* group, |
| 42 | uword pc, |
| 43 | bool is_return_address); |
| 44 | static CodePtr FindCode(IsolateGroup* group, |
| 45 | uword pc, |
| 46 | bool is_return_address); |
| 47 | }; |
| 48 | |
| 49 | } // namespace dart |
| 50 | |
| 51 | #endif // RUNTIME_VM_REVERSE_PC_LOOKUP_CACHE_H_ |
| 52 | |