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

JDK-8298277: Replace "session" with "scope" for FFM access #11593

Closed
wants to merge 2 commits into from

Conversation

minborg
Copy link
Contributor

@minborg minborg commented Dec 8, 2022

This PR proposes changing variable names and text from "session" to "scope". The proposed changes are only for the FFM API and not other parts like the Vector API and test classes.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8298277: Replace "session" with "scope" for FFM access

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11593/head:pull/11593
$ git checkout pull/11593

Update a local copy of the PR:
$ git checkout pull/11593
$ git pull https://git.openjdk.org/jdk pull/11593/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11593

View PR using the GUI difftool:
$ git pr show -t 11593

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11593.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 8, 2022

👋 Welcome back pminborg! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 8, 2022
@openjdk
Copy link

openjdk bot commented Dec 8, 2022

@minborg The following label will be automatically applied to this pull request:

  • core-libs

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.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Dec 8, 2022
@mlbridge
Copy link

mlbridge bot commented Dec 8, 2022

Webrevs

@@ -154,7 +154,7 @@ public MemorySegment allocate(long byteSize, long byteAlignment) {
/**
* Mismatch over long lengths.
*/
public static long vectorizedMismatchLargeForBytes(MemorySessionImpl aSession, MemorySessionImpl bSession,
public static long vectorizedMismatchLargeForBytes(MemorySessionImpl aScope, MemorySessionImpl bScope,
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems unnecessary - note that the type is MemorySessionImpl

@@ -32,8 +32,8 @@
import jdk.internal.vm.annotation.ForceInline;

/**
* A confined session, which features an owner thread. The liveness check features an additional
* confinement check - that is, calling any operation on this session from a thread other than the
* A confined scope, which features an owner thread. The liveness check features an additional
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be left as session (since we have not changed the name of the class)

* A confined session, which features an owner thread. The liveness check features an additional
* confinement check - that is, calling any operation on this session from a thread other than the
* A confined scope, which features an owner thread. The liveness check features an additional
* confinement check - that is, calling any operation on this scope from a thread other than the
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

* The global, non-closeable, shared session. Similar to a shared session, but its {@link #close()} method throws unconditionally.
* Adding new resources to the global session, does nothing: as the session can never become not-alive, there is nothing to track.
* Acquiring and or releasing a memory session similarly does nothing.
* The global, non-closeable, shared scope. Similar to a shared scope, but its {@link #close()} method throws unconditionally.
Copy link
Contributor

Choose a reason for hiding this comment

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

And here.

* While it would be possible to model an implicit session as a non-closeable view of a shared
* session, it is better to capture the fact that an implicit session is not just a non-closeable
* view of some session which might be closeable. This is useful e.g. in the implementations of
* This is an implicit, GC-backed memory scope. Implicit scopes cannot be closed explicitly.
Copy link
Contributor

Choose a reason for hiding this comment

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

These should not be changed.

@@ -39,16 +39,16 @@

/**
* This class manages the temporal bounds associated with a memory segment as well
* as thread confinement. A session has a liveness bit, which is updated when the session is closed
* as thread confinement. A scope has a liveness bit, which is updated when the scope is closed
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably all the usages of session here should be left as is

public static boolean sameOwnerThread(SegmentScope session1, SegmentScope session2) {
return ((MemorySessionImpl) session1).ownerThread() ==
((MemorySessionImpl) session2).ownerThread();
public static boolean sameOwnerThread(SegmentScope scope1, SegmentScope scope2) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This renaming is the only one that should survive

@@ -317,7 +317,7 @@ static WrongThreadException wrongThread() {
}

static UnsupportedOperationException nonCloseable() {
return new UnsupportedOperationException("Attempted to close a non-closeable session");
return new UnsupportedOperationException("Attempted to close a non-closeable scope");
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder how much we still need this - e.g. through the API is no longer possible to get there?

* A shared session, which can be shared across multiple threads. Closing a shared session has to ensure that
* (i) only one thread can successfully close a session (e.g. in a close vs. close race) and that
* (ii) no other thread is accessing the memory associated with this session while the segment is being
* A shared scope, which can be shared across multiple threads. Closing a shared scope has to ensure that
Copy link
Contributor

Choose a reason for hiding this comment

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

These should not be changed

@@ -252,7 +252,7 @@ public SegmentScope session() {
* Create a binding context from given scope. The resulting context will throw when
* the context's allocator is accessed.
*/
public static Context ofSession() {
public static Context ofScope() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think ofArena seems more apt here?

Copy link
Contributor

Choose a reason for hiding this comment

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

More generally, I think that now that we can subclass Arena, Binding.Context can just become a subclass of Arena. Then we might have several implementations, some of which throw on allocate(), some other will throw on scope() and close(). Seems a more direct approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's do that in a separate PR.

@openjdk
Copy link

openjdk bot commented Dec 8, 2022

@minborg 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:

8298277: Replace "session" with "scope" for FFM access

Reviewed-by: mcimadamore

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 13 new commits pushed to the master branch:

  • 175e3d3: 8296149: Start of release updates for JDK 21
  • d562d3f: 8297642: PhaseIdealLoop::only_has_infinite_loops must detect all loops that never lead to termination
  • fc52f21: 8298255: JFR provide information about dynamization of number of compiler threads
  • e555d54: 8298383: JFR: GenerateJfrFiles.java lacks copyright header
  • c084431: 8298379: JFR: Some UNTIMED events only sets endTime
  • ea108f5: 8298129: Let checkpoint event sizes grow beyond u4 limit
  • 165dcdd: 8297718: Make NMT free:ing protocol more granular
  • fbe7b00: 8298173: GarbageCollectionNotificationContentTest test failed: no decrease in Eden usage
  • d8ef60b: 8298272: Clean up ProblemList
  • 9353899: 8298175: JFR: Common timestamp for periodic events
  • ... and 3 more: https://git.openjdk.org/jdk/compare/b9346e149e6cfcaf18bfafbd262f6fed209dc644...master

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 (@mcimadamore) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 8, 2022
@minborg
Copy link
Contributor Author

minborg commented Dec 8, 2022

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Dec 8, 2022
@openjdk
Copy link

openjdk bot commented Dec 8, 2022

@minborg
Your change (at version 41c111b) is now ready to be sponsored by a Committer.

@minborg
Copy link
Contributor Author

minborg commented Dec 14, 2022

Superseded by openjdk/jdk20#29

@minborg minborg closed this Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored
2 participants