diff options
Diffstat (limited to 'src/compiler_llvm')
| -rw-r--r-- | src/compiler_llvm/art_module.ll | 30 | ||||
| -rw-r--r-- | src/compiler_llvm/generated/art_module.cc | 289 | ||||
| -rw-r--r-- | src/compiler_llvm/jni_compiler.cc | 105 | ||||
| -rw-r--r-- | src/compiler_llvm/runtime_support_func_list.h | 9 | ||||
| -rw-r--r-- | src/compiler_llvm/runtime_support_llvm.cc | 112 |
5 files changed, 351 insertions, 194 deletions
diff --git a/src/compiler_llvm/art_module.ll b/src/compiler_llvm/art_module.ll index eb2e1b8875..124b9b7ba3 100644 --- a/src/compiler_llvm/art_module.ll +++ b/src/compiler_llvm/art_module.ll @@ -53,8 +53,6 @@ declare void @art_pop_shadow_frame_from_code(%ShadowFrame*) ; Exception ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -declare i1 @art_is_exception_pending_from_code() - declare void @art_throw_div_zero_from_code() declare void @art_throw_array_bounds_from_code(i32, i32) declare void @art_throw_no_such_method_from_code(i32) @@ -167,9 +165,37 @@ declare i64 @art_f2l(float) declare i32 @art_f2i(float) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; JNI +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +declare i32 @art_jni_method_start(%JavaObject*) + +declare i32 @art_jni_method_start_synchronized(%JavaObject*, + %JavaObject*) + +declare void @art_jni_method_end(i32, + %JavaObject*) + + +declare void @art_jni_method_end_synchronized(i32, + %JavaObject*, + %JavaObject*) + +declare %JavaObject* @art_jni_method_end_with_reference(%JavaObject*, + i32, + %JavaObject*) + +declare %JavaObject* @art_jni_method_end_with_reference_synchronized(%JavaObject*, + i32, + %JavaObject*, + %JavaObject*) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Temporary runtime support, will be removed in the future ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +declare i1 @art_is_exception_pending_from_code() + declare void @art_mark_gc_card_from_code(%JavaObject*, %JavaObject*) declare void @art_proxy_invoke_handler_from_code(%JavaObject*, ...) diff --git a/src/compiler_llvm/generated/art_module.cc b/src/compiler_llvm/generated/art_module.cc index 033316dca5..2111339c65 100644 --- a/src/compiler_llvm/generated/art_module.cc +++ b/src/compiler_llvm/generated/art_module.cc @@ -108,11 +108,13 @@ FunctionType* FuncTy_8 = FunctionType::get( std::vector<Type*>FuncTy_9_args; FunctionType* FuncTy_9 = FunctionType::get( - /*Result=*/IntegerType::get(mod->getContext(), 1), + /*Result=*/Type::getVoidTy(mod->getContext()), /*Params=*/FuncTy_9_args, /*isVarArg=*/false); 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, @@ -120,13 +122,14 @@ FunctionType* FuncTy_10 = FunctionType::get( std::vector<Type*>FuncTy_11_args; 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()), /*Params=*/FuncTy_11_args, /*isVarArg=*/false); 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=*/Type::getVoidTy(mod->getContext()), @@ -136,23 +139,24 @@ FunctionType* FuncTy_12 = FunctionType::get( 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(IntegerType::get(mod->getContext(), 32)); FunctionType* FuncTy_13 = FunctionType::get( - /*Result=*/Type::getVoidTy(mod->getContext()), + /*Result=*/IntegerType::get(mod->getContext(), 32), /*Params=*/FuncTy_13_args, /*isVarArg=*/false); std::vector<Type*>FuncTy_14_args; -FuncTy_14_args.push_back(PointerTy_1); 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=*/IntegerType::get(mod->getContext(), 32), + /*Result=*/PointerTy_1, /*Params=*/FuncTy_14_args, /*isVarArg=*/false); 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=*/PointerTy_1, @@ -162,43 +166,42 @@ FunctionType* FuncTy_15 = FunctionType::get( 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)); -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(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=*/Type::getVoidTy(mod->getContext()), + /*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(PointerTy_1); FuncTy_18_args.push_back(PointerTy_1); +FuncTy_18_args.push_back(IntegerType::get(mod->getContext(), 32)); FunctionType* FuncTy_18 = FunctionType::get( /*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(), 32)); FunctionType* FuncTy_19 = FunctionType::get( - /*Result=*/PointerTy_1, + /*Result=*/IntegerType::get(mod->getContext(), 32), /*Params=*/FuncTy_19_args, /*isVarArg=*/false); 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(IntegerType::get(mod->getContext(), 32)); +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, @@ -207,7 +210,7 @@ FunctionType* FuncTy_20 = FunctionType::get( 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(IntegerType::get(mod->getContext(), 64)); +FuncTy_21_args.push_back(PointerTy_1); FunctionType* FuncTy_21 = FunctionType::get( /*Result=*/IntegerType::get(mod->getContext(), 32), /*Params=*/FuncTy_21_args, @@ -216,7 +219,6 @@ FunctionType* FuncTy_21 = FunctionType::get( std::vector<Type*>FuncTy_22_args; FuncTy_22_args.push_back(IntegerType::get(mod->getContext(), 32)); FuncTy_22_args.push_back(PointerTy_1); -FuncTy_22_args.push_back(PointerTy_1); FunctionType* FuncTy_22 = FunctionType::get( /*Result=*/IntegerType::get(mod->getContext(), 32), /*Params=*/FuncTy_22_args, @@ -226,7 +228,7 @@ std::vector<Type*>FuncTy_23_args; FuncTy_23_args.push_back(IntegerType::get(mod->getContext(), 32)); FuncTy_23_args.push_back(PointerTy_1); FunctionType* FuncTy_23 = FunctionType::get( - /*Result=*/IntegerType::get(mod->getContext(), 32), + /*Result=*/IntegerType::get(mod->getContext(), 64), /*Params=*/FuncTy_23_args, /*isVarArg=*/false); @@ -234,15 +236,17 @@ std::vector<Type*>FuncTy_24_args; FuncTy_24_args.push_back(IntegerType::get(mod->getContext(), 32)); FuncTy_24_args.push_back(PointerTy_1); FunctionType* FuncTy_24 = FunctionType::get( - /*Result=*/IntegerType::get(mod->getContext(), 64), + /*Result=*/PointerTy_1, /*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); +FuncTy_25_args.push_back(IntegerType::get(mod->getContext(), 32)); FunctionType* FuncTy_25 = FunctionType::get( - /*Result=*/PointerTy_1, + /*Result=*/IntegerType::get(mod->getContext(), 32), /*Params=*/FuncTy_25_args, /*isVarArg=*/false); @@ -250,7 +254,7 @@ std::vector<Type*>FuncTy_26_args; 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(IntegerType::get(mod->getContext(), 32)); +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, @@ -260,7 +264,7 @@ std::vector<Type*>FuncTy_27_args; 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(IntegerType::get(mod->getContext(), 64)); +FuncTy_27_args.push_back(PointerTy_1); FunctionType* FuncTy_27 = FunctionType::get( /*Result=*/IntegerType::get(mod->getContext(), 32), /*Params=*/FuncTy_27_args, @@ -270,80 +274,111 @@ 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); -FuncTy_28_args.push_back(PointerTy_1); FunctionType* FuncTy_28 = FunctionType::get( - /*Result=*/IntegerType::get(mod->getContext(), 32), + /*Result=*/IntegerType::get(mod->getContext(), 64), /*Params=*/FuncTy_28_args, /*isVarArg=*/false); std::vector<Type*>FuncTy_29_args; -FuncTy_29_args.push_back(IntegerType::get(mod->getContext(), 32)); FuncTy_29_args.push_back(PointerTy_1); FuncTy_29_args.push_back(PointerTy_1); FunctionType* FuncTy_29 = FunctionType::get( - /*Result=*/IntegerType::get(mod->getContext(), 64), + /*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=*/PointerTy_1, + /*Result=*/Type::getVoidTy(mod->getContext()), /*Params=*/FuncTy_30_args, /*isVarArg=*/false); std::vector<Type*>FuncTy_31_args; FuncTy_31_args.push_back(PointerTy_1); -FuncTy_31_args.push_back(IntegerType::get(mod->getContext(), 32)); FuncTy_31_args.push_back(PointerTy_1); -FuncTy_31_args.push_back(IntegerType::get(mod->getContext(), 32)); FunctionType* FuncTy_31 = FunctionType::get( - /*Result=*/Type::getVoidTy(mod->getContext()), + /*Result=*/IntegerType::get(mod->getContext(), 32), /*Params=*/FuncTy_31_args, /*isVarArg=*/false); std::vector<Type*>FuncTy_32_args; -FuncTy_32_args.push_back(PointerTy_1); -FuncTy_32_args.push_back(PointerTy_1); +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::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::getDoubleTy(mod->getContext())); +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(Type::getFloatTy(mod->getContext())); FunctionType* FuncTy_35 = FunctionType::get( - /*Result=*/IntegerType::get(mod->getContext(), 64), + /*Result=*/IntegerType::get(mod->getContext(), 32), /*Params=*/FuncTy_35_args, /*isVarArg=*/false); std::vector<Type*>FuncTy_36_args; -FuncTy_36_args.push_back(Type::getFloatTy(mod->getContext())); +FuncTy_36_args.push_back(PointerTy_1); FunctionType* FuncTy_36 = FunctionType::get( /*Result=*/IntegerType::get(mod->getContext(), 32), /*Params=*/FuncTy_36_args, /*isVarArg=*/false); std::vector<Type*>FuncTy_37_args; +FuncTy_37_args.push_back(IntegerType::get(mod->getContext(), 32)); +FuncTy_37_args.push_back(PointerTy_1); FuncTy_37_args.push_back(PointerTy_1); FunctionType* FuncTy_37 = FunctionType::get( /*Result=*/Type::getVoidTy(mod->getContext()), /*Params=*/FuncTy_37_args, + /*isVarArg=*/false); + +std::vector<Type*>FuncTy_38_args; +FuncTy_38_args.push_back(PointerTy_1); +FuncTy_38_args.push_back(IntegerType::get(mod->getContext(), 32)); +FuncTy_38_args.push_back(PointerTy_1); +FunctionType* FuncTy_38 = FunctionType::get( + /*Result=*/PointerTy_1, + /*Params=*/FuncTy_38_args, + /*isVarArg=*/false); + +std::vector<Type*>FuncTy_39_args; +FuncTy_39_args.push_back(PointerTy_1); +FuncTy_39_args.push_back(IntegerType::get(mod->getContext(), 32)); +FuncTy_39_args.push_back(PointerTy_1); +FuncTy_39_args.push_back(PointerTy_1); +FunctionType* FuncTy_39 = FunctionType::get( + /*Result=*/PointerTy_1, + /*Params=*/FuncTy_39_args, + /*isVarArg=*/false); + +std::vector<Type*>FuncTy_40_args; +FunctionType* FuncTy_40 = FunctionType::get( + /*Result=*/IntegerType::get(mod->getContext(), 1), + /*Params=*/FuncTy_40_args, + /*isVarArg=*/false); + +std::vector<Type*>FuncTy_41_args; +FuncTy_41_args.push_back(PointerTy_1); +FunctionType* FuncTy_41 = FunctionType::get( + /*Result=*/Type::getVoidTy(mod->getContext()), + /*Params=*/FuncTy_41_args, /*isVarArg=*/true); @@ -437,21 +472,10 @@ func_art_pop_shadow_frame_from_code->setCallingConv(CallingConv::C); AttrListPtr func_art_pop_shadow_frame_from_code_PAL; func_art_pop_shadow_frame_from_code->setAttributes(func_art_pop_shadow_frame_from_code_PAL); -Function* func_art_is_exception_pending_from_code = mod->getFunction("art_is_exception_pending_from_code"); -if (!func_art_is_exception_pending_from_code) { -func_art_is_exception_pending_from_code = Function::Create( - /*Type=*/FuncTy_9, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"art_is_exception_pending_from_code", mod); // (external, no body) -func_art_is_exception_pending_from_code->setCallingConv(CallingConv::C); -} -AttrListPtr func_art_is_exception_pending_from_code_PAL; -func_art_is_exception_pending_from_code->setAttributes(func_art_is_exception_pending_from_code_PAL); - 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_10, + /*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); @@ -462,7 +486,7 @@ func_art_throw_div_zero_from_code->setAttributes(func_art_throw_div_zero_from_co 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_11, + /*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); @@ -473,7 +497,7 @@ func_art_throw_array_bounds_from_code->setAttributes(func_art_throw_array_bounds 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_12, + /*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); @@ -484,7 +508,7 @@ func_art_throw_no_such_method_from_code->setAttributes(func_art_throw_no_such_me 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_12, + /*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); @@ -495,7 +519,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_10, + /*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); @@ -517,7 +541,7 @@ func_art_throw_exception_from_code->setAttributes(func_art_throw_exception_from_ 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_13, + /*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); @@ -528,7 +552,7 @@ func_art_throw_verification_error_from_code->setAttributes(func_art_throw_verifi 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_14, + /*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); @@ -539,7 +563,7 @@ func_art_find_catch_block_from_code->setAttributes(func_art_find_catch_block_fro 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_15, + /*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); @@ -550,7 +574,7 @@ func_art_alloc_object_from_code->setAttributes(func_art_alloc_object_from_code_P 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_15, + /*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); @@ -561,7 +585,7 @@ func_art_alloc_object_from_code_with_access_check->setAttributes(func_art_alloc_ 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_16, + /*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); @@ -572,7 +596,7 @@ func_art_alloc_array_from_code->setAttributes(func_art_alloc_array_from_code_PAL 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_16, + /*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); @@ -583,7 +607,7 @@ func_art_alloc_array_from_code_with_access_check->setAttributes(func_art_alloc_a 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_16, + /*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); @@ -594,7 +618,7 @@ func_art_check_and_alloc_array_from_code->setAttributes(func_art_check_and_alloc 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_16, + /*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); @@ -605,7 +629,7 @@ func_art_check_and_alloc_array_from_code_with_access_check->setAttributes(func_a 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_17, + /*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); @@ -616,7 +640,7 @@ func_art_find_instance_field_from_code->setAttributes(func_art_find_instance_fie 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_17, + /*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); @@ -627,7 +651,7 @@ func_art_find_static_field_from_code->setAttributes(func_art_find_static_field_f 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_18, + /*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); @@ -638,7 +662,7 @@ func_art_find_static_method_from_code_with_access_check->setAttributes(func_art_ 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_18, + /*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); @@ -649,7 +673,7 @@ func_art_find_direct_method_from_code_with_access_check->setAttributes(func_art_ 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_18, + /*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); @@ -660,7 +684,7 @@ func_art_find_virtual_method_from_code_with_access_check->setAttributes(func_art 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_18, + /*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); @@ -671,7 +695,7 @@ func_art_find_super_method_from_code_with_access_check->setAttributes(func_art_f 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_18, + /*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); @@ -682,7 +706,7 @@ func_art_find_interface_method_from_code_with_access_check->setAttributes(func_a 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_18, + /*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); @@ -693,7 +717,7 @@ func_art_find_interface_method_from_code->setAttributes(func_art_find_interface_ 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_15, + /*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); @@ -704,7 +728,7 @@ func_art_initialize_static_storage_from_code->setAttributes(func_art_initialize_ 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_15, + /*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); @@ -715,7 +739,7 @@ func_art_initialize_type_from_code->setAttributes(func_art_initialize_type_from_ 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_15, + /*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); @@ -726,7 +750,7 @@ func_art_initialize_type_and_verify_access_from_code->setAttributes(func_art_ini 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_19, + /*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); @@ -737,7 +761,7 @@ func_art_resolve_string_from_code->setAttributes(func_art_resolve_string_from_co 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_20, + /*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); @@ -748,7 +772,7 @@ func_art_set32_static_from_code->setAttributes(func_art_set32_static_from_code_P 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_21, + /*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); @@ -759,7 +783,7 @@ func_art_set64_static_from_code->setAttributes(func_art_set64_static_from_code_P 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_22, + /*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); @@ -770,7 +794,7 @@ func_art_set_obj_static_from_code->setAttributes(func_art_set_obj_static_from_co 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_23, + /*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); @@ -781,7 +805,7 @@ func_art_get32_static_from_code->setAttributes(func_art_get32_static_from_code_P 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_24, + /*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); @@ -792,7 +816,7 @@ func_art_get64_static_from_code->setAttributes(func_art_get64_static_from_code_P 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_25, + /*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); @@ -803,7 +827,7 @@ func_art_get_obj_static_from_code->setAttributes(func_art_get_obj_static_from_co 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_26, + /*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); @@ -814,7 +838,7 @@ func_art_set32_instance_from_code->setAttributes(func_art_set32_instance_from_co 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_27, + /*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); @@ -825,7 +849,7 @@ func_art_set64_instance_from_code->setAttributes(func_art_set64_instance_from_co 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_28, + /*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); @@ -836,7 +860,7 @@ func_art_set_obj_instance_from_code->setAttributes(func_art_set_obj_instance_fro 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_22, + /*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); @@ -847,7 +871,7 @@ func_art_get32_instance_from_code->setAttributes(func_art_get32_instance_from_co 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_29, + /*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); @@ -858,7 +882,7 @@ func_art_get64_instance_from_code->setAttributes(func_art_get64_instance_from_co 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_15, + /*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); @@ -869,7 +893,7 @@ func_art_get_obj_instance_from_code->setAttributes(func_art_get_obj_instance_fro 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_30, + /*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); @@ -880,7 +904,7 @@ func_art_decode_jobject_in_thread->setAttributes(func_art_decode_jobject_in_thre 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_31, + /*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); @@ -891,7 +915,7 @@ func_art_fill_array_data_from_code->setAttributes(func_art_fill_array_data_from_ 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_32, + /*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); @@ -924,7 +948,7 @@ func_art_check_put_array_element_from_code->setAttributes(func_art_check_put_arr Function* func_art_d2l = mod->getFunction("art_d2l"); if (!func_art_d2l) { func_art_d2l = Function::Create( - /*Type=*/FuncTy_33, + /*Type=*/FuncTy_32, /*Linkage=*/GlobalValue::ExternalLinkage, /*Name=*/"art_d2l", mod); // (external, no body) func_art_d2l->setCallingConv(CallingConv::C); @@ -935,7 +959,7 @@ func_art_d2l->setAttributes(func_art_d2l_PAL); Function* func_art_d2i = mod->getFunction("art_d2i"); if (!func_art_d2i) { func_art_d2i = Function::Create( - /*Type=*/FuncTy_34, + /*Type=*/FuncTy_33, /*Linkage=*/GlobalValue::ExternalLinkage, /*Name=*/"art_d2i", mod); // (external, no body) func_art_d2i->setCallingConv(CallingConv::C); @@ -946,7 +970,7 @@ func_art_d2i->setAttributes(func_art_d2i_PAL); Function* func_art_f2l = mod->getFunction("art_f2l"); if (!func_art_f2l) { func_art_f2l = Function::Create( - /*Type=*/FuncTy_35, + /*Type=*/FuncTy_34, /*Linkage=*/GlobalValue::ExternalLinkage, /*Name=*/"art_f2l", mod); // (external, no body) func_art_f2l->setCallingConv(CallingConv::C); @@ -957,7 +981,7 @@ func_art_f2l->setAttributes(func_art_f2l_PAL); Function* func_art_f2i = mod->getFunction("art_f2i"); if (!func_art_f2i) { func_art_f2i = Function::Create( - /*Type=*/FuncTy_36, + /*Type=*/FuncTy_35, /*Linkage=*/GlobalValue::ExternalLinkage, /*Name=*/"art_f2i", mod); // (external, no body) func_art_f2i->setCallingConv(CallingConv::C); @@ -965,6 +989,83 @@ func_art_f2i->setCallingConv(CallingConv::C); AttrListPtr func_art_f2i_PAL; func_art_f2i->setAttributes(func_art_f2i_PAL); +Function* func_art_jni_method_start = mod->getFunction("art_jni_method_start"); +if (!func_art_jni_method_start) { +func_art_jni_method_start = Function::Create( + /*Type=*/FuncTy_36, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"art_jni_method_start", mod); // (external, no body) +func_art_jni_method_start->setCallingConv(CallingConv::C); +} +AttrListPtr func_art_jni_method_start_PAL; +func_art_jni_method_start->setAttributes(func_art_jni_method_start_PAL); + +Function* func_art_jni_method_start_synchronized = mod->getFunction("art_jni_method_start_synchronized"); +if (!func_art_jni_method_start_synchronized) { +func_art_jni_method_start_synchronized = Function::Create( + /*Type=*/FuncTy_31, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"art_jni_method_start_synchronized", mod); // (external, no body) +func_art_jni_method_start_synchronized->setCallingConv(CallingConv::C); +} +AttrListPtr func_art_jni_method_start_synchronized_PAL; +func_art_jni_method_start_synchronized->setAttributes(func_art_jni_method_start_synchronized_PAL); + +Function* func_art_jni_method_end = mod->getFunction("art_jni_method_end"); +if (!func_art_jni_method_end) { +func_art_jni_method_end = Function::Create( + /*Type=*/FuncTy_16, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"art_jni_method_end", mod); // (external, no body) +func_art_jni_method_end->setCallingConv(CallingConv::C); +} +AttrListPtr func_art_jni_method_end_PAL; +func_art_jni_method_end->setAttributes(func_art_jni_method_end_PAL); + +Function* func_art_jni_method_end_synchronized = mod->getFunction("art_jni_method_end_synchronized"); +if (!func_art_jni_method_end_synchronized) { +func_art_jni_method_end_synchronized = Function::Create( + /*Type=*/FuncTy_37, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"art_jni_method_end_synchronized", mod); // (external, no body) +func_art_jni_method_end_synchronized->setCallingConv(CallingConv::C); +} +AttrListPtr func_art_jni_method_end_synchronized_PAL; +func_art_jni_method_end_synchronized->setAttributes(func_art_jni_method_end_synchronized_PAL); + +Function* func_art_jni_method_end_with_reference = mod->getFunction("art_jni_method_end_with_reference"); +if (!func_art_jni_method_end_with_reference) { +func_art_jni_method_end_with_reference = Function::Create( + /*Type=*/FuncTy_38, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"art_jni_method_end_with_reference", mod); // (external, no body) +func_art_jni_method_end_with_reference->setCallingConv(CallingConv::C); +} +AttrListPtr func_art_jni_method_end_with_reference_PAL; +func_art_jni_method_end_with_reference->setAttributes(func_art_jni_method_end_with_reference_PAL); + +Function* func_art_jni_method_end_with_reference_synchronized = mod->getFunction("art_jni_method_end_with_reference_synchronized"); +if (!func_art_jni_method_end_with_reference_synchronized) { +func_art_jni_method_end_with_reference_synchronized = Function::Create( + /*Type=*/FuncTy_39, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"art_jni_method_end_with_reference_synchronized", mod); // (external, no body) +func_art_jni_method_end_with_reference_synchronized->setCallingConv(CallingConv::C); +} +AttrListPtr func_art_jni_method_end_with_reference_synchronized_PAL; +func_art_jni_method_end_with_reference_synchronized->setAttributes(func_art_jni_method_end_with_reference_synchronized_PAL); + +Function* func_art_is_exception_pending_from_code = mod->getFunction("art_is_exception_pending_from_code"); +if (!func_art_is_exception_pending_from_code) { +func_art_is_exception_pending_from_code = Function::Create( + /*Type=*/FuncTy_40, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"art_is_exception_pending_from_code", mod); // (external, no body) +func_art_is_exception_pending_from_code->setCallingConv(CallingConv::C); +} +AttrListPtr func_art_is_exception_pending_from_code_PAL; +func_art_is_exception_pending_from_code->setAttributes(func_art_is_exception_pending_from_code_PAL); + Function* func_art_mark_gc_card_from_code = mod->getFunction("art_mark_gc_card_from_code"); if (!func_art_mark_gc_card_from_code) { func_art_mark_gc_card_from_code = Function::Create( @@ -979,7 +1080,7 @@ func_art_mark_gc_card_from_code->setAttributes(func_art_mark_gc_card_from_code_P 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_37, + /*Type=*/FuncTy_41, /*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/jni_compiler.cc b/src/compiler_llvm/jni_compiler.cc index 1f687f6f20..8bb8b8759b 100644 --- a/src/compiler_llvm/jni_compiler.cc +++ b/src/compiler_llvm/jni_compiler.cc @@ -32,6 +32,7 @@ #include <llvm/BasicBlock.h> #include <llvm/DerivedTypes.h> #include <llvm/Function.h> +#include <llvm/ADT/SmallVector.h> #include <llvm/Type.h> namespace art { @@ -117,13 +118,8 @@ CompiledMethod* JniCompiler::Compile() { // Get JNIEnv llvm::Value* jni_env_object_addr = irb_.Runtime().EmitLoadFromThreadOffset(Thread::JniEnvOffset().Int32Value(), - irb_.getJObjectTy(), - kTBAAJRuntime); - - // Set thread state to kNative - irb_.Runtime().EmitStoreToThreadOffset(Thread::StateOffset().Int32Value(), - irb_.getInt32(kNative), - kTBAARuntimeInfo); + irb_.getJObjectTy(), + kTBAAJRuntime); // Get callee code_addr llvm::Value* code_addr = @@ -152,7 +148,8 @@ CompiledMethod* JniCompiler::Compile() { llvm::Value* sirt_field_addr = irb_.CreateGEP(shadow_frame_, gep_index); irb_.CreateStore(this_object_or_class_object, sirt_field_addr, kTBAAShadowFrame); // Push the "this object or class object" to out args - args.push_back(irb_.CreateBitCast(sirt_field_addr, irb_.getJObjectTy())); + this_object_or_class_object = irb_.CreateBitCast(sirt_field_addr, irb_.getJObjectTy()); + args.push_back(this_object_or_class_object); // Store arguments to SIRT, and push back to args for (arg_iter = arg_begin; arg_iter != arg_end; ++arg_iter) { if (arg_iter->getType() == irb_.getJObjectTy()) { @@ -173,74 +170,48 @@ CompiledMethod* JniCompiler::Compile() { } } - // Acquire lock for synchronized methods. - if (is_synchronized) { - irb_.Runtime().EmitLockObject(this_object_or_class_object); + llvm::Value* saved_local_ref_cookie; + { // JniMethodStart + RuntimeId func_id = is_synchronized ? JniMethodStartSynchronized + : JniMethodStart; + llvm::SmallVector<llvm::Value*, 2> args; + if (is_synchronized) { + args.push_back(this_object_or_class_object); + } + args.push_back(irb_.Runtime().EmitGetCurrentThread()); + saved_local_ref_cookie = + irb_.CreateCall(irb_.GetRuntime(func_id), args); } - // saved_local_ref_cookie = env->local_ref_cookie - llvm::Value* saved_local_ref_cookie = - irb_.LoadFromObjectOffset(jni_env_object_addr, - JNIEnvExt::LocalRefCookieOffset().Int32Value(), - irb_.getInt32Ty(), - kTBAARuntimeInfo); - - // env->local_ref_cookie = env->locals.segment_state - llvm::Value* segment_state = - irb_.LoadFromObjectOffset(jni_env_object_addr, - JNIEnvExt::SegmentStateOffset().Int32Value(), - irb_.getInt32Ty(), - kTBAARuntimeInfo); - irb_.StoreToObjectOffset(jni_env_object_addr, - JNIEnvExt::LocalRefCookieOffset().Int32Value(), - segment_state, - kTBAARuntimeInfo); - - // Call!!! llvm::Value* retval = irb_.CreateCall(code_addr, args); + { // JniMethodEnd + bool is_return_ref = return_shorty == 'L'; + RuntimeId func_id = + is_return_ref ? (is_synchronized ? JniMethodEndWithReferenceSynchronized + : JniMethodEndWithReference) + : (is_synchronized ? JniMethodEndSynchronized + : JniMethodEnd); + llvm::SmallVector<llvm::Value*, 4> args; + if (is_return_ref) { + args.push_back(retval); + } + args.push_back(saved_local_ref_cookie); + if (is_synchronized) { + args.push_back(this_object_or_class_object); + } + args.push_back(irb_.Runtime().EmitGetCurrentThread()); - // Release lock for synchronized methods. - if (is_synchronized) { - irb_.Runtime().EmitUnlockObject(this_object_or_class_object); - } - - // Set thread state to kRunnable - irb_.Runtime().EmitStoreToThreadOffset(Thread::StateOffset().Int32Value(), - irb_.getInt32(kRunnable), - kTBAARuntimeInfo); - - // Do a suspend check - irb_.Runtime().EmitTestSuspend(); - - if (return_shorty == 'L') { - // Get thread object - llvm::Value* thread_object_addr = irb_.Runtime().EmitGetCurrentThread(); + llvm::Value* decoded_jobject = + irb_.CreateCall(irb_.GetRuntime(func_id), args); - // If the return value is reference, it may point to SIRT, we should decode it. - retval = irb_.CreateCall2(irb_.GetRuntime(DecodeJObjectInThread), - thread_object_addr, - retval); + // Return decoded jobject if return reference. + if (is_return_ref) { + retval = decoded_jobject; + } } - // env->locals.segment_state = env->local_ref_cookie - llvm::Value* local_ref_cookie = - irb_.LoadFromObjectOffset(jni_env_object_addr, - JNIEnvExt::LocalRefCookieOffset().Int32Value(), - irb_.getInt32Ty(), - kTBAARuntimeInfo); - irb_.StoreToObjectOffset(jni_env_object_addr, - JNIEnvExt::SegmentStateOffset().Int32Value(), - local_ref_cookie, - kTBAARuntimeInfo); - - // env->local_ref_cookie = saved_local_ref_cookie - irb_.StoreToObjectOffset(jni_env_object_addr, - JNIEnvExt::LocalRefCookieOffset().Int32Value(), - saved_local_ref_cookie, - kTBAARuntimeInfo); - // Pop the shadow frame irb_.Runtime().EmitPopShadowFrame(old_shadow_frame); diff --git a/src/compiler_llvm/runtime_support_func_list.h b/src/compiler_llvm/runtime_support_func_list.h index 30c6d6bcb6..236e02b7aa 100644 --- a/src/compiler_llvm/runtime_support_func_list.h +++ b/src/compiler_llvm/runtime_support_func_list.h @@ -64,8 +64,13 @@ V(FindCatchBlock, art_find_catch_block_from_code) \ V(MarkGCCard, art_mark_gc_card_from_code) \ V(ProxyInvokeHandler, art_proxy_invoke_handler_from_code) \ - V(DecodeJObjectInThread, art_decode_jobject_in_thread) \ V(art_d2l, art_d2l) \ V(art_d2i, art_d2i) \ V(art_f2l, art_f2l) \ - V(art_f2i, art_f2i) + V(art_f2i, art_f2i) \ + V(JniMethodStart, art_jni_method_start) \ + V(JniMethodStartSynchronized, art_jni_method_start_synchronized) \ + V(JniMethodEnd, art_jni_method_end) \ + V(JniMethodEndSynchronized, art_jni_method_end_synchronized) \ + V(JniMethodEndWithReference, art_jni_method_end_with_reference) \ + V(JniMethodEndWithReferenceSynchronized, art_jni_method_end_with_reference_synchronized) diff --git a/src/compiler_llvm/runtime_support_llvm.cc b/src/compiler_llvm/runtime_support_llvm.cc index e0fefd5e06..ccc0e14d7a 100644 --- a/src/compiler_llvm/runtime_support_llvm.cc +++ b/src/compiler_llvm/runtime_support_llvm.cc @@ -275,6 +275,14 @@ static Method* FindMethodHelper(uint32_t method_idx, Object* this_object, Method } } DCHECK(!thread->IsExceptionPending()); + const void* code = method->GetCode(); + + // When we return, the caller will branch to this address, so it had better not be 0! + if (UNLIKELY(code == NULL)) { + MethodHelper mh(method); + LOG(FATAL) << "Code was NULL in method: " << PrettyMethod(method) + << " location: " << mh.GetDexFile().GetLocation(); + } return method; } @@ -538,35 +546,6 @@ Object* art_get_obj_instance_from_code(uint32_t field_idx, Method* referrer, Obj return 0; } -Object* art_decode_jobject_in_thread(Thread* self, jobject java_object) - SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_) { - if (self->IsExceptionPending()) { - return NULL; - } - Object* o = self->DecodeJObject(java_object); - if (o == NULL || !self->GetJniEnv()->check_jni) { - return o; - } - - if (o == kInvalidIndirectRefObject) { - JniAbortF(NULL, "invalid reference returned from %s", - PrettyMethod(self->GetCurrentMethod()).c_str()); - } - - // Make sure that the result is an instance of the type this - // method was expected to return. - Method* m = self->GetCurrentMethod(); - MethodHelper mh(m); - Class* return_type = mh.GetReturnType(); - - if (!o->InstanceOf(return_type)) { - JniAbortF(NULL, "attempt to return an instance of %s from %s", - PrettyTypeOf(o).c_str(), PrettyMethod(m).c_str()); - } - - return o; -} - void art_fill_array_data_from_code(Method* method, uint32_t dex_pc, Array* array, uint32_t payload_offset) SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_) { @@ -649,6 +628,81 @@ void art_check_put_array_element_from_code(const Object* element, const Object* } //---------------------------------------------------------------------------- +// JNI +//---------------------------------------------------------------------------- + +// Called on entry to JNI, transition out of Runnable and release share of mutator_lock_. +uint32_t art_jni_method_start(Thread* self) + UNLOCK_FUNCTION(GlobalSynchronizatio::mutator_lock_) { + JNIEnvExt* env = self->GetJniEnv(); + uint32_t saved_local_ref_cookie = env->local_ref_cookie; + env->local_ref_cookie = env->locals.GetSegmentState(); + self->TransitionFromRunnableToSuspended(kNative); + return saved_local_ref_cookie; +} + +uint32_t art_jni_method_start_synchronized(jobject to_lock, Thread* self) + UNLOCK_FUNCTION(GlobalSynchronization::mutator_lock_) { + self->DecodeJObject(to_lock)->MonitorEnter(self); + return art_jni_method_start(self); +} + +static inline void PopLocalReferences(uint32_t saved_local_ref_cookie, Thread* self) { + JNIEnvExt* env = self->GetJniEnv(); + env->locals.SetSegmentState(env->local_ref_cookie); + env->local_ref_cookie = saved_local_ref_cookie; +} + +void art_jni_method_end(uint32_t saved_local_ref_cookie, Thread* self) + SHARED_LOCK_FUNCTION(GlobalSynchronization::mutator_lock_) { + self->TransitionFromSuspendedToRunnable(); + PopLocalReferences(saved_local_ref_cookie, self); +} + + +void art_jni_method_end_synchronized(uint32_t saved_local_ref_cookie, jobject locked, + Thread* self) + SHARED_LOCK_FUNCTION(GlobalSynchronization::mutator_lock_) { + self->TransitionFromSuspendedToRunnable(); + UnlockJniSynchronizedMethod(locked, self); // Must decode before pop. + PopLocalReferences(saved_local_ref_cookie, self); +} + +Object* art_jni_method_end_with_reference(jobject result, uint32_t saved_local_ref_cookie, + Thread* self) + SHARED_LOCK_FUNCTION(GlobalSynchronization::mutator_lock_) { + self->TransitionFromSuspendedToRunnable(); + Object* o = self->DecodeJObject(result); // Must decode before pop. + PopLocalReferences(saved_local_ref_cookie, self); + // Process result. + if (UNLIKELY(self->GetJniEnv()->check_jni)) { + if (self->IsExceptionPending()) { + return NULL; + } + CheckReferenceResult(o, self); + } + return o; +} + +Object* art_jni_method_end_with_reference_synchronized(jobject result, + uint32_t saved_local_ref_cookie, + jobject locked, Thread* self) + SHARED_LOCK_FUNCTION(GlobalSynchronization::mutator_lock_) { + self->TransitionFromSuspendedToRunnable(); + UnlockJniSynchronizedMethod(locked, self); // Must decode before pop. + Object* o = self->DecodeJObject(result); + PopLocalReferences(saved_local_ref_cookie, self); + // Process result. + if (UNLIKELY(self->GetJniEnv()->check_jni)) { + if (self->IsExceptionPending()) { + return NULL; + } + CheckReferenceResult(o, self); + } + return o; +} + +//---------------------------------------------------------------------------- // Runtime Support Function Lookup Callback //---------------------------------------------------------------------------- |