Support for SetVReg and add SetGPR.
These changes are useful for debugging and are required for being able
to change all GC roots.
MIPS is untested.
Change-Id: I2ba055de64264098bffe869a4fb192d0975f1c8f
diff --git a/src/oat/runtime/context.h b/src/oat/runtime/context.h
index 317030f..895abf9 100644
--- a/src/oat/runtime/context.h
+++ b/src/oat/runtime/context.h
@@ -24,7 +24,8 @@
class StackVisitor;
-// Representation of a thread's context on the executing machine
+// Representation of a thread's context on the executing machine, used to implement long jumps in
+// the quick stack frame layout.
class Context {
public:
// Creates a context for the running architecture
@@ -32,6 +33,9 @@
virtual ~Context() {}
+ // Re-initializes the registers for context re-use.
+ virtual void Reset() = 0;
+
// Read values from callee saves in the given frame. The frame also holds
// the method that holds the layout.
virtual void FillCalleeSaves(const StackVisitor& fr) = 0;
@@ -45,12 +49,16 @@
// Read the given GPR
virtual uintptr_t GetGPR(uint32_t reg) = 0;
+ // Set the given GPR.
+ virtual void SetGPR(uint32_t reg, uintptr_t value) = 0;
+
// Smash the caller save registers. If we're throwing, we don't want to return bogus values.
virtual void SmashCallerSaves() = 0;
// Switch execution of the executing context to this context
virtual void DoLongJump() = 0;
+ protected:
enum {
kBadGprBase = 0xebad6070,
kBadFprBase = 0xebad8070,