class CompiledMethod; class CompiledMethodStorage; class InstructionSetFeatures;
namespace linker {
// MultiOatRelativePatcher is a helper class for handling patching across // any number of oat files. It provides storage for method code offsets // and wraps RelativePatcher calls, adjusting relative offsets according // to the value set by SetAdjustment(). class MultiOatRelativePatcher final { public: using const_iterator = SafeMap<MethodReference, uint32_t>::const_iterator;
// Mark the start of a new oat file (for statistics retrieval) and set the // adjustment for a new oat file to apply to all relative offsets that are // passed to the MultiOatRelativePatcher. // // The adjustment should be the global offset of the base from which relative // offsets are calculated, such as the start of .rodata for the current oat file. // It must must never point directly to a method's code to avoid relative offsets // with value 0 because this value is used as a missing offset indication in // GetOffset() and an error indication in WriteThunks(). Additionally, it must be // relative to a page-aligned boundary, so that it does not skew alignment calculations, // say arm64 ADRP. void StartOatFile(uint32_t adjustment);
// Get relative offset. Returns 0 when the offset has not been set yet.
uint32_t GetOffset(MethodReference method_ref) { auto it = method_offset_map_.map.find(method_ref); return (it != method_offset_map_.map.end()) ? it->second - adjustment_ : 0u;
}
// Set the offset. void SetOffset(MethodReference method_ref, uint32_t offset) {
method_offset_map_.map.Put(method_ref, offset + adjustment_);
}
// Map method reference to assigned offset. // Wrap the map in a class implementing RelativePatcherTargetProvider. class MethodOffsetMap : public RelativePatcherTargetProvider { public:
std::pair<bool, uint32_t> FindMethodOffset(MethodReference ref) override;
SafeMap<MethodReference, uint32_t> map;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.