< prev index next >

src/hotspot/share/services/mallocSiteTable.hpp

Print this page
rev 47400 : [mq]: cmpxchg_ptr


  62 class MallocSiteHashtableEntry : public CHeapObj<mtNMT> {
  63  private:
  64   MallocSite                _malloc_site;
  65   MallocSiteHashtableEntry* _next;
  66 
  67  public:
  68   MallocSiteHashtableEntry() : _next(NULL) { }
  69 
  70   MallocSiteHashtableEntry(NativeCallStack stack, MEMFLAGS flags):
  71     _malloc_site(stack, flags), _next(NULL) {
  72     assert(flags != mtNone, "Expect a real memory type");
  73   }
  74 
  75   inline const MallocSiteHashtableEntry* next() const {
  76     return _next;
  77   }
  78 
  79   // Insert an entry atomically.
  80   // Return true if the entry is inserted successfully.
  81   // The operation can be failed due to contention from other thread.
  82   bool atomic_insert(const MallocSiteHashtableEntry* entry) {
  83     return (Atomic::cmpxchg_ptr((void*)entry, (volatile void*)&_next,
  84       NULL) == NULL);
  85   }
  86 
  87   void set_callsite(const MallocSite& site) {
  88     _malloc_site = site;
  89   }
  90 
  91   inline const MallocSite* peek() const { return &_malloc_site; }
  92   inline MallocSite* data()             { return &_malloc_site; }
  93 
  94   inline long hash() const { return _malloc_site.hash(); }
  95   inline bool equals(const NativeCallStack& stack) const {
  96     return _malloc_site.equals(stack);
  97   }
  98   // Allocation/deallocation on this allocation site
  99   inline void allocate(size_t size)   { _malloc_site.allocate(size);   }
 100   inline void deallocate(size_t size) { _malloc_site.deallocate(size); }
 101   // Memory counters
 102   inline size_t size() const  { return _malloc_site.size();  }
 103   inline size_t count() const { return _malloc_site.count(); }
 104 };
 105 




  62 class MallocSiteHashtableEntry : public CHeapObj<mtNMT> {
  63  private:
  64   MallocSite                _malloc_site;
  65   MallocSiteHashtableEntry* _next;
  66 
  67  public:
  68   MallocSiteHashtableEntry() : _next(NULL) { }
  69 
  70   MallocSiteHashtableEntry(NativeCallStack stack, MEMFLAGS flags):
  71     _malloc_site(stack, flags), _next(NULL) {
  72     assert(flags != mtNone, "Expect a real memory type");
  73   }
  74 
  75   inline const MallocSiteHashtableEntry* next() const {
  76     return _next;
  77   }
  78 
  79   // Insert an entry atomically.
  80   // Return true if the entry is inserted successfully.
  81   // The operation can be failed due to contention from other thread.
  82   bool atomic_insert(const MallocSiteHashtableEntry* entry);



  83 
  84   void set_callsite(const MallocSite& site) {
  85     _malloc_site = site;
  86   }
  87 
  88   inline const MallocSite* peek() const { return &_malloc_site; }
  89   inline MallocSite* data()             { return &_malloc_site; }
  90 
  91   inline long hash() const { return _malloc_site.hash(); }
  92   inline bool equals(const NativeCallStack& stack) const {
  93     return _malloc_site.equals(stack);
  94   }
  95   // Allocation/deallocation on this allocation site
  96   inline void allocate(size_t size)   { _malloc_site.allocate(size);   }
  97   inline void deallocate(size_t size) { _malloc_site.deallocate(size); }
  98   // Memory counters
  99   inline size_t size() const  { return _malloc_site.size();  }
 100   inline size_t count() const { return _malloc_site.count(); }
 101 };
 102 


< prev index next >