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

Rework getJimModules() #2465

Merged
merged 1 commit into from
Jul 26, 2018
Merged

Rework getJimModules() #2465

merged 1 commit into from
Jul 26, 2018

Conversation

gacholio
Copy link
Contributor

  • inline single-use function
  • handle errors consistently
  • load instrument module before adding to classpath
  • remove unnecessary use of VM constant pool

Fixes: #2437

Signed-off-by: Graham Chapman graham_chapman@ca.ibm.com

* but it won't keep the class alive. That's OK in this case since the class in
* question is not a candidate for unloading.
*/
vm->jimModules = jimModules = (jclass)&j9JimModules->classObject;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is iffy as it assumes the J9Class will never be freed (today's behaviour). We've been talking about freeing the obsolete classes and this cause a hard to find bug.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is just refactored existing code... something to be cleaned up, not necessarily as part of this PR. If you're not going to fix this now, let me know and I'll open an issue for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's iffy for a class that we don't know everything about - in this case, it's a boot class (or whatever the JDK9 equivalent is), so we are sure it's not a candidate for unloading.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, in JDK9+ not every java.* class is loaded by the bootloader. Some have been moved to the app loader. (This one is loaded by the bootloader)

My concern is more with future bugs when we allow redefined J9Classes to be GC'd.... though this may not be a concern with FastHCR due to keeping the J9Class stable.

All that to say, we should at minimum open a issue to remember to look at this again,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I don't want an issue for it - this was a change we made to avoid the need to lock and allocate a global ref.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we trying to avoid creating the global ref? Is there a usecase that demonstrates the current solution is better? I would expect the extra cost of the global ref to be in the noise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was to avoid the need for a single-use monitor. Since you're clearly upset by this, I'll change it back (though I'll reuse an existing monitor).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

(*env)->DeleteLocalRef(env, classLoaderClass);
(*env)->DeleteLocalRef(env, filenameString);
(*env)->DeleteLocalRef(env, classLoaderRef);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my own education: why were these calls to DeleteLocalRef reordered?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reordered them to be in reverse order of creation, in case that were to ever matter for future optimization of the local ref space (I don't think it does at the moment).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thanks.

- inline single-use function
- handle errors consistently
- load instrument module before adding to classpath
- remove unnecessary use of VM constant pool

Fixes: eclipse-openj9#2437

Signed-off-by: Graham Chapman <graham_chapman@ca.ibm.com>
Copy link
Member

@DanHeidinga DanHeidinga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@DanHeidinga
Copy link
Member

Jenkins test sanity xlinux jdk10

@DanHeidinga
Copy link
Member

Jenkins test sanity xlinux jdk8

@DanHeidinga DanHeidinga merged commit f1fd1aa into eclipse-openj9:master Jul 26, 2018
@gacholio gacholio deleted the rework branch July 26, 2018 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants