< prev index next >

src/hotspot/share/cds/archiveUtils.inline.hpp

Print this page
@@ -25,10 +25,14 @@
  #ifndef SHARE_CDS_ARCHIVEUTILS_INLINE_HPP
  #define SHARE_CDS_ARCHIVEUTILS_INLINE_HPP
  
  #include "cds/archiveUtils.hpp"
  
+ #include "cds/archiveBuilder.hpp"
+ #include "oops/array.hpp"
+ #include "utilities/growableArray.hpp"
+ 
  #include "utilities/bitMap.inline.hpp"
  
  inline bool SharedDataRelocator::do_bit(size_t offset) {
    address* p = _patch_base + offset;
    assert(_patch_base <= p && p < _patch_end, "must be");

@@ -45,6 +49,21 @@
                                     (int)offset, p2i(p), p2i(old_ptr), p2i(new_ptr)));
    *p = new_ptr;
    return true; // keep iterating
  }
  
+ // Returns the address of an Array<T> that's allocated in the ArchiveBuilder "buffer" space.
+ template <typename T>
+ Array<T>* ArchiveUtils::archive_array(GrowableArray<T>* tmp_array) {
+   Array<T>* archived_array = ArchiveBuilder::new_ro_array<T>(tmp_array->length());
+   for (int i = 0; i < tmp_array->length(); i++) {
+     archived_array->at_put(i, tmp_array->at(i));
+     if (std::is_pointer<T>::value) {
+       ArchivePtrMarker::mark_pointer(archived_array->adr_at(i));
+     }
+   }
+ 
+   return archived_array;
+ }
+ 
+ 
  #endif // SHARE_CDS_ARCHIVEUTILS_INLINE_HPP
< prev index next >