-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8294293: Remove unused _width and _newlines field in outputStream #10411
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
Conversation
👋 Welcome back jsjolen! A progress list of the required criteria for merging this PR into |
@jdksjolen 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. |
Webrevs
|
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.
Looks good, thanks!
@@ -86,7 +86,6 @@ class outputStream : public ResourceObj { | |||
void move_to(int col, int slop = 6, int min_space = 2); | |||
|
|||
// sizing | |||
int width() const { return _width; } | |||
int position() const { return _position; } | |||
julong count() const { return _precount + _position; } | |||
void set_count(julong count) { _precount = count - _position; } |
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.
These julong should probably be uint64_t.
But it may cause some more changes, e.g. _file_end in CompileLog should then also probably also be uint64_t.
We can look at that in another RFE.
@jdksjolen This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. 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 104 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@robehn, @dholmes-ora) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
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.
Generally seems okay but a couple of queries.
Thanks.
@@ -29,6 +29,7 @@ | |||
#include "runtime/timer.hpp" | |||
#include "utilities/globalDefinitions.hpp" | |||
#include "utilities/macros.hpp" | |||
#include <cstdint> |
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 std header doesn't seem to be used anywhere else in hotspot code - why do we need it here?
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.
Good catch, it's been removed.
// print to output stream. It can be redirected by a vfprintf hook | ||
jio_print(s, len); | ||
} | ||
|
||
// print to log file | ||
if (has_log_file()) { | ||
int nl0 = _newlines; | ||
xmlTextStream::write(s, len); |
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.
xmlTextStream::write seems to be unused after this change.
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.
It does seem that way. The outputStream::write
method is the function which all subclasses of outputStream
implements, so we shouldn't remove this function without removing xmlTextStream
. That's probably a separate RFE, and perhaps not desirable as it'd require merging the class into defaultStream
.
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.
I'm confused by this part of the change. How can the original code call xmlTextStream::write
without an instance of xmlTextStream
to apply it to???
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.
defaultStream
inherits from xmlTextStream
and defaultStream::write
exists, so this specifies to call the superclass method, and not its own method. In long form: this->xmlTextStream::write
(haven't attempted to compile)
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! Thanks - I had missed this code was in defaultStream
. It seems a bit klunky to break encapsulation and effectively inline the super write() call so that we can get access to whether a newline was seen - but monitoring _newlines
across the write call is at least as bad. I guess this is the problem of trying to have a flushable stream extend a non-flushable superclass - you somehow need to see inside the write to know if there were newlines. The new code at least saves the need for the field.
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 this seems reasonable.
Thanks.
// print to output stream. It can be redirected by a vfprintf hook | ||
jio_print(s, len); | ||
} | ||
|
||
// print to log file | ||
if (has_log_file()) { | ||
int nl0 = _newlines; | ||
xmlTextStream::write(s, len); |
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! Thanks - I had missed this code was in defaultStream
. It seems a bit klunky to break encapsulation and effectively inline the super write() call so that we can get access to whether a newline was seen - but monitoring _newlines
across the write call is at least as bad. I guess this is the problem of trying to have a flushable stream extend a non-flushable superclass - you somehow need to see inside the write to know if there were newlines. The new code at least saves the need for the field.
/integrate |
@jdksjolen |
/sponsor |
Going to push as commit 052a924.
Your commit was automatically rebased without conflicts. |
@coleenp @jdksjolen Pushed as commit 052a924. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
_width
is unused so I deleted it_newlines
was used in one place, and only to check if any new lines had been seen. I removed_newlines
and instead usedupdate_position
's unused return value to indicate whether any newlines has been seen. This required expanding the call ofxmlTextStream::write
indefaultStream
.This removes some cruft from
outputStream
and saves us 8 bytes on the size ofoutputStream
.I also noted that
_position
isn't number of chars into a line, but rather a "visual position". It's a bit surprising, which is why I added this comment. This can be seen in the\t
case inupdate_position
.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10411/head:pull/10411
$ git checkout pull/10411
Update a local copy of the PR:
$ git checkout pull/10411
$ git pull https://git.openjdk.org/jdk pull/10411/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10411
View PR using the GUI difftool:
$ git pr show -t 10411
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10411.diff