99 address unpack_handler() const {
100 return *(address*)adr_unpack_handler();
101 }
102
103 // static Klass* array_klass_impl(InstanceKlass* this_k, bool or_null, int n, TRAPS);
104
105 GrowableArray<SigEntry> collect_fields(int base_off = 0) const;
106
107 void cleanup_blobs();
108
109 protected:
110 // Returns the array class for the n'th dimension
111 Klass* array_klass_impl(bool or_null, int n, TRAPS);
112
113 // Returns the array class with this class as element type
114 Klass* array_klass_impl(bool or_null, TRAPS);
115
116 public:
117 // Type testing
118 bool is_value_slow() const { return true; }
119
120 // Casting from Klass*
121 static ValueKlass* cast(Klass* k) {
122 assert(k->is_value(), "cast to ValueKlass");
123 return (ValueKlass*) k;
124 }
125
126 // Use this to return the size of an instance in heap words
127 // Implementation is currently simple because all value types are allocated
128 // in Java heap like Java objects.
129 virtual int size_helper() const {
130 return layout_helper_to_size_helper(layout_helper());
131 }
132
133 // allocate_instance() allocates a stand alone value in the Java heap
134 instanceOop allocate_instance(TRAPS);
135 // allocate_buffered_or_heap_instance() tries to allocate a value in the
136 // thread local value buffer, if allocation fails, it allocates it in the
137 // Java heap
138 instanceOop allocate_buffered_or_heap_instance(bool* in_heap, TRAPS);
191 }
192
193 // store the value of this klass contained with src into dst, raw data ptr
194 void value_store(void* src, void* dst, size_t raw_byte_size, bool dst_is_heap, bool dst_uninitialized);
195
196 oop unbox(Handle src, InstanceKlass* target_klass, TRAPS);
197 oop box(Handle src, InstanceKlass* target_klass, TRAPS);
198
199 // GC support...
200
201 // oop iterate raw value type data pointer (where oop_addr may not be an oop, but backing/array-element)
202 template <bool nv, typename T, class OopClosureType>
203 inline void oop_iterate_specialized(const address oop_addr, OopClosureType* closure);
204
205 template <bool nv, typename T, class OopClosureType>
206 inline void oop_iterate_specialized_bounded(const address oop_addr, OopClosureType* closure, void* lo, void* hi);
207
208 // calling convention support
209 void initialize_calling_convention();
210 Array<SigEntry>* extended_sig() const {
211 assert(this != SystemDictionary::___Value_klass(), "make no sense for __Value");
212 return *((Array<SigEntry>**)adr_extended_sig());
213 }
214 Array<VMRegPair>* return_regs() const {
215 assert(this != SystemDictionary::___Value_klass(), "make no sense for __Value");
216 return *((Array<VMRegPair>**)adr_return_regs());
217 }
218 void save_oop_fields(const RegisterMap& map, GrowableArray<Handle>& handles) const;
219 bool save_oop_results(RegisterMap& map, GrowableArray<Handle>& handles) const;
220 void restore_oop_results(RegisterMap& map, GrowableArray<Handle>& handles) const;
221 oop realloc_result(const RegisterMap& reg_map, const GrowableArray<Handle>& handles, bool buffered, TRAPS);
222 static ValueKlass* returned_value_type(const RegisterMap& reg_map);
223
224 // pack and unpack handlers. Need to be loadable from generated code
225 // so at a fixed offset from the base of the klass pointer.
226 static ByteSize pack_handler_offset() {
227 return in_ByteSize(InstanceKlass::header_size() * wordSize);
228 }
229
230 static ByteSize unpack_handler_offset() {
231 return in_ByteSize((InstanceKlass::header_size()+1) * wordSize);
232 }
233
234 void deallocate_contents(ClassLoaderData* loader_data);
235 static void cleanup(ValueKlass* ik) ;
236 };
237
238 #endif /* SHARE_VM_OOPS_VALUEKLASS_HPP */
|
99 address unpack_handler() const {
100 return *(address*)adr_unpack_handler();
101 }
102
103 // static Klass* array_klass_impl(InstanceKlass* this_k, bool or_null, int n, TRAPS);
104
105 GrowableArray<SigEntry> collect_fields(int base_off = 0) const;
106
107 void cleanup_blobs();
108
109 protected:
110 // Returns the array class for the n'th dimension
111 Klass* array_klass_impl(bool or_null, int n, TRAPS);
112
113 // Returns the array class with this class as element type
114 Klass* array_klass_impl(bool or_null, TRAPS);
115
116 public:
117 // Type testing
118 bool is_value_slow() const { return true; }
119 bool is__Value() const { return (this == SystemDictionary::___Value_klass()); }
120
121 // Casting from Klass*
122 static ValueKlass* cast(Klass* k) {
123 assert(k->is_value(), "cast to ValueKlass");
124 return (ValueKlass*) k;
125 }
126
127 // Use this to return the size of an instance in heap words
128 // Implementation is currently simple because all value types are allocated
129 // in Java heap like Java objects.
130 virtual int size_helper() const {
131 return layout_helper_to_size_helper(layout_helper());
132 }
133
134 // allocate_instance() allocates a stand alone value in the Java heap
135 instanceOop allocate_instance(TRAPS);
136 // allocate_buffered_or_heap_instance() tries to allocate a value in the
137 // thread local value buffer, if allocation fails, it allocates it in the
138 // Java heap
139 instanceOop allocate_buffered_or_heap_instance(bool* in_heap, TRAPS);
192 }
193
194 // store the value of this klass contained with src into dst, raw data ptr
195 void value_store(void* src, void* dst, size_t raw_byte_size, bool dst_is_heap, bool dst_uninitialized);
196
197 oop unbox(Handle src, InstanceKlass* target_klass, TRAPS);
198 oop box(Handle src, InstanceKlass* target_klass, TRAPS);
199
200 // GC support...
201
202 // oop iterate raw value type data pointer (where oop_addr may not be an oop, but backing/array-element)
203 template <bool nv, typename T, class OopClosureType>
204 inline void oop_iterate_specialized(const address oop_addr, OopClosureType* closure);
205
206 template <bool nv, typename T, class OopClosureType>
207 inline void oop_iterate_specialized_bounded(const address oop_addr, OopClosureType* closure, void* lo, void* hi);
208
209 // calling convention support
210 void initialize_calling_convention();
211 Array<SigEntry>* extended_sig() const {
212 assert(!is__Value(), "make no sense for __Value");
213 return *((Array<SigEntry>**)adr_extended_sig());
214 }
215 Array<VMRegPair>* return_regs() const {
216 assert(!is__Value(), "make no sense for __Value");
217 return *((Array<VMRegPair>**)adr_return_regs());
218 }
219 bool can_be_returned_as_fields() const;
220 void save_oop_fields(const RegisterMap& map, GrowableArray<Handle>& handles) const;
221 void restore_oop_results(RegisterMap& map, GrowableArray<Handle>& handles) const;
222 oop realloc_result(const RegisterMap& reg_map, const GrowableArray<Handle>& handles, bool buffered, TRAPS);
223 static ValueKlass* returned_value_klass(const RegisterMap& reg_map);
224
225 // pack and unpack handlers. Need to be loadable from generated code
226 // so at a fixed offset from the base of the klass pointer.
227 static ByteSize pack_handler_offset() {
228 return in_ByteSize(InstanceKlass::header_size() * wordSize);
229 }
230
231 static ByteSize unpack_handler_offset() {
232 return in_ByteSize((InstanceKlass::header_size()+1) * wordSize);
233 }
234
235 void deallocate_contents(ClassLoaderData* loader_data);
236 static void cleanup(ValueKlass* ik) ;
237 };
238
239 #endif /* SHARE_VM_OOPS_VALUEKLASS_HPP */
|