src/share/vm/memory/space.hpp

changeset 873
122d10c82f3f
parent 791
1ee8caae33af
child 952
e9be0e04635a
equal deleted inserted replaced
849:348be627a148 873:122d10c82f3f
419 // MarkSweep support phase4 419 // MarkSweep support phase4
420 virtual void compact(); 420 virtual void compact();
421 421
422 // The maximum percentage of objects that can be dead in the compacted 422 // The maximum percentage of objects that can be dead in the compacted
423 // live part of a compacted space ("deadwood" support.) 423 // live part of a compacted space ("deadwood" support.)
424 virtual int allowed_dead_ratio() const { return 0; }; 424 virtual size_t allowed_dead_ratio() const { return 0; };
425 425
426 // Some contiguous spaces may maintain some data structures that should 426 // Some contiguous spaces may maintain some data structures that should
427 // be updated whenever an allocation crosses a boundary. This function 427 // be updated whenever an allocation crosses a boundary. This function
428 // returns the first such boundary. 428 // returns the first such boundary.
429 // (The default implementation returns the end of the space, so the 429 // (The default implementation returns the end of the space, so the
505 int invocations = SharedHeap::heap()->perm_gen()->stat_record()->invocations;\ 505 int invocations = SharedHeap::heap()->perm_gen()->stat_record()->invocations;\
506 bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0); \ 506 bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0); \
507 \ 507 \
508 size_t allowed_deadspace = 0; \ 508 size_t allowed_deadspace = 0; \
509 if (skip_dead) { \ 509 if (skip_dead) { \
510 int ratio = allowed_dead_ratio(); \ 510 const size_t ratio = allowed_dead_ratio(); \
511 allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize; \ 511 allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize; \
512 } \ 512 } \
513 \ 513 \
514 HeapWord* q = bottom(); \ 514 HeapWord* q = bottom(); \
515 HeapWord* t = scan_limit(); \ 515 HeapWord* t = scan_limit(); \
1077 1077
1078 class TenuredSpace: public OffsetTableContigSpace { 1078 class TenuredSpace: public OffsetTableContigSpace {
1079 friend class VMStructs; 1079 friend class VMStructs;
1080 protected: 1080 protected:
1081 // Mark sweep support 1081 // Mark sweep support
1082 int allowed_dead_ratio() const; 1082 size_t allowed_dead_ratio() const;
1083 public: 1083 public:
1084 // Constructor 1084 // Constructor
1085 TenuredSpace(BlockOffsetSharedArray* sharedOffsetArray, 1085 TenuredSpace(BlockOffsetSharedArray* sharedOffsetArray,
1086 MemRegion mr) : 1086 MemRegion mr) :
1087 OffsetTableContigSpace(sharedOffsetArray, mr) {} 1087 OffsetTableContigSpace(sharedOffsetArray, mr) {}
1092 1092
1093 class ContigPermSpace: public OffsetTableContigSpace { 1093 class ContigPermSpace: public OffsetTableContigSpace {
1094 friend class VMStructs; 1094 friend class VMStructs;
1095 protected: 1095 protected:
1096 // Mark sweep support 1096 // Mark sweep support
1097 int allowed_dead_ratio() const; 1097 size_t allowed_dead_ratio() const;
1098 public: 1098 public:
1099 // Constructor 1099 // Constructor
1100 ContigPermSpace(BlockOffsetSharedArray* sharedOffsetArray, MemRegion mr) : 1100 ContigPermSpace(BlockOffsetSharedArray* sharedOffsetArray, MemRegion mr) :
1101 OffsetTableContigSpace(sharedOffsetArray, mr) {} 1101 OffsetTableContigSpace(sharedOffsetArray, mr) {}
1102 }; 1102 };

mercurial