Refactor runtime support builder.

Also, add inline assembly for load offset from current thread.

Change-Id: I5c32c04a5ab9a8574acbaf8ee3e08761ebe33d4f
diff --git a/src/thread.h b/src/thread.h
index 9ebe00c..f51b581 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -35,6 +35,7 @@
 #include "oat/runtime/oat_support_entrypoints.h"
 #include "offsets.h"
 #include "runtime_stats.h"
+#include "shadow_frame.h"
 #include "stack.h"
 #include "trace.h"
 #include "UniquePtr.h"
@@ -436,8 +437,19 @@
     return ThreadOffset(OFFSETOF_MEMBER(Thread, top_of_managed_stack_pc_));
   }
 
-  void PushShadowFrame(ShadowFrame* frame);
-  ShadowFrame* PopShadowFrame();
+  ShadowFrame* PushShadowFrame(ShadowFrame* frame) {
+    ShadowFrame* old_frame = top_shadow_frame_;
+    top_shadow_frame_ = frame;
+    frame->SetLink(old_frame);
+    return old_frame;
+  }
+
+  ShadowFrame* PopShadowFrame() {
+    CHECK(top_shadow_frame_ != NULL);
+    ShadowFrame* frame = top_shadow_frame_;
+    top_shadow_frame_ = frame->GetLink();
+    return frame;
+  }
 
   static ThreadOffset TopShadowFrameOffset() {
     return ThreadOffset(OFFSETOF_MEMBER(Thread, top_shadow_frame_));