< prev index next >

src/share/vm/classfile/classFileStream.cpp

Print this page
rev 8957 : 8223147: JFR Backport
8199712: Flight Recorder
8203346: JFR: Inconsistent signature of jfr_add_string_constant
8195817: JFR.stop should require name of recording
8195818: JFR.start should increase autogenerated name by one
8195819: Remove recording=x from jcmd JFR.check output
8203921: JFR thread sampling is missing fixes from JDK-8194552
8203929: Limit amount of data for JFR.dump
8203664: JFR start failure after AppCDS archive created with JFR StartFlightRecording
8003209: JFR events for network utilization
8207392: [PPC64] Implement JFR profiling

*** 28,43 **** void ClassFileStream::truncated_file_error(TRAPS) { THROW_MSG(vmSymbols::java_lang_ClassFormatError(), "Truncated class file"); } ! ClassFileStream::ClassFileStream(u1* buffer, int length, const char* source) { _buffer_start = buffer; _buffer_end = buffer + length; _current = buffer; _source = source; ! _need_verify = false; } u1 ClassFileStream::get_u1(TRAPS) { if (_need_verify) { guarantee_more(1, CHECK_0); --- 28,43 ---- void ClassFileStream::truncated_file_error(TRAPS) { THROW_MSG(vmSymbols::java_lang_ClassFormatError(), "Truncated class file"); } ! ClassFileStream::ClassFileStream(u1* buffer, int length, const char* source, bool need_verify) { _buffer_start = buffer; _buffer_end = buffer + length; _current = buffer; _source = source; ! _need_verify = need_verify; } u1 ClassFileStream::get_u1(TRAPS) { if (_need_verify) { guarantee_more(1, CHECK_0);
*** 98,102 **** --- 98,130 ---- if (_need_verify) { guarantee_more(length * 4, CHECK); } _current += length * 4; } + + #if INCLUDE_JFR + + u1* ClassFileStream::clone_buffer() const { + u1* const new_buffer_start = NEW_RESOURCE_ARRAY(u1, length()); + memcpy(new_buffer_start, _buffer_start, length()); + return new_buffer_start; + } + + const char* const ClassFileStream::clone_source() const { + const char* const src = source(); + char* source_copy = NULL; + if (src != NULL) { + size_t source_len = strlen(src); + source_copy = NEW_RESOURCE_ARRAY(char, source_len + 1); + strncpy(source_copy, src, source_len + 1); + } + return source_copy; + } + + ClassFileStream* ClassFileStream::clone() const { + u1* const new_buffer_start = clone_buffer(); + return new ClassFileStream(new_buffer_start, + length(), + clone_source(), + need_verify()); + } + #endif // INCLUDE_JFR
< prev index next >