lambda: Add support for invoke-interface for boxed innate lambdas
Lambda closures created with the 'create-lambda' instruction
(termed "innate lambdas") can be turned into an object with 'box-lambda'.
This CL enables support for those kinds of lambdas to work with
'invoke-interface' by generating a proxy class for the lambda.
Note: MIPS32/64 support not included.
Bug: 24618608
Bug: 25107649
Change-Id: Ic8f1bb66ebeaed4097e758a50becf1cff6ccaefb
diff --git a/runtime/lambda/art_lambda_method.cc b/runtime/lambda/art_lambda_method.cc
index 6f9f8bb..0690cd1 100644
--- a/runtime/lambda/art_lambda_method.cc
+++ b/runtime/lambda/art_lambda_method.cc
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include "art_method-inl.h"
#include "lambda/art_lambda_method.h"
#include "base/logging.h"
@@ -73,5 +74,12 @@
}
}
+size_t ArtLambdaMethod::GetArgumentVRegCount() const {
+ DCHECK(GetArtMethod()->IsStatic()); // Instance methods don't have receiver in shorty.
+ const char* method_shorty = GetArtMethod()->GetShorty();
+ DCHECK_NE(*method_shorty, '\0') << method_shorty;
+ return ShortyFieldType::CountVirtualRegistersRequired(method_shorty + 1); // skip return type
+}
+
} // namespace lambda
} // namespace art