< prev index next >

src/share/vm/jfr/writers/jfrJavaEventWriter.cpp

Print this page
rev 9061 : 8227011: Starting a JFR recording in response to JVMTI VMInit and / or Java agent premain corrupts memory
Reviewed-by: egahlin, rwestberg

*** 140,151 **** } bool JfrJavaEventWriter::initialize() { static bool initialized = false; if (!initialized) { ! Thread* thread = Thread::current(); ! initialized = setup_event_writer_offsets(thread); } return initialized; } jboolean JfrJavaEventWriter::flush(jobject writer, jint used, jint requested, JavaThread* jt) { --- 140,150 ---- } bool JfrJavaEventWriter::initialize() { static bool initialized = false; if (!initialized) { ! initialized = setup_event_writer_offsets(Thread::current()); } return initialized; } jboolean JfrJavaEventWriter::flush(jobject writer, jint used, jint requested, JavaThread* jt) {
*** 160,169 **** --- 159,169 ---- // "validity" is contextually defined here to mean // that some memory location was provided that is // large enough to accommodate the "requested size". const bool is_valid = buffer->free_size() >= (size_t)(used + requested); u1* const new_current_position = is_valid ? buffer->pos() + used : buffer->pos(); + assert(start_pos_offset != invalid_offset, "invariant"); w->long_field_put(start_pos_offset, (jlong)buffer->pos()); w->long_field_put(current_pos_offset, (jlong)new_current_position); // only update java writer if underlying memory changed if (buffer != current) { w->long_field_put(start_pos_address_offset, (jlong)buffer->pos_address());
< prev index next >