Support for exception throwing.
These changes start to add support for a long jump style of exception throw.
A Context is added to build up the registers that will be loaded by the long
jump from callee saves that are on the stack. Throws are reworked slightly to
give the PC for the frame of the method being looked at, rather than the return
PC (that previously led the trace's PC to be off by a frame). Callee save
support is added to the JNI compiler which then no longer needs to spill
incoming argument registers as it may reuse the callee saves.
Currently the code is lightly tested on ARM and doesn't support
restoring floating point callee save registers.
Also clean up some PIC TODOs.
Change-Id: I9bcef4ab3bf4a9de57d7a5123fb3bb1707ca8921
diff --git a/src/context_x86.h b/src/context_x86.h
new file mode 100644
index 0000000..0e31b25
--- /dev/null
+++ b/src/context_x86.h
@@ -0,0 +1,37 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+
+#ifndef ART_SRC_CONTEXT_X86_H_
+#define ART_SRC_CONTEXT_X86_H_
+
+#include "context.h"
+
+namespace art {
+namespace x86 {
+
+class X86Context : public Context {
+ public:
+ X86Context() : esp_(0), eip_(0) {}
+ virtual ~X86Context() {}
+
+ // No callee saves on X86
+ virtual void FillCalleeSaves(const Frame& fr) {}
+
+ virtual void SetSP(uintptr_t new_sp) {
+ esp_ = new_sp;
+ }
+
+ virtual void SetPC(uintptr_t new_pc) {
+ eip_ = new_pc;
+ }
+
+ virtual void DoLongJump();
+
+ private:
+ // Currently just ESP and EIP are used
+ uintptr_t esp_;
+ uintptr_t eip_;
+};
+} // namespace x86
+} // namespace art
+
+#endif // ART_SRC_CONTEXT_X86_H_