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

Change Attachment.loadAgentLibrary() to a static method #17919

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,11 @@ private boolean parseLoadAgent(String cmd) {
* add prefixes and suffixes to the library name.
* @return null if successful, diagnostic string if error
*/
String loadAgentLibrary(String agentLibrary, String options,
static String loadAgentLibrary(String agentLibrary, String options,
boolean decorate) {
IPC.logMessage("loadAgentLibrary " + agentLibrary + ':' + options + " decorate=" + decorate); //$NON-NLS-1$ //$NON-NLS-2$
ClassLoader loader = java.lang.ClassLoader.getSystemClassLoader();
int status = loadAgentLibraryImpl(loader ,agentLibrary, options, decorate);
int status = loadAgentLibraryImpl(true, loader, agentLibrary, options, decorate);
if (0 != status) {
if (-1 == status) {
return Response.EXCEPTION_AGENT_LOAD_EXCEPTION + ' '
Expand All @@ -384,16 +384,18 @@ String loadAgentLibrary(String agentLibrary, String options,
}

/**
*
* @param agentLibrary
* a dummy arg to ensure that current native method has the ClassLoader instance
* as it's second argument required by jnimisc.cpp:getCurrentClassLoader()
* @param agentLibrary
JasonFengJ9 marked this conversation as resolved.
Show resolved Hide resolved
* name of the agent library
* @param options
* arguments to the library's Agent_OnAttach function
* @param decorate
* add prefixes and suffixes to the library name.
* add prefixes and suffixes to the library name
* @return 0 if all went well
*/
private native int loadAgentLibraryImpl(ClassLoader loader,String agentLibrary,
private static native int loadAgentLibraryImpl(boolean dummy, ClassLoader loader,String agentLibrary,
String options, boolean decorate);

private int getPortNumber() {
Expand Down
2 changes: 1 addition & 1 deletion runtime/vm/BytecodeInterpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4841,7 +4841,7 @@ class INTERPRETER_CLASS
return rc;
}

/* openj9.internal.tools.attach.target.Attachment: private native int loadAgentLibraryImpl(ClassLoader loader, String agentLibrary, String options, boolean decorate); */
/* openj9.internal.tools.attach.target.Attachment: private static native int loadAgentLibraryImpl(boolean dummy, ClassLoader loader, String agentLibrary, String options, boolean decorate); */
VMINLINE VM_BytecodeAction
inlAttachmentLoadAgentLibraryImpl(REGISTER_ARGS_LIST)
{
Expand Down