-
Notifications
You must be signed in to change notification settings - Fork 76
8259032: MappedMemorySegmentImpl#makeMappedSegment() ignores Unmapper#pagePosition #84
Conversation
…address computation
👋 Welcome back mcimadamore! A progress list of the required criteria for merging this PR into |
@mcimadamore The following labels 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 lists. If you would like to change these labels, use the /label pull request command. |
@@ -25,7 +25,7 @@ | |||
* @test | |||
* @modules java.base/sun.nio.ch | |||
* jdk.incubator.foreign/jdk.internal.foreign | |||
* @run testng/othervm -Dforeign.restricted=permit TestByteBuffer | |||
* @run testng/othervm --illegal-access=permit -Dforeign.restricted=permit TestByteBuffer |
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.
Can you change java.base/sun.nio.ch to java.base/sun.nio.ch:+open instead? That would avoid the --illegal-access=permit.
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 am not sure if a test like this is really needed.
The alignment is pageSize on Linux and some arbitrary value (65536) on Windows. If you have some test file that writes like a few bytes (1, 2, 3, 4,...) To a file and then maps it with offsets other than zero, you just have to get the first byte and compare it to offset.
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.
In fact the new test only checks if everything is aligned like we expect, but it does not test that our mapping returns a memory segment with expected contents.
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.
So I tend to make a simple test without reflection that writes a defined sequence of bytes to a file and then maps it with various offsets, checking that the first byte in the mapped segment is from that sequence.
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 suggestion!
@mcimadamore this pull request can not be integrated into git checkout 8259032_pagepos
git fetch https://git.openjdk.java.net/jdk16 master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
Hi, |
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 suggestion from Uwe.
/integrate |
@mcimadamore This PR has not yet been marked as ready for integration. |
@mcimadamore 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 no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
/contributor add uschindler |
@mcimadamore |
/integrate |
@mcimadamore Pushed as commit e66187d. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hi,
this patch fixes an oversight where the address() method in FileChannelImpl.Unmapper does not take into account the value of
pagePosition
- this leads to a situation in which, effectively, the specified offset when mapping the segment is ignored by the runtime (because base address will always be aligned to some known quantity - which is OS/platform dependent).To test this I had to break open into FileChannelImpl and ready the granularity.
Progress
Issue
Reviewers
Contributors
<uschindler@openjdk.org>
Download
$ git fetch https://git.openjdk.java.net/jdk16 pull/84/head:pull/84
$ git checkout pull/84