summaryrefslogtreecommitdiffstats
path: root/make/config/clImplCustomCode11.java
diff options
context:
space:
mode:
authorWade Walker <[email protected]>2015-09-19 15:20:23 -0500
committerWade Walker <[email protected]>2015-11-08 14:05:29 -0600
commit4638f4b3fdf4c946bda0b290a83652e4db00edea (patch)
tree7d027b893fbf1d55d578e2f156186075a092810c /make/config/clImplCustomCode11.java
parent9a90181ed1fb596275fee9ebca0f3d1093722ca9 (diff)
Factor out common custom C and Java code to reduce duplication
Consolidated C custom code so common functions are only defined once in the 1.1 version, then are called from the 1.2 and 2.0 version. Pulled common code in CLImpl up into the autogenerated implementation class and removed the hand-written implementation (since it was left empty). Factored custom Java code out so there was as little duplication as possible across the three CLImpl versions, with common code for all three versions in clImplCustomCode.java.
Diffstat (limited to 'make/config/clImplCustomCode11.java')
-rw-r--r--make/config/clImplCustomCode11.java55
1 files changed, 3 insertions, 52 deletions
diff --git a/make/config/clImplCustomCode11.java b/make/config/clImplCustomCode11.java
index 0dcb770f..bc1cfdda 100644
--- a/make/config/clImplCustomCode11.java
+++ b/make/config/clImplCustomCode11.java
@@ -1,60 +1,11 @@
-
- /** If null, OpenCL is not available on this machine. */
- static final DynamicLibraryBundle dynamicLookupHelper;
protected static final CLProcAddressTable11 addressTable;
static {
addressTable = new CLProcAddressTable11();
- dynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DynamicLibraryBundle>() {
- public DynamicLibraryBundle run() {
- final DynamicLibraryBundle bundle = new DynamicLibraryBundle(new CLDynamicLibraryBundleInfo());
- if(!bundle.isToolLibLoaded()) {
- // couldn't load native CL library
- // TODO: log this?
- return null;
- }
- if(!bundle.isLibComplete()) {
- System.err.println("Couln't load native CL/JNI glue library");
- return null;
- }
- addressTable.reset(bundle);
- /** Not required nor forced
- if( !initializeImpl() ) {
- System.err.println("Native initialization failure of CL/JNI glue library");
- return null;
- } */
- return bundle;
- } } );
- }
-
- /**
- * Accessor.
- * @returns true if OpenCL is available on this machine.
- */
- public static boolean isAvailable() { return dynamicLookupHelper != null; }
- public static CLProcAddressTable11 getCLProcAddressTable() { return addressTable; }
-
- static long clGetExtensionFunctionAddress(long clGetExtensionFunctionAddressHandle, java.lang.String procname)
- {
- if (clGetExtensionFunctionAddressHandle == 0) {
- throw new RuntimeException("Passed null pointer for method \"clGetExtensionFunctionAddress\"");
- }
- return dispatch_clGetExtensionFunctionAddressStatic(procname, clGetExtensionFunctionAddressHandle);
}
- public CLAbstractImpl11() {
- }
-
- /** Entry point (through function pointer) to C language function: <br> <code> void* clGetExtensionFunctionAddress(const char * fname); </code> */
- long clGetExtensionFunctionAddress(String fname) {
+ public static CLProcAddressTable11 getAddressTable() { return addressTable; }
- final long __addr_ = addressTable._addressof_clGetExtensionFunctionAddress;
- if (__addr_ == 0) {
- throw new UnsupportedOperationException("Method \"clGetExtensionFunctionAddress\" not available");
- }
- return dispatch_clGetExtensionFunctionAddressStatic(fname, __addr_);
+ public CLImpl11() {
+ init();
}
-
- /** Entry point (through function pointer) to C language function: <br> <code> void* clGetExtensionFunctionAddress(const char * fname); </code> */
- private static native long dispatch_clGetExtensionFunctionAddressStatic(String fname, long procAddress);
-