Profiler directed clean-up of dex2oat.
Fix bad usage of std::string in: the verifier and compiler driver method
arguments, causing unnecessary boxing and allocations; in creating a symbol for
the dex compilation unit, that is only used in portable builds; in pattern
matching for intrinsics by name.
Make class linker dex and classes locks reader/writer to allow concurrent
dex cache or class querying. Refactor ComputeCompilingMethodsClass to pass in a
dex cache hint, to avoid taking any locks when the dex file of the compiling
method matches that of the field or method being resolved.
Make the RegType's HasClass method virtual to avoid frequent virtual method
dispatch. Make RegTypeCache GetFromId inlinable.
Various other bits of whitespace and formatting clean-up.
Change-Id: Id152e1e5a6fed2961dad0b612b7aa0c48001ef94
diff --git a/src/compiler/dex/quick/gen_invoke.cc b/src/compiler/dex/quick/gen_invoke.cc
index f44272a..733fdc9 100644
--- a/src/compiler/dex/quick/gen_invoke.cc
+++ b/src/compiler/dex/quick/gen_invoke.cc
@@ -15,6 +15,7 @@
*/
#include "compiler/dex/compiler_ir.h"
+#include "dex_file-inl.h"
#include "invoke_type.h"
#include "mirror/array.h"
#include "mirror/string.h"
@@ -1177,6 +1178,10 @@
// TODO - add Mips implementation
return false;
}
+ if (cu_->instruction_set == kX86 && is_object) {
+ // TODO: fix X86, it exhausts registers for card marking.
+ return false;
+ }
// Unused - RegLocation rl_src_unsafe = info->args[0];
RegLocation rl_src_obj = info->args[1]; // Object
RegLocation rl_src_offset = info->args[2]; // long low
@@ -1220,8 +1225,10 @@
* method. By doing this during basic block construction, we can also
* take advantage of/generate new useful dataflow info.
*/
- std::string tgt_method(PrettyMethod(info->index, *cu_->dex_file));
- if (tgt_method.find(" java.lang") != std::string::npos) {
+ const char* tgt_methods_declaring_class =
+ cu_->dex_file->GetMethodDeclaringClassDescriptor(cu_->dex_file->GetMethodId(info->index));
+ if (strstr(tgt_methods_declaring_class, "Ljava/lang") != NULL) {
+ std::string tgt_method(PrettyMethod(info->index, *cu_->dex_file));
if (tgt_method == "long java.lang.Double.doubleToRawLongBits(double)") {
return GenInlinedDoubleCvt(info);
}
@@ -1275,7 +1282,8 @@
if (tgt_method == "java.lang.Thread java.lang.Thread.currentThread()") {
return GenInlinedCurrentThread(info);
}
- } else if (tgt_method.find(" sun.misc.Unsafe") != std::string::npos) {
+ } else if (strstr(tgt_methods_declaring_class, "Lsun/misc/Unsafe;") != NULL) {
+ std::string tgt_method(PrettyMethod(info->index, *cu_->dex_file));
if (tgt_method == "boolean sun.misc.Unsafe.compareAndSwapInt(java.lang.Object, long, int, int)") {
return GenInlinedCas32(info, false);
}