32 #include "utilities/macros.hpp"
33
34 // +1 for NULL singular entry.
35 OopStorage* OopStorageSet::storages[all_count + 1] = {};
36
37 static Mutex* make_oopstorage_mutex(const char* storage_name,
38 const char* kind,
39 int rank) {
40 char name[256];
41 os::snprintf(name, sizeof(name), "%s %s lock", storage_name, kind);
42 return new PaddedMutex(rank, name, true, Mutex::_safepoint_check_never);
43 }
44
45 static OopStorage* make_oopstorage(const char* name) {
46 Mutex* alloc = make_oopstorage_mutex(name, "alloc", Mutex::oopstorage);
47 Mutex* active = make_oopstorage_mutex(name, "active", Mutex::oopstorage - 1);
48 return new OopStorage(name, alloc, active);
49 }
50
51 void OopStorageSet::initialize() {
52 storages[jni_global_index] = make_oopstorage("JNI global");
53 storages[vm_global_index] = make_oopstorage("VM global");
54 storages[jni_weak_index] = make_oopstorage("JNI weak");
55 storages[vm_weak_index] = make_oopstorage("VM weak");
56 storages[string_table_weak_index] = make_oopstorage("StringTable weak");
57 storages[resolved_method_table_weak_index] =
58 make_oopstorage("ResolvedMethodTable weak");
59
60 // Ensure we have all of them.
61 STATIC_ASSERT(all_count == 6);
62 assert(storages[singular_index] == NULL, "postcondition");
63 #ifdef ASSERT
64 for (uint i = all_start; i < all_end; ++i) {
65 assert(storages[i] != NULL, "postcondition");
66 }
67 #endif // ASSERT
68 }
69
70 void oopstorage_init() {
71 OopStorageSet::initialize();
72 }
73
74 #ifdef ASSERT
75
76 void OopStorageSet::verify_initialized(uint index) {
77 assert(storages[index] != NULL, "oopstorage_init not yet called");
78 }
|
32 #include "utilities/macros.hpp"
33
34 // +1 for NULL singular entry.
35 OopStorage* OopStorageSet::storages[all_count + 1] = {};
36
37 static Mutex* make_oopstorage_mutex(const char* storage_name,
38 const char* kind,
39 int rank) {
40 char name[256];
41 os::snprintf(name, sizeof(name), "%s %s lock", storage_name, kind);
42 return new PaddedMutex(rank, name, true, Mutex::_safepoint_check_never);
43 }
44
45 static OopStorage* make_oopstorage(const char* name) {
46 Mutex* alloc = make_oopstorage_mutex(name, "alloc", Mutex::oopstorage);
47 Mutex* active = make_oopstorage_mutex(name, "active", Mutex::oopstorage - 1);
48 return new OopStorage(name, alloc, active);
49 }
50
51 void OopStorageSet::initialize() {
52 storages[jni_global_index] = make_oopstorage("JNI Global");
53 storages[vm_global_index] = make_oopstorage("VM Global");
54 storages[jni_weak_index] = make_oopstorage("JNI Weak");
55 storages[vm_weak_index] = make_oopstorage("VM Weak");
56 storages[string_table_weak_index] = make_oopstorage("StringTable Weak");
57 storages[resolved_method_table_weak_index] =
58 make_oopstorage("ResolvedMethodTable Weak");
59
60 // Ensure we have all of them.
61 STATIC_ASSERT(all_count == 6);
62 assert(storages[singular_index] == NULL, "postcondition");
63 #ifdef ASSERT
64 for (uint i = all_start; i < all_end; ++i) {
65 assert(storages[i] != NULL, "postcondition");
66 }
67 #endif // ASSERT
68 }
69
70 void oopstorage_init() {
71 OopStorageSet::initialize();
72 }
73
74 #ifdef ASSERT
75
76 void OopStorageSet::verify_initialized(uint index) {
77 assert(storages[index] != NULL, "oopstorage_init not yet called");
78 }
|