123 // Traversal of weak global handles.
124 static void weak_oops_do(OopClosure* f);
125
126 static OopStorage* global_handles();
127 static OopStorage* weak_global_handles();
128 };
129
130
131
132 // JNI handle blocks holding local/global JNI handles
133
134 class JNIHandleBlock : public CHeapObj<mtInternal> {
135 friend class VMStructs;
136 friend class CppInterpreter;
137
138 private:
139 enum SomeConstants {
140 block_size_in_oops = 32 // Number of handles per handle block
141 };
142
143 oop _handles[block_size_in_oops]; // The handles
144 int _top; // Index of next unused handle
145 JNIHandleBlock* _next; // Link to next block
146
147 // The following instance variables are only used by the first block in a chain.
148 // Having two types of blocks complicates the code and the space overhead in negligible.
149 JNIHandleBlock* _last; // Last block in use
150 JNIHandleBlock* _pop_frame_link; // Block to restore on PopLocalFrame call
151 oop* _free_list; // Handle free list
152 int _allocate_before_rebuild; // Number of blocks to allocate before rebuilding free list
153
154 // Check JNI, "planned capacity" for current frame (or push/ensure)
155 size_t _planned_capacity;
156
157 #ifndef PRODUCT
158 JNIHandleBlock* _block_list_link; // Link for list below
159 static JNIHandleBlock* _block_list; // List of all allocated blocks (for debugging only)
160 #endif
161
162 static JNIHandleBlock* _block_free_list; // Free list of currently unused blocks
163 static int _blocks_allocated; // For debugging/printing
164
165 // Fill block with bad_handle values
166 void zap() NOT_DEBUG_RETURN;
167
168 // Free list computation
169 void rebuild_free_list();
170
171 // No more handles in the both the current and following blocks
|
123 // Traversal of weak global handles.
124 static void weak_oops_do(OopClosure* f);
125
126 static OopStorage* global_handles();
127 static OopStorage* weak_global_handles();
128 };
129
130
131
132 // JNI handle blocks holding local/global JNI handles
133
134 class JNIHandleBlock : public CHeapObj<mtInternal> {
135 friend class VMStructs;
136 friend class CppInterpreter;
137
138 private:
139 enum SomeConstants {
140 block_size_in_oops = 32 // Number of handles per handle block
141 };
142
143 uintptr_t _handles[block_size_in_oops]; // The handles
144 int _top; // Index of next unused handle
145 JNIHandleBlock* _next; // Link to next block
146
147 // The following instance variables are only used by the first block in a chain.
148 // Having two types of blocks complicates the code and the space overhead in negligible.
149 JNIHandleBlock* _last; // Last block in use
150 JNIHandleBlock* _pop_frame_link; // Block to restore on PopLocalFrame call
151 uintptr_t* _free_list; // Handle free list
152 int _allocate_before_rebuild; // Number of blocks to allocate before rebuilding free list
153
154 // Check JNI, "planned capacity" for current frame (or push/ensure)
155 size_t _planned_capacity;
156
157 #ifndef PRODUCT
158 JNIHandleBlock* _block_list_link; // Link for list below
159 static JNIHandleBlock* _block_list; // List of all allocated blocks (for debugging only)
160 #endif
161
162 static JNIHandleBlock* _block_free_list; // Free list of currently unused blocks
163 static int _blocks_allocated; // For debugging/printing
164
165 // Fill block with bad_handle values
166 void zap() NOT_DEBUG_RETURN;
167
168 // Free list computation
169 void rebuild_free_list();
170
171 // No more handles in the both the current and following blocks
|