Implement Link-loading and pass 62 tests in JniInternalTest.

The passed tests include the 12 originally ARM-only tests. Now it works
on x86 as well if defined(ART_USE_LLVM_COMPILER).

Change-Id: I03092637fa4f0979ca77e0cac06e5d31a867e465
diff --git a/src/compiler_llvm/compiler_llvm.cc b/src/compiler_llvm/compiler_llvm.cc
index 56f0b07..0985894 100644
--- a/src/compiler_llvm/compiler_llvm.cc
+++ b/src/compiler_llvm/compiler_llvm.cc
@@ -55,8 +55,8 @@
 
 
 CompilerLLVM::CompilerLLVM(Compiler* compiler, InstructionSet insn_set)
-: compiler_(compiler), compiler_lock_("llvm_compiler_lock"),
-  insn_set_(insn_set), cunit_counter_(0) {
+    : compiler_(compiler), compiler_lock_("llvm_compiler_lock"),
+      insn_set_(insn_set), cunit_counter_(0) {
 
   // Initialize LLVM libraries
   pthread_once(&llvm_initialized, InitializeLLVM);
@@ -69,6 +69,7 @@
 
 
 void CompilerLLVM::EnsureCompilationUnit() {
+  MutexLock GUARD(compiler_lock_);
   DCHECK_NE(llvm_initialized, PTHREAD_ONCE_INIT);
   if (cunit_.get() == NULL) {
     cunit_.reset(new CompilationUnit(insn_set_));