252 // They must look completely different from normal indexes.
253 // The main reason is that byte swapping is sometimes done on normal indexes.
254 // Finally, it is helpful for debugging to tell the two apart.
255 static bool is_invokedynamic_index(int i) { return (i < 0); }
256 static int decode_invokedynamic_index(int i) { assert(is_invokedynamic_index(i), ""); return ~i; }
257 static int encode_invokedynamic_index(int i) { assert(!is_invokedynamic_index(i), ""); return ~i; }
258
259 // Given the per-instruction index of an indy instruction, report the
260 // main constant pool entry for its bootstrap specifier.
261 // From there, uncached_name/signature_ref_at will get the name/type.
262 inline u2 invokedynamic_bootstrap_ref_index_at(int indy_index) const;
263
264 // Assembly code support
265 static ByteSize tags_offset() { return byte_offset_of(ConstantPool, _tags); }
266 static ByteSize cache_offset() { return byte_offset_of(ConstantPool, _cache); }
267 static ByteSize pool_holder_offset() { return byte_offset_of(ConstantPool, _pool_holder); }
268 static ByteSize resolved_klasses_offset() { return byte_offset_of(ConstantPool, _resolved_klasses); }
269
270 // Storing constants
271
272 // For temporary use while constructing constant pool
273 void klass_index_at_put(int cp_index, int name_index) {
274 tag_at_put(cp_index, JVM_CONSTANT_ClassIndex);
275 *int_at_addr(cp_index) = name_index;
276 }
277
278 // Hidden class support:
279 void klass_at_put(int class_index, Klass* k);
280
281 void unresolved_klass_at_put(int cp_index, int name_index, int resolved_klass_index) {
282 release_tag_at_put(cp_index, JVM_CONSTANT_UnresolvedClass);
283
284 assert((name_index & 0xffff0000) == 0, "must be");
285 assert((resolved_klass_index & 0xffff0000) == 0, "must be");
286 *int_at_addr(cp_index) =
287 build_int_from_shorts((jushort)resolved_klass_index, (jushort)name_index);
288 }
289
290 void method_handle_index_at_put(int cp_index, int ref_kind, int ref_index) {
291 tag_at_put(cp_index, JVM_CONSTANT_MethodHandle);
292 *int_at_addr(cp_index) = ((jint) ref_index<<16) | ref_kind;
|
252 // They must look completely different from normal indexes.
253 // The main reason is that byte swapping is sometimes done on normal indexes.
254 // Finally, it is helpful for debugging to tell the two apart.
255 static bool is_invokedynamic_index(int i) { return (i < 0); }
256 static int decode_invokedynamic_index(int i) { assert(is_invokedynamic_index(i), ""); return ~i; }
257 static int encode_invokedynamic_index(int i) { assert(!is_invokedynamic_index(i), ""); return ~i; }
258
259 // Given the per-instruction index of an indy instruction, report the
260 // main constant pool entry for its bootstrap specifier.
261 // From there, uncached_name/signature_ref_at will get the name/type.
262 inline u2 invokedynamic_bootstrap_ref_index_at(int indy_index) const;
263
264 // Assembly code support
265 static ByteSize tags_offset() { return byte_offset_of(ConstantPool, _tags); }
266 static ByteSize cache_offset() { return byte_offset_of(ConstantPool, _cache); }
267 static ByteSize pool_holder_offset() { return byte_offset_of(ConstantPool, _pool_holder); }
268 static ByteSize resolved_klasses_offset() { return byte_offset_of(ConstantPool, _resolved_klasses); }
269
270 // Storing constants
271
272 // For temporary use while constructing constant pool. Used during a retransform/class redefinition as well.
273 void klass_index_at_put(int cp_index, int name_index) {
274 tag_at_put(cp_index, JVM_CONSTANT_ClassIndex);
275 *int_at_addr(cp_index) = name_index;
276 }
277
278 // Hidden class support:
279 void klass_at_put(int class_index, Klass* k);
280
281 void unresolved_klass_at_put(int cp_index, int name_index, int resolved_klass_index) {
282 release_tag_at_put(cp_index, JVM_CONSTANT_UnresolvedClass);
283
284 assert((name_index & 0xffff0000) == 0, "must be");
285 assert((resolved_klass_index & 0xffff0000) == 0, "must be");
286 *int_at_addr(cp_index) =
287 build_int_from_shorts((jushort)resolved_klass_index, (jushort)name_index);
288 }
289
290 void method_handle_index_at_put(int cp_index, int ref_kind, int ref_index) {
291 tag_at_put(cp_index, JVM_CONSTANT_MethodHandle);
292 *int_at_addr(cp_index) = ((jint) ref_index<<16) | ref_kind;
|