132 // Having two types of blocks complicates the code and the space overhead in negligible.
133 JNIHandleBlock* _last; // Last block in use
134 JNIHandleBlock* _pop_frame_link; // Block to restore on PopLocalFrame call
135 oop* _free_list; // Handle free list
136 int _allocate_before_rebuild; // Number of blocks to allocate before rebuilding free list
137
138 // Check JNI, "planned capacity" for current frame (or push/ensure)
139 size_t _planned_capacity;
140
141 #ifndef PRODUCT
142 JNIHandleBlock* _block_list_link; // Link for list below
143 static JNIHandleBlock* _block_list; // List of all allocated blocks (for debugging only)
144 #endif
145
146 static JNIHandleBlock* _block_free_list; // Free list of currently unused blocks
147 static int _blocks_allocated; // For debugging/printing
148
149 // Fill block with bad_handle values
150 void zap();
151
152 protected:
153 // No more handles in the both the current and following blocks
154 void clear() { _top = 0; }
155
156 private:
157 // Free list computation
158 void rebuild_free_list();
159
160 public:
161 // Handle allocation
162 jobject allocate_handle(oop obj);
163
164 // Release Handle
165 void release_handle(jobject);
166
167 // Block allocation and block free list management
168 static JNIHandleBlock* allocate_block(Thread* thread = NULL);
169 static void release_block(JNIHandleBlock* block, Thread* thread = NULL);
170
171 // JNI PushLocalFrame/PopLocalFrame support
172 JNIHandleBlock* pop_frame_link() const { return _pop_frame_link; }
173 void set_pop_frame_link(JNIHandleBlock* block) { _pop_frame_link = block; }
174
175 // Stub generator support
176 static int top_offset_in_bytes() { return offset_of(JNIHandleBlock, _top); }
|
132 // Having two types of blocks complicates the code and the space overhead in negligible.
133 JNIHandleBlock* _last; // Last block in use
134 JNIHandleBlock* _pop_frame_link; // Block to restore on PopLocalFrame call
135 oop* _free_list; // Handle free list
136 int _allocate_before_rebuild; // Number of blocks to allocate before rebuilding free list
137
138 // Check JNI, "planned capacity" for current frame (or push/ensure)
139 size_t _planned_capacity;
140
141 #ifndef PRODUCT
142 JNIHandleBlock* _block_list_link; // Link for list below
143 static JNIHandleBlock* _block_list; // List of all allocated blocks (for debugging only)
144 #endif
145
146 static JNIHandleBlock* _block_free_list; // Free list of currently unused blocks
147 static int _blocks_allocated; // For debugging/printing
148
149 // Fill block with bad_handle values
150 void zap();
151
152 // Free list computation
153 void rebuild_free_list();
154
155 public:
156 // Handle allocation
157 jobject allocate_handle(oop obj);
158
159 // Release Handle
160 void release_handle(jobject);
161
162 // Block allocation and block free list management
163 static JNIHandleBlock* allocate_block(Thread* thread = NULL);
164 static void release_block(JNIHandleBlock* block, Thread* thread = NULL);
165
166 // JNI PushLocalFrame/PopLocalFrame support
167 JNIHandleBlock* pop_frame_link() const { return _pop_frame_link; }
168 void set_pop_frame_link(JNIHandleBlock* block) { _pop_frame_link = block; }
169
170 // Stub generator support
171 static int top_offset_in_bytes() { return offset_of(JNIHandleBlock, _top); }
|