From 2145e8c3ee9786eb00473797cd764a74f76d8add Mon Sep 17 00:00:00 2001 From: Vibhatha Lakmal Abeykoon Date: Mon, 26 Aug 2024 18:09:23 +0530 Subject: [PATCH] fix: adding ffm configs --- java/bom/pom.xml | 6 +- .../java/org/apache/arrow/memory/TestFFM.java | 79 ------------------- java/memory/memory-foreign/pom.xml | 30 +++++++ java/pom.xml | 58 +++++++++++++- 4 files changed, 88 insertions(+), 85 deletions(-) delete mode 100644 java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestFFM.java create mode 100644 java/memory/memory-foreign/pom.xml diff --git a/java/bom/pom.xml b/java/bom/pom.xml index ce05f25bc6c9e..b1b99e81b4196 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -81,9 +81,9 @@ under the License. 11 - 11 - 11 - 11 + 22 + 22 + 22 diff --git a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestFFM.java b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestFFM.java deleted file mode 100644 index 0cd207f2a6fb5..0000000000000 --- a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestFFM.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.arrow.memory; - -import java.lang.foreign.MemorySegment; -import java.nio.ByteBuffer; -import org.apache.arrow.memory.util.MemoryUtil; -import org.junit.jupiter.api.Test; - -public class TestFFM { - - @Test - public void testBufferCopyWithUnsafe() { - ByteBuffer srcBuffer = ByteBuffer.allocateDirect(10); - ByteBuffer destBuffer = ByteBuffer.allocateDirect(10); - - // Fill source buffer with data - for (int i = 0; i < 10; i++) { - srcBuffer.put((byte) i); - } - - // Flip the buffer to prepare for reading - srcBuffer.flip(); - - // Get the memory addresses of the buffers - long srcAddress = MemoryUtil.getByteBufferAddress(srcBuffer); - long destAddress = MemoryUtil.getByteBufferAddress(destBuffer); - - // Copy the data from the source buffer to the destination buffer - MemoryUtil.copyMemory(srcAddress, destAddress, 10); - // Verify the copy - destBuffer.flip(); - while (destBuffer.hasRemaining()) { - System.out.println(destBuffer.get()); - } - } - - @Test - public void testBufferCopyWithFFM() { - // Allocate two ByteBuffers - ByteBuffer srcBuffer = ByteBuffer.allocateDirect(10); - ByteBuffer destBuffer = ByteBuffer.allocateDirect(10); - - // Fill source buffer with data - for (int i = 0; i < 10; i++) { - srcBuffer.put((byte) i); - } - - // Flip the source buffer to prepare for reading - srcBuffer.flip(); - - // Wrap the ByteBuffers with MemorySegments - MemorySegment srcSegment = MemorySegment.ofBuffer(srcBuffer); - MemorySegment destSegment = MemorySegment.ofBuffer(destBuffer); - - // Copy memory from srcSegment to destSegment - srcSegment.copyFrom(destSegment.asSlice(0, 10)); - - // Verify the copy - destBuffer.flip(); - while (destBuffer.hasRemaining()) { - System.out.println(destBuffer.get()); - } - } -} diff --git a/java/memory/memory-foreign/pom.xml b/java/memory/memory-foreign/pom.xml new file mode 100644 index 0000000000000..ae38f89b555cd --- /dev/null +++ b/java/memory/memory-foreign/pom.xml @@ -0,0 +1,30 @@ + + + + + arrow-memory + org.apache.arrow + 15.0.0-SNAPSHOT + + 4.0.0 + + arrow-memory-foreign + Arrow Memory - Foreign + Allocator and utils for allocating memory in Arrow based on java.lang.foreign + + + + org.apache.arrow + arrow-memory-core + + + \ No newline at end of file diff --git a/java/pom.xml b/java/pom.xml index a73453df68fd2..644e40fd289dc 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -117,9 +117,9 @@ under the License. --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED 11 - 11 - 11 - 11 + 21 + 21 + 21 + jdk22 + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 22 + 22 + UTF-8 + + -XDcompilePolicy=simple + -Xplugin:ErrorProne -XepExcludedPaths:.*/(target/generated-sources)/.* + -J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED + + + + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + --add-opens=java.base/java.nio=ALL-UNNAMED + + Foreign + + + + + +