Merge iceland to greenland.

Change-Id: Ic4440a658bb2fccb558024a736d896baaf172f3c
diff --git a/src/compiler_llvm/compiler_llvm.cc b/src/compiler_llvm/compiler_llvm.cc
index dc79643..3a1bebc 100644
--- a/src/compiler_llvm/compiler_llvm.cc
+++ b/src/compiler_llvm/compiler_llvm.cc
@@ -116,7 +116,11 @@
 
 CompilationUnit* CompilerLLVM::AllocateCompilationUnit() {
   MutexLock GUARD(num_cunits_lock_);
-  return new CompilationUnit(this, num_cunits_++);
+  CompilationUnit* cunit = new CompilationUnit(this, num_cunits_++);
+  if (!bitcode_filename_.empty()) {
+    cunit->SetBitcodeFileName(StringPrintf("%s-%zu", bitcode_filename_.c_str(), num_cunits_-1));
+  }
+  return cunit;
 }
 
 
diff --git a/src/compiler_llvm/compiler_llvm.h b/src/compiler_llvm/compiler_llvm.h
index 24a766e..4680648 100644
--- a/src/compiler_llvm/compiler_llvm.h
+++ b/src/compiler_llvm/compiler_llvm.h
@@ -89,12 +89,6 @@
  private:
   CompilationUnit* AllocateCompilationUnit();
 
-  void Materialize(CompilationUnit* cunit);
-
-  bool IsBitcodeFileNameAvailable() const {
-    return !bitcode_filename_.empty();
-  }
-
   Compiler* compiler_;
 
   InstructionSet insn_set_;
diff --git a/src/compiler_llvm/gbc_expander.cc b/src/compiler_llvm/gbc_expander.cc
index e2b9834..77c1bf5 100644
--- a/src/compiler_llvm/gbc_expander.cc
+++ b/src/compiler_llvm/gbc_expander.cc
@@ -194,8 +194,13 @@
 char GBCExpanderPass::ID = 0;
 
 bool GBCExpanderPass::runOnFunction(llvm::Function& func) {
+  // Runtime support or stub
+  if (func.getName().startswith("art_") || func.getName().startswith("Art")) {
+    return false;
+  }
   bool changed;
 
+  // TODO: Use intrinsic.
   changed = InsertStackOverflowCheck(func);
 
   std::list<std::pair<llvm::CallInst*,
@@ -962,7 +967,7 @@
   switch (intr_id) {
     //==- Thread -----------------------------------------------------------==//
     case IntrinsicHelper::GetCurrentThread: {
-      return ExpandToRuntime(runtime_support::GetCurrentThread, call_inst);
+      return irb_.Runtime().EmitGetCurrentThread();
     }
     case IntrinsicHelper::TestSuspend: {
       Expand_TestSuspend(call_inst);
diff --git a/src/compiler_llvm/runtime_support_builder.cc b/src/compiler_llvm/runtime_support_builder.cc
index 8bbac94..7ef8917 100644
--- a/src/compiler_llvm/runtime_support_builder.cc
+++ b/src/compiler_llvm/runtime_support_builder.cc
@@ -235,7 +235,7 @@
     Function* slow_func = GetRuntimeSupportFunction(runtime_support::TestSuspend);
     Function* func = Function::Create(slow_func->getFunctionType(),
                                       GlobalValue::LinkOnceODRLinkage,
-                                      "test_suspend_fast",
+                                      "art_test_suspend_fast",
                                       &module_);
     MakeFunctionInline(func);
     BasicBlock* basic_block = BasicBlock::Create(context_, "entry", func);