Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8257967: JFR: Events for loaded agents #12923

Closed
wants to merge 22 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/hotspot/share/prims/agentList.cpp
Original file line number Diff line number Diff line change
@@ -339,8 +339,8 @@ static OnLoadEntry_t lookup_Agent_OnLoad_entry_point(Agent* agent) {
}

// For backwards compatibility with -Xrun, convert Xrun agents with no JVM_OnLoad,
// but which have an Agent_OnLoad, to be treated like -agentpath (JVMTI agents)
void AgentList::promote_xrun_to_jvmti() {
// but which have an Agent_OnLoad, to be treated like -agentpath
void AgentList::convert_xrun_agents() {
Iterator it = xrun_agents();
while (it.has_next()) {
Agent* const agent = it.next();
@@ -349,20 +349,24 @@ void AgentList::promote_xrun_to_jvmti() {
// If there is an JVM_OnLoad function it will get called later,
// otherwise see if there is an Agent_OnLoad.
if (on_load_entry == nullptr) {
vm_exit_during_initialization("Could not find JVM_OnLoad or Agent_OnLoad function in the library", agent->name());
on_load_entry = lookup_Agent_OnLoad_entry_point(agent);
if (on_load_entry != nullptr) {
agent->_is_xrun = false; // promoted
} else {
vm_exit_during_initialization("Could not find JVM_OnLoad or Agent_OnLoad function in the library", agent->name());
}
}
agent->_is_xrun = false; // promoted
}
}

// Invokes Agent_OnLoad for -agentlib:.. -agentpath: and converted / promoted -Xrun agents.
// Invokes Agent_OnLoad for -agentlib:.. -agentpath: and converted -Xrun agents.
// Called very early -- before JavaThreads exist
void AgentList::load_agents() {
assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_PRIMORDIAL, "invalid init sequence");
extern struct JavaVM_ main_vm;

// Promote -Xrun to -agentlib: if there is no JVM_OnLoad
promote_xrun_to_jvmti();
// Convert -Xrun to -agentlib: if there is no JVM_OnLoad
convert_xrun_agents();

JvmtiExport::enter_onload_phase();

2 changes: 1 addition & 1 deletion src/hotspot/share/prims/agentList.hpp
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ class AgentList : AllStatic {

static void timestamp();
static void invoke_JVM_OnLoad();
static void promote_xrun_to_jvmti();
static void convert_xrun_agents();
static void link_jplis(Agent* agent);

public: