35 #include "classfile/verifier.hpp"
36 #include "classfile/vmSymbols.hpp"
37 #include "code/dependencyContext.hpp"
38 #include "compiler/compileBroker.hpp"
39 #include "gc/shared/collectedHeap.inline.hpp"
40 #include "gc/shared/specialized_oop_closures.hpp"
41 #include "interpreter/oopMapCache.hpp"
42 #include "interpreter/rewriter.hpp"
43 #include "jvmtifiles/jvmti.h"
44 #include "logging/log.hpp"
45 #include "logging/logMessage.hpp"
46 #include "logging/logStream.hpp"
47 #include "memory/allocation.inline.hpp"
48 #include "memory/heapInspection.hpp"
49 #include "memory/iterator.inline.hpp"
50 #include "memory/metadataFactory.hpp"
51 #include "memory/metaspaceClosure.hpp"
52 #include "memory/metaspaceShared.hpp"
53 #include "memory/oopFactory.hpp"
54 #include "memory/resourceArea.hpp"
55 #include "oops/fieldStreams.hpp"
56 #include "oops/instanceClassLoaderKlass.hpp"
57 #include "oops/instanceKlass.inline.hpp"
58 #include "oops/instanceMirrorKlass.hpp"
59 #include "oops/instanceOop.hpp"
60 #include "oops/klass.inline.hpp"
61 #include "oops/method.hpp"
62 #include "oops/oop.inline.hpp"
63 #include "oops/symbol.hpp"
64 #include "prims/jvmtiExport.hpp"
65 #include "prims/jvmtiRedefineClasses.hpp"
66 #include "prims/jvmtiThreadState.hpp"
67 #include "prims/methodComparator.hpp"
68 #include "runtime/atomic.hpp"
69 #include "runtime/fieldDescriptor.hpp"
70 #include "runtime/handles.inline.hpp"
71 #include "runtime/javaCalls.hpp"
72 #include "runtime/mutexLocker.hpp"
73 #include "runtime/orderAccess.inline.hpp"
74 #include "runtime/thread.inline.hpp"
2243 } else {
2244 // Adding one to the attribute length in order to store a null terminator
2245 // character could cause an overflow because the attribute length is
2246 // already coded with an u4 in the classfile, but in practice, it's
2247 // unlikely to happen.
2248 assert((length+1) > length, "Overflow checking");
2249 char* sde = NEW_C_HEAP_ARRAY(char, (length + 1), mtClass);
2250 for (int i = 0; i < length; i++) {
2251 sde[i] = array[i];
2252 }
2253 sde[length] = '\0';
2254 _source_debug_extension = sde;
2255 }
2256 }
2257
2258 address InstanceKlass::static_field_addr(int offset) {
2259 assert(offset >= InstanceMirrorKlass::offset_of_static_fields(), "has already been adjusted");
2260 return (address)(offset + cast_from_oop<intptr_t>(java_mirror()));
2261 }
2262
2263
2264 const char* InstanceKlass::signature_name() const {
2265 int hash_len = 0;
2266 char hash_buf[40];
2267
2268 // If this is an anonymous class, append a hash to make the name unique
2269 if (is_anonymous()) {
2270 intptr_t hash = (java_mirror() != NULL) ? java_mirror()->identity_hash() : 0;
2271 jio_snprintf(hash_buf, sizeof(hash_buf), "/" UINTX_FORMAT, (uintx)hash);
2272 hash_len = (int)strlen(hash_buf);
2273 }
2274
2275 // Get the internal name as a c string
2276 const char* src = (const char*) (name()->as_C_string());
2277 const int src_length = (int)strlen(src);
2278
2279 char* dest = NEW_RESOURCE_ARRAY(char, src_length + hash_len + 3);
2280
2281 // Add L as type indicator
2282 int dest_index = 0;
|
35 #include "classfile/verifier.hpp"
36 #include "classfile/vmSymbols.hpp"
37 #include "code/dependencyContext.hpp"
38 #include "compiler/compileBroker.hpp"
39 #include "gc/shared/collectedHeap.inline.hpp"
40 #include "gc/shared/specialized_oop_closures.hpp"
41 #include "interpreter/oopMapCache.hpp"
42 #include "interpreter/rewriter.hpp"
43 #include "jvmtifiles/jvmti.h"
44 #include "logging/log.hpp"
45 #include "logging/logMessage.hpp"
46 #include "logging/logStream.hpp"
47 #include "memory/allocation.inline.hpp"
48 #include "memory/heapInspection.hpp"
49 #include "memory/iterator.inline.hpp"
50 #include "memory/metadataFactory.hpp"
51 #include "memory/metaspaceClosure.hpp"
52 #include "memory/metaspaceShared.hpp"
53 #include "memory/oopFactory.hpp"
54 #include "memory/resourceArea.hpp"
55 #include "oops/access.inline.hpp"
56 #include "oops/fieldStreams.hpp"
57 #include "oops/instanceClassLoaderKlass.hpp"
58 #include "oops/instanceKlass.inline.hpp"
59 #include "oops/instanceMirrorKlass.hpp"
60 #include "oops/instanceOop.hpp"
61 #include "oops/klass.inline.hpp"
62 #include "oops/method.hpp"
63 #include "oops/oop.inline.hpp"
64 #include "oops/symbol.hpp"
65 #include "prims/jvmtiExport.hpp"
66 #include "prims/jvmtiRedefineClasses.hpp"
67 #include "prims/jvmtiThreadState.hpp"
68 #include "prims/methodComparator.hpp"
69 #include "runtime/atomic.hpp"
70 #include "runtime/fieldDescriptor.hpp"
71 #include "runtime/handles.inline.hpp"
72 #include "runtime/javaCalls.hpp"
73 #include "runtime/mutexLocker.hpp"
74 #include "runtime/orderAccess.inline.hpp"
75 #include "runtime/thread.inline.hpp"
2244 } else {
2245 // Adding one to the attribute length in order to store a null terminator
2246 // character could cause an overflow because the attribute length is
2247 // already coded with an u4 in the classfile, but in practice, it's
2248 // unlikely to happen.
2249 assert((length+1) > length, "Overflow checking");
2250 char* sde = NEW_C_HEAP_ARRAY(char, (length + 1), mtClass);
2251 for (int i = 0; i < length; i++) {
2252 sde[i] = array[i];
2253 }
2254 sde[length] = '\0';
2255 _source_debug_extension = sde;
2256 }
2257 }
2258
2259 address InstanceKlass::static_field_addr(int offset) {
2260 assert(offset >= InstanceMirrorKlass::offset_of_static_fields(), "has already been adjusted");
2261 return (address)(offset + cast_from_oop<intptr_t>(java_mirror()));
2262 }
2263
2264 oop InstanceKlass::static_oop_field(int offset) {
2265 assert(offset >= InstanceMirrorKlass::offset_of_static_fields(), "has already been adjusted");
2266 return HeapAccess<>::oop_load_at(java_mirror(), offset);
2267 }
2268
2269 const char* InstanceKlass::signature_name() const {
2270 int hash_len = 0;
2271 char hash_buf[40];
2272
2273 // If this is an anonymous class, append a hash to make the name unique
2274 if (is_anonymous()) {
2275 intptr_t hash = (java_mirror() != NULL) ? java_mirror()->identity_hash() : 0;
2276 jio_snprintf(hash_buf, sizeof(hash_buf), "/" UINTX_FORMAT, (uintx)hash);
2277 hash_len = (int)strlen(hash_buf);
2278 }
2279
2280 // Get the internal name as a c string
2281 const char* src = (const char*) (name()->as_C_string());
2282 const int src_length = (int)strlen(src);
2283
2284 char* dest = NEW_RESOURCE_ARRAY(char, src_length + hash_len + 3);
2285
2286 // Add L as type indicator
2287 int dest_index = 0;
|