From b58671eed54d90d155883d19ae1c424b7c7c6266 Mon Sep 17 00:00:00 2001 From: Sven Guenther Date: Tue, 11 Sep 2018 14:06:50 +0200 Subject: [PATCH 1/2] Remove the usage of javah with the jdk8 the javah command is deprecated and is removed at least in the jdk10. The javac is now doing the work, the necessary changes are added to the pom.xml. To mark the parts which should be exposed into the header files, it is important to use the java native annotation @Native. Only the files which contains exposed information are generated. --- pom.xml | 6 ++++++ src/main/java/com/aparapi/Config.java | 3 +++ src/main/java/com/aparapi/Kernel.java | 2 ++ src/main/java/com/aparapi/Range.java | 3 +++ .../internal/opencl/OpenCLArgDescriptor.java | 17 +++++++++++++++++ .../com/aparapi/internal/opencl/OpenCLMem.java | 6 ++++++ 6 files changed, 37 insertions(+) diff --git a/pom.xml b/pom.xml index 0d285bf1..ac0d4bfc 100644 --- a/pom.xml +++ b/pom.xml @@ -111,6 +111,12 @@ org.apache.maven.plugins maven-compiler-plugin + + + -h + ../include/ + + net.alchim31.maven diff --git a/src/main/java/com/aparapi/Config.java b/src/main/java/com/aparapi/Config.java index cca378d2..c54833c0 100644 --- a/src/main/java/com/aparapi/Config.java +++ b/src/main/java/com/aparapi/Config.java @@ -58,6 +58,8 @@ to national security controls as identified on the Commerce Control List (curren import java.util.logging.*; +import java.lang.annotation.Native; + /** * A central location for holding all runtime configurable properties as well as logging configuration. * @@ -151,6 +153,7 @@ public class Config extends ConfigJNI{ public static final boolean enablePUTSTATIC = Boolean.getBoolean(propPkgName + ".enable.PUTSTATIC"); // Allow static array accesses + @Native public static final boolean enableGETSTATIC = true; //Boolean.getBoolean(propPkgName + ".enable.GETSTATIC"); public static final boolean enableINVOKEINTERFACE = Boolean.getBoolean(propPkgName + ".enable.INVOKEINTERFACE"); diff --git a/src/main/java/com/aparapi/Kernel.java b/src/main/java/com/aparapi/Kernel.java index dc96f2e1..a50ffb71 100644 --- a/src/main/java/com/aparapi/Kernel.java +++ b/src/main/java/com/aparapi/Kernel.java @@ -63,6 +63,7 @@ to national security controls as identified on the Commerce Control List (curren import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; +import java.lang.annotation.Native; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -1946,6 +1947,7 @@ protected double tan(double _d) { } private static final double LOG_2_RECIPROCAL = 1.0D / Math.log(2.0D); + @Native private static final double PI_RECIPROCAL = 1.0D / Math.PI; @OpenCLMapping(mapTo = "acospi") diff --git a/src/main/java/com/aparapi/Range.java b/src/main/java/com/aparapi/Range.java index 06561269..c67de846 100644 --- a/src/main/java/com/aparapi/Range.java +++ b/src/main/java/com/aparapi/Range.java @@ -19,6 +19,7 @@ import com.aparapi.internal.jni.*; import java.util.*; +import java.lang.annotation.Native; /** * @@ -64,8 +65,10 @@ */ public class Range extends RangeJNI{ + @Native public static final int THREADS_PER_CORE = 16; + @Native public static final int MAX_OPENCL_GROUP_SIZE = 256; public static final int MAX_GROUP_SIZE = Math.max(Runtime.getRuntime().availableProcessors() * THREADS_PER_CORE, diff --git a/src/main/java/com/aparapi/internal/opencl/OpenCLArgDescriptor.java b/src/main/java/com/aparapi/internal/opencl/OpenCLArgDescriptor.java index 713b48dd..d35348ed 100644 --- a/src/main/java/com/aparapi/internal/opencl/OpenCLArgDescriptor.java +++ b/src/main/java/com/aparapi/internal/opencl/OpenCLArgDescriptor.java @@ -18,36 +18,53 @@ */ package com.aparapi.internal.opencl; +import java.lang.annotation.Native; + public class OpenCLArgDescriptor{ + @Native public final static int ARG_BYTE_BIT = 1 << 0x000; + @Native public final static int ARG_SHORT_BIT = 1 << 0x001; + @Native public final static int ARG_INT_BIT = 1 << 0x002; + @Native public final static int ARG_FLOAT_BIT = 1 << 0x003; + @Native public final static int ARG_LONG_BIT = 1 << 0x004; + @Native public final static int ARG_DOUBLE_BIT = 1 << 0x005; + @Native public final static int ARG_ARRAY_BIT = 1 << 0x006; + @Native public final static int ARG_PRIMITIVE_BIT = 1 << 0x007; + @Native public final static int ARG_GLOBAL_BIT = 1 << 0x008; + @Native public final static int ARG_LOCAL_BIT = 1 << 0x009; + @Native public final static int ARG_CONST_BIT = 1 << 0x00A; + @Native public final static int ARG_READONLY_BIT = 1 << 0x00B; + @Native public final static int ARG_WRITEONLY_BIT = 1 << 0x00C; + @Native public final static int ARG_READWRITE_BIT = 1 << 0x00D; + @Native public final static int ARG_ISARG_BIT = 1 << 0x00E; public OpenCLMem memVal; diff --git a/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java b/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java index 19724223..5977a2ab 100644 --- a/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java +++ b/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java @@ -15,12 +15,18 @@ */ package com.aparapi.internal.opencl; +import java.lang.annotation.Native; + + public class OpenCLMem{ + @Native public final static int MEM_DIRTY_BIT = 1 << 0x00F; + @Native public final static int MEM_COPY_BIT = 1 << 0x010; + @Native public final static int MEM_ENQUEUED_BIT = 1 << 0x011; public long bits; // dirty, copy, enqueued From b79b68dbb6b3a2c826ffefe498a409dc281affde Mon Sep 17 00:00:00 2001 From: Sven Guenther Date: Thu, 13 Sep 2018 21:43:36 +0200 Subject: [PATCH 2/2] Update version and contributors --- CHANGELOG.md | 1 + CONTRIBUTORS.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d7540ca..1e53fc7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Aparapi Changelog ## v1.10.1 +* Fixed the header genaration for JDK8 and above. ## 1.10.0 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 7f4eef94..13c97b6b 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -24,6 +24,7 @@ * Toon Baeyens * Luis Mendes * Saurabh Rawat +* Sven Guenther # Details @@ -58,4 +59,4 @@ Below are some of the specific details of various contributions. * Luis Mendes submited PR to Fix Java execution mode to fail-fast when Kernel execution fails * Luis Mendes submited PR to Java execution mode now provides detailed backtraces of failed Kernel threads including passId, groupIds, globalIds and localIds * Saurabh Rawat contributed apache BCEL bytecode parsing and Scala support. -* Luis Mendes submited PR #139 to Fix arrays of AtomicInteger stored on local variables no longer fail with type cast exception - Partial fix for #138 \ No newline at end of file +* Luis Mendes submited PR #139 to Fix arrays of AtomicInteger stored on local variables no longer fail with type cast exception - Partial fix for #138