summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler_llvm/art_module.ll2
-rw-r--r--src/compiler_llvm/generated/art_module.cc12
-rw-r--r--src/compiler_llvm/jni_compiler.cc5
-rw-r--r--src/compiler_llvm/method_compiler.cc9
-rw-r--r--src/compiler_llvm/runtime_support_builder.cc14
-rw-r--r--src/compiler_llvm/runtime_support_builder_arm.cc5
-rw-r--r--src/compiler_llvm/runtime_support_builder_x86.cc5
-rw-r--r--src/compiler_llvm/upcall_compiler.cc3
-rw-r--r--src/compiler_llvm/utils_llvm.h8
9 files changed, 46 insertions, 17 deletions
diff --git a/src/compiler_llvm/art_module.ll b/src/compiler_llvm/art_module.ll
index 87be92acb9..6d4b56b6a1 100644
--- a/src/compiler_llvm/art_module.ll
+++ b/src/compiler_llvm/art_module.ll
@@ -41,7 +41,7 @@ declare void @art_set_current_thread_from_code(%JavaObject*)
declare void @art_lock_object_from_code(%JavaObject*, %JavaObject*)
declare void @art_unlock_object_from_code(%JavaObject*, %JavaObject*)
-declare void @art_test_suspend_from_code()
+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()
diff --git a/src/compiler_llvm/generated/art_module.cc b/src/compiler_llvm/generated/art_module.cc
index c727d406ef..1237ec05be 100644
--- a/src/compiler_llvm/generated/art_module.cc
+++ b/src/compiler_llvm/generated/art_module.cc
@@ -83,13 +83,13 @@ FunctionType* FuncTy_5 = FunctionType::get(
/*isVarArg=*/false);
std::vector<Type*>FuncTy_6_args;
+FuncTy_6_args.push_back(PointerTy_2);
FunctionType* FuncTy_6 = FunctionType::get(
/*Result=*/Type::getVoidTy(mod->getContext()),
/*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,
@@ -387,7 +387,7 @@ func_art_unlock_object_from_code->setAttributes(func_art_unlock_object_from_code
Function* func_art_test_suspend_from_code = mod->getFunction("art_test_suspend_from_code");
if (!func_art_test_suspend_from_code) {
func_art_test_suspend_from_code = Function::Create(
- /*Type=*/FuncTy_6,
+ /*Type=*/FuncTy_4,
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"art_test_suspend_from_code", mod); // (external, no body)
func_art_test_suspend_from_code->setCallingConv(CallingConv::C);
@@ -398,7 +398,7 @@ func_art_test_suspend_from_code->setAttributes(func_art_test_suspend_from_code_P
Function* func_art_push_shadow_frame_from_code = mod->getFunction("art_push_shadow_frame_from_code");
if (!func_art_push_shadow_frame_from_code) {
func_art_push_shadow_frame_from_code = Function::Create(
- /*Type=*/FuncTy_7,
+ /*Type=*/FuncTy_6,
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"art_push_shadow_frame_from_code", mod); // (external, no body)
func_art_push_shadow_frame_from_code->setCallingConv(CallingConv::C);
@@ -409,7 +409,7 @@ func_art_push_shadow_frame_from_code->setAttributes(func_art_push_shadow_frame_f
Function* func_art_pop_shadow_frame_from_code = mod->getFunction("art_pop_shadow_frame_from_code");
if (!func_art_pop_shadow_frame_from_code) {
func_art_pop_shadow_frame_from_code = Function::Create(
- /*Type=*/FuncTy_6,
+ /*Type=*/FuncTy_7,
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"art_pop_shadow_frame_from_code", mod); // (external, no body)
func_art_pop_shadow_frame_from_code->setCallingConv(CallingConv::C);
@@ -431,7 +431,7 @@ func_art_is_exception_pending_from_code->setAttributes(func_art_is_exception_pen
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_6,
+ /*Type=*/FuncTy_7,
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"art_throw_div_zero_from_code", mod); // (external, no body)
func_art_throw_div_zero_from_code->setCallingConv(CallingConv::C);
@@ -475,7 +475,7 @@ func_art_throw_null_pointer_exception_from_code->setAttributes(func_art_throw_nu
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_6,
+ /*Type=*/FuncTy_7,
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"art_throw_stack_overflow_from_code", mod); // (external, no body)
func_art_throw_stack_overflow_from_code->setCallingConv(CallingConv::C);
diff --git a/src/compiler_llvm/jni_compiler.cc b/src/compiler_llvm/jni_compiler.cc
index c1152ab96e..02985f79b4 100644
--- a/src/compiler_llvm/jni_compiler.cc
+++ b/src/compiler_llvm/jni_compiler.cc
@@ -30,7 +30,6 @@
#include "shadow_frame.h"
#include "utils_llvm.h"
-#include <llvm/Analysis/Verifier.h>
#include <llvm/BasicBlock.h>
#include <llvm/DerivedTypes.h>
#include <llvm/Function.h>
@@ -264,7 +263,7 @@ CompiledMethod* JniCompiler::Compile() {
irb_.getInt32(kRunnable));
// Do a suspend check
- irb_.CreateCall(irb_.GetRuntime(TestSuspend));
+ irb_.CreateCall(irb_.GetRuntime(TestSuspend), thread_object_addr);
if (return_shorty == 'L') {
// If the return value is reference, it may point to SIRT, we should decode it.
@@ -298,7 +297,7 @@ CompiledMethod* JniCompiler::Compile() {
}
// Verify the generated bitcode
- llvm::verifyFunction(*func_, llvm::PrintMessageAction);
+ VERIFY_LLVM_FUNCTION(*func_);
// Add the memory usage approximation of the compilation unit
cunit_->AddMemUsageApproximation((sirt_size * 4 + 50) * 50);
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index 5bd1695ea1..8e592fe778 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -35,7 +35,6 @@
#include <iomanip>
-#include <llvm/Analysis/Verifier.h>
#include <llvm/BasicBlock.h>
#include <llvm/Function.h>
#include <llvm/GlobalVariable.h>
@@ -3687,7 +3686,7 @@ CompiledMethod *MethodCompiler::Compile() {
EmitPrologueLastBranch();
// Verify the generated bitcode
- llvm::verifyFunction(*func_, llvm::PrintMessageAction);
+ VERIFY_LLVM_FUNCTION(*func_);
// Add the memory usage approximation of the compilation unit
cunit_->AddMemUsageApproximation(code_item_->insns_size_in_code_units_ * 900);
@@ -3738,8 +3737,12 @@ void MethodCompiler::EmitGuard_ExceptionLandingPad(uint32_t dex_pc) {
void MethodCompiler::EmitGuard_GarbageCollectionSuspend(uint32_t dex_pc) {
llvm::Value* runtime_func = irb_.GetRuntime(TestSuspend);
+
+ llvm::Value* thread_object_addr = irb_.CreateCall(irb_.GetRuntime(GetCurrentThread));
+
EmitUpdateDexPC(dex_pc);
- irb_.CreateCall(runtime_func);
+
+ irb_.CreateCall(runtime_func, thread_object_addr);
EmitGuard_ExceptionLandingPad(dex_pc);
}
diff --git a/src/compiler_llvm/runtime_support_builder.cc b/src/compiler_llvm/runtime_support_builder.cc
index a13867c56a..c5ff6d7476 100644
--- a/src/compiler_llvm/runtime_support_builder.cc
+++ b/src/compiler_llvm/runtime_support_builder.cc
@@ -20,6 +20,7 @@
#include "ir_builder.h"
#include "shadow_frame.h"
#include "thread.h"
+#include "utils_llvm.h"
#include <llvm/DerivedTypes.h>
#include <llvm/Function.h>
@@ -98,6 +99,8 @@ void RuntimeSupportBuilder::OptimizeRuntimeSupport() {
Thread::TopShadowFrameOffset().Int32Value(),
new_shadow_frame);
irb_.CreateRetVoid();
+
+ VERIFY_LLVM_FUNCTION(*func);
}
if (!target_runtime_support_func_[PopShadowFrame]) {
@@ -118,6 +121,8 @@ void RuntimeSupportBuilder::OptimizeRuntimeSupport() {
Thread::TopShadowFrameOffset().Int32Value(),
old_shadow_frame);
irb_.CreateRetVoid();
+
+ VERIFY_LLVM_FUNCTION(*func);
}
if (!target_runtime_support_func_[IsExceptionPending]) {
@@ -133,6 +138,8 @@ void RuntimeSupportBuilder::OptimizeRuntimeSupport() {
irb_.getJObjectTy());
Value* is_exception_not_null = irb_.CreateICmpNE(exception, irb_.getJNull());
irb_.CreateRet(is_exception_not_null);
+
+ VERIFY_LLVM_FUNCTION(*func);
}
if (!target_runtime_support_func_[TestSuspend]) {
@@ -146,8 +153,7 @@ void RuntimeSupportBuilder::OptimizeRuntimeSupport() {
BasicBlock* basic_block = BasicBlock::Create(context_, "entry", func);
irb_.SetInsertPoint(basic_block);
- Function* get_thread = GetRuntimeSupportFunction(GetCurrentThread);
- Value* thread = irb_.CreateCall(get_thread);
+ Value* thread = func->arg_begin();
Value* suspend_count = irb_.LoadFromObjectOffset(thread,
Thread::SuspendCountOffset().Int32Value(),
irb_.getJIntTy());
@@ -165,6 +171,8 @@ void RuntimeSupportBuilder::OptimizeRuntimeSupport() {
irb_.CreateRetVoid();
OverrideRuntimeSupportFunction(TestSuspend, func);
+
+ VERIFY_LLVM_FUNCTION(*func);
}
if (!target_runtime_support_func_[MarkGCCard]) {
@@ -197,6 +205,8 @@ void RuntimeSupportBuilder::OptimizeRuntimeSupport() {
Value* card_table_entry = irb_.CreateGEP(card_table, card_no);
irb_.CreateStore(irb_.getInt8(GC_CARD_DIRTY), card_table_entry);
irb_.CreateRetVoid();
+
+ VERIFY_LLVM_FUNCTION(*func);
}
}
diff --git a/src/compiler_llvm/runtime_support_builder_arm.cc b/src/compiler_llvm/runtime_support_builder_arm.cc
index ab33967285..6029d3ee55 100644
--- a/src/compiler_llvm/runtime_support_builder_arm.cc
+++ b/src/compiler_llvm/runtime_support_builder_arm.cc
@@ -18,6 +18,7 @@
#include "ir_builder.h"
#include "thread.h"
+#include "utils_llvm.h"
#include <llvm/DerivedTypes.h>
#include <llvm/Function.h>
@@ -45,6 +46,8 @@ void RuntimeSupportBuilderARM::TargetOptimizeRuntimeSupport() {
InlineAsm* get_r9 = InlineAsm::get(func->getFunctionType(), "mov $0, r9", "=r", false);
Value* r9 = irb_.CreateCall(get_r9);
irb_.CreateRet(r9);
+
+ VERIFY_LLVM_FUNCTION(*func);
}
{
@@ -57,6 +60,8 @@ void RuntimeSupportBuilderARM::TargetOptimizeRuntimeSupport() {
Value* thread = func->arg_begin();
irb_.CreateCall(set_r9, thread);
irb_.CreateRetVoid();
+
+ VERIFY_LLVM_FUNCTION(*func);
}
}
diff --git a/src/compiler_llvm/runtime_support_builder_x86.cc b/src/compiler_llvm/runtime_support_builder_x86.cc
index c381874370..ee5f6d8662 100644
--- a/src/compiler_llvm/runtime_support_builder_x86.cc
+++ b/src/compiler_llvm/runtime_support_builder_x86.cc
@@ -18,6 +18,7 @@
#include "ir_builder.h"
#include "thread.h"
+#include "utils_llvm.h"
#include <llvm/DerivedTypes.h>
#include <llvm/Function.h>
@@ -50,6 +51,8 @@ void RuntimeSupportBuilderX86::TargetOptimizeRuntimeSupport() {
InlineAsm* get_fp = InlineAsm::get(func_ty, "movl %fs:($1), $0", "=r,r", false);
Value* fp = irb_.CreateCall(get_fp, irb_.getPtrEquivInt(Thread::SelfOffset().Int32Value()));
irb_.CreateRet(fp);
+
+ VERIFY_LLVM_FUNCTION(*func);
}
{
@@ -58,6 +61,8 @@ void RuntimeSupportBuilderX86::TargetOptimizeRuntimeSupport() {
BasicBlock* basic_block = BasicBlock::Create(context_, "entry", func);
irb_.SetInsertPoint(basic_block);
irb_.CreateRetVoid();
+
+ VERIFY_LLVM_FUNCTION(*func);
}
}
diff --git a/src/compiler_llvm/upcall_compiler.cc b/src/compiler_llvm/upcall_compiler.cc
index 4b99cf7ab8..11d50ffcad 100644
--- a/src/compiler_llvm/upcall_compiler.cc
+++ b/src/compiler_llvm/upcall_compiler.cc
@@ -26,7 +26,6 @@
#include "runtime_support_func.h"
#include "utils_llvm.h"
-#include <llvm/Analysis/Verifier.h>
#include <llvm/BasicBlock.h>
#include <llvm/Function.h>
#include <llvm/GlobalVariable.h>
@@ -181,7 +180,7 @@ CompiledInvokeStub* UpcallCompiler::CreateStub(bool is_static,
irb_.CreateRetVoid();
// Verify the generated function
- llvm::verifyFunction(*func, llvm::PrintMessageAction);
+ VERIFY_LLVM_FUNCTION(*func);
// Add the memory usage approximation of the compilation unit
cunit_->AddMemUsageApproximation((shorty_size * 3 + 8) * 50);
diff --git a/src/compiler_llvm/utils_llvm.h b/src/compiler_llvm/utils_llvm.h
index fb9f0cb3f2..89a1946cb4 100644
--- a/src/compiler_llvm/utils_llvm.h
+++ b/src/compiler_llvm/utils_llvm.h
@@ -19,11 +19,19 @@
#include "stringprintf.h"
+#include <llvm/Analysis/Verifier.h>
+
#include <stdint.h>
#include <string>
namespace art {
+#ifndef NDEBUG
+#define VERIFY_LLVM_FUNCTION(func) llvm::verifyFunction(func, llvm::PrintMessageAction)
+#else
+#define VERIFY_LLVM_FUNCTION(func)
+#endif
+
inline static std::string ElfFuncName(uint16_t elf_func_idx) {
return StringPrintf("Art%u", static_cast<unsigned int>(elf_func_idx));
}