src/share/vm/oops/constantPool.hpp

Print this page

        

*** 81,90 **** --- 81,96 ---- // Array of resolved objects from the constant pool and map from resolved // object index to original constant pool index jobject _resolved_references; Array<u2>* _reference_map; + // Needed for JvmtiConstantPoolReconstituter. + // Map from a pseudo-string index to the original Utf8 entry index. + // Each u4 entry consist of two packed u2 integers: + // JVM_CONSTANT_String index and JVM_CONSTANT_Utf8 index + GrowableArray<u4>* _pseudo_string_map; + enum { _has_preresolution = 1, // Flags _on_stack = 2 };
*** 158,167 **** --- 164,203 ---- bool is_constantPool() const volatile { return true; } Array<u1>* tags() const { return _tags; } Array<u2>* operands() const { return _operands; } + GrowableArray<u4>* pseudo_string_map() { + if (_pseudo_string_map == NULL) { + _pseudo_string_map = new(ResourceObj::C_HEAP, mtClass) GrowableArray<u4>(1, true); + } + return _pseudo_string_map; + } + + void map_pseudo_string_indices(u2 index, u2 utf8_idx) { + u4 packed = index << 16 | utf8_idx; + pseudo_string_map()->append(packed); + } + + u2 get_pseudo_string_utf8_index(u2 index) { + GrowableArray<u4>* map = pseudo_string_map(); + int len = map->length(); + // The entries are ordered by value so that a binary search can be + // used if a performance bottleneck is observed in this area. + for (int i = 0; i < len; i++) { + u4 packed = map->at(i); + u2 idx = (packed >> 16) & 0xFF; + if (idx == index) { + u2 utf8_idx = packed & 0xFF; + assert(utf8_idx > 0, "Utf8 cp index in pseudo-string map must be positive"); + return utf8_idx; + } + } + assert(true, "not found a matching entry in pseudo-string map"); + return 0; + } + bool has_preresolution() const { return (_flags & _has_preresolution) != 0; } void set_has_preresolution() { _flags |= _has_preresolution; } // Redefine classes support. If a method refering to this constant pool // is on the executing stack, or as a handle in vm code, this constant pool