diff options
author | 2014-01-06 12:55:46 -0800 | |
---|---|---|
committer | 2014-02-06 23:20:27 -0800 | |
commit | ef7d42fca18c16fbaf103822ad16f23246e2905d (patch) | |
tree | c67eea52a349c2ea7f2c3bdda8e73933c05531a8 /runtime/atomic_integer.h | |
parent | 822115a225185d2896607eb08d70ce5c7099adef (diff) |
Object model changes to support 64bit.
Modify mirror objects so that references between them use an ObjectReference
value type rather than an Object* so that functionality to compress larger
references can be captured in the ObjectRefererence implementation.
ObjectReferences are 32bit and all other aspects of object layout remain as
they are currently.
Expand fields in objects holding pointers so they can hold 64bit pointers. Its
expected the size of these will come down by improving where we hold compiler
meta-data.
Stub out x86_64 architecture specific runtime implementation.
Modify OutputStream so that reads and writes are of unsigned quantities.
Make the use of portable or quick code more explicit.
Templatize AtomicInteger to support more than just int32_t as a type.
Add missing, and fix issues relating to, missing annotalysis information on the
mutator lock.
Refactor and share implementations for array copy between System and uses
elsewhere in the runtime.
Fix numerous 64bit build issues.
Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822
Diffstat (limited to 'runtime/atomic_integer.h')
-rw-r--r-- | runtime/atomic_integer.h | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/runtime/atomic_integer.h b/runtime/atomic_integer.h deleted file mode 100644 index 651ca4a6e9..0000000000 --- a/runtime/atomic_integer.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2012 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_ATOMIC_INTEGER_H_ -#define ART_RUNTIME_ATOMIC_INTEGER_H_ - -#include <stdint.h> - -namespace art { - -class AtomicInteger { - public: - AtomicInteger() : value_(0) { } - - explicit AtomicInteger(int32_t value) : value_(value) { } - - AtomicInteger& operator=(int32_t desired) { - Store(desired); - return *this; - } - - int32_t Load() const { - return value_; - } - - operator int32_t() const { - return Load(); - } - - int32_t FetchAndAdd(const int32_t value) { - return __sync_fetch_and_add(&value_, value); // Return old_value. - } - - int32_t FetchAndSub(const int32_t value) { - return __sync_fetch_and_sub(&value_, value); // Return old value. - } - - int32_t operator++() { // Prefix operator. - return __sync_add_and_fetch(&value_, 1); // Return new value. - } - - int32_t operator++(int32_t) { // Postfix operator. - return __sync_fetch_and_add(&value_, 1); // Return old value. - } - - int32_t operator--() { // Prefix operator. - return __sync_sub_and_fetch(&value_, 1); // Return new value. - } - - int32_t operator--(int32_t) { // Postfix operator. - return __sync_fetch_and_sub(&value_, 1); // Return old value. - } - - bool CompareAndSwap(int32_t expected_value, int32_t desired_value) { - return __sync_bool_compare_and_swap(&value_, expected_value, desired_value); - } - - volatile int32_t* Address() { - return &value_; - } - - private: - // Unsafe = operator for non atomic operations on the integer. - void Store(int32_t desired) { - value_ = desired; - } - - volatile int32_t value_; -}; - -} // namespace art - -#endif // ART_RUNTIME_ATOMIC_INTEGER_H_ |