< prev index next >

src/hotspot/share/memory/vtBuffer.hpp

Print this page




 119   }
 120 
 121   void zap(void *start);
 122 };
 123 
 124 /* VTBuffer is a thread-local buffer used to store values, or TLVB (Thread-Local Value Buffer).
 125  * Values allocated in the TLVB have the same layout as values allocated in the Java heap:
 126  * same header size, same offsets for fields. The only difference is on the meaning of the
 127  * mark word: in a buffered value, the mark word contains an oop pointing to the Java mirror
 128  * of the value's class, with the two least significant bits used for internal marking.
 129  * Values allocated in the TLVB are references through oops, however, because TLVBs are not
 130  * part of the Java heap, those oops *must never be exposed to GCs*. But buffered values
 131  * can contain references to Java heap allocated objects or values, in addition to the
 132  * reference to the Java mirror, and these oops have to be processed by GC. The solution is
 133  * to let GC closures iterate over the internal oops, but not directly on the buffered value
 134  * itself (see ValueKlass::iterate_over_inside_oops() method).
 135  */
 136 
 137 class VTBuffer : AllStatic {
 138   friend class VMStructs;


 139 private:
 140   static address _base;

 141   static size_t _size;
 142   static address _commit_ptr;
 143 
 144   static VTBufferChunk* _free_list;
 145   static Mutex* _pool_lock;
 146   static int _pool_counter;
 147   static int _max_pool_counter;
 148   static int _total_allocated;
 149   static int _total_failed;
 150 
 151 public:
 152   static void init();
 153   static VTBufferChunk* get_new_chunk(JavaThread* thread);
 154 
 155   static Mutex* lock() { return _pool_lock; }
 156   static oop allocate_value(ValueKlass* k, TRAPS);
 157   static bool allocate_vt_chunk(JavaThread* thread);
 158   static void recycle_chunk(JavaThread* thread, VTBufferChunk* chunk);
 159   static void return_vt_chunk(JavaThread* thread, VTBufferChunk* chunk);
 160 




 119   }
 120 
 121   void zap(void *start);
 122 };
 123 
 124 /* VTBuffer is a thread-local buffer used to store values, or TLVB (Thread-Local Value Buffer).
 125  * Values allocated in the TLVB have the same layout as values allocated in the Java heap:
 126  * same header size, same offsets for fields. The only difference is on the meaning of the
 127  * mark word: in a buffered value, the mark word contains an oop pointing to the Java mirror
 128  * of the value's class, with the two least significant bits used for internal marking.
 129  * Values allocated in the TLVB are references through oops, however, because TLVBs are not
 130  * part of the Java heap, those oops *must never be exposed to GCs*. But buffered values
 131  * can contain references to Java heap allocated objects or values, in addition to the
 132  * reference to the Java mirror, and these oops have to be processed by GC. The solution is
 133  * to let GC closures iterate over the internal oops, but not directly on the buffered value
 134  * itself (see ValueKlass::iterate_over_inside_oops() method).
 135  */
 136 
 137 class VTBuffer : AllStatic {
 138   friend class VMStructs;
 139   friend class TemplateTable;
 140   friend class InterpreterRuntime;
 141 private:
 142   static address _base;
 143   static address _end;
 144   static size_t _size;
 145   static address _commit_ptr;
 146 
 147   static VTBufferChunk* _free_list;
 148   static Mutex* _pool_lock;
 149   static int _pool_counter;
 150   static int _max_pool_counter;
 151   static int _total_allocated;
 152   static int _total_failed;
 153 
 154 public:
 155   static void init();
 156   static VTBufferChunk* get_new_chunk(JavaThread* thread);
 157 
 158   static Mutex* lock() { return _pool_lock; }
 159   static oop allocate_value(ValueKlass* k, TRAPS);
 160   static bool allocate_vt_chunk(JavaThread* thread);
 161   static void recycle_chunk(JavaThread* thread, VTBufferChunk* chunk);
 162   static void return_vt_chunk(JavaThread* thread, VTBufferChunk* chunk);
 163 


< prev index next >