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
8271514: support JFR use of new ThreadsList::Iterator #4949
Conversation
…adsList::Iterator
|
@dcubed-ojdk The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
|
/label remove hotspot /label add hotspot-runtime |
@dcubed-ojdk |
@dcubed-ojdk |
@dcubed-ojdk |
/contributor add @kimbarrett |
@dcubed-ojdk |
Hi Dan,
I'm assuming that the intent of this conversion is that JavaThreadIteratorWithHandle
is going to be removed - is that right?
The conversion seems okay but definitely not a trivial change IMO. And a query below before I can approve this.
Thanks,
David
@@ -47,15 +47,17 @@ class JfrThreadIterator : public AP { | |||
|
|||
class JfrJavaThreadIteratorAdapter { | |||
private: | |||
JavaThreadIteratorWithHandle _iter; | |||
JavaThread* _next; | |||
ThreadsListHandle _tlist; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to store this?
It looks very suspiocious to have a member that is a stackObj, in a class that is not itself a stackObj. ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _tlist is used locally in JfrJavaThreadIteratorAdapter constructor only, so it is possible to get rid of it for the price of complicating the constructor a little bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _tlist
is a handle that ensures the captured ThreadsList remains live while the iterator (or a copy) exists. Dropping it would leave _it
and _end
potentially dangling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I had assumed there was a ThreadsList/Handle in the enclosing scope that was being used to initialize this and keep things live, but that is not the case.
I still think it makes no sense to have a StackObj subtype as a member though. Maybe ThreadsListHandle should no longer be a StackObj ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a change wrto StackObj usage. This adapter class used to have a member that was a JavaThreadIteratorWithHandle (the WithHandle class for the same reason the new code has a ThreadsListHandle, to keep the associated ThreadsList alive), which also derives from StackObj.
Personally, I want to agree with you. I would (and do) use StackObj far more sparingly than it appears in our code base. But I've had this same argument with other folks. The de facto situation, so far as I understand it, is that deriving from StackObj documents normal usage. It has no operational behavior or additional semantics, other than attempting to prevent heap allocation (and it doesn't really succeed there, since a derived class could override that behavior, though I don't currently know of any that do so). That seems to be what some people want from it and think is useful, and I've stopped trying to convince them otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JfrThreadIterator is only used as a stack-allocated object, so it and the adapters can be decorated with StackObj to better communicate this intent. The AP (Allocation Policy) policy in JfrThreadIterator can be removed and the JfrThreadIterator can be decorated with StackObj (unconditionally). Depends on how much you want to spend on this (I would guess minimal). But in actual usages, the iterators and adapters are de-facto StackObj already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I didn't realise JTIWH was also stackObj.
The thing with StackObj to me is that it indicates a local object that does something interesting on construction and then also on destruction (eg. like MutexLocker). So having one as a member where the destruction is not related to a stack scope seems odd to me. But a stackObj member in a stackObj class seems more reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StackObj to me communicates intent. I don't have to look for "new SomeClass" to see how it is allocated and deallocated, since the new and delete operator are private and won't compile. Same is true for AllStatic. I'm one that hasn't been convinced otherwise. I'm not totally intransigent though as i approved the removal of ValueObj. So there's that.
Hi Dan,
It looks good to me modulo the question from David.
Thanks,
Serguei
That was my intent. But this is a somewhat complicated use, so dealing with it separately. And I agree this is not a trivial change. |
The dependent pull request has now been integrated, and the target branch of this pull request has been updated. This means that changes from the dependent pull request can start to show up as belonging to this pull request, which may be confusing for reviewers. To remedy this situation, simply merge the latest changes from the new target branch into this pull request by running commands similar to these in the local repository for your personal fork: git checkout JDK-8271513
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# if there are conflicts, follow the instructions given by git merge
git commit -m "Merge master"
git push |
@dcubed-ojdk This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 9 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the
|
@dcubed-ojdk This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
The rebase has passed Mach5 Tier1 testing; Mach5 Tier[23] are in process. Update: Mach5 Tier[23] test also passed. |
Going to push as commit 8657f77.
Your commit was automatically rebased without conflicts. |
@dcubed-ojdk Pushed as commit 8657f77. |
A trivial fix to support JFR use of new ThreadsList::Iterator.
This fix was tested with Mach5 Tier[1-3].
Progress
Issue
Reviewers
Contributors
<kbarrett@openjdk.org>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4949/head:pull/4949
$ git checkout pull/4949
Update a local copy of the PR:
$ git checkout pull/4949
$ git pull https://git.openjdk.java.net/jdk pull/4949/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 4949
View PR using the GUI difftool:
$ git pr show -t 4949
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4949.diff