178
179 // value_mirror is the primary mirror
180 oop value_mirror() const { return java_lang_Class::inline_type_mirror(java_mirror()); }
181 oop indirect_mirror() const { return java_lang_Class::indirect_type_mirror(java_mirror()); }
182
183 // Casting from Klass*
184 static ValueKlass* cast(Klass* k);
185
186 // Use this to return the size of an instance in heap words
187 // Implementation is currently simple because all value types are allocated
188 // in Java heap like Java objects.
189 virtual int size_helper() const {
190 return layout_helper_to_size_helper(layout_helper());
191 }
192
193 // Metadata iterators
194 void array_klasses_do(void f(Klass* k));
195
196 // allocate_instance() allocates a stand alone value in the Java heap
197 instanceOop allocate_instance(TRAPS);
198
199 // minimum number of bytes occupied by nonstatic fields, HeapWord aligned or pow2
200 int raw_value_byte_size();
201
202 address data_for_oop(oop o) const;
203 oop oop_for_data(address data) const;
204
205 // Query if h/w provides atomic load/store
206 bool is_atomic();
207
208 bool flatten_array();
209
210 bool contains_oops() const { return nonstatic_oop_map_count() > 0; }
211 int nonstatic_oop_count();
212
213 // General store methods
214 //
215 // Normally loads and store methods would be found in *Oops classes, but since values can be
216 // "in-lined" (flattened) into containing oops, these methods reside here in ValueKlass.
217 //
254 address unpack_handler() const {
255 return *(address*)adr_unpack_handler();
256 }
257
258 // pack and unpack handlers. Need to be loadable from generated code
259 // so at a fixed offset from the base of the klass pointer.
260 static ByteSize pack_handler_offset() {
261 return byte_offset_of(ValueKlassFixedBlock, _pack_handler);
262 }
263
264 static ByteSize pack_handler_jobject_offset() {
265 return byte_offset_of(ValueKlassFixedBlock, _pack_handler_jobject);
266 }
267
268 static ByteSize unpack_handler_offset() {
269 return byte_offset_of(ValueKlassFixedBlock, _unpack_handler);
270 }
271
272 static ByteSize default_value_offset_offset() {
273 return byte_offset_of(ValueKlassFixedBlock, _default_value_offset);
274 }
275
276 void set_default_value_offset(int offset) {
277 *((int*)adr_default_value_offset()) = offset;
278 }
279
280 int default_value_offset() {
281 int offset = *((int*)adr_default_value_offset());
282 assert(offset != 0, "must not be called if not initialized");
283 return offset;
284 }
285
286 void set_default_value(oop val) {
287 java_mirror()->obj_field_put(default_value_offset(), val);
288 indirect_mirror()->obj_field_put(default_value_offset(), val);
289 }
290
291 oop default_value();
292 void deallocate_contents(ClassLoaderData* loader_data);
293 static void cleanup(ValueKlass* ik) ;
|
178
179 // value_mirror is the primary mirror
180 oop value_mirror() const { return java_lang_Class::inline_type_mirror(java_mirror()); }
181 oop indirect_mirror() const { return java_lang_Class::indirect_type_mirror(java_mirror()); }
182
183 // Casting from Klass*
184 static ValueKlass* cast(Klass* k);
185
186 // Use this to return the size of an instance in heap words
187 // Implementation is currently simple because all value types are allocated
188 // in Java heap like Java objects.
189 virtual int size_helper() const {
190 return layout_helper_to_size_helper(layout_helper());
191 }
192
193 // Metadata iterators
194 void array_klasses_do(void f(Klass* k));
195
196 // allocate_instance() allocates a stand alone value in the Java heap
197 instanceOop allocate_instance(TRAPS);
198 instanceOop allocate_instance_buffer(TRAPS);
199
200 // minimum number of bytes occupied by nonstatic fields, HeapWord aligned or pow2
201 int raw_value_byte_size();
202
203 address data_for_oop(oop o) const;
204 oop oop_for_data(address data) const;
205
206 // Query if h/w provides atomic load/store
207 bool is_atomic();
208
209 bool flatten_array();
210
211 bool contains_oops() const { return nonstatic_oop_map_count() > 0; }
212 int nonstatic_oop_count();
213
214 // General store methods
215 //
216 // Normally loads and store methods would be found in *Oops classes, but since values can be
217 // "in-lined" (flattened) into containing oops, these methods reside here in ValueKlass.
218 //
255 address unpack_handler() const {
256 return *(address*)adr_unpack_handler();
257 }
258
259 // pack and unpack handlers. Need to be loadable from generated code
260 // so at a fixed offset from the base of the klass pointer.
261 static ByteSize pack_handler_offset() {
262 return byte_offset_of(ValueKlassFixedBlock, _pack_handler);
263 }
264
265 static ByteSize pack_handler_jobject_offset() {
266 return byte_offset_of(ValueKlassFixedBlock, _pack_handler_jobject);
267 }
268
269 static ByteSize unpack_handler_offset() {
270 return byte_offset_of(ValueKlassFixedBlock, _unpack_handler);
271 }
272
273 static ByteSize default_value_offset_offset() {
274 return byte_offset_of(ValueKlassFixedBlock, _default_value_offset);
275 }
276
277 static ByteSize first_field_offset_offset() {
278 return byte_offset_of(ValueKlassFixedBlock, _first_field_offset);
279 }
280
281 void set_default_value_offset(int offset) {
282 *((int*)adr_default_value_offset()) = offset;
283 }
284
285 int default_value_offset() {
286 int offset = *((int*)adr_default_value_offset());
287 assert(offset != 0, "must not be called if not initialized");
288 return offset;
289 }
290
291 void set_default_value(oop val) {
292 java_mirror()->obj_field_put(default_value_offset(), val);
293 indirect_mirror()->obj_field_put(default_value_offset(), val);
294 }
295
296 oop default_value();
297 void deallocate_contents(ClassLoaderData* loader_data);
298 static void cleanup(ValueKlass* ik) ;
|