< prev index next >

src/hotspot/share/oops/valueKlass.hpp

Print this page
rev 55127 : 8223351: [lworld] Primary mirror and nullable mirror for inline type
Reviewed-by: tbd


 120   Klass* allocate_value_array_klass(TRAPS);
 121 
 122   int collect_fields(GrowableArray<SigEntry>* sig, int base_off = 0) const;
 123 
 124   void cleanup_blobs();
 125 
 126  protected:
 127   // Returns the array class for the n'th dimension
 128   Klass* array_klass_impl(ArrayStorageProperties storage_props, bool or_null, int n, TRAPS);
 129 
 130   // Returns the array class with this class as element type
 131   Klass* array_klass_impl(ArrayStorageProperties storage_props, bool or_null, TRAPS);
 132 
 133   // Specifically flat array klass
 134   Klass* value_array_klass(ArrayStorageProperties storage_props, bool or_null, int rank, TRAPS);
 135 
 136  public:
 137   // Type testing
 138   bool is_value_slow() const        { return true; }
 139 
 140   oop value_mirror() const { return java_lang_Class::value_mirror(java_mirror()); }
 141   oop   box_mirror() const { return java_lang_Class::box_mirror(java_mirror()); }

 142 
 143   // Casting from Klass*
 144   static ValueKlass* cast(Klass* k) {
 145     assert(k->is_value(), "cast to ValueKlass");
 146     return (ValueKlass*) k;
 147   }
 148 
 149   // Use this to return the size of an instance in heap words
 150   // Implementation is currently simple because all value types are allocated
 151   // in Java heap like Java objects.
 152   virtual int size_helper() const {
 153     return layout_helper_to_size_helper(layout_helper());
 154   }
 155 
 156   // Metadata iterators
 157   void array_klasses_do(void f(Klass* k));
 158 
 159   // allocate_instance() allocates a stand alone value in the Java heap
 160   instanceOop allocate_instance(TRAPS);
 161 


 235   static ByteSize unpack_handler_offset() {
 236     return byte_offset_of(ValueKlassFixedBlock, _unpack_handler);
 237   }
 238 
 239   static ByteSize default_value_offset_offset() {
 240     return byte_offset_of(ValueKlassFixedBlock, _default_value_offset);
 241   }
 242 
 243   void set_default_value_offset(int offset) {
 244     *((int*)adr_default_value_offset()) = offset;
 245   }
 246 
 247   int default_value_offset() {
 248     int offset = *((int*)adr_default_value_offset());
 249     assert(offset != 0, "must not be called if not initialized");
 250     return offset;
 251   }
 252 
 253   void set_default_value(oop val) {
 254     java_mirror()->obj_field_put(default_value_offset(), val);
 255     value_mirror()->obj_field_put(default_value_offset(), val);
 256   }
 257 
 258   oop default_value() {
 259     oop val = java_mirror()->obj_field_acquire(default_value_offset());
 260     assert(oopDesc::is_oop(val), "Sanity check");
 261     assert(val->is_value(), "Sanity check");
 262     assert(val->klass() == this, "sanity check");
 263     return val;
 264   }
 265 
 266   void deallocate_contents(ClassLoaderData* loader_data);
 267   static void cleanup(ValueKlass* ik) ;
 268 
 269   // Verification
 270   void verify_on(outputStream* st);
 271   void oop_verify_on(oop obj, outputStream* st);
 272 
 273 };
 274 
 275 #endif /* SHARE_VM_OOPS_VALUEKLASS_HPP */


 120   Klass* allocate_value_array_klass(TRAPS);
 121 
 122   int collect_fields(GrowableArray<SigEntry>* sig, int base_off = 0) const;
 123 
 124   void cleanup_blobs();
 125 
 126  protected:
 127   // Returns the array class for the n'th dimension
 128   Klass* array_klass_impl(ArrayStorageProperties storage_props, bool or_null, int n, TRAPS);
 129 
 130   // Returns the array class with this class as element type
 131   Klass* array_klass_impl(ArrayStorageProperties storage_props, bool or_null, TRAPS);
 132 
 133   // Specifically flat array klass
 134   Klass* value_array_klass(ArrayStorageProperties storage_props, bool or_null, int rank, TRAPS);
 135 
 136  public:
 137   // Type testing
 138   bool is_value_slow() const        { return true; }
 139 
 140   // value_mirror is the primary mirror
 141   oop value_mirror() const    { return java_lang_Class::inline_type_mirror(java_mirror()); }
 142   oop nullable_mirror() const { return java_lang_Class::nullable_type_mirror(java_mirror()); }
 143 
 144   // Casting from Klass*
 145   static ValueKlass* cast(Klass* k) {
 146     assert(k->is_value(), "cast to ValueKlass");
 147     return (ValueKlass*) k;
 148   }
 149 
 150   // Use this to return the size of an instance in heap words
 151   // Implementation is currently simple because all value types are allocated
 152   // in Java heap like Java objects.
 153   virtual int size_helper() const {
 154     return layout_helper_to_size_helper(layout_helper());
 155   }
 156 
 157   // Metadata iterators
 158   void array_klasses_do(void f(Klass* k));
 159 
 160   // allocate_instance() allocates a stand alone value in the Java heap
 161   instanceOop allocate_instance(TRAPS);
 162 


 236   static ByteSize unpack_handler_offset() {
 237     return byte_offset_of(ValueKlassFixedBlock, _unpack_handler);
 238   }
 239 
 240   static ByteSize default_value_offset_offset() {
 241     return byte_offset_of(ValueKlassFixedBlock, _default_value_offset);
 242   }
 243 
 244   void set_default_value_offset(int offset) {
 245     *((int*)adr_default_value_offset()) = offset;
 246   }
 247 
 248   int default_value_offset() {
 249     int offset = *((int*)adr_default_value_offset());
 250     assert(offset != 0, "must not be called if not initialized");
 251     return offset;
 252   }
 253 
 254   void set_default_value(oop val) {
 255     java_mirror()->obj_field_put(default_value_offset(), val);
 256     nullable_mirror()->obj_field_put(default_value_offset(), val);
 257   }
 258 
 259   oop default_value() {
 260     oop val = java_mirror()->obj_field_acquire(default_value_offset());
 261     assert(oopDesc::is_oop(val), "Sanity check");
 262     assert(val->is_value(), "Sanity check");
 263     assert(val->klass() == this, "sanity check");
 264     return val;
 265   }
 266 
 267   void deallocate_contents(ClassLoaderData* loader_data);
 268   static void cleanup(ValueKlass* ik) ;
 269 
 270   // Verification
 271   void verify_on(outputStream* st);
 272   void oop_verify_on(oop obj, outputStream* st);
 273 
 274 };
 275 
 276 #endif /* SHARE_VM_OOPS_VALUEKLASS_HPP */
< prev index next >