// // Classes in this file model simulator executors - per thread entities with their own contexts: // simulated stack, registers, etc. //
// This class implements a basic simulator executor which is capable of executing sequences // of simulated ISA instructions. It is not aware of ART runtime so it can manage only trivial // ART methods. // // Currently only used by code generator tests. class BasicCodeSimulator { public:
BasicCodeSimulator() {} virtual ~BasicCodeSimulator() {}
// Starts simulating instructions of a target isa from a buffer. virtualvoid RunFrom(intptr_t code_buffer) = 0;
// Get return value according to C ABI. virtualbool GetCReturnBool() const = 0; virtual int32_t GetCReturnInt32() const = 0; virtual int64_t GetCReturnInt64() const = 0;
// Can the target_isa be simulated on the current host ISA? static constexpr bool CanSimulate(InstructionSet target_isa) { // We currently support only 64-bit hosts as the simulator is designed around the fact // that host/target pointer size is the same. if constexpr (kRuntimeISA == InstructionSet::kX86_64) { switch (target_isa) { case InstructionSet::kArm64: returntrue; default: returnfalse;
}
} else { returnfalse;
}
}
// libart(d)-simulator is only included as a dependency on device targets. #ifndef ART_TARGET // Create a basic code simulator object. extern"C" BasicCodeSimulator* CreateBasicCodeSimulator(InstructionSet target_isa,
size_t stack_size); #else
[[maybe_unused]] static BasicCodeSimulator* CreateBasicCodeSimulator(InstructionSet, size_t) { return nullptr;
} #endif
#ifdef ART_USE_SIMULATOR
// This class implements an ART runtime aware simulator executor which can execute all quick ABI // code: is aware of ART entrypoints, ABI/ISA transitions, etc. class CodeSimulator { public:
CodeSimulator() {} virtual ~CodeSimulator() {}
// Invokes (starts to simulate) a method; this should follow the semantics of // art_quick_invoke_stub. virtualvoid Invoke(ArtMethod* method,
uint32_t* args,
uint32_t args_size,
Thread* self,
JValue* result, constchar* shorty, bool isStatic) REQUIRES_SHARED(Locks::mutator_lock_) = 0;
// Get the current stack pointer from the simulator. virtual int64_t GetStackPointer() = 0; // Get the stack base from the simulator. virtual uint8_t* GetStackBaseInternal() = 0; // Get the simulated program counter (PC). virtual uintptr_t GetPc() = 0;
// Try to handle an implicit check that occurred during simulation. virtualbool HandleNullPointer(int sig, siginfo_t* siginfo, void* context) = 0;
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.