1.1 --- a/src/share/vm/gc_interface/collectedHeap.hpp Wed Dec 10 23:46:10 2008 -0800 1.2 +++ b/src/share/vm/gc_interface/collectedHeap.hpp Thu Dec 11 12:05:08 2008 -0800 1.3 @@ -47,6 +47,9 @@ 1.4 static int _fire_out_of_memory_count; 1.5 #endif 1.6 1.7 + // Used for filler objects (static, but initialized in ctor). 1.8 + static size_t _filler_array_max_size; 1.9 + 1.10 protected: 1.11 MemRegion _reserved; 1.12 BarrierSet* _barrier_set; 1.13 @@ -119,6 +122,21 @@ 1.14 // Clears an allocated object. 1.15 inline static void init_obj(HeapWord* obj, size_t size); 1.16 1.17 + // Filler object utilities. 1.18 + static inline size_t filler_array_hdr_size(); 1.19 + static inline size_t filler_array_min_size(); 1.20 + static inline size_t filler_array_max_size(); 1.21 + 1.22 + DEBUG_ONLY(static void fill_args_check(HeapWord* start, size_t words);) 1.23 + DEBUG_ONLY(static void zap_filler_array(HeapWord* start, size_t words);) 1.24 + 1.25 + // Fill with a single array; caller must ensure filler_array_min_size() <= 1.26 + // words <= filler_array_max_size(). 1.27 + static inline void fill_with_array(HeapWord* start, size_t words); 1.28 + 1.29 + // Fill with a single object (either an int array or a java.lang.Object). 1.30 + static inline void fill_with_object_impl(HeapWord* start, size_t words); 1.31 + 1.32 // Verification functions 1.33 virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size) 1.34 PRODUCT_RETURN; 1.35 @@ -294,6 +312,27 @@ 1.36 // The boundary between a "large" and "small" array of primitives, in words. 1.37 virtual size_t large_typearray_limit() = 0; 1.38 1.39 + // Utilities for turning raw memory into filler objects. 1.40 + // 1.41 + // min_fill_size() is the smallest region that can be filled. 1.42 + // fill_with_objects() can fill arbitrary-sized regions of the heap using 1.43 + // multiple objects. fill_with_object() is for regions known to be smaller 1.44 + // than the largest array of integers; it uses a single object to fill the 1.45 + // region and has slightly less overhead. 1.46 + static size_t min_fill_size() { 1.47 + return size_t(align_object_size(oopDesc::header_size())); 1.48 + } 1.49 + 1.50 + static void fill_with_objects(HeapWord* start, size_t words); 1.51 + 1.52 + static void fill_with_object(HeapWord* start, size_t words); 1.53 + static void fill_with_object(MemRegion region) { 1.54 + fill_with_object(region.start(), region.word_size()); 1.55 + } 1.56 + static void fill_with_object(HeapWord* start, HeapWord* end) { 1.57 + fill_with_object(start, pointer_delta(end, start)); 1.58 + } 1.59 + 1.60 // Some heaps may offer a contiguous region for shared non-blocking 1.61 // allocation, via inlined code (by exporting the address of the top and 1.62 // end fields defining the extent of the contiguous allocation region.)