8381233: Linker and FunctionDescriptor do not need to be value based class#30481
8381233: Linker and FunctionDescriptor do not need to be value based class#30481YaSuenag wants to merge 1 commit intoopenjdk:masterfrom
Conversation
|
👋 Welcome back ysuenaga! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
I think |
| * @implSpec | ||
| * Implementing classes are immutable, thread-safe and | ||
| * <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>. | ||
| * Implementing classes are immutable, thread-safe. |
There was a problem hiding this comment.
| * Implementing classes are immutable, thread-safe. | |
| * Implementing classes are immutable, thread-safe and | |
| * <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>. |
| * @see MemoryLayout | ||
| * @since 22 | ||
| */ | ||
| public sealed interface FunctionDescriptor permits FunctionDescriptorImpl { |
There was a problem hiding this comment.
| @ValueBased | |
| public sealed interface FunctionDescriptor permits FunctionDescriptorImpl { |
|
@mcimadamore I left the reply for #30443 (comment) here.
Can you show some example(s)? I checked JDK source with I think the class should be labeled "value based class" depending on the use case. In void process(MemoryLayout layout, MemorySegment data) {
if (layout == LAYOUT_FOR_A) {
procA(data);
} else if (layout == LAYOUT_FOR_B) {
procB(data);
}
}In It is the reason why I proposed to remove "value-based" from |
On the review for JDK-8380955 (#30443),
LinkerandFunctionDescriptordo not need to be value based class because they would not be treated as "value".Linkeris defined as providing a way to look up the canonical layouts associated with the data types used by the ABI.FunctionDescriptorrepresents the signature of a foreign function. They are not "value".Actually they and their child (final) classes do not have
@ValueBased, thusjavacand-XX:DiagnoseSyncOnValueBasedClassescannot identify if they are used in anti-pattern of value based class. Thus this change does not change behavior, just documentation updates.Progress
Issues
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30481/head:pull/30481$ git checkout pull/30481Update a local copy of the PR:
$ git checkout pull/30481$ git pull https://git.openjdk.org/jdk.git pull/30481/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 30481View PR using the GUI difftool:
$ git pr show -t 30481Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30481.diff
Using Webrev
Link to Webrev Comment