GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Auto-port 5.0: fix FFM address semantics in directBufferAddress (#16… · netty/netty@e16d76f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • common/src/main/java/io/netty/util/internal
    • PlatformDependent0.java
  • transport-native-unix-common/src/main/java/io/netty/channel/unix
    • Buffer.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎common/src/main/java/io/netty/util/internal/PlatformDependent0.java‎

Copy file name to clipboardExpand all lines: common/src/main/java/io/netty/util/internal/PlatformDependent0.java
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,9 @@ static long directBufferAddress(ByteBuffer buffer) {
689689
}
690690
if (hasMemorySegmentAddressOfBuffer()) {
691691
try {
692-
return (long) MEMORY_SEGMENT_ADDRESS_OF_BUFFER.invokeExact((Buffer) buffer);
692+
// MemorySegment.ofBuffer(buffer).address() includes the current position offset.
693+
// Netty/JNI GetDirectBufferAddress expects the base (index 0) address, so subtract position.
694+
return (long) MEMORY_SEGMENT_ADDRESS_OF_BUFFER.invokeExact((Buffer) buffer) - buffer.position();
693695
} catch (Throwable e) {
694696
LinkageError error = new LinkageError("Failed to call MemorySegment.ofBuffer(arg1).address()");
695697
error.initCause(e);
Collapse file

‎transport-native-unix-common/src/main/java/io/netty/channel/unix/Buffer.java‎

Copy file name to clipboardExpand all lines: transport-native-unix-common/src/main/java/io/netty/channel/unix/Buffer.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static CleanableDirectBuffer allocateDirectBufferWithNativeOrder(int capa
6262
*/
6363
public static long memoryAddress(ByteBuffer buffer) {
6464
assert buffer.isDirect();
65-
if (PlatformDependent.hasUnsafe()) {
65+
if (PlatformDependent.hasDirectByteBufferAddress(buffer)) {
6666
return PlatformDependent.directBufferAddress(buffer);
6767
}
6868
return memoryAddress0(buffer);

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.