OSDN Git Service

Quick: Inline synthetic accessors generated by jack.
authorVladimir Marko <vmarko@google.com>
Wed, 6 May 2015 13:09:04 +0000 (14:09 +0100)
committerVladimir Marko <vmarko@google.com>
Wed, 6 May 2015 14:40:50 +0000 (15:40 +0100)
While javac names synthetic accessors "access$nnn", jack
names them "-getN", "-putN" and "-wrapN". For simplicity,
treat all methods starting with "-" as synthetic accessors.

Bug: 20873367
Change-Id: I67990a6c2ef1d25dafe460ef70143a113bb5b7da

runtime/quick/inline_method_analyser.cc

index 9cf4b16..1c404ff 100644 (file)
@@ -134,7 +134,10 @@ bool InlineMethodAnalyser::AnalyseMethodCode(verifier::MethodVerifier* verifier,
 bool InlineMethodAnalyser::IsSyntheticAccessor(MethodReference ref) {
   const DexFile::MethodId& method_id = ref.dex_file->GetMethodId(ref.dex_method_index);
   const char* method_name = ref.dex_file->GetMethodName(method_id);
-  return strncmp(method_name, "access$", strlen("access$")) == 0;
+  // javac names synthetic accessors "access$nnn",
+  // jack names them "-getN", "-putN", "-wrapN".
+  return strncmp(method_name, "access$", strlen("access$")) == 0 ||
+      strncmp(method_name, "-", strlen("-")) == 0;
 }
 
 bool InlineMethodAnalyser::AnalyseReturnMethod(const DexFile::CodeItem* code_item,