summaryrefslogtreecommitdiff
path: root/runtime/lambda/closure_builder.h
diff options
context:
space:
mode:
author Igor Murashkin <iam@google.com> 2015-09-25 14:22:08 -0700
committer Igor Murashkin <iam@google.com> 2015-09-25 15:53:00 -0700
commitb72123440d8541362ebdb131436f9dbdda5fd329 (patch)
tree41e3d21496a270edc06879f084a504a39af9469b /runtime/lambda/closure_builder.h
parent9f3b8d38de615efef6d2536817f19ad2ccaa313a (diff)
lambda: Experimental support for capture-variable and liberate-variable
Supports capturing/liberating any primitive variables. No support for capturing objects/lambdas yet since they would both need GC changes to track roots through closures. Change-Id: Ibfb68bfe4c579dbf93823aac4c0e6ac8f6360c5d
Diffstat (limited to 'runtime/lambda/closure_builder.h')
-rw-r--r--runtime/lambda/closure_builder.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/runtime/lambda/closure_builder.h b/runtime/lambda/closure_builder.h
index 542e12afaa..23eb484529 100644
--- a/runtime/lambda/closure_builder.h
+++ b/runtime/lambda/closure_builder.h
@@ -40,13 +40,12 @@ class ArtLambdaMethod; // forward declaration
//
// The mutator lock must be held for the duration of the lifetime of this object,
// since it needs to temporarily store heap references into an internal list.
-class ClosureBuilder : ValueObject {
+class ClosureBuilder {
public:
using ShortyTypeEnum = decltype(ShortyFieldType::kByte);
-
// Mark this primitive value to be captured as the specified type.
- template <typename T, ShortyTypeEnum kShortyType>
+ template <typename T, ShortyTypeEnum kShortyType = ShortyFieldTypeSelectEnum<T>::value>
void CaptureVariablePrimitive(T value);
// Mark this object reference to be captured.
@@ -63,6 +62,9 @@ class ClosureBuilder : ValueObject {
// Returns how many variables have been captured so far.
size_t GetCaptureCount() const;
+ // Get the list of captured variables' shorty field types.
+ const std::string& GetCapturedVariableShortyTypes() const;
+
// Creates a closure in-place and writes out the data into 'memory'.
// Memory must be at least 'GetSize' bytes large.
// All previously marked data to be captured is now written out.
@@ -93,6 +95,7 @@ class ClosureBuilder : ValueObject {
size_t size_ = kInitialSize;
bool is_dynamic_size_ = false;
std::vector<ShortyFieldTypeTraits::MaxType> values_;
+ std::string shorty_types_;
};
} // namespace lambda