Implement throw-verification-error opcode in LLVM-based compiler.

Change-Id: I3b902e593f380d7524c8a2d94800d0323364c613
diff --git a/src/compiler_llvm/art_module.ll b/src/compiler_llvm/art_module.ll
index 74616d1..1ca556b 100644
--- a/src/compiler_llvm/art_module.ll
+++ b/src/compiler_llvm/art_module.ll
@@ -60,6 +60,7 @@
 declare void @art_throw_null_pointer_exception_from_code(i32)
 declare void @art_throw_stack_overflow_from_code()
 declare void @art_throw_exception_from_code(%JavaObject*)
+declare void @art_throw_verification_error_from_code(%JavaObject*, i32, i32)
 
 declare i32 @art_find_catch_block_from_code(%JavaObject*, i32)
 
diff --git a/src/compiler_llvm/generated/art_module.cc b/src/compiler_llvm/generated/art_module.cc
index 6676e02..e327c00 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="
@@ -111,23 +111,23 @@
 std::vector<Type*>FuncTy_10_args;
 FuncTy_10_args.push_back(PointerTy_1);
 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=*/IntegerType::get(mod->getContext(), 32),
+ /*Result=*/Type::getVoidTy(mod->getContext()),
  /*Params=*/FuncTy_10_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_11_args;
-FuncTy_11_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_11_args.push_back(PointerTy_1);
+FuncTy_11_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_11 = FunctionType::get(
- /*Result=*/PointerTy_1,
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_11_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_12_args;
 FuncTy_12_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_12_args.push_back(PointerTy_1);
-FuncTy_12_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_12 = FunctionType::get(
  /*Result=*/PointerTy_1,
  /*Params=*/FuncTy_12_args,
@@ -136,41 +136,41 @@
 std::vector<Type*>FuncTy_13_args;
 FuncTy_13_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_13_args.push_back(PointerTy_1);
+FuncTy_13_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_13 = FunctionType::get(
- /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Result=*/PointerTy_1,
  /*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(PointerTy_1);
 FunctionType* FuncTy_14 = FunctionType::get(
- /*Result=*/PointerTy_1,
+ /*Result=*/Type::getVoidTy(mod->getContext()),
  /*Params=*/FuncTy_14_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_15_args;
-FuncTy_15_args.push_back(PointerTy_1);
 FuncTy_15_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_15_args.push_back(PointerTy_1);
+FuncTy_15_args.push_back(PointerTy_1);
 FunctionType* FuncTy_15 = FunctionType::get(
  /*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(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_16 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Result=*/PointerTy_1,
  /*Params=*/FuncTy_16_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_17_args;
 FuncTy_17_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_17_args.push_back(PointerTy_1);
-FuncTy_17_args.push_back(IntegerType::get(mod->getContext(), 64));
+FuncTy_17_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_17 = FunctionType::get(
  /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_17_args,
@@ -179,7 +179,7 @@
 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(PointerTy_1);
+FuncTy_18_args.push_back(IntegerType::get(mod->getContext(), 64));
 FunctionType* FuncTy_18 = FunctionType::get(
  /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_18_args,
@@ -188,6 +188,7 @@
 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(PointerTy_1);
 FunctionType* FuncTy_19 = FunctionType::get(
  /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_19_args,
@@ -197,17 +198,15 @@
 FuncTy_20_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_20_args.push_back(PointerTy_1);
 FunctionType* FuncTy_20 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 64),
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_20_args,
  /*isVarArg=*/false);
 
 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);
-FuncTy_21_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_21 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Result=*/IntegerType::get(mod->getContext(), 64),
  /*Params=*/FuncTy_21_args,
  /*isVarArg=*/false);
 
@@ -215,7 +214,7 @@
 FuncTy_22_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_22_args.push_back(PointerTy_1);
 FuncTy_22_args.push_back(PointerTy_1);
-FuncTy_22_args.push_back(IntegerType::get(mod->getContext(), 64));
+FuncTy_22_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_22 = FunctionType::get(
  /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_22_args,
@@ -225,7 +224,7 @@
 FuncTy_23_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_23_args.push_back(PointerTy_1);
 FuncTy_23_args.push_back(PointerTy_1);
-FuncTy_23_args.push_back(PointerTy_1);
+FuncTy_23_args.push_back(IntegerType::get(mod->getContext(), 64));
 FunctionType* FuncTy_23 = FunctionType::get(
  /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_23_args,
@@ -235,16 +234,18 @@
 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(PointerTy_1);
 FunctionType* FuncTy_24 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 64),
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_24_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_25_args;
+FuncTy_25_args.push_back(IntegerType::get(mod->getContext(), 32));
 FuncTy_25_args.push_back(PointerTy_1);
 FuncTy_25_args.push_back(PointerTy_1);
 FunctionType* FuncTy_25 = FunctionType::get(
- /*Result=*/PointerTy_1,
+ /*Result=*/IntegerType::get(mod->getContext(), 64),
  /*Params=*/FuncTy_25_args,
  /*isVarArg=*/false);
 
@@ -252,7 +253,7 @@
 FuncTy_26_args.push_back(PointerTy_1);
 FuncTy_26_args.push_back(PointerTy_1);
 FunctionType* FuncTy_26 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Result=*/PointerTy_1,
  /*Params=*/FuncTy_26_args,
  /*isVarArg=*/false);
 
@@ -260,27 +261,35 @@
 FuncTy_27_args.push_back(PointerTy_1);
 FuncTy_27_args.push_back(PointerTy_1);
 FunctionType* FuncTy_27 = FunctionType::get(
- /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_27_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_28_args;
 FuncTy_28_args.push_back(PointerTy_1);
 FuncTy_28_args.push_back(PointerTy_1);
-FuncTy_28_args.push_back(IntegerType::get(mod->getContext(), 32));
-FuncTy_28_args.push_back(IntegerType::get(mod->getContext(), 1));
 FunctionType* FuncTy_28 = FunctionType::get(
- /*Result=*/PointerTy_1,
+ /*Result=*/Type::getVoidTy(mod->getContext()),
  /*Params=*/FuncTy_28_args,
  /*isVarArg=*/false);
 
 std::vector<Type*>FuncTy_29_args;
 FuncTy_29_args.push_back(PointerTy_1);
+FuncTy_29_args.push_back(PointerTy_1);
+FuncTy_29_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_29_args.push_back(IntegerType::get(mod->getContext(), 1));
 FunctionType* FuncTy_29 = FunctionType::get(
  /*Result=*/PointerTy_1,
  /*Params=*/FuncTy_29_args,
  /*isVarArg=*/false);
 
+std::vector<Type*>FuncTy_30_args;
+FuncTy_30_args.push_back(PointerTy_1);
+FunctionType* FuncTy_30 = FunctionType::get(
+ /*Result=*/PointerTy_1,
+ /*Params=*/FuncTy_30_args,
+ /*isVarArg=*/false);
+
 
 // Function Declarations
 
@@ -449,10 +458,21 @@
 AttrListPtr func_art_throw_exception_from_code_PAL;
 func_art_throw_exception_from_code->setAttributes(func_art_throw_exception_from_code_PAL);
 
+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_10,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_throw_verification_error_from_code", mod); // (external, no body)
+func_art_throw_verification_error_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_throw_verification_error_from_code_PAL;
+func_art_throw_verification_error_from_code->setAttributes(func_art_throw_verification_error_from_code_PAL);
+
 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_10,
+ /*Type=*/FuncTy_11,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_catch_block_from_code", mod); // (external, no body)
 func_art_find_catch_block_from_code->setCallingConv(CallingConv::C);
@@ -463,7 +483,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_11,
+ /*Type=*/FuncTy_12,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_alloc_object_from_code", mod); // (external, no body)
 func_art_alloc_object_from_code->setCallingConv(CallingConv::C);
@@ -474,7 +494,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_11,
+ /*Type=*/FuncTy_12,
  /*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);
@@ -485,7 +505,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_12,
+ /*Type=*/FuncTy_13,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_alloc_array_from_code", mod); // (external, no body)
 func_art_alloc_array_from_code->setCallingConv(CallingConv::C);
@@ -496,7 +516,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_12,
+ /*Type=*/FuncTy_13,
  /*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);
@@ -507,7 +527,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_12,
+ /*Type=*/FuncTy_13,
  /*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);
@@ -518,7 +538,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_12,
+ /*Type=*/FuncTy_13,
  /*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);
@@ -529,7 +549,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_13,
+ /*Type=*/FuncTy_14,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_instance_field_from_code", mod); // (external, no body)
 func_art_find_instance_field_from_code->setCallingConv(CallingConv::C);
@@ -540,7 +560,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_13,
+ /*Type=*/FuncTy_14,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_static_field_from_code", mod); // (external, no body)
 func_art_find_static_field_from_code->setCallingConv(CallingConv::C);
@@ -551,7 +571,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_14,
+ /*Type=*/FuncTy_15,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_interface_method_from_code", mod); // (external, no body)
 func_art_find_interface_method_from_code->setCallingConv(CallingConv::C);
@@ -562,7 +582,7 @@
 Function* func_art_find_virtual_method_from_code = mod->getFunction("art_find_virtual_method_from_code");
 if (!func_art_find_virtual_method_from_code) {
 func_art_find_virtual_method_from_code = Function::Create(
- /*Type=*/FuncTy_14,
+ /*Type=*/FuncTy_15,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_virtual_method_from_code", mod); // (external, no body)
 func_art_find_virtual_method_from_code->setCallingConv(CallingConv::C);
@@ -573,7 +593,7 @@
 Function* func_art_find_super_method_from_code = mod->getFunction("art_find_super_method_from_code");
 if (!func_art_find_super_method_from_code) {
 func_art_find_super_method_from_code = Function::Create(
- /*Type=*/FuncTy_14,
+ /*Type=*/FuncTy_15,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_find_super_method_from_code", mod); // (external, no body)
 func_art_find_super_method_from_code->setCallingConv(CallingConv::C);
@@ -584,7 +604,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_11,
+ /*Type=*/FuncTy_12,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_initialize_static_storage_from_code", mod); // (external, no body)
 func_art_initialize_static_storage_from_code->setCallingConv(CallingConv::C);
@@ -595,7 +615,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_11,
+ /*Type=*/FuncTy_12,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_initialize_type_from_code", mod); // (external, no body)
 func_art_initialize_type_from_code->setCallingConv(CallingConv::C);
@@ -606,7 +626,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_11,
+ /*Type=*/FuncTy_12,
  /*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);
@@ -617,7 +637,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_15,
+ /*Type=*/FuncTy_16,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_resolve_string_from_code", mod); // (external, no body)
 func_art_resolve_string_from_code->setCallingConv(CallingConv::C);
@@ -628,7 +648,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_16,
+ /*Type=*/FuncTy_17,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_set32_static_from_code", mod); // (external, no body)
 func_art_set32_static_from_code->setCallingConv(CallingConv::C);
@@ -639,7 +659,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_17,
+ /*Type=*/FuncTy_18,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_set64_static_from_code", mod); // (external, no body)
 func_art_set64_static_from_code->setCallingConv(CallingConv::C);
@@ -650,7 +670,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_18,
+ /*Type=*/FuncTy_19,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_set_obj_static_from_code", mod); // (external, no body)
 func_art_set_obj_static_from_code->setCallingConv(CallingConv::C);
@@ -661,7 +681,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_19,
+ /*Type=*/FuncTy_20,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_get32_static_from_code", mod); // (external, no body)
 func_art_get32_static_from_code->setCallingConv(CallingConv::C);
@@ -672,7 +692,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_20,
+ /*Type=*/FuncTy_21,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_get64_static_from_code", mod); // (external, no body)
 func_art_get64_static_from_code->setCallingConv(CallingConv::C);
@@ -683,7 +703,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_11,
+ /*Type=*/FuncTy_12,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_get_obj_static_from_code", mod); // (external, no body)
 func_art_get_obj_static_from_code->setCallingConv(CallingConv::C);
@@ -694,7 +714,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_21,
+ /*Type=*/FuncTy_22,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_set32_instance_from_code", mod); // (external, no body)
 func_art_set32_instance_from_code->setCallingConv(CallingConv::C);
@@ -705,7 +725,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_22,
+ /*Type=*/FuncTy_23,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_set64_instance_from_code", mod); // (external, no body)
 func_art_set64_instance_from_code->setCallingConv(CallingConv::C);
@@ -716,7 +736,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_23,
+ /*Type=*/FuncTy_24,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_set_obj_instance_from_code", mod); // (external, no body)
 func_art_set_obj_instance_from_code->setCallingConv(CallingConv::C);
@@ -727,7 +747,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_18,
+ /*Type=*/FuncTy_19,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_get32_instance_from_code", mod); // (external, no body)
 func_art_get32_instance_from_code->setCallingConv(CallingConv::C);
@@ -738,7 +758,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_24,
+ /*Type=*/FuncTy_25,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_get64_instance_from_code", mod); // (external, no body)
 func_art_get64_instance_from_code->setCallingConv(CallingConv::C);
@@ -749,7 +769,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_14,
+ /*Type=*/FuncTy_15,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_get_obj_instance_from_code", mod); // (external, no body)
 func_art_get_obj_instance_from_code->setCallingConv(CallingConv::C);
@@ -760,7 +780,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_25,
+ /*Type=*/FuncTy_26,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_decode_jobject_in_thread", mod); // (external, no body)
 func_art_decode_jobject_in_thread->setCallingConv(CallingConv::C);
@@ -771,7 +791,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_26,
+ /*Type=*/FuncTy_27,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_is_assignable_from_code", mod); // (external, no body)
 func_art_is_assignable_from_code->setCallingConv(CallingConv::C);
@@ -782,7 +802,7 @@
 Function* func_art_check_cast_from_code = mod->getFunction("art_check_cast_from_code");
 if (!func_art_check_cast_from_code) {
 func_art_check_cast_from_code = Function::Create(
- /*Type=*/FuncTy_27,
+ /*Type=*/FuncTy_28,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_check_cast_from_code", mod); // (external, no body)
 func_art_check_cast_from_code->setCallingConv(CallingConv::C);
@@ -793,7 +813,7 @@
 Function* func_art_check_put_array_element_from_code = mod->getFunction("art_check_put_array_element_from_code");
 if (!func_art_check_put_array_element_from_code) {
 func_art_check_put_array_element_from_code = Function::Create(
- /*Type=*/FuncTy_27,
+ /*Type=*/FuncTy_28,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_check_put_array_element_from_code", mod); // (external, no body)
 func_art_check_put_array_element_from_code->setCallingConv(CallingConv::C);
@@ -804,7 +824,7 @@
 Function* func_art_ensure_resolved_from_code = mod->getFunction("art_ensure_resolved_from_code");
 if (!func_art_ensure_resolved_from_code) {
 func_art_ensure_resolved_from_code = Function::Create(
- /*Type=*/FuncTy_28,
+ /*Type=*/FuncTy_29,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_ensure_resolved_from_code", mod); // (external, no body)
 func_art_ensure_resolved_from_code->setCallingConv(CallingConv::C);
@@ -815,7 +835,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_29,
+ /*Type=*/FuncTy_30,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"art_fix_stub_from_code", mod); // (external, no body)
 func_art_fix_stub_from_code->setCallingConv(CallingConv::C);
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index 5485ba6..d3d7e39 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -1139,6 +1139,10 @@
     EmitInsn_IntShiftArithmImmediate(ARGS, kIntArithm_UShr);
     break;
 
+  case Instruction::THROW_VERIFICATION_ERROR:
+    EmitInsn_ThrowVerificationError(ARGS);
+    break;
+
   case Instruction::UNUSED_3E:
   case Instruction::UNUSED_3F:
   case Instruction::UNUSED_40:
@@ -1158,7 +1162,6 @@
   case Instruction::UNUSED_EA:
   case Instruction::UNUSED_EB:
   case Instruction::UNUSED_EC:
-  case Instruction::THROW_VERIFICATION_ERROR:
   case Instruction::UNUSED_EE:
   case Instruction::UNUSED_EF:
   case Instruction::UNUSED_F0:
@@ -1271,6 +1274,24 @@
 }
 
 
+void MethodCompiler::EmitInsn_ThrowVerificationError(uint32_t dex_pc,
+                                                     Instruction const* insn) {
+
+  DecodedInstruction dec_insn(insn);
+
+  EmitUpdateLineNumFromDexPC(dex_pc);
+
+  llvm::Value* method_object_addr = EmitLoadMethodObjectAddr();
+  llvm::Value* kind_value = irb_.getInt32(dec_insn.vA);
+  llvm::Value* ref_value = irb_.getInt32(dec_insn.vB);
+
+  irb_.CreateCall3(irb_.GetRuntime(ThrowVerificationError),
+                   method_object_addr, kind_value, ref_value);
+
+  EmitBranchExceptionLandingPad(dex_pc);
+}
+
+
 void MethodCompiler::EmitInsn_ReturnVoid(uint32_t dex_pc,
                                          Instruction const* insn) {
   // Garbage collection safe-point
diff --git a/src/compiler_llvm/method_compiler.h b/src/compiler_llvm/method_compiler.h
index 48d4467..e20a80a 100644
--- a/src/compiler_llvm/method_compiler.h
+++ b/src/compiler_llvm/method_compiler.h
@@ -141,6 +141,7 @@
   // MOVE_EXCEPTION, THROW instructions
   void EmitInsn_MoveException(GEN_INSN_ARGS);
   void EmitInsn_ThrowException(GEN_INSN_ARGS);
+  void EmitInsn_ThrowVerificationError(GEN_INSN_ARGS);
 
   // RETURN instructions
   void EmitInsn_ReturnVoid(GEN_INSN_ARGS);
diff --git a/src/compiler_llvm/runtime_support_func_list.h b/src/compiler_llvm/runtime_support_func_list.h
index 56755fa..51cba5b 100644
--- a/src/compiler_llvm/runtime_support_func_list.h
+++ b/src/compiler_llvm/runtime_support_func_list.h
@@ -27,6 +27,7 @@
   V(ThrowNullPointerException, art_throw_null_pointer_exception_from_code) \
   V(ThrowDivZeroException, art_throw_div_zero_from_code) \
   V(ThrowIndexOutOfBounds, art_throw_array_bounds_from_code) \
+  V(ThrowVerificationError, art_throw_verification_error_from_code) \
   V(InitializeTypeAndVerifyAccess, art_initialize_type_and_verify_access_from_code) \
   V(InitializeType, art_initialize_type_from_code) \
   V(IsAssignable, art_is_assignable_from_code) \
diff --git a/src/compiler_llvm/runtime_support_llvm.cc b/src/compiler_llvm/runtime_support_llvm.cc
index 79d06df..9c3de0d 100644
--- a/src/compiler_llvm/runtime_support_llvm.cc
+++ b/src/compiler_llvm/runtime_support_llvm.cc
@@ -139,6 +139,12 @@
   }
 }
 
+void art_throw_verification_error_from_code(Method* current_method,
+                                            int32_t kind,
+                                            int32_t ref) {
+  ThrowVerificationError(Thread::Current(), current_method, kind, ref);
+}
+
 int32_t art_find_catch_block_from_code(Method* current_method, int32_t dex_pc) {
   Thread* thread = Thread::Current();
   Class* exception_type = thread->GetException()->GetClass();
diff --git a/src/oat/runtime/support_throw.cc b/src/oat/runtime/support_throw.cc
index 7d198c9..d5820bf 100644
--- a/src/oat/runtime/support_throw.cc
+++ b/src/oat/runtime/support_throw.cc
@@ -98,91 +98,12 @@
   self->DeliverException();
 }
 
-static std::string ClassNameFromIndex(Method* method, uint32_t ref,
-                                      verifier::VerifyErrorRefType ref_type, bool access) {
-  ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
-  const DexFile& dex_file = class_linker->FindDexFile(method->GetDeclaringClass()->GetDexCache());
-
-  uint16_t type_idx = 0;
-  if (ref_type == verifier::VERIFY_ERROR_REF_FIELD) {
-    const DexFile::FieldId& id = dex_file.GetFieldId(ref);
-    type_idx = id.class_idx_;
-  } else if (ref_type == verifier::VERIFY_ERROR_REF_METHOD) {
-    const DexFile::MethodId& id = dex_file.GetMethodId(ref);
-    type_idx = id.class_idx_;
-  } else if (ref_type == verifier::VERIFY_ERROR_REF_CLASS) {
-    type_idx = ref;
-  } else {
-    CHECK(false) << static_cast<int>(ref_type);
-  }
-
-  std::string class_name(PrettyDescriptor(dex_file.StringByTypeIdx(type_idx)));
-  if (!access) {
-    return class_name;
-  }
-
-  std::string result;
-  result += "tried to access class ";
-  result += class_name;
-  result += " from class ";
-  result += PrettyDescriptor(method->GetDeclaringClass());
-  return result;
-}
-
 extern "C" void artThrowVerificationErrorFromCode(int32_t kind, int32_t ref, Thread* self, Method** sp) {
   FinishCalleeSaveFrameSetup(self, sp, Runtime::kSaveAll);
   Frame frame = self->GetTopOfStack();  // We need the calling method as context to interpret 'ref'
   frame.Next();
   Method* method = frame.GetMethod();
-
-  verifier::VerifyErrorRefType ref_type =
-      static_cast<verifier::VerifyErrorRefType>(kind >> verifier::kVerifyErrorRefTypeShift);
-
-  const char* exception_class = "Ljava/lang/VerifyError;";
-  std::string msg;
-
-  switch (static_cast<verifier::VerifyError>(kind & ~(0xff << verifier::kVerifyErrorRefTypeShift))) {
-  case verifier::VERIFY_ERROR_NO_CLASS:
-    exception_class = "Ljava/lang/NoClassDefFoundError;";
-    msg = ClassNameFromIndex(method, ref, ref_type, false);
-    break;
-  case verifier::VERIFY_ERROR_NO_FIELD:
-    exception_class = "Ljava/lang/NoSuchFieldError;";
-    msg = FieldNameFromIndex(method, ref, ref_type, false);
-    break;
-  case verifier::VERIFY_ERROR_NO_METHOD:
-    exception_class = "Ljava/lang/NoSuchMethodError;";
-    msg = MethodNameFromIndex(method, ref, ref_type, false);
-    break;
-  case verifier::VERIFY_ERROR_ACCESS_CLASS:
-    exception_class = "Ljava/lang/IllegalAccessError;";
-    msg = ClassNameFromIndex(method, ref, ref_type, true);
-    break;
-  case verifier::VERIFY_ERROR_ACCESS_FIELD:
-    exception_class = "Ljava/lang/IllegalAccessError;";
-    msg = FieldNameFromIndex(method, ref, ref_type, true);
-    break;
-  case verifier::VERIFY_ERROR_ACCESS_METHOD:
-    exception_class = "Ljava/lang/IllegalAccessError;";
-    msg = MethodNameFromIndex(method, ref, ref_type, true);
-    break;
-  case verifier::VERIFY_ERROR_CLASS_CHANGE:
-    exception_class = "Ljava/lang/IncompatibleClassChangeError;";
-    msg = ClassNameFromIndex(method, ref, ref_type, false);
-    break;
-  case verifier::VERIFY_ERROR_INSTANTIATION:
-    exception_class = "Ljava/lang/InstantiationError;";
-    msg = ClassNameFromIndex(method, ref, ref_type, false);
-    break;
-  case verifier::VERIFY_ERROR_BAD_CLASS_SOFT:
-  case verifier::VERIFY_ERROR_BAD_CLASS_HARD:
-    // Generic VerifyError; use default exception, no message.
-    break;
-  case verifier::VERIFY_ERROR_NONE:
-    CHECK(false);
-    break;
-  }
-  self->ThrowNewException(exception_class, msg.c_str());
+  ThrowVerificationError(self, method, kind, ref);
   self->DeliverException();
 }
 
diff --git a/src/runtime_support.cc b/src/runtime_support.cc
index 40b43c1..0a1cf8f 100644
--- a/src/runtime_support.cc
+++ b/src/runtime_support.cc
@@ -221,6 +221,90 @@
   return result;
 }
 
+static inline std::string ClassNameFromIndex(const Method* method, uint32_t ref,
+                                             verifier::VerifyErrorRefType ref_type, bool access) {
+  ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
+  const DexFile& dex_file = class_linker->FindDexFile(method->GetDeclaringClass()->GetDexCache());
+
+  uint16_t type_idx = 0;
+  if (ref_type == verifier::VERIFY_ERROR_REF_FIELD) {
+    const DexFile::FieldId& id = dex_file.GetFieldId(ref);
+    type_idx = id.class_idx_;
+  } else if (ref_type == verifier::VERIFY_ERROR_REF_METHOD) {
+    const DexFile::MethodId& id = dex_file.GetMethodId(ref);
+    type_idx = id.class_idx_;
+  } else if (ref_type == verifier::VERIFY_ERROR_REF_CLASS) {
+    type_idx = ref;
+  } else {
+    CHECK(false) << static_cast<int>(ref_type);
+  }
+
+  std::string class_name(PrettyDescriptor(dex_file.StringByTypeIdx(type_idx)));
+  if (!access) {
+    return class_name;
+  }
+
+  std::string result;
+  result += "tried to access class ";
+  result += class_name;
+  result += " from class ";
+  result += PrettyDescriptor(method->GetDeclaringClass());
+  return result;
+}
+
+void ThrowVerificationError(Thread* self, const Method* method,
+                            int32_t kind, int32_t ref) {
+  verifier::VerifyErrorRefType ref_type =
+      static_cast<verifier::VerifyErrorRefType>(kind >> verifier::kVerifyErrorRefTypeShift);
+
+  const char* exception_class = "Ljava/lang/VerifyError;";
+  std::string msg;
+
+  switch (static_cast<verifier::VerifyError>(kind & ~(0xff << verifier::kVerifyErrorRefTypeShift))) {
+  case verifier::VERIFY_ERROR_NO_CLASS:
+    exception_class = "Ljava/lang/NoClassDefFoundError;";
+    msg = ClassNameFromIndex(method, ref, ref_type, false);
+    break;
+  case verifier::VERIFY_ERROR_NO_FIELD:
+    exception_class = "Ljava/lang/NoSuchFieldError;";
+    msg = FieldNameFromIndex(method, ref, ref_type, false);
+    break;
+  case verifier::VERIFY_ERROR_NO_METHOD:
+    exception_class = "Ljava/lang/NoSuchMethodError;";
+    msg = MethodNameFromIndex(method, ref, ref_type, false);
+    break;
+  case verifier::VERIFY_ERROR_ACCESS_CLASS:
+    exception_class = "Ljava/lang/IllegalAccessError;";
+    msg = ClassNameFromIndex(method, ref, ref_type, true);
+    break;
+  case verifier::VERIFY_ERROR_ACCESS_FIELD:
+    exception_class = "Ljava/lang/IllegalAccessError;";
+    msg = FieldNameFromIndex(method, ref, ref_type, true);
+    break;
+  case verifier::VERIFY_ERROR_ACCESS_METHOD:
+    exception_class = "Ljava/lang/IllegalAccessError;";
+    msg = MethodNameFromIndex(method, ref, ref_type, true);
+    break;
+  case verifier::VERIFY_ERROR_CLASS_CHANGE:
+    exception_class = "Ljava/lang/IncompatibleClassChangeError;";
+    msg = ClassNameFromIndex(method, ref, ref_type, false);
+    break;
+  case verifier::VERIFY_ERROR_INSTANTIATION:
+    exception_class = "Ljava/lang/InstantiationError;";
+    msg = ClassNameFromIndex(method, ref, ref_type, false);
+    break;
+  case verifier::VERIFY_ERROR_BAD_CLASS_SOFT:
+  case verifier::VERIFY_ERROR_BAD_CLASS_HARD:
+    // Generic VerifyError; use default exception, no message.
+    break;
+  case verifier::VERIFY_ERROR_NONE:
+    CHECK(false);
+    break;
+  }
+
+  self->ThrowNewException(exception_class, msg.c_str());
+}
+
 // Helper function to allocate array for FILLED_NEW_ARRAY.
 Array* CheckAndAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t component_count,
                                   Thread* self, bool access_check) {
diff --git a/src/runtime_support.h b/src/runtime_support.h
index 0cbfd59..bbb9512 100644
--- a/src/runtime_support.h
+++ b/src/runtime_support.h
@@ -55,6 +55,7 @@
 void ThrowNullPointerExceptionForMethodAccess(Thread* self, Method* caller, uint32_t method_idx,
                                               InvokeType type);
 void ThrowNullPointerExceptionFromDexPC(Thread* self, Method* caller, uint32_t dex_pc);
+void ThrowVerificationError(Thread* self, const Method* method, int32_t kind, int32_t ref);
 
 std::string FieldNameFromIndex(const Method* method, uint32_t ref,
                                verifier::VerifyErrorRefType ref_type, bool access);