1376 #endif // PRODUCT |
1376 #endif // PRODUCT |
1377 |
1377 |
1378 |
1378 |
1379 // JVMTI GetConstantPool support |
1379 // JVMTI GetConstantPool support |
1380 |
1380 |
1381 // For temporary use until code is stable. |
1381 // For debugging of constant pool |
1382 #define DBG(code) |
1382 const bool debug_cpool = false; |
1383 |
1383 |
1384 static const char* WARN_MSG = "Must not be such entry!"; |
1384 #define DBG(code) do { if (debug_cpool) { (code); } } while(0) |
1385 |
1385 |
1386 static void print_cpool_bytes(jint cnt, u1 *bytes) { |
1386 static void print_cpool_bytes(jint cnt, u1 *bytes) { |
|
1387 const char* WARN_MSG = "Must not be such entry!"; |
1387 jint size = 0; |
1388 jint size = 0; |
1388 u2 idx1, idx2; |
1389 u2 idx1, idx2; |
1389 |
1390 |
1390 for (jint idx = 1; idx < cnt; idx++) { |
1391 for (jint idx = 1; idx < cnt; idx++) { |
1391 jint ent_size = 0; |
1392 jint ent_size = 0; |
1667 *bytes = JVM_CONSTANT_String; |
1668 *bytes = JVM_CONSTANT_String; |
1668 Symbol* sym = unresolved_string_at(idx); |
1669 Symbol* sym = unresolved_string_at(idx); |
1669 idx1 = tbl->symbol_to_value(sym); |
1670 idx1 = tbl->symbol_to_value(sym); |
1670 assert(idx1 != 0, "Have not found a hashtable entry"); |
1671 assert(idx1 != 0, "Have not found a hashtable entry"); |
1671 Bytes::put_Java_u2((address) (bytes+1), idx1); |
1672 Bytes::put_Java_u2((address) (bytes+1), idx1); |
1672 DBG(char *str = sym->as_utf8()); |
1673 DBG(printf("JVM_CONSTANT_String: idx=#%03hd, %s", idx1, sym->as_utf8())); |
1673 DBG(printf("JVM_CONSTANT_String: idx=#%03hd, %s", idx1, str)); |
|
1674 break; |
1674 break; |
1675 } |
1675 } |
1676 case JVM_CONSTANT_Fieldref: |
1676 case JVM_CONSTANT_Fieldref: |
1677 case JVM_CONSTANT_Methodref: |
1677 case JVM_CONSTANT_Methodref: |
1678 case JVM_CONSTANT_InterfaceMethodref: { |
1678 case JVM_CONSTANT_InterfaceMethodref: { |
1742 |
1742 |
1743 // Keep temorarily for debugging until it's stable. |
1743 // Keep temorarily for debugging until it's stable. |
1744 DBG(print_cpool_bytes(cnt, start_bytes)); |
1744 DBG(print_cpool_bytes(cnt, start_bytes)); |
1745 return (int)(bytes - start_bytes); |
1745 return (int)(bytes - start_bytes); |
1746 } /* end copy_cpool_bytes */ |
1746 } /* end copy_cpool_bytes */ |
|
1747 |
|
1748 #undef DBG |
1747 |
1749 |
1748 |
1750 |
1749 void ConstantPool::set_on_stack(const bool value) { |
1751 void ConstantPool::set_on_stack(const bool value) { |
1750 if (value) { |
1752 if (value) { |
1751 _flags |= _on_stack; |
1753 _flags |= _on_stack; |