summaryrefslogtreecommitdiff
path: root/compiler/optimizing/builder.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2017-10-31 11:38:30 +0000
committer Vladimir Marko <vmarko@google.com> 2017-11-15 14:29:52 +0000
commit92f7f3ce3b01f7c7df1c15b81c900e087248093f (patch)
tree37647ac824e450f80d752539cabbe631ba795c75 /compiler/optimizing/builder.h
parent5dcb0d2cabe9d67987a6a7477fb124cef92abefb (diff)
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
Diffstat (limited to 'compiler/optimizing/builder.h')
-rw-r--r--compiler/optimizing/builder.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/optimizing/builder.h b/compiler/optimizing/builder.h
index 5a860f1e43..0bb3a051f7 100644
--- a/compiler/optimizing/builder.h
+++ b/compiler/optimizing/builder.h
@@ -21,17 +21,19 @@
#include "dex_file-inl.h"
#include "dex_file.h"
#include "driver/compiler_driver.h"
-#include "driver/dex_compilation_unit.h"
#include "nodes.h"
namespace art {
+class ArtMethod;
class CodeGenerator;
+class DexCompilationUnit;
class OptimizingCompilerStats;
class HGraphBuilder : public ValueObject {
public:
HGraphBuilder(HGraph* graph,
+ const DexFile::CodeItem* code_item,
const DexCompilationUnit* dex_compilation_unit,
const DexCompilationUnit* outer_compilation_unit,
CompilerDriver* driver,
@@ -47,8 +49,8 @@ class HGraphBuilder : public ValueObject {
VariableSizedHandleScope* handles,
DataType::Type return_type = DataType::Type::kInt32)
: graph_(graph),
- dex_file_(dex_compilation_unit->GetDexFile()),
- code_item_(code_item),
+ dex_file_(&graph->GetDexFile()),
+ code_item_(&code_item),
dex_compilation_unit_(dex_compilation_unit),
outer_compilation_unit_(nullptr),
compiler_driver_(nullptr),
@@ -59,6 +61,7 @@ class HGraphBuilder : public ValueObject {
return_type_(return_type) {}
GraphAnalysisResult BuildGraph();
+ void BuildIntrinsicGraph(ArtMethod* method);
static constexpr const char* kBuilderPassName = "builder";
@@ -67,7 +70,7 @@ class HGraphBuilder : public ValueObject {
HGraph* const graph_;
const DexFile* const dex_file_;
- const DexFile::CodeItem& code_item_;
+ const DexFile::CodeItem* const code_item_; // null for intrinsic graph.
// The compilation unit of the current method being compiled. Note that
// it can be an inlined method.