From 92f7f3ce3b01f7c7df1c15b81c900e087248093f Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 31 Oct 2017 11:38:30 +0000 Subject: Use intrinsic codegen for compiling intrinsic methods. When compiling an intrinsic method, generate a graph that invokes the same method and try to compile it. If the call is actually intrinsified (or simplified to other HIR) and yields a leaf method, use the result of this compilation attempt, otherwise compile the actual code or JNI stub. Note that CodeGenerator::CreateThrowingSlowPathLocations() actually marks the locations as kNoCall if the throw is not in a catch block, thus considering some throwing methods (for example, String.charAt()) as leaf methods. We would ideally want to use the intrinsic codegen for all intrinsics that do not generate a slow-path call to the default implementation. Relying on the leaf method is suboptimal as we're missing out on methods that do other types of calls, for example runtime calls. This shall be fixed in a subsequent CL. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 67717501 Change-Id: I640fda7c22d4ff494b5ff77ebec3b7f5f75af652 --- compiler/optimizing/instruction_builder.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'compiler/optimizing/instruction_builder.h') diff --git a/compiler/optimizing/instruction_builder.h b/compiler/optimizing/instruction_builder.h index 058b711687..f551ac4280 100644 --- a/compiler/optimizing/instruction_builder.h +++ b/compiler/optimizing/instruction_builder.h @@ -50,7 +50,7 @@ class HInstructionBuilder : public ValueObject { HBasicBlockBuilder* block_builder, SsaBuilder* ssa_builder, const DexFile* dex_file, - const DexFile::CodeItem& code_item, + const DexFile::CodeItem* code_item, DataType::Type return_type, const DexCompilationUnit* dex_compilation_unit, const DexCompilationUnit* outer_compilation_unit, @@ -85,6 +85,7 @@ class HInstructionBuilder : public ValueObject { } bool Build(); + void BuildIntrinsic(ArtMethod* method); private: void InitializeBlockLocals(); @@ -327,7 +328,7 @@ class HInstructionBuilder : public ValueObject { // The dex file where the method being compiled is, and the bytecode data. const DexFile* const dex_file_; - const DexFile::CodeItem& code_item_; + const DexFile::CodeItem* const code_item_; // null for intrinsic graph. // The return type of the method being compiled. const DataType::Type return_type_; -- cgit v1.2.3-59-g8ed1b