Get rid of platform-specific method inliners.
The DexFileToMethodInlinerMap dependency on CompilerDriver
and its instruction set makes it impossible to implement
verification-time checking for methods we want to inline.
Therefore, we get rid of the platform-specific method
inliners and rely on the backend's existing ability to
recognize when it can actually emit an intrinsic function.
Change-Id: I57947db93f13a26c1c794cb3584130321106306f
diff --git a/compiler/dex/quick/dex_file_method_inliner.h b/compiler/dex/quick/dex_file_method_inliner.h
index bc00513..948f4bb 100644
--- a/compiler/dex/quick/dex_file_method_inliner.h
+++ b/compiler/dex/quick/dex_file_method_inliner.h
@@ -89,12 +89,8 @@
*/
class DexFileMethodInliner {
public:
- virtual ~DexFileMethodInliner();
-
- /**
- * Find all known intrinsic methods in the dex_file and cache their indices.
- */
- virtual void FindIntrinsics(const DexFile* dex_file) = 0;
+ DexFileMethodInliner();
+ ~DexFileMethodInliner();
/**
* Check whether a particular method index corresponds to an intrinsic function.
@@ -103,15 +99,10 @@
/**
* Generate code for an intrinsic function invocation.
- *
- * TODO: This should be target-specific. For the time being,
- * it's shared since it dispatches everything to backend.
*/
bool GenIntrinsic(Mir2Lir* backend, CallInfo* info) const;
- protected:
- DexFileMethodInliner();
-
+ private:
/**
* To avoid multiple lookups of a class by its descriptor, we cache its
* type index in the IndexCache. These are the indexes into the IndexCache
@@ -290,6 +281,7 @@
static const char* kClassCacheNames[];
static const char* kNameCacheNames[];
static const ProtoDef kProtoCacheDefs[];
+ static const IntrinsicDef kIntrinsicMethods[];
static const uint32_t kIndexNotFound = static_cast<uint32_t>(-1);
static const uint32_t kIndexUnresolved = static_cast<uint32_t>(-2);
@@ -303,14 +295,22 @@
static uint32_t FindMethodIndex(const DexFile* dex_file, IndexCache* cache,
const MethodDef& method_def);
- void DoFindIntrinsics(const DexFile* dex_file, IndexCache* cache,
- const IntrinsicDef* defs, uint32_t def_count);
+ /**
+ * Find all known intrinsic methods in the dex_file and cache their indices.
+ *
+ * Only DexFileToMethodInlinerMap may call this function to initialize the inliner.
+ */
+ void FindIntrinsics(const DexFile* dex_file);
+
+ friend class DexFileToMethodInlinerMap;
/*
* Maps method indexes (for the particular DexFile) to Intrinsic defintions.
*/
std::map<uint32_t, Intrinsic> intrinsics_;
const DexFile* dex_file_;
+
+ DISALLOW_COPY_AND_ASSIGN(DexFileMethodInliner);
};
} // namespace art