Skip to content

Commit 86a8b48

Browse files
committed
8337458: Remove debugging code print_cpool_bytes
Reviewed-by: dholmes, shade
1 parent 16a1d0a commit 86a8b48

File tree

1 file changed

+0
-153
lines changed

1 file changed

+0
-153
lines changed

src/hotspot/share/oops/constantPool.cpp

Lines changed: 0 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,138 +2017,6 @@ const char* ConstantPool::printable_name_at(int cp_index) {
20172017
#endif // PRODUCT
20182018

20192019

2020-
// JVMTI GetConstantPool support
2021-
2022-
// For debugging of constant pool
2023-
const bool debug_cpool = false;
2024-
2025-
#define DBG(code) do { if (debug_cpool) { (code); } } while(0)
2026-
2027-
static void print_cpool_bytes(jint cnt, u1 *bytes) {
2028-
const char* WARN_MSG = "Must not be such entry!";
2029-
jint size = 0;
2030-
u2 idx1, idx2;
2031-
2032-
for (jint idx = 1; idx < cnt; idx++) {
2033-
jint ent_size = 0;
2034-
u1 tag = *bytes++;
2035-
size++; // count tag
2036-
2037-
printf("const #%03d, tag: %02d ", idx, tag);
2038-
switch(tag) {
2039-
case JVM_CONSTANT_Invalid: {
2040-
printf("Invalid");
2041-
break;
2042-
}
2043-
case JVM_CONSTANT_Unicode: {
2044-
printf("Unicode %s", WARN_MSG);
2045-
break;
2046-
}
2047-
case JVM_CONSTANT_Utf8: {
2048-
u2 len = Bytes::get_Java_u2(bytes);
2049-
char str[128];
2050-
if (len > 127) {
2051-
len = 127;
2052-
}
2053-
strncpy(str, (char *) (bytes+2), len);
2054-
str[len] = '\0';
2055-
printf("Utf8 \"%s\"", str);
2056-
ent_size = 2 + len;
2057-
break;
2058-
}
2059-
case JVM_CONSTANT_Integer: {
2060-
u4 val = Bytes::get_Java_u4(bytes);
2061-
printf("int %d", *(int *) &val);
2062-
ent_size = 4;
2063-
break;
2064-
}
2065-
case JVM_CONSTANT_Float: {
2066-
u4 val = Bytes::get_Java_u4(bytes);
2067-
printf("float %5.3ff", *(float *) &val);
2068-
ent_size = 4;
2069-
break;
2070-
}
2071-
case JVM_CONSTANT_Long: {
2072-
u8 val = Bytes::get_Java_u8(bytes);
2073-
printf("long " INT64_FORMAT, (int64_t) *(jlong *) &val);
2074-
ent_size = 8;
2075-
idx++; // Long takes two cpool slots
2076-
break;
2077-
}
2078-
case JVM_CONSTANT_Double: {
2079-
u8 val = Bytes::get_Java_u8(bytes);
2080-
printf("double %5.3fd", *(jdouble *)&val);
2081-
ent_size = 8;
2082-
idx++; // Double takes two cpool slots
2083-
break;
2084-
}
2085-
case JVM_CONSTANT_Class: {
2086-
idx1 = Bytes::get_Java_u2(bytes);
2087-
printf("class #%03d", idx1);
2088-
ent_size = 2;
2089-
break;
2090-
}
2091-
case JVM_CONSTANT_String: {
2092-
idx1 = Bytes::get_Java_u2(bytes);
2093-
printf("String #%03d", idx1);
2094-
ent_size = 2;
2095-
break;
2096-
}
2097-
case JVM_CONSTANT_Fieldref: {
2098-
idx1 = Bytes::get_Java_u2(bytes);
2099-
idx2 = Bytes::get_Java_u2(bytes+2);
2100-
printf("Field #%03d, #%03d", (int) idx1, (int) idx2);
2101-
ent_size = 4;
2102-
break;
2103-
}
2104-
case JVM_CONSTANT_Methodref: {
2105-
idx1 = Bytes::get_Java_u2(bytes);
2106-
idx2 = Bytes::get_Java_u2(bytes+2);
2107-
printf("Method #%03d, #%03d", idx1, idx2);
2108-
ent_size = 4;
2109-
break;
2110-
}
2111-
case JVM_CONSTANT_InterfaceMethodref: {
2112-
idx1 = Bytes::get_Java_u2(bytes);
2113-
idx2 = Bytes::get_Java_u2(bytes+2);
2114-
printf("InterfMethod #%03d, #%03d", idx1, idx2);
2115-
ent_size = 4;
2116-
break;
2117-
}
2118-
case JVM_CONSTANT_NameAndType: {
2119-
idx1 = Bytes::get_Java_u2(bytes);
2120-
idx2 = Bytes::get_Java_u2(bytes+2);
2121-
printf("NameAndType #%03d, #%03d", idx1, idx2);
2122-
ent_size = 4;
2123-
break;
2124-
}
2125-
case JVM_CONSTANT_ClassIndex: {
2126-
printf("ClassIndex %s", WARN_MSG);
2127-
break;
2128-
}
2129-
case JVM_CONSTANT_UnresolvedClass: {
2130-
printf("UnresolvedClass: %s", WARN_MSG);
2131-
break;
2132-
}
2133-
case JVM_CONSTANT_UnresolvedClassInError: {
2134-
printf("UnresolvedClassInErr: %s", WARN_MSG);
2135-
break;
2136-
}
2137-
case JVM_CONSTANT_StringIndex: {
2138-
printf("StringIndex: %s", WARN_MSG);
2139-
break;
2140-
}
2141-
}
2142-
printf(";\n");
2143-
bytes += ent_size;
2144-
size += ent_size;
2145-
}
2146-
printf("Cpool size: %d\n", size);
2147-
fflush(nullptr);
2148-
return;
2149-
} /* end print_cpool_bytes */
2150-
2151-
21522020
// Returns size of constant pool entry.
21532021
jint ConstantPool::cpool_entry_size(jint idx) {
21542022
switch(tag_at(idx).value()) {
@@ -2211,15 +2079,13 @@ jint ConstantPool::hash_entries_to(SymbolHash *symmap,
22112079
case JVM_CONSTANT_Utf8: {
22122080
Symbol* sym = symbol_at(idx);
22132081
symmap->add_if_absent(sym, idx);
2214-
DBG(printf("adding symbol entry %s = %d\n", sym->as_utf8(), idx));
22152082
break;
22162083
}
22172084
case JVM_CONSTANT_Class:
22182085
case JVM_CONSTANT_UnresolvedClass:
22192086
case JVM_CONSTANT_UnresolvedClassInError: {
22202087
Symbol* sym = klass_name_at(idx);
22212088
classmap->add_if_absent(sym, idx);
2222-
DBG(printf("adding class entry %s = %d\n", sym->as_utf8(), idx));
22232089
break;
22242090
}
22252091
case JVM_CONSTANT_Long:
@@ -2253,15 +2119,12 @@ int ConstantPool::copy_cpool_bytes(int cpool_size,
22532119
assert(size + ent_size <= cpool_size, "Size mismatch");
22542120

22552121
*bytes = tag;
2256-
DBG(printf("#%03hd tag=%03hd, ", (short)idx, (short)tag));
22572122
switch(tag) {
22582123
case JVM_CONSTANT_Invalid: {
2259-
DBG(printf("JVM_CONSTANT_Invalid"));
22602124
break;
22612125
}
22622126
case JVM_CONSTANT_Unicode: {
22632127
assert(false, "Wrong constant pool tag: JVM_CONSTANT_Unicode");
2264-
DBG(printf("JVM_CONSTANT_Unicode"));
22652128
break;
22662129
}
22672130
case JVM_CONSTANT_Utf8: {
@@ -2273,7 +2136,6 @@ int ConstantPool::copy_cpool_bytes(int cpool_size,
22732136
for (int i = 0; i < len; i++) {
22742137
bytes[3+i] = (u1) str[i];
22752138
}
2276-
DBG(printf("JVM_CONSTANT_Utf8: %s ", str));
22772139
break;
22782140
}
22792141
case JVM_CONSTANT_Integer: {
@@ -2306,7 +2168,6 @@ int ConstantPool::copy_cpool_bytes(int cpool_size,
23062168
idx1 = tbl->symbol_to_value(sym);
23072169
assert(idx1 != 0, "Have not found a hashtable entry");
23082170
Bytes::put_Java_u2((address) (bytes+1), idx1);
2309-
DBG(printf("JVM_CONSTANT_Class: idx=#%03hd, %s", idx1, sym->as_utf8()));
23102171
break;
23112172
}
23122173
case JVM_CONSTANT_String: {
@@ -2315,7 +2176,6 @@ int ConstantPool::copy_cpool_bytes(int cpool_size,
23152176
idx1 = tbl->symbol_to_value(sym);
23162177
assert(idx1 != 0, "Have not found a hashtable entry");
23172178
Bytes::put_Java_u2((address) (bytes+1), idx1);
2318-
DBG(printf("JVM_CONSTANT_String: idx=#%03hd, %s", idx1, sym->as_utf8()));
23192179
break;
23202180
}
23212181
case JVM_CONSTANT_Fieldref:
@@ -2325,29 +2185,25 @@ int ConstantPool::copy_cpool_bytes(int cpool_size,
23252185
idx2 = uncached_name_and_type_ref_index_at(idx);
23262186
Bytes::put_Java_u2((address) (bytes+1), idx1);
23272187
Bytes::put_Java_u2((address) (bytes+3), idx2);
2328-
DBG(printf("JVM_CONSTANT_Methodref: %hd %hd", idx1, idx2));
23292188
break;
23302189
}
23312190
case JVM_CONSTANT_NameAndType: {
23322191
idx1 = name_ref_index_at(idx);
23332192
idx2 = signature_ref_index_at(idx);
23342193
Bytes::put_Java_u2((address) (bytes+1), idx1);
23352194
Bytes::put_Java_u2((address) (bytes+3), idx2);
2336-
DBG(printf("JVM_CONSTANT_NameAndType: %hd %hd", idx1, idx2));
23372195
break;
23382196
}
23392197
case JVM_CONSTANT_ClassIndex: {
23402198
*bytes = JVM_CONSTANT_Class;
23412199
idx1 = checked_cast<u2>(klass_index_at(idx));
23422200
Bytes::put_Java_u2((address) (bytes+1), idx1);
2343-
DBG(printf("JVM_CONSTANT_ClassIndex: %hd", idx1));
23442201
break;
23452202
}
23462203
case JVM_CONSTANT_StringIndex: {
23472204
*bytes = JVM_CONSTANT_String;
23482205
idx1 = checked_cast<u2>(string_index_at(idx));
23492206
Bytes::put_Java_u2((address) (bytes+1), idx1);
2350-
DBG(printf("JVM_CONSTANT_StringIndex: %hd", idx1));
23512207
break;
23522208
}
23532209
case JVM_CONSTANT_MethodHandle:
@@ -2357,15 +2213,13 @@ int ConstantPool::copy_cpool_bytes(int cpool_size,
23572213
idx1 = checked_cast<u2>(method_handle_index_at(idx));
23582214
*(bytes+1) = (unsigned char) kind;
23592215
Bytes::put_Java_u2((address) (bytes+2), idx1);
2360-
DBG(printf("JVM_CONSTANT_MethodHandle: %d %hd", kind, idx1));
23612216
break;
23622217
}
23632218
case JVM_CONSTANT_MethodType:
23642219
case JVM_CONSTANT_MethodTypeInError: {
23652220
*bytes = JVM_CONSTANT_MethodType;
23662221
idx1 = checked_cast<u2>(method_type_index_at(idx));
23672222
Bytes::put_Java_u2((address) (bytes+1), idx1);
2368-
DBG(printf("JVM_CONSTANT_MethodType: %hd", idx1));
23692223
break;
23702224
}
23712225
case JVM_CONSTANT_Dynamic:
@@ -2376,7 +2230,6 @@ int ConstantPool::copy_cpool_bytes(int cpool_size,
23762230
assert(idx2 == bootstrap_name_and_type_ref_index_at(idx), "correct half of u4");
23772231
Bytes::put_Java_u2((address) (bytes+1), idx1);
23782232
Bytes::put_Java_u2((address) (bytes+3), idx2);
2379-
DBG(printf("JVM_CONSTANT_Dynamic: %hd %hd", idx1, idx2));
23802233
break;
23812234
}
23822235
case JVM_CONSTANT_InvokeDynamic: {
@@ -2386,23 +2239,17 @@ int ConstantPool::copy_cpool_bytes(int cpool_size,
23862239
assert(idx2 == bootstrap_name_and_type_ref_index_at(idx), "correct half of u4");
23872240
Bytes::put_Java_u2((address) (bytes+1), idx1);
23882241
Bytes::put_Java_u2((address) (bytes+3), idx2);
2389-
DBG(printf("JVM_CONSTANT_InvokeDynamic: %hd %hd", idx1, idx2));
23902242
break;
23912243
}
23922244
}
2393-
DBG(printf("\n"));
23942245
bytes += ent_size;
23952246
size += ent_size;
23962247
}
23972248
assert(size == cpool_size, "Size mismatch");
23982249

2399-
// Keep temporarily for debugging until it's stable.
2400-
DBG(print_cpool_bytes(cnt, start_bytes));
24012250
return (int)(bytes - start_bytes);
24022251
} /* end copy_cpool_bytes */
24032252

2404-
#undef DBG
2405-
24062253
bool ConstantPool::is_maybe_on_stack() const {
24072254
// This method uses the similar logic as nmethod::is_maybe_on_stack()
24082255
if (!Continuations::enabled()) {

0 commit comments

Comments
 (0)