OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #ifndef VM_BECOME_H_ |
| 6 #define VM_BECOME_H_ |
| 7 |
| 8 #include "vm/allocation.h" |
| 9 |
| 10 namespace dart { |
| 11 |
| 12 class Array; |
| 13 |
| 14 class Become : public AllStatic { |
| 15 public: |
| 16 // Smalltalk's one-way bulk become (Array>>#elementsForwardIdentityTo:). |
| 17 // Redirects all pointers to elements of 'before' to the corresponding element |
| 18 // in 'after'. Every element in 'before' is guaranteed to be dead after this |
| 19 // operation, though we won't finalize them until the next GC discovers this. |
| 20 // Useful for atomically applying behavior and schema changes. |
| 21 static void ElementsForwardIdentity(const Array& before, const Array& after); |
| 22 |
| 23 // For completeness, Smalltalk also has a two-way bulk become |
| 24 // (Array>>#elementsExchangeIdentityWith:). This is typically used in |
| 25 // application-level virtual memory or persistence schemes, where a set of |
| 26 // objects are swapped with so-called husks and the original objects are |
| 27 // serialized. |
| 28 // static void ElementsExchangeIdentity(const Array& before, |
| 29 // const Array& after); |
| 30 }; |
| 31 |
| 32 } // namespace dart |
| 33 |
| 34 #endif // VM_BECOME_H_ |
OLD | NEW |