63 64 DIR_Chunk* find_match(GrowableArray<DIR_Chunk*>* arr, 65 int start_index, 66 DebugInformationRecorder* dir) { 67 int end_index = arr->length(); 68 int hash = this->_hash, length = this->_length; 69 address buf = dir->stream()->buffer(); 70 for (int i = end_index; --i >= start_index; ) { 71 DIR_Chunk* that = arr->at(i); 72 if (hash == that->_hash && 73 length == that->_length && 74 0 == memcmp(buf + this->_offset, buf + that->_offset, length)) { 75 return that; 76 } 77 } 78 return NULL; 79 } 80 }; 81 82 static inline bool compute_recording_non_safepoints() { 83 if (JvmtiExport::should_post_compiled_method_load() 84 && FLAG_IS_DEFAULT(DebugNonSafepoints)) { 85 // The default value of this flag is taken to be true, 86 // if JVMTI is looking at nmethod codes. 87 // We anticipate that JVMTI may wish to participate in profiling. 88 return true; 89 } 90 91 // If the flag is set manually, use it, whether true or false. 92 // Otherwise, if JVMTI is not in the picture, use the default setting. 93 // (This is true in debug, just for the exercise, false in product mode.) 94 return DebugNonSafepoints; 95 } 96 97 DebugInformationRecorder::DebugInformationRecorder(OopRecorder* oop_recorder) 98 : _recording_non_safepoints(compute_recording_non_safepoints()) 99 { 100 _pcs_size = 100; 101 _pcs = NEW_RESOURCE_ARRAY(PcDesc, _pcs_size); 102 _pcs_length = 0; 103 104 _prev_safepoint_pc = PcDesc::lower_offset_limit; 105 106 _stream = new DebugInfoWriteStream(this, 10 * K); | 63 64 DIR_Chunk* find_match(GrowableArray<DIR_Chunk*>* arr, 65 int start_index, 66 DebugInformationRecorder* dir) { 67 int end_index = arr->length(); 68 int hash = this->_hash, length = this->_length; 69 address buf = dir->stream()->buffer(); 70 for (int i = end_index; --i >= start_index; ) { 71 DIR_Chunk* that = arr->at(i); 72 if (hash == that->_hash && 73 length == that->_length && 74 0 == memcmp(buf + this->_offset, buf + that->_offset, length)) { 75 return that; 76 } 77 } 78 return NULL; 79 } 80 }; 81 82 static inline bool compute_recording_non_safepoints() { 83 if ((EnableEventTracing || JvmtiExport::should_post_compiled_method_load()) 84 && FLAG_IS_DEFAULT(DebugNonSafepoints)) { 85 // The default value of this flag is taken to be true, 86 // if event tracing is enabled or JVMTI is looking at nmethod codes. 87 // We anticipate that JVMTI may wish to participate in profiling. 88 return true; 89 } 90 91 // If the flag is set manually, use it, whether true or false. 92 // Otherwise, if JVMTI is not in the picture, use the default setting. 93 // (This is true in debug, just for the exercise, false in product mode.) 94 return DebugNonSafepoints; 95 } 96 97 DebugInformationRecorder::DebugInformationRecorder(OopRecorder* oop_recorder) 98 : _recording_non_safepoints(compute_recording_non_safepoints()) 99 { 100 _pcs_size = 100; 101 _pcs = NEW_RESOURCE_ARRAY(PcDesc, _pcs_size); 102 _pcs_length = 0; 103 104 _prev_safepoint_pc = PcDesc::lower_offset_limit; 105 106 _stream = new DebugInfoWriteStream(this, 10 * K); |