Merge "Fix build to rebuild tests correctly, and disable pre-dexopt." into ics-mr1-plus-art
diff --git a/build/Android.common.mk b/build/Android.common.mk
index 33c33af..8e0fd51 100644
--- a/build/Android.common.mk
+++ b/build/Android.common.mk
@@ -393,6 +393,7 @@
 	\
 	ExceptionTest \
 	GrowthLimit \
+	ConcurrentGC \
 	IntMath \
 	Invoke \
 	MemUsage \
diff --git a/src/compiler_llvm/art_module.ll b/src/compiler_llvm/art_module.ll
index caef683..e7738ad 100644
--- a/src/compiler_llvm/art_module.ll
+++ b/src/compiler_llvm/art_module.ll
@@ -43,8 +43,8 @@
 
 declare void @art_test_suspend_from_code(%JavaObject*)
 
-declare void @art_push_shadow_frame_from_code(%ShadowFrame*)
-declare void @art_pop_shadow_frame_from_code()
+declare %ShadowFrame* @art_push_shadow_frame_from_code(%ShadowFrame*)
+declare void @art_pop_shadow_frame_from_code(%ShadowFrame*)
 
 
 
diff --git a/src/compiler_llvm/dalvik_reg.cc b/src/compiler_llvm/dalvik_reg.cc
index e19067f..c3263ae 100644
--- a/src/compiler_llvm/dalvik_reg.cc
+++ b/src/compiler_llvm/dalvik_reg.cc
@@ -23,62 +23,13 @@
 using namespace art::compiler_llvm;
 
 
-namespace {
-
-  class DalvikLocalVarReg : public DalvikReg {
-   public:
-    DalvikLocalVarReg(MethodCompiler& method_compiler, uint32_t reg_idx);
-
-    virtual void SetValue(JType jty, JTypeSpace space, llvm::Value* value);
-
-    virtual ~DalvikLocalVarReg();
-
-   private:
-    virtual llvm::Value* GetRawAddr(JType jty, JTypeSpace space);
-
-   private:
-    uint32_t reg_idx_;
-    llvm::Value* reg_32_;
-    llvm::Value* reg_64_;
-    llvm::Value* reg_obj_;
-    llvm::Value* reg_shadow_frame_;
-  };
-
-  class DalvikRetValReg : public DalvikReg {
-   public:
-    DalvikRetValReg(MethodCompiler& method_compiler);
-
-    virtual ~DalvikRetValReg();
-
-   private:
-    virtual llvm::Value* GetRawAddr(JType jty, JTypeSpace space);
-
-   private:
-    llvm::Value* reg_32_;
-    llvm::Value* reg_64_;
-    llvm::Value* reg_obj_;
-  };
-
-} // anonymous namespace
-
-
 //----------------------------------------------------------------------------
 // Dalvik Register
 //----------------------------------------------------------------------------
 
-DalvikReg* DalvikReg::CreateLocalVarReg(MethodCompiler& method_compiler,
-                                        uint32_t reg_idx) {
-  return new DalvikLocalVarReg(method_compiler, reg_idx);
-}
-
-
-DalvikReg* DalvikReg::CreateRetValReg(MethodCompiler& method_compiler) {
-  return new DalvikRetValReg(method_compiler);
-}
-
-
-DalvikReg::DalvikReg(MethodCompiler& method_compiler)
-: method_compiler_(&method_compiler), irb_(method_compiler.GetIRBuilder()) {
+DalvikReg::DalvikReg(MethodCompiler& method_compiler, const std::string& name)
+: method_compiler_(&method_compiler), irb_(method_compiler.GetIRBuilder()),
+  reg_name_(name), reg_32_(NULL), reg_64_(NULL), reg_obj_(NULL) {
 }
 
 
@@ -133,7 +84,7 @@
   switch (space) {
   case kReg:
   case kField:
-    value = irb_.CreateLoad(GetAddr(jty, space), kTBAARegister);
+    value = irb_.CreateLoad(GetAddr(jty), kTBAARegister);
     break;
 
   case kAccurate:
@@ -150,7 +101,7 @@
       // NOTE: In array type space, boolean is truncated from i32 to i8, while
       // in accurate type space, boolean is truncated from i32 to i1.
       // For the other cases, array type space is equal to accurate type space.
-      value = RegCat1Trunc(irb_.CreateLoad(GetAddr(jty, space), kTBAARegister),
+      value = RegCat1Trunc(irb_.CreateLoad(GetAddr(jty), kTBAARegister),
                            irb_.getJType(jty, space));
       break;
 
@@ -159,7 +110,7 @@
     case kFloat:
     case kDouble:
     case kObject:
-      value = irb_.CreateLoad(GetAddr(jty, space), kTBAARegister);
+      value = irb_.CreateLoad(GetAddr(jty), kTBAARegister);
       break;
 
     default:
@@ -190,7 +141,7 @@
   switch (space) {
   case kReg:
   case kField:
-    irb_.CreateStore(value, GetAddr(jty, space), kTBAARegister);
+    irb_.CreateStore(value, GetAddr(jty), kTBAARegister);
     return;
 
   case kAccurate:
@@ -204,7 +155,7 @@
       // NOTE: In accurate type space, we have to zero extend boolean from
       // i1 to i32, and char from i16 to i32.  In array type space, we have
       // to zero extend boolean from i8 to i32, and char from i16 to i32.
-      irb_.CreateStore(RegCat1ZExt(value), GetAddr(jty, space), kTBAARegister);
+      irb_.CreateStore(RegCat1ZExt(value), GetAddr(jty), kTBAARegister);
       break;
 
     case kByte:
@@ -212,7 +163,7 @@
       // NOTE: In accurate type space, we have to signed extend byte from
       // i8 to i32, and short from i16 to i32.  In array type space, we have
       // to sign extend byte from i8 to i32, and short from i16 to i32.
-      irb_.CreateStore(RegCat1SExt(value), GetAddr(jty, space), kTBAARegister);
+      irb_.CreateStore(RegCat1SExt(value), GetAddr(jty), kTBAARegister);
       break;
 
     case kInt:
@@ -220,7 +171,7 @@
     case kFloat:
     case kDouble:
     case kObject:
-      irb_.CreateStore(value, GetAddr(jty, space), kTBAARegister);
+      irb_.CreateStore(value, GetAddr(jty), kTBAARegister);
       break;
 
     default:
@@ -230,94 +181,23 @@
 }
 
 
-llvm::Value* DalvikReg::GetAddr(JType jty, JTypeSpace space) {
-  return GetRawAddr(jty, space);
-}
-
-
-//----------------------------------------------------------------------------
-// Dalvik Local Variable Register
-//----------------------------------------------------------------------------
-
-DalvikLocalVarReg::DalvikLocalVarReg(MethodCompiler& method_compiler,
-                                     uint32_t reg_idx)
-: DalvikReg(method_compiler), reg_idx_(reg_idx),
-  reg_32_(NULL), reg_64_(NULL), reg_obj_(NULL), reg_shadow_frame_(NULL) {
-}
-
-
-DalvikLocalVarReg::~DalvikLocalVarReg() {
-}
-
-
-void DalvikLocalVarReg::SetValue(JType jty, JTypeSpace space, llvm::Value* value) {
-  DalvikReg::SetValue(jty, space, value);
-
-  if (jty == kObject && reg_shadow_frame_ != NULL) {
-    irb_.CreateStore(value, reg_shadow_frame_, kTBAAShadowFrame);
-  }
-}
-
-
-llvm::Value* DalvikLocalVarReg::GetRawAddr(JType jty, JTypeSpace space) {
+llvm::Value* DalvikReg::GetAddr(JType jty) {
   switch (GetRegCategoryFromJType(jty)) {
   case kRegCat1nr:
     if (reg_32_ == NULL) {
-      reg_32_ = method_compiler_->AllocDalvikLocalVarReg(kRegCat1nr, reg_idx_);
+      reg_32_ = method_compiler_->AllocDalvikReg(kRegCat1nr, reg_name_);
     }
     return reg_32_;
 
   case kRegCat2:
     if (reg_64_ == NULL) {
-      reg_64_ = method_compiler_->AllocDalvikLocalVarReg(kRegCat2, reg_idx_);
+      reg_64_ = method_compiler_->AllocDalvikReg(kRegCat2, reg_name_);
     }
     return reg_64_;
 
   case kRegObject:
     if (reg_obj_ == NULL) {
-      reg_obj_ = method_compiler_->AllocDalvikLocalVarReg(kRegObject, reg_idx_);
-      reg_shadow_frame_ = method_compiler_->AllocShadowFrameEntry(reg_idx_);
-    }
-    return reg_obj_;
-
-  default:
-    LOG(FATAL) << "Unexpected register category: "
-               << GetRegCategoryFromJType(jty);
-    return NULL;
-  }
-}
-
-
-//----------------------------------------------------------------------------
-// Dalvik Returned Value Temporary Register
-//----------------------------------------------------------------------------
-
-DalvikRetValReg::DalvikRetValReg(MethodCompiler& method_compiler)
-: DalvikReg(method_compiler), reg_32_(NULL), reg_64_(NULL), reg_obj_(NULL) {
-}
-
-
-DalvikRetValReg::~DalvikRetValReg() {
-}
-
-
-llvm::Value* DalvikRetValReg::GetRawAddr(JType jty, JTypeSpace space) {
-  switch (GetRegCategoryFromJType(jty)) {
-  case kRegCat1nr:
-    if (reg_32_ == NULL) {
-      reg_32_ = method_compiler_->AllocDalvikRetValReg(kRegCat1nr);
-    }
-    return reg_32_;
-
-  case kRegCat2:
-    if (reg_64_ == NULL) {
-      reg_64_ = method_compiler_->AllocDalvikRetValReg(kRegCat2);
-    }
-    return reg_64_;
-
-  case kRegObject:
-    if (reg_obj_ == NULL) {
-      reg_obj_ = method_compiler_->AllocDalvikRetValReg(kRegObject);
+      reg_obj_ = method_compiler_->AllocDalvikReg(kRegObject, reg_name_);
     }
     return reg_obj_;
 
diff --git a/src/compiler_llvm/dalvik_reg.h b/src/compiler_llvm/dalvik_reg.h
index 7356c87..f950771 100644
--- a/src/compiler_llvm/dalvik_reg.h
+++ b/src/compiler_llvm/dalvik_reg.h
@@ -20,6 +20,7 @@
 #include "backend_types.h"
 
 #include <stdint.h>
+#include <string>
 
 namespace llvm {
   class Type;
@@ -34,16 +35,13 @@
 
 class DalvikReg {
  public:
-  static DalvikReg* CreateLocalVarReg(MethodCompiler& method_compiler,
-                                      uint32_t reg_idx);
-
-  static DalvikReg* CreateRetValReg(MethodCompiler& method_compiler);
-
   static llvm::Type* GetRegCategoryEquivSizeTy(IRBuilder& irb, RegCategory reg_cat);
 
   static char GetRegCategoryNamePrefix(RegCategory reg_cat);
 
-  virtual ~DalvikReg();
+  DalvikReg(MethodCompiler& method_compiler, const std::string& name);
+
+  ~DalvikReg();
 
   llvm::Value* GetValue(JType jty, JTypeSpace space);
 
@@ -51,28 +49,27 @@
     return GetValue(GetJTypeFromShorty(shorty), space);
   }
 
-  virtual void SetValue(JType jty, JTypeSpace space, llvm::Value* value);
+  void SetValue(JType jty, JTypeSpace space, llvm::Value* value);
 
   void SetValue(char shorty, JTypeSpace space, llvm::Value* value) {
     return SetValue(GetJTypeFromShorty(shorty), space, value);
   }
 
- protected:
-  DalvikReg(MethodCompiler& method_compiler);
-
  private:
-  llvm::Value* GetAddr(JType jty, JTypeSpace space);
+  llvm::Value* GetAddr(JType jty);
 
   llvm::Value* RegCat1SExt(llvm::Value* value);
   llvm::Value* RegCat1ZExt(llvm::Value* value);
 
   llvm::Value* RegCat1Trunc(llvm::Value* value, llvm::Type* ty);
 
-  virtual llvm::Value* GetRawAddr(JType jty, JTypeSpace space) = 0;
-
- protected:
   MethodCompiler* method_compiler_;
   IRBuilder& irb_;
+
+  std::string reg_name_;
+  llvm::Value* reg_32_;
+  llvm::Value* reg_64_;
+  llvm::Value* reg_obj_;
 };
 
 } // namespace compiler_llvm
diff --git a/src/compiler_llvm/generated/art_module.cc b/src/compiler_llvm/generated/art_module.cc
index cd93542..f25a88b 100644
--- a/src/compiler_llvm/generated/art_module.cc
+++ b/src/compiler_llvm/generated/art_module.cc
@@ -1,4 +1,4 @@
-// Generated with ../tools/gen_art_module_cc.sh
+// Generated with tools/gen_art_module_cc.sh
 
 
 #pragma GCC diagnostic ignored "-Wframe-larger-than="
@@ -85,11 +85,12 @@
 std::vector<Type*>FuncTy_6_args;
 FuncTy_6_args.push_back(PointerTy_2);
 FunctionType* FuncTy_6 = FunctionType::get(
- /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Result=*/PointerTy_2,
  /*Params=*/FuncTy_6_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_7_args;
+FuncTy_7_args.push_back(PointerTy_2);
 FunctionType* FuncTy_7 = FunctionType::get(
  /*Result=*/Type::getVoidTy(mod->getContext()),
  /*Params=*/FuncTy_7_args,
@@ -102,8 +103,6 @@
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_9_args;
-FuncTy_9_args.push_back(IntegerType::get(mod->getContext(), 32));
-FuncTy_9_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_9 = FunctionType::get(
  /*Result=*/Type::getVoidTy(mod->getContext()),
  /*Params=*/FuncTy_9_args,
@@ -111,14 +110,13 @@
 
 std::vector<Type*>FuncTy_10_args;
 FuncTy_10_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_10_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_10 = FunctionType::get(
  /*Result=*/Type::getVoidTy(mod->getContext()),
  /*Params=*/FuncTy_10_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_11_args;
-FuncTy_11_args.push_back(PointerTy_1);
-FuncTy_11_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_11_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_11 = FunctionType::get(
  /*Result=*/Type::getVoidTy(mod->getContext()),
@@ -128,24 +126,23 @@
 std::vector<Type*>FuncTy_12_args;
 FuncTy_12_args.push_back(PointerTy_1);
 FuncTy_12_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_12_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_12 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Result=*/Type::getVoidTy(mod->getContext()),
  /*Params=*/FuncTy_12_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_13_args;
+FuncTy_13_args.push_back(PointerTy_1);
 FuncTy_13_args.push_back(IntegerType::get(mod->getContext(), 32));
-FuncTy_13_args.push_back(PointerTy_1);
-FuncTy_13_args.push_back(PointerTy_1);
 FunctionType* FuncTy_13 = FunctionType::get(
- /*Result=*/PointerTy_1,
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_13_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_14_args;
 FuncTy_14_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_14_args.push_back(PointerTy_1);
-FuncTy_14_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_14_args.push_back(PointerTy_1);
 FunctionType* FuncTy_14 = FunctionType::get(
  /*Result=*/PointerTy_1,
@@ -155,42 +152,43 @@
 std::vector<Type*>FuncTy_15_args;
 FuncTy_15_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_15_args.push_back(PointerTy_1);
+FuncTy_15_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_15_args.push_back(PointerTy_1);
 FunctionType* FuncTy_15 = FunctionType::get(
- /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Result=*/PointerTy_1,
  /*Params=*/FuncTy_15_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_16_args;
 FuncTy_16_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_16_args.push_back(PointerTy_1);
-FuncTy_16_args.push_back(PointerTy_1);
-FuncTy_16_args.push_back(PointerTy_1);
 FunctionType* FuncTy_16 = FunctionType::get(
- /*Result=*/PointerTy_1,
+ /*Result=*/Type::getVoidTy(mod->getContext()),
  /*Params=*/FuncTy_16_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_17_args;
-FuncTy_17_args.push_back(PointerTy_1);
 FuncTy_17_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_17_args.push_back(PointerTy_1);
+FuncTy_17_args.push_back(PointerTy_1);
+FuncTy_17_args.push_back(PointerTy_1);
 FunctionType* FuncTy_17 = FunctionType::get(
  /*Result=*/PointerTy_1,
  /*Params=*/FuncTy_17_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_18_args;
-FuncTy_18_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_18_args.push_back(PointerTy_1);
 FuncTy_18_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_18 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Result=*/PointerTy_1,
  /*Params=*/FuncTy_18_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_19_args;
 FuncTy_19_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_19_args.push_back(PointerTy_1);
-FuncTy_19_args.push_back(IntegerType::get(mod->getContext(), 64));
+FuncTy_19_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_19 = FunctionType::get(
  /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_19_args,
@@ -199,7 +197,7 @@
 std::vector<Type*>FuncTy_20_args;
 FuncTy_20_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_20_args.push_back(PointerTy_1);
-FuncTy_20_args.push_back(PointerTy_1);
+FuncTy_20_args.push_back(IntegerType::get(mod->getContext(), 64));
 FunctionType* FuncTy_20 = FunctionType::get(
  /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_20_args,
@@ -208,6 +206,7 @@
 std::vector<Type*>FuncTy_21_args;
 FuncTy_21_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_21_args.push_back(PointerTy_1);
+FuncTy_21_args.push_back(PointerTy_1);
 FunctionType* FuncTy_21 = FunctionType::get(
  /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_21_args,
@@ -217,7 +216,7 @@
 FuncTy_22_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_22_args.push_back(PointerTy_1);
 FunctionType* FuncTy_22 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 64),
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_22_args,
  /*isVarArg=*/false);
 
@@ -225,17 +224,15 @@
 FuncTy_23_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_23_args.push_back(PointerTy_1);
 FunctionType* FuncTy_23 = FunctionType::get(
- /*Result=*/PointerTy_1,
+ /*Result=*/IntegerType::get(mod->getContext(), 64),
  /*Params=*/FuncTy_23_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_24_args;
 FuncTy_24_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_24_args.push_back(PointerTy_1);
-FuncTy_24_args.push_back(PointerTy_1);
-FuncTy_24_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_24 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Result=*/PointerTy_1,
  /*Params=*/FuncTy_24_args,
  /*isVarArg=*/false);
 
@@ -243,7 +240,7 @@
 FuncTy_25_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_25_args.push_back(PointerTy_1);
 FuncTy_25_args.push_back(PointerTy_1);
-FuncTy_25_args.push_back(IntegerType::get(mod->getContext(), 64));
+FuncTy_25_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_25 = FunctionType::get(
  /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_25_args,
@@ -253,7 +250,7 @@
 FuncTy_26_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_26_args.push_back(PointerTy_1);
 FuncTy_26_args.push_back(PointerTy_1);
-FuncTy_26_args.push_back(PointerTy_1);
+FuncTy_26_args.push_back(IntegerType::get(mod->getContext(), 64));
 FunctionType* FuncTy_26 = FunctionType::get(
  /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_26_args,
@@ -263,77 +260,87 @@
 FuncTy_27_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_27_args.push_back(PointerTy_1);
 FuncTy_27_args.push_back(PointerTy_1);
+FuncTy_27_args.push_back(PointerTy_1);
 FunctionType* FuncTy_27 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 64),
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_27_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_28_args;
+FuncTy_28_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_28_args.push_back(PointerTy_1);
 FuncTy_28_args.push_back(PointerTy_1);
 FunctionType* FuncTy_28 = FunctionType::get(
- /*Result=*/PointerTy_1,
+ /*Result=*/IntegerType::get(mod->getContext(), 64),
  /*Params=*/FuncTy_28_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_29_args;
 FuncTy_29_args.push_back(PointerTy_1);
-FuncTy_29_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_29_args.push_back(PointerTy_1);
-FuncTy_29_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_29 = FunctionType::get(
- /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Result=*/PointerTy_1,
  /*Params=*/FuncTy_29_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_30_args;
 FuncTy_30_args.push_back(PointerTy_1);
+FuncTy_30_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_30_args.push_back(PointerTy_1);
+FuncTy_30_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_30 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Result=*/Type::getVoidTy(mod->getContext()),
  /*Params=*/FuncTy_30_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_31_args;
-FuncTy_31_args.push_back(Type::getDoubleTy(mod->getContext()));
+FuncTy_31_args.push_back(PointerTy_1);
+FuncTy_31_args.push_back(PointerTy_1);
 FunctionType* FuncTy_31 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 64),
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_31_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_32_args;
 FuncTy_32_args.push_back(Type::getDoubleTy(mod->getContext()));
 FunctionType* FuncTy_32 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Result=*/IntegerType::get(mod->getContext(), 64),
  /*Params=*/FuncTy_32_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_33_args;
-FuncTy_33_args.push_back(Type::getFloatTy(mod->getContext()));
+FuncTy_33_args.push_back(Type::getDoubleTy(mod->getContext()));
 FunctionType* FuncTy_33 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 64),
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_33_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_34_args;
 FuncTy_34_args.push_back(Type::getFloatTy(mod->getContext()));
 FunctionType* FuncTy_34 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Result=*/IntegerType::get(mod->getContext(), 64),
  /*Params=*/FuncTy_34_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_35_args;
-FuncTy_35_args.push_back(PointerTy_1);
+FuncTy_35_args.push_back(Type::getFloatTy(mod->getContext()));
 FunctionType* FuncTy_35 = FunctionType::get(
- /*Result=*/PointerTy_1,
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_35_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_36_args;
 FuncTy_36_args.push_back(PointerTy_1);
 FunctionType* FuncTy_36 = FunctionType::get(
- /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Result=*/PointerTy_1,
  /*Params=*/FuncTy_36_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_37_args;
+FuncTy_37_args.push_back(PointerTy_1);
+FunctionType* FuncTy_37 = FunctionType::get(
+ /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Params=*/FuncTy_37_args,
  /*isVarArg=*/true);
 
 
@@ -441,7 +448,7 @@
 Function* func_art_throw_div_zero_from_code = mod->getFunction("art_throw_div_zero_from_code");
 if (!func_art_throw_div_zero_from_code) {
 func_art_throw_div_zero_from_code = Function::Create(
- /*Type=*/FuncTy_7,
+ /*Type=*/FuncTy_9,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_throw_div_zero_from_code", mod); // (external, no body)
 func_art_throw_div_zero_from_code->setCallingConv(CallingConv::C);
@@ -452,7 +459,7 @@
 Function* func_art_throw_array_bounds_from_code = mod->getFunction("art_throw_array_bounds_from_code");
 if (!func_art_throw_array_bounds_from_code) {
 func_art_throw_array_bounds_from_code = Function::Create(
- /*Type=*/FuncTy_9,
+ /*Type=*/FuncTy_10,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_throw_array_bounds_from_code", mod); // (external, no body)
 func_art_throw_array_bounds_from_code->setCallingConv(CallingConv::C);
@@ -463,7 +470,7 @@
 Function* func_art_throw_no_such_method_from_code = mod->getFunction("art_throw_no_such_method_from_code");
 if (!func_art_throw_no_such_method_from_code) {
 func_art_throw_no_such_method_from_code = Function::Create(
- /*Type=*/FuncTy_10,
+ /*Type=*/FuncTy_11,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_throw_no_such_method_from_code", mod); // (external, no body)
 func_art_throw_no_such_method_from_code->setCallingConv(CallingConv::C);
@@ -474,7 +481,7 @@
 Function* func_art_throw_null_pointer_exception_from_code = mod->getFunction("art_throw_null_pointer_exception_from_code");
 if (!func_art_throw_null_pointer_exception_from_code) {
 func_art_throw_null_pointer_exception_from_code = Function::Create(
- /*Type=*/FuncTy_10,
+ /*Type=*/FuncTy_11,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_throw_null_pointer_exception_from_code", mod); // (external, no body)
 func_art_throw_null_pointer_exception_from_code->setCallingConv(CallingConv::C);
@@ -485,7 +492,7 @@
 Function* func_art_throw_stack_overflow_from_code = mod->getFunction("art_throw_stack_overflow_from_code");
 if (!func_art_throw_stack_overflow_from_code) {
 func_art_throw_stack_overflow_from_code = Function::Create(
- /*Type=*/FuncTy_7,
+ /*Type=*/FuncTy_9,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_throw_stack_overflow_from_code", mod); // (external, no body)
 func_art_throw_stack_overflow_from_code->setCallingConv(CallingConv::C);
@@ -507,7 +514,7 @@
 Function* func_art_throw_verification_error_from_code = mod->getFunction("art_throw_verification_error_from_code");
 if (!func_art_throw_verification_error_from_code) {
 func_art_throw_verification_error_from_code = Function::Create(
- /*Type=*/FuncTy_11,
+ /*Type=*/FuncTy_12,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_throw_verification_error_from_code", mod); // (external, no body)
 func_art_throw_verification_error_from_code->setCallingConv(CallingConv::C);
@@ -518,7 +525,7 @@
 Function* func_art_find_catch_block_from_code = mod->getFunction("art_find_catch_block_from_code");
 if (!func_art_find_catch_block_from_code) {
 func_art_find_catch_block_from_code = Function::Create(
- /*Type=*/FuncTy_12,
+ /*Type=*/FuncTy_13,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_catch_block_from_code", mod); // (external, no body)
 func_art_find_catch_block_from_code->setCallingConv(CallingConv::C);
@@ -529,7 +536,7 @@
 Function* func_art_alloc_object_from_code = mod->getFunction("art_alloc_object_from_code");
 if (!func_art_alloc_object_from_code) {
 func_art_alloc_object_from_code = Function::Create(
- /*Type=*/FuncTy_13,
+ /*Type=*/FuncTy_14,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_alloc_object_from_code", mod); // (external, no body)
 func_art_alloc_object_from_code->setCallingConv(CallingConv::C);
@@ -540,7 +547,7 @@
 Function* func_art_alloc_object_from_code_with_access_check = mod->getFunction("art_alloc_object_from_code_with_access_check");
 if (!func_art_alloc_object_from_code_with_access_check) {
 func_art_alloc_object_from_code_with_access_check = Function::Create(
- /*Type=*/FuncTy_13,
+ /*Type=*/FuncTy_14,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_alloc_object_from_code_with_access_check", mod); // (external, no body)
 func_art_alloc_object_from_code_with_access_check->setCallingConv(CallingConv::C);
@@ -551,7 +558,7 @@
 Function* func_art_alloc_array_from_code = mod->getFunction("art_alloc_array_from_code");
 if (!func_art_alloc_array_from_code) {
 func_art_alloc_array_from_code = Function::Create(
- /*Type=*/FuncTy_14,
+ /*Type=*/FuncTy_15,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_alloc_array_from_code", mod); // (external, no body)
 func_art_alloc_array_from_code->setCallingConv(CallingConv::C);
@@ -562,7 +569,7 @@
 Function* func_art_alloc_array_from_code_with_access_check = mod->getFunction("art_alloc_array_from_code_with_access_check");
 if (!func_art_alloc_array_from_code_with_access_check) {
 func_art_alloc_array_from_code_with_access_check = Function::Create(
- /*Type=*/FuncTy_14,
+ /*Type=*/FuncTy_15,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_alloc_array_from_code_with_access_check", mod); // (external, no body)
 func_art_alloc_array_from_code_with_access_check->setCallingConv(CallingConv::C);
@@ -573,7 +580,7 @@
 Function* func_art_check_and_alloc_array_from_code = mod->getFunction("art_check_and_alloc_array_from_code");
 if (!func_art_check_and_alloc_array_from_code) {
 func_art_check_and_alloc_array_from_code = Function::Create(
- /*Type=*/FuncTy_14,
+ /*Type=*/FuncTy_15,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_check_and_alloc_array_from_code", mod); // (external, no body)
 func_art_check_and_alloc_array_from_code->setCallingConv(CallingConv::C);
@@ -584,7 +591,7 @@
 Function* func_art_check_and_alloc_array_from_code_with_access_check = mod->getFunction("art_check_and_alloc_array_from_code_with_access_check");
 if (!func_art_check_and_alloc_array_from_code_with_access_check) {
 func_art_check_and_alloc_array_from_code_with_access_check = Function::Create(
- /*Type=*/FuncTy_14,
+ /*Type=*/FuncTy_15,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_check_and_alloc_array_from_code_with_access_check", mod); // (external, no body)
 func_art_check_and_alloc_array_from_code_with_access_check->setCallingConv(CallingConv::C);
@@ -595,7 +602,7 @@
 Function* func_art_find_instance_field_from_code = mod->getFunction("art_find_instance_field_from_code");
 if (!func_art_find_instance_field_from_code) {
 func_art_find_instance_field_from_code = Function::Create(
- /*Type=*/FuncTy_15,
+ /*Type=*/FuncTy_16,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_instance_field_from_code", mod); // (external, no body)
 func_art_find_instance_field_from_code->setCallingConv(CallingConv::C);
@@ -606,7 +613,7 @@
 Function* func_art_find_static_field_from_code = mod->getFunction("art_find_static_field_from_code");
 if (!func_art_find_static_field_from_code) {
 func_art_find_static_field_from_code = Function::Create(
- /*Type=*/FuncTy_15,
+ /*Type=*/FuncTy_16,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_static_field_from_code", mod); // (external, no body)
 func_art_find_static_field_from_code->setCallingConv(CallingConv::C);
@@ -617,7 +624,7 @@
 Function* func_art_find_static_method_from_code_with_access_check = mod->getFunction("art_find_static_method_from_code_with_access_check");
 if (!func_art_find_static_method_from_code_with_access_check) {
 func_art_find_static_method_from_code_with_access_check = Function::Create(
- /*Type=*/FuncTy_16,
+ /*Type=*/FuncTy_17,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_static_method_from_code_with_access_check", mod); // (external, no body)
 func_art_find_static_method_from_code_with_access_check->setCallingConv(CallingConv::C);
@@ -628,7 +635,7 @@
 Function* func_art_find_direct_method_from_code_with_access_check = mod->getFunction("art_find_direct_method_from_code_with_access_check");
 if (!func_art_find_direct_method_from_code_with_access_check) {
 func_art_find_direct_method_from_code_with_access_check = Function::Create(
- /*Type=*/FuncTy_16,
+ /*Type=*/FuncTy_17,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_direct_method_from_code_with_access_check", mod); // (external, no body)
 func_art_find_direct_method_from_code_with_access_check->setCallingConv(CallingConv::C);
@@ -639,7 +646,7 @@
 Function* func_art_find_virtual_method_from_code_with_access_check = mod->getFunction("art_find_virtual_method_from_code_with_access_check");
 if (!func_art_find_virtual_method_from_code_with_access_check) {
 func_art_find_virtual_method_from_code_with_access_check = Function::Create(
- /*Type=*/FuncTy_16,
+ /*Type=*/FuncTy_17,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_virtual_method_from_code_with_access_check", mod); // (external, no body)
 func_art_find_virtual_method_from_code_with_access_check->setCallingConv(CallingConv::C);
@@ -650,7 +657,7 @@
 Function* func_art_find_super_method_from_code_with_access_check = mod->getFunction("art_find_super_method_from_code_with_access_check");
 if (!func_art_find_super_method_from_code_with_access_check) {
 func_art_find_super_method_from_code_with_access_check = Function::Create(
- /*Type=*/FuncTy_16,
+ /*Type=*/FuncTy_17,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_super_method_from_code_with_access_check", mod); // (external, no body)
 func_art_find_super_method_from_code_with_access_check->setCallingConv(CallingConv::C);
@@ -661,7 +668,7 @@
 Function* func_art_find_interface_method_from_code_with_access_check = mod->getFunction("art_find_interface_method_from_code_with_access_check");
 if (!func_art_find_interface_method_from_code_with_access_check) {
 func_art_find_interface_method_from_code_with_access_check = Function::Create(
- /*Type=*/FuncTy_16,
+ /*Type=*/FuncTy_17,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_interface_method_from_code_with_access_check", mod); // (external, no body)
 func_art_find_interface_method_from_code_with_access_check->setCallingConv(CallingConv::C);
@@ -672,7 +679,7 @@
 Function* func_art_find_interface_method_from_code = mod->getFunction("art_find_interface_method_from_code");
 if (!func_art_find_interface_method_from_code) {
 func_art_find_interface_method_from_code = Function::Create(
- /*Type=*/FuncTy_16,
+ /*Type=*/FuncTy_17,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_interface_method_from_code", mod); // (external, no body)
 func_art_find_interface_method_from_code->setCallingConv(CallingConv::C);
@@ -683,7 +690,7 @@
 Function* func_art_initialize_static_storage_from_code = mod->getFunction("art_initialize_static_storage_from_code");
 if (!func_art_initialize_static_storage_from_code) {
 func_art_initialize_static_storage_from_code = Function::Create(
- /*Type=*/FuncTy_13,
+ /*Type=*/FuncTy_14,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_initialize_static_storage_from_code", mod); // (external, no body)
 func_art_initialize_static_storage_from_code->setCallingConv(CallingConv::C);
@@ -694,7 +701,7 @@
 Function* func_art_initialize_type_from_code = mod->getFunction("art_initialize_type_from_code");
 if (!func_art_initialize_type_from_code) {
 func_art_initialize_type_from_code = Function::Create(
- /*Type=*/FuncTy_13,
+ /*Type=*/FuncTy_14,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_initialize_type_from_code", mod); // (external, no body)
 func_art_initialize_type_from_code->setCallingConv(CallingConv::C);
@@ -705,7 +712,7 @@
 Function* func_art_initialize_type_and_verify_access_from_code = mod->getFunction("art_initialize_type_and_verify_access_from_code");
 if (!func_art_initialize_type_and_verify_access_from_code) {
 func_art_initialize_type_and_verify_access_from_code = Function::Create(
- /*Type=*/FuncTy_13,
+ /*Type=*/FuncTy_14,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_initialize_type_and_verify_access_from_code", mod); // (external, no body)
 func_art_initialize_type_and_verify_access_from_code->setCallingConv(CallingConv::C);
@@ -716,7 +723,7 @@
 Function* func_art_resolve_string_from_code = mod->getFunction("art_resolve_string_from_code");
 if (!func_art_resolve_string_from_code) {
 func_art_resolve_string_from_code = Function::Create(
- /*Type=*/FuncTy_17,
+ /*Type=*/FuncTy_18,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_resolve_string_from_code", mod); // (external, no body)
 func_art_resolve_string_from_code->setCallingConv(CallingConv::C);
@@ -727,7 +734,7 @@
 Function* func_art_set32_static_from_code = mod->getFunction("art_set32_static_from_code");
 if (!func_art_set32_static_from_code) {
 func_art_set32_static_from_code = Function::Create(
- /*Type=*/FuncTy_18,
+ /*Type=*/FuncTy_19,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_set32_static_from_code", mod); // (external, no body)
 func_art_set32_static_from_code->setCallingConv(CallingConv::C);
@@ -738,7 +745,7 @@
 Function* func_art_set64_static_from_code = mod->getFunction("art_set64_static_from_code");
 if (!func_art_set64_static_from_code) {
 func_art_set64_static_from_code = Function::Create(
- /*Type=*/FuncTy_19,
+ /*Type=*/FuncTy_20,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_set64_static_from_code", mod); // (external, no body)
 func_art_set64_static_from_code->setCallingConv(CallingConv::C);
@@ -749,7 +756,7 @@
 Function* func_art_set_obj_static_from_code = mod->getFunction("art_set_obj_static_from_code");
 if (!func_art_set_obj_static_from_code) {
 func_art_set_obj_static_from_code = Function::Create(
- /*Type=*/FuncTy_20,
+ /*Type=*/FuncTy_21,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_set_obj_static_from_code", mod); // (external, no body)
 func_art_set_obj_static_from_code->setCallingConv(CallingConv::C);
@@ -760,7 +767,7 @@
 Function* func_art_get32_static_from_code = mod->getFunction("art_get32_static_from_code");
 if (!func_art_get32_static_from_code) {
 func_art_get32_static_from_code = Function::Create(
- /*Type=*/FuncTy_21,
+ /*Type=*/FuncTy_22,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_get32_static_from_code", mod); // (external, no body)
 func_art_get32_static_from_code->setCallingConv(CallingConv::C);
@@ -771,7 +778,7 @@
 Function* func_art_get64_static_from_code = mod->getFunction("art_get64_static_from_code");
 if (!func_art_get64_static_from_code) {
 func_art_get64_static_from_code = Function::Create(
- /*Type=*/FuncTy_22,
+ /*Type=*/FuncTy_23,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_get64_static_from_code", mod); // (external, no body)
 func_art_get64_static_from_code->setCallingConv(CallingConv::C);
@@ -782,7 +789,7 @@
 Function* func_art_get_obj_static_from_code = mod->getFunction("art_get_obj_static_from_code");
 if (!func_art_get_obj_static_from_code) {
 func_art_get_obj_static_from_code = Function::Create(
- /*Type=*/FuncTy_23,
+ /*Type=*/FuncTy_24,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_get_obj_static_from_code", mod); // (external, no body)
 func_art_get_obj_static_from_code->setCallingConv(CallingConv::C);
@@ -793,7 +800,7 @@
 Function* func_art_set32_instance_from_code = mod->getFunction("art_set32_instance_from_code");
 if (!func_art_set32_instance_from_code) {
 func_art_set32_instance_from_code = Function::Create(
- /*Type=*/FuncTy_24,
+ /*Type=*/FuncTy_25,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_set32_instance_from_code", mod); // (external, no body)
 func_art_set32_instance_from_code->setCallingConv(CallingConv::C);
@@ -804,7 +811,7 @@
 Function* func_art_set64_instance_from_code = mod->getFunction("art_set64_instance_from_code");
 if (!func_art_set64_instance_from_code) {
 func_art_set64_instance_from_code = Function::Create(
- /*Type=*/FuncTy_25,
+ /*Type=*/FuncTy_26,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_set64_instance_from_code", mod); // (external, no body)
 func_art_set64_instance_from_code->setCallingConv(CallingConv::C);
@@ -815,7 +822,7 @@
 Function* func_art_set_obj_instance_from_code = mod->getFunction("art_set_obj_instance_from_code");
 if (!func_art_set_obj_instance_from_code) {
 func_art_set_obj_instance_from_code = Function::Create(
- /*Type=*/FuncTy_26,
+ /*Type=*/FuncTy_27,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_set_obj_instance_from_code", mod); // (external, no body)
 func_art_set_obj_instance_from_code->setCallingConv(CallingConv::C);
@@ -826,7 +833,7 @@
 Function* func_art_get32_instance_from_code = mod->getFunction("art_get32_instance_from_code");
 if (!func_art_get32_instance_from_code) {
 func_art_get32_instance_from_code = Function::Create(
- /*Type=*/FuncTy_20,
+ /*Type=*/FuncTy_21,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_get32_instance_from_code", mod); // (external, no body)
 func_art_get32_instance_from_code->setCallingConv(CallingConv::C);
@@ -837,7 +844,7 @@
 Function* func_art_get64_instance_from_code = mod->getFunction("art_get64_instance_from_code");
 if (!func_art_get64_instance_from_code) {
 func_art_get64_instance_from_code = Function::Create(
- /*Type=*/FuncTy_27,
+ /*Type=*/FuncTy_28,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_get64_instance_from_code", mod); // (external, no body)
 func_art_get64_instance_from_code->setCallingConv(CallingConv::C);
@@ -848,7 +855,7 @@
 Function* func_art_get_obj_instance_from_code = mod->getFunction("art_get_obj_instance_from_code");
 if (!func_art_get_obj_instance_from_code) {
 func_art_get_obj_instance_from_code = Function::Create(
- /*Type=*/FuncTy_13,
+ /*Type=*/FuncTy_14,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_get_obj_instance_from_code", mod); // (external, no body)
 func_art_get_obj_instance_from_code->setCallingConv(CallingConv::C);
@@ -859,7 +866,7 @@
 Function* func_art_decode_jobject_in_thread = mod->getFunction("art_decode_jobject_in_thread");
 if (!func_art_decode_jobject_in_thread) {
 func_art_decode_jobject_in_thread = Function::Create(
- /*Type=*/FuncTy_28,
+ /*Type=*/FuncTy_29,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_decode_jobject_in_thread", mod); // (external, no body)
 func_art_decode_jobject_in_thread->setCallingConv(CallingConv::C);
@@ -870,7 +877,7 @@
 Function* func_art_fill_array_data_from_code = mod->getFunction("art_fill_array_data_from_code");
 if (!func_art_fill_array_data_from_code) {
 func_art_fill_array_data_from_code = Function::Create(
- /*Type=*/FuncTy_29,
+ /*Type=*/FuncTy_30,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_fill_array_data_from_code", mod); // (external, no body)
 func_art_fill_array_data_from_code->setCallingConv(CallingConv::C);
@@ -881,7 +888,7 @@
 Function* func_art_is_assignable_from_code = mod->getFunction("art_is_assignable_from_code");
 if (!func_art_is_assignable_from_code) {
 func_art_is_assignable_from_code = Function::Create(
- /*Type=*/FuncTy_30,
+ /*Type=*/FuncTy_31,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_is_assignable_from_code", mod); // (external, no body)
 func_art_is_assignable_from_code->setCallingConv(CallingConv::C);
@@ -914,7 +921,7 @@
 Function* func_art_d2l = mod->getFunction("art_d2l");
 if (!func_art_d2l) {
 func_art_d2l = Function::Create(
- /*Type=*/FuncTy_31,
+ /*Type=*/FuncTy_32,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_d2l", mod); // (external, no body)
 func_art_d2l->setCallingConv(CallingConv::C);
@@ -925,7 +932,7 @@
 Function* func_art_d2i = mod->getFunction("art_d2i");
 if (!func_art_d2i) {
 func_art_d2i = Function::Create(
- /*Type=*/FuncTy_32,
+ /*Type=*/FuncTy_33,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_d2i", mod); // (external, no body)
 func_art_d2i->setCallingConv(CallingConv::C);
@@ -936,7 +943,7 @@
 Function* func_art_f2l = mod->getFunction("art_f2l");
 if (!func_art_f2l) {
 func_art_f2l = Function::Create(
- /*Type=*/FuncTy_33,
+ /*Type=*/FuncTy_34,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_f2l", mod); // (external, no body)
 func_art_f2l->setCallingConv(CallingConv::C);
@@ -947,7 +954,7 @@
 Function* func_art_f2i = mod->getFunction("art_f2i");
 if (!func_art_f2i) {
 func_art_f2i = Function::Create(
- /*Type=*/FuncTy_34,
+ /*Type=*/FuncTy_35,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_f2i", mod); // (external, no body)
 func_art_f2i->setCallingConv(CallingConv::C);
@@ -969,7 +976,7 @@
 Function* func_art_fix_stub_from_code = mod->getFunction("art_fix_stub_from_code");
 if (!func_art_fix_stub_from_code) {
 func_art_fix_stub_from_code = Function::Create(
- /*Type=*/FuncTy_35,
+ /*Type=*/FuncTy_36,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_fix_stub_from_code", mod); // (external, no body)
 func_art_fix_stub_from_code->setCallingConv(CallingConv::C);
@@ -980,7 +987,7 @@
 Function* func_art_proxy_invoke_handler_from_code = mod->getFunction("art_proxy_invoke_handler_from_code");
 if (!func_art_proxy_invoke_handler_from_code) {
 func_art_proxy_invoke_handler_from_code = Function::Create(
- /*Type=*/FuncTy_36,
+ /*Type=*/FuncTy_37,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_proxy_invoke_handler_from_code", mod); // (external, no body)
 func_art_proxy_invoke_handler_from_code->setCallingConv(CallingConv::C);
diff --git a/src/compiler_llvm/ir_builder.h b/src/compiler_llvm/ir_builder.h
index e1a47c4..46c37f1 100644
--- a/src/compiler_llvm/ir_builder.h
+++ b/src/compiler_llvm/ir_builder.h
@@ -295,6 +295,10 @@
     return jobject_type_;
   }
 
+  llvm::Type* getArtFrameTy() {
+    return art_frame_type_;
+  }
+
   llvm::PointerType* getJEnvTy() {
     return jenv_type_;
   }
diff --git a/src/compiler_llvm/jni_compiler.cc b/src/compiler_llvm/jni_compiler.cc
index 4b9fb05..c76c80d 100644
--- a/src/compiler_llvm/jni_compiler.cc
+++ b/src/compiler_llvm/jni_compiler.cc
@@ -136,7 +136,8 @@
 
   // Push the shadow frame
   llvm::Value* shadow_frame_upcast = irb_.CreateConstGEP2_32(shadow_frame_, 0, 0);
-  irb_.CreateCall(irb_.GetRuntime(PushShadowFrame), shadow_frame_upcast);
+  llvm::Value* old_shadow_frame =
+      irb_.CreateCall(irb_.GetRuntime(PushShadowFrame), shadow_frame_upcast);
 
   // Get JNIEnv
   llvm::Value* jni_env_object_addr =
@@ -271,7 +272,7 @@
                            kTBAARuntimeInfo);
 
   // Pop the shadow frame
-  irb_.CreateCall(irb_.GetRuntime(PopShadowFrame));
+  irb_.CreateCall(irb_.GetRuntime(PopShadowFrame), old_shadow_frame);
 
   // Return!
   if (return_shorty != 'V') {
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index 2781598..52b7b5f 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -19,6 +19,7 @@
 #include "backend_types.h"
 #include "compilation_unit.h"
 #include "compiler.h"
+#include "dalvik_reg.h"
 #include "inferred_reg_category_map.h"
 #include "ir_builder.h"
 #include "logging.h"
@@ -63,6 +64,7 @@
     irb_(*cunit->GetIRBuilder()),
     func_(NULL),
     regs_(code_item_->registers_size_),
+    shadow_frame_entries_(code_item_->registers_size_),
     reg_to_shadow_frame_index_(code_item_->registers_size_, -1),
     retval_reg_(NULL),
     basic_block_stack_overflow_(NULL),
@@ -71,7 +73,8 @@
     basic_blocks_(code_item_->insns_size_in_code_units_),
     basic_block_landing_pads_(code_item_->tries_size_, NULL),
     basic_block_unwind_(NULL), basic_block_unreachable_(NULL),
-    shadow_frame_(NULL), elf_func_idx_(cunit_->AcquireUniqueElfFuncIndex()) {
+    shadow_frame_(NULL), jvalue_temp_(NULL), old_shadow_frame_(NULL),
+    elf_func_idx_(cunit_->AcquireUniqueElfFuncIndex()) {
 }
 
 
@@ -170,18 +173,29 @@
   irb_.SetInsertPoint(basic_block_alloca_);
   jvalue_temp_ = irb_.CreateAlloca(irb_.getJValueTy());
 
-  // Create register array
-  for (uint16_t r = 0; r < code_item_->registers_size_; ++r) {
-    regs_[r] = DalvikReg::CreateLocalVarReg(*this, r);
-  }
-
-  retval_reg_.reset(DalvikReg::CreateRetValReg(*this));
-
   // Create Shadow Frame
   if (method_info_.need_shadow_frame) {
     EmitPrologueAllocShadowFrame();
   }
 
+  // Create register array
+  for (uint16_t r = 0; r < code_item_->registers_size_; ++r) {
+    std::string name;
+#if !defined(NDEBUG)
+    name = StringPrintf("%u", r);
+#endif
+    regs_[r] = new DalvikReg(*this, name);
+
+    // Cache shadow frame entry address
+    shadow_frame_entries_[r] = GetShadowFrameEntry(r);
+  }
+
+  std::string name;
+#if !defined(NDEBUG)
+  name = "_res";
+#endif
+  retval_reg_.reset(new DalvikReg(*this, name));
+
   // Store argument to dalvik register
   irb_.SetInsertPoint(basic_block_reg_arg_init_);
   EmitPrologueAssignArgRegister();
@@ -307,7 +321,7 @@
   llvm::Value* shadow_frame_upcast =
     irb_.CreateConstGEP2_32(shadow_frame_, 0, 0);
 
-  irb_.CreateCall(irb_.GetRuntime(PushShadowFrame), shadow_frame_upcast);
+  old_shadow_frame_ = irb_.CreateCall(irb_.GetRuntime(PushShadowFrame), shadow_frame_upcast);
 }
 
 
@@ -324,13 +338,13 @@
   ++arg_iter; // skip method object
 
   if (!oat_compilation_unit_->IsStatic()) {
-    EmitStoreDalvikReg(arg_reg, kObject, kAccurate, arg_iter);
+    regs_[arg_reg]->SetValue(kObject, kAccurate, arg_iter);
     ++arg_iter;
     ++arg_reg;
   }
 
   for (uint32_t i = 1; i < shorty_size; ++i, ++arg_iter) {
-    EmitStoreDalvikReg(arg_reg, shorty[i], kAccurate, arg_iter);
+    regs_[arg_reg]->SetValue(shorty[i], kAccurate, arg_iter);
 
     ++arg_reg;
     if (shorty[i] == 'J' || shorty[i] == 'D') {
@@ -3876,14 +3890,13 @@
 }
 
 
-llvm::Value* MethodCompiler::AllocDalvikLocalVarReg(RegCategory cat,
-                                                    uint32_t reg_idx) {
+llvm::Value* MethodCompiler::AllocDalvikReg(RegCategory cat, const std::string& name) {
   // Get reg_type and reg_name from DalvikReg
   llvm::Type* reg_type = DalvikReg::GetRegCategoryEquivSizeTy(irb_, cat);
   std::string reg_name;
 
 #if !defined(NDEBUG)
-  StringAppendF(&reg_name, "%c%u", DalvikReg::GetRegCategoryNamePrefix(cat), reg_idx);
+  StringAppendF(&reg_name, "%c%s", DalvikReg::GetRegCategoryNamePrefix(cat), name.c_str());
 #endif
 
   // Save current IR builder insert point
@@ -3901,7 +3914,7 @@
 }
 
 
-llvm::Value* MethodCompiler::AllocShadowFrameEntry(uint32_t reg_idx) {
+llvm::Value* MethodCompiler::GetShadowFrameEntry(uint32_t reg_idx) {
   if (reg_to_shadow_frame_index_[reg_idx] == -1) {
     // This register dosen't need ShadowFrame entry
     return NULL;
@@ -3914,7 +3927,7 @@
   std::string reg_name;
 
 #if !defined(NDEBUG)
-  StringAppendF(&reg_name, "o%u", reg_idx);
+  StringAppendF(&reg_name, "s%u", reg_idx);
 #endif
 
   // Save current IR builder insert point
@@ -3938,35 +3951,12 @@
 }
 
 
-llvm::Value* MethodCompiler::AllocDalvikRetValReg(RegCategory cat) {
-  // Get reg_type and reg_name from DalvikReg
-  llvm::Type* reg_type = DalvikReg::GetRegCategoryEquivSizeTy(irb_, cat);
-  std::string reg_name;
-
-#if !defined(NDEBUG)
-  StringAppendF(&reg_name, "%c_res", DalvikReg::GetRegCategoryNamePrefix(cat));
-#endif
-
-  // Save current IR builder insert point
-  llvm::IRBuilderBase::InsertPoint irb_ip_original = irb_.saveIP();
-  irb_.SetInsertPoint(basic_block_alloca_);
-
-  // Alloca
-  llvm::Value* reg_addr = irb_.CreateAlloca(reg_type, 0, reg_name);
-
-  // Restore IRBuilder insert point
-  irb_.restoreIP(irb_ip_original);
-
-  DCHECK_NE(reg_addr, static_cast<llvm::Value*>(NULL));
-  return reg_addr;
-}
-
-
 void MethodCompiler::EmitPopShadowFrame() {
   if (!method_info_.need_shadow_frame) {
     return;
   }
-  irb_.CreateCall(irb_.GetRuntime(PopShadowFrame));
+  DCHECK(old_shadow_frame_ != NULL);
+  irb_.CreateCall(irb_.GetRuntime(PopShadowFrame), old_shadow_frame_);
 }
 
 
@@ -3981,6 +3971,48 @@
 }
 
 
+llvm::Value* MethodCompiler::EmitLoadDalvikReg(uint32_t reg_idx, JType jty,
+                                               JTypeSpace space) {
+  return regs_[reg_idx]->GetValue(jty, space);
+}
+
+llvm::Value* MethodCompiler::EmitLoadDalvikReg(uint32_t reg_idx, char shorty,
+                                               JTypeSpace space) {
+  return EmitLoadDalvikReg(reg_idx, GetJTypeFromShorty(shorty), space);
+}
+
+void MethodCompiler::EmitStoreDalvikReg(uint32_t reg_idx, JType jty,
+                                        JTypeSpace space, llvm::Value* new_value) {
+  regs_[reg_idx]->SetValue(jty, space, new_value);
+  if (jty == kObject && shadow_frame_entries_[reg_idx] != NULL) {
+    irb_.CreateStore(new_value, shadow_frame_entries_[reg_idx], kTBAAShadowFrame);
+  }
+}
+
+void MethodCompiler::EmitStoreDalvikReg(uint32_t reg_idx, char shorty,
+                                        JTypeSpace space, llvm::Value* new_value) {
+  EmitStoreDalvikReg(reg_idx, GetJTypeFromShorty(shorty), space, new_value);
+}
+
+llvm::Value* MethodCompiler::EmitLoadDalvikRetValReg(JType jty, JTypeSpace space) {
+  return retval_reg_->GetValue(jty, space);
+}
+
+llvm::Value* MethodCompiler::EmitLoadDalvikRetValReg(char shorty, JTypeSpace space) {
+  return EmitLoadDalvikRetValReg(GetJTypeFromShorty(shorty), space);
+}
+
+void MethodCompiler::EmitStoreDalvikRetValReg(JType jty, JTypeSpace space,
+                                              llvm::Value* new_value) {
+  retval_reg_->SetValue(jty, space, new_value);
+}
+
+void MethodCompiler::EmitStoreDalvikRetValReg(char shorty, JTypeSpace space,
+                                              llvm::Value* new_value) {
+  EmitStoreDalvikRetValReg(GetJTypeFromShorty(shorty), space, new_value);
+}
+
+
 // TODO: Use high-level IR to do this
 bool MethodCompiler::EmitInlineJavaIntrinsic(const std::string& callee_method_name,
                                              const std::vector<llvm::Value*>& args,
@@ -4139,18 +4171,7 @@
       break;
 
     case Instruction::INSTANCE_OF:
-      may_throw_exception = true;
-      if (dec_insn.vA == this_reg_idx) {
-        modify_this = true;
-      }
-      break;
-
     case Instruction::ARRAY_LENGTH:
-      if (dec_insn.vA == this_reg_idx) {
-        modify_this = true;
-      }
-      break;
-
     case Instruction::NEW_INSTANCE:
     case Instruction::NEW_ARRAY:
       may_throw_exception = true;
diff --git a/src/compiler_llvm/method_compiler.h b/src/compiler_llvm/method_compiler.h
index 50411a1..c912397 100644
--- a/src/compiler_llvm/method_compiler.h
+++ b/src/compiler_llvm/method_compiler.h
@@ -18,7 +18,6 @@
 #define ART_SRC_COMPILER_LLVM_METHOD_COMPILER_H_
 
 #include "backend_types.h"
-#include "dalvik_reg.h"
 #include "dex_file.h"
 #include "dex_instruction.h"
 #include "invoke_type.h"
@@ -59,6 +58,7 @@
 
 class CompilationUnit;
 class CompilerLLVM;
+class DalvikReg;
 class IRBuilder;
 
 class MethodCompiler {
@@ -81,11 +81,9 @@
 
   // Register helper function
 
-  llvm::Value* AllocDalvikLocalVarReg(RegCategory cat, uint32_t reg_idx);
+  llvm::Value* AllocDalvikReg(RegCategory cat, const std::string& name);
 
-  llvm::Value* AllocShadowFrameEntry(uint32_t reg_idx);
-
-  llvm::Value* AllocDalvikRetValReg(RegCategory cat);
+  llvm::Value* GetShadowFrameEntry(uint32_t reg_idx);
 
 
  private:
@@ -395,43 +393,23 @@
 
   // Register helper function
 
-  llvm::Value* EmitLoadDalvikReg(uint32_t reg_idx, JType jty,
-                                 JTypeSpace space) {
-    return regs_[reg_idx]->GetValue(jty, space);
-  }
+  llvm::Value* EmitLoadDalvikReg(uint32_t reg_idx, JType jty, JTypeSpace space);
 
-  llvm::Value* EmitLoadDalvikReg(uint32_t reg_idx, char shorty,
-                                 JTypeSpace space) {
-    return EmitLoadDalvikReg(reg_idx, GetJTypeFromShorty(shorty), space);
-  }
+  llvm::Value* EmitLoadDalvikReg(uint32_t reg_idx, char shorty, JTypeSpace space);
 
   void EmitStoreDalvikReg(uint32_t reg_idx, JType jty,
-                          JTypeSpace space, llvm::Value* new_value) {
-    regs_[reg_idx]->SetValue(jty, space, new_value);
-  }
+                          JTypeSpace space, llvm::Value* new_value);
 
   void EmitStoreDalvikReg(uint32_t reg_idx, char shorty,
-                          JTypeSpace space, llvm::Value* new_value) {
-    EmitStoreDalvikReg(reg_idx, GetJTypeFromShorty(shorty), space, new_value);
-  }
+                          JTypeSpace space, llvm::Value* new_value);
 
-  llvm::Value* EmitLoadDalvikRetValReg(JType jty, JTypeSpace space) {
-    return retval_reg_->GetValue(jty, space);
-  }
+  llvm::Value* EmitLoadDalvikRetValReg(JType jty, JTypeSpace space);
 
-  llvm::Value* EmitLoadDalvikRetValReg(char shorty, JTypeSpace space) {
-    return EmitLoadDalvikRetValReg(GetJTypeFromShorty(shorty), space);
-  }
+  llvm::Value* EmitLoadDalvikRetValReg(char shorty, JTypeSpace space);
 
-  void EmitStoreDalvikRetValReg(JType jty, JTypeSpace space,
-                                llvm::Value* new_value) {
-    retval_reg_->SetValue(jty, space, new_value);
-  }
+  void EmitStoreDalvikRetValReg(JType jty, JTypeSpace space, llvm::Value* new_value);
 
-  void EmitStoreDalvikRetValReg(char shorty, JTypeSpace space,
-                                llvm::Value* new_value) {
-    EmitStoreDalvikRetValReg(GetJTypeFromShorty(shorty), space, new_value);
-  }
+  void EmitStoreDalvikRetValReg(char shorty, JTypeSpace space, llvm::Value* new_value);
 
   // TODO: Use high-level IR to do this
   bool EmitInlineJavaIntrinsic(const std::string& callee_method_name,
@@ -477,6 +455,7 @@
   llvm::Function* func_;
 
   std::vector<DalvikReg*> regs_;
+  std::vector<llvm::Value*> shadow_frame_entries_;
   std::vector<int32_t> reg_to_shadow_frame_index_;
   UniquePtr<DalvikReg> retval_reg_;
 
@@ -492,6 +471,7 @@
 
   llvm::AllocaInst* shadow_frame_;
   llvm::AllocaInst* jvalue_temp_;
+  llvm::Value* old_shadow_frame_;
 
   uint16_t elf_func_idx_;
 };
diff --git a/src/compiler_llvm/runtime_support_builder.cc b/src/compiler_llvm/runtime_support_builder.cc
index 5a56890..3bcd212 100644
--- a/src/compiler_llvm/runtime_support_builder.cc
+++ b/src/compiler_llvm/runtime_support_builder.cc
@@ -83,17 +83,17 @@
     Value* new_shadow_frame = func->arg_begin();
     Value* old_shadow_frame = irb_.LoadFromObjectOffset(thread,
                                                         Thread::TopShadowFrameOffset().Int32Value(),
-                                                        irb_.getJObjectTy(),
+                                                        irb_.getArtFrameTy()->getPointerTo(),
                                                         kTBAARuntimeInfo);
-    irb_.StoreToObjectOffset(new_shadow_frame,
-                             ShadowFrame::LinkOffset(),
-                             old_shadow_frame,
-                             kTBAAShadowFrame);
     irb_.StoreToObjectOffset(thread,
                              Thread::TopShadowFrameOffset().Int32Value(),
                              new_shadow_frame,
                              kTBAARuntimeInfo);
-    irb_.CreateRetVoid();
+    irb_.StoreToObjectOffset(new_shadow_frame,
+                             ShadowFrame::LinkOffset(),
+                             old_shadow_frame,
+                             kTBAAShadowFrame);
+    irb_.CreateRet(old_shadow_frame);
 
     VERIFY_LLVM_FUNCTION(*func);
   }
@@ -106,14 +106,7 @@
 
     Function* get_thread = GetRuntimeSupportFunction(GetCurrentThread);
     Value* thread = irb_.CreateCall(get_thread);
-    Value* new_shadow_frame = irb_.LoadFromObjectOffset(thread,
-                                                        Thread::TopShadowFrameOffset().Int32Value(),
-                                                        irb_.getJObjectTy(),
-                                                        kTBAARuntimeInfo);
-    Value* old_shadow_frame = irb_.LoadFromObjectOffset(new_shadow_frame,
-                                                        ShadowFrame::LinkOffset(),
-                                                        irb_.getJObjectTy(),
-                                                        kTBAAShadowFrame);
+    Value* old_shadow_frame = func->arg_begin();
     irb_.StoreToObjectOffset(thread,
                              Thread::TopShadowFrameOffset().Int32Value(),
                              old_shadow_frame,
diff --git a/src/compiler_llvm/runtime_support_llvm.cc b/src/compiler_llvm/runtime_support_llvm.cc
index 8eb378b..86bf954 100644
--- a/src/compiler_llvm/runtime_support_llvm.cc
+++ b/src/compiler_llvm/runtime_support_llvm.cc
@@ -80,11 +80,12 @@
   Runtime::Current()->GetThreadList()->FullSuspendCheck(thread);
 }
 
-void art_push_shadow_frame_from_code(void* new_shadow_frame) {
+void* art_push_shadow_frame_from_code(void* new_shadow_frame) {
   LOG(FATAL) << "Implemented by IRBuilder.";
+  return NULL;
 }
 
-void art_pop_shadow_frame_from_code() {
+void art_pop_shadow_frame_from_code(void*) {
   LOG(FATAL) << "Implemented by IRBuilder.";
 }
 
diff --git a/src/compiler_llvm/runtime_support_llvm.h b/src/compiler_llvm/runtime_support_llvm.h
index f8228c5..b7f0655 100644
--- a/src/compiler_llvm/runtime_support_llvm.h
+++ b/src/compiler_llvm/runtime_support_llvm.h
@@ -36,9 +36,9 @@
 // Thread
 //----------------------------------------------------------------------------
 
-void art_push_shadow_frame_from_code(void* new_shadow_frame);
+void* art_push_shadow_frame_from_code(void* new_shadow_frame);
 
-void art_pop_shadow_frame_from_code();
+void art_pop_shadow_frame_from_code(void*);
 
 
 //----------------------------------------------------------------------------
diff --git a/src/mem_map.cc b/src/mem_map.cc
index 9943343..ba34d8b 100644
--- a/src/mem_map.cc
+++ b/src/mem_map.cc
@@ -176,7 +176,8 @@
 
   byte* actual = reinterpret_cast<byte*>(mmap(addr, page_aligned_size, prot, flags, fd.get(), 0));
   if (actual == MAP_FAILED) {
-    PLOG(ERROR) << "mmap failed (" << name << ")";
+    PLOG(ERROR) << "mmap(" << reinterpret_cast<void*>(addr) << ", " << page_aligned_size
+                << ", " << prot << ", " << flags << ", " << fd.get() << ", 0) failed for " << name;
     return NULL;
   }
   return new MemMap(actual, length, actual, page_aligned_size);
diff --git a/test/ConcurrentGC/ConcurrentGC.java b/test/ConcurrentGC/ConcurrentGC.java
new file mode 100644
index 0000000..1a0fec8
--- /dev/null
+++ b/test/ConcurrentGC/ConcurrentGC.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Random;
+
+public class ConcurrentGC {
+    private static final int buckets = 16 * 1024;
+    private static final int bufferSize = 1024;
+
+    static class ByteContainer {
+        public byte[] bytes;
+    }
+
+    public static void main(String[] args) throws Exception {
+        try {
+            ByteContainer[] l = new ByteContainer[buckets];
+
+            for (int i = 0; i < buckets; ++i) {
+                l[i] = new ByteContainer();
+            }
+
+            Random rnd = new Random(123456);
+            for (int i = 0; i < buckets / 256; ++i) {
+                int index = rnd.nextInt(buckets);
+                l[index].bytes = new byte[bufferSize];
+
+                // Try to get GC to run if we can
+                Runtime.getRuntime().gc();
+
+                // Shuffle the array to try cause the lost object problem:
+                // This problem occurs when an object is white, it may be
+                // only referenced from a white or grey object. If the white
+                // object is moved during a CMS to be a black object's field, it
+                // causes the moved object to not get marked. This can result in
+                // heap corruption. A typical way to address this issue is by
+                // having a card table.
+                // This aspect of the test is meant to ensure that card
+                // dirtying works and that we check the marked cards after
+                // marking.
+                // If these operations are not done, a segfault / failed assert
+                // should occur.
+                for (int j = 0; j < l.length; ++j) {
+                    int a = l.length - i - 1;
+                    int b = rnd.nextInt(a);
+                    byte[] temp = l[a].bytes;
+                    l[a].bytes = l[b].bytes;
+                    l[b].bytes = temp;
+                }
+            }
+        } catch (OutOfMemoryError e) {
+        }
+    }
+}