mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8227011: Starting a JFR recording in response to JVMTI VMInit and / or Java agent premain corrupts memory
Reviewed-by: egahlin, rwestberg
This commit is contained in:
parent
6e16ff4cea
commit
ebde73209f
4 changed files with 13 additions and 7 deletions
|
@ -135,8 +135,7 @@ static bool setup_event_writer_offsets(TRAPS) {
|
|||
bool JfrJavaEventWriter::initialize() {
|
||||
static bool initialized = false;
|
||||
if (!initialized) {
|
||||
Thread* thread = Thread::current();
|
||||
initialized = setup_event_writer_offsets(thread);
|
||||
initialized = setup_event_writer_offsets(Thread::current());
|
||||
}
|
||||
return initialized;
|
||||
}
|
||||
|
@ -155,6 +154,7 @@ jboolean JfrJavaEventWriter::flush(jobject writer, jint used, jint requested, Ja
|
|||
// 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue