From 14832efeb92334c562ebedef34e920d30e3cee69 Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Fri, 5 Aug 2016 11:44:32 +0100 Subject: Revert experimental lambda feature. This is a revert of the following changes : 30c475a2046951a81769c2db0b2dad66cd71e189. lambda: Minor capture-variable/liberate-variable clean-up after post-merge reviews. 6918bf13eb855b3aa8ccdddda2d27ae8c60cec56. lambda: Experimental support for capture-variable and liberate-variable fc1ccd740b7c8e96dfac675cfc580122cd1b40a6. lambda: Infrastructure to support capture/liberate-variable dex opcodes e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7. runtime: Add lambda box/unbox object equality 2ee54e249ad21c74f29a161e248bebe7d22fddf1. runtime: Partially implement box-lambda and unbox-lambda experimental opcodes 158f35c98e2ec0d40d2c032b8cdce5fb60944a7f. interpreter: Add experimental lambda opcodes for invoke/create-lambda a3bb72036f5454e410467f7151dc89f725ae1151. Added format 25x to dexdump(2). Plus surrounding cleanups. Test: make test-art Change-Id: Ic6f999ad17385ef933f763641049cf721510b202 --- runtime/lambda/closure_builder.h | 104 --------------------------------------- 1 file changed, 104 deletions(-) delete mode 100644 runtime/lambda/closure_builder.h (limited to 'runtime/lambda/closure_builder.h') diff --git a/runtime/lambda/closure_builder.h b/runtime/lambda/closure_builder.h deleted file mode 100644 index 23eb484529..0000000000 --- a/runtime/lambda/closure_builder.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef ART_RUNTIME_LAMBDA_CLOSURE_BUILDER_H_ -#define ART_RUNTIME_LAMBDA_CLOSURE_BUILDER_H_ - -#include "base/macros.h" -#include "base/mutex.h" // For Locks::mutator_lock_. -#include "base/value_object.h" -#include "lambda/shorty_field_type.h" - -#include -#include - -namespace art { -class ArtMethod; // forward declaration - -namespace mirror { -class Object; // forward declaration -} // namespace mirror - -namespace lambda { -class ArtLambdaMethod; // forward declaration - -// Build a closure by capturing variables one at a time. -// When all variables have been marked captured, the closure can be created in-place into -// a target memory address. -// -// 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 { - public: - using ShortyTypeEnum = decltype(ShortyFieldType::kByte); - - // Mark this primitive value to be captured as the specified type. - template ::value> - void CaptureVariablePrimitive(T value); - - // Mark this object reference to be captured. - void CaptureVariableObject(mirror::Object* object) SHARED_REQUIRES(Locks::mutator_lock_); - - // Mark this lambda closure to be captured. - void CaptureVariableLambda(Closure* closure); - - // Get the size (in bytes) of the closure. - // This size is used to be able to allocate memory large enough to write the closure into. - // Call 'CreateInPlace' to actually write the closure out. - size_t GetSize() const; - - // 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. - Closure* CreateInPlace(void* memory, ArtLambdaMethod* target_method) const - SHARED_REQUIRES(Locks::mutator_lock_); - - // Locks need to be held for entire lifetime of ClosureBuilder. - ClosureBuilder() SHARED_REQUIRES(Locks::mutator_lock_) - {} - - // Locks need to be held for entire lifetime of ClosureBuilder. - ~ClosureBuilder() SHARED_REQUIRES(Locks::mutator_lock_) - {} - - private: - // Initial size a closure starts out before any variables are written. - // Header size only. - static constexpr size_t kInitialSize = sizeof(ArtLambdaMethod*); - - // Write a Closure's variables field from the captured variables. - // variables_size specified in bytes, and only includes enough room to write variables into. - // Returns the calculated actual size of the closure. - size_t WriteValues(ArtLambdaMethod* target_method, - uint8_t variables[], - size_t header_size, - size_t variables_size) const SHARED_REQUIRES(Locks::mutator_lock_); - - size_t size_ = kInitialSize; - bool is_dynamic_size_ = false; - std::vector values_; - std::string shorty_types_; -}; - -} // namespace lambda -} // namespace art - -#endif // ART_RUNTIME_LAMBDA_CLOSURE_BUILDER_H_ -- cgit v1.2.3-59-g8ed1b