From b5e03b2f22b6b448fc424e508bc14cf78f8d02f7 Mon Sep 17 00:00:00 2001 From: Gary Frost <frost.gary@gmail.com> Date: Mon, 28 Nov 2011 23:34:26 +0000 Subject: [PATCH] Patch to support char type (mapping to unsigned int in OpenCL) provided by Ryan. Fix for issue #3 --- .../com/amd/aparapi/ClassParseException.java | 16 +- .../java/com/amd/aparapi/KernelRunner.java | 245 ++++++++++-------- .../java/com/amd/aparapi/KernelWriter.java | 98 +++---- .../src/java/com/amd/aparapi/MethodModel.java | 74 ++---- 4 files changed, 229 insertions(+), 204 deletions(-) diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/ClassParseException.java b/com.amd.aparapi/src/java/com/amd/aparapi/ClassParseException.java index 68f76233..7d175346 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/ClassParseException.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/ClassParseException.java @@ -56,9 +56,7 @@ package com.amd.aparapi; ATHROW("We don't support athrow instructions"), // SYNCHRONIZE("We don't support monitorenter or monitorexit instructions"), // NEW("We don't support new instructions"), // - CHARARRAY("We don't support java char array accesses"), // ARRAYALIAS("We don't support copying refs in kernels"), // - ACCESSTOCHARFIELD("We don't support java char type"), // SWITCH("We don't support lookupswitch or tableswitch instructions"), // METHODARRAYARG("We don't support passing arrays as method args"), // RECURSION("We don't support recursion"), // @@ -67,10 +65,9 @@ package com.amd.aparapi; BADGETTERTYPEMISMATCH("Getter return type does not match field var type"), // BADGETTERNAMEMISMATCH("Getter name does not match fiels name"), // BADGETTERNAMENOTFOUND("Getter not found"), // - BADSETTERTYPEMISMATCH("Setter arg type does not match field var type"), // + BADSETTERTYPEMISMATCH("Setter arg type does not match field var type"), // EXCEPTION("We don't support catch blocks"), // ARRAYLOCALVARIABLE("Found an array local variable which assumes that we will alias a field array"), // - CHARLOCALVARIABLE("Found a char local variable"), // CONFUSINGBRANCHESPOSSIBLYCONTINUE("we don't support continue"), // CONFUSINGBRANCHESPOSSIBLYBREAK("we don't support break"), // OBJECTFIELDREFERENCE("Using java objects inside kernels is not supported"), // @@ -83,9 +80,10 @@ package com.amd.aparapi; ACCESSEDOBJECTSETTERARRAY("Passing array arguments to Intrinsics in expression form is not supported"), // MULTIDIMENSIONARRAYASSIGN("Can't assign to two dimension array"), // MULTIDIMENSIONARRAYACCESS("Can't access through a two dimensional array"); + private String description; - TYPE(String _description) { + TYPE(final String _description) { description = _description; } @@ -98,19 +96,19 @@ package com.amd.aparapi; TYPE type; - ClassParseException(TYPE _type) { + ClassParseException(final TYPE _type) { super(_type.getDescription()); type = _type; instruction = null; } - ClassParseException(Instruction _instruction, TYPE _type) { + ClassParseException(final Instruction _instruction, final TYPE _type) { super("@" + _instruction.getThisPC() + " " + _instruction.getByteCode() + " " + _type.getDescription()); type = _type; instruction = _instruction; } - ClassParseException(TYPE _type, String _methodName) { + ClassParseException(final TYPE _type, final String _methodName) { super("@" + _methodName + " " + _type.getDescription()); type = _type; instruction = null; @@ -124,7 +122,7 @@ package com.amd.aparapi; return (type); } - ClassParseException(Throwable _t) { + ClassParseException(final Throwable _t) { super(_t); } } diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/KernelRunner.java b/com.amd.aparapi/src/java/com/amd/aparapi/KernelRunner.java index 778171b0..87e7de46 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/KernelRunner.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/KernelRunner.java @@ -77,9 +77,9 @@ class KernelRunner{ private static Logger logger = Logger.getLogger(Config.getLoggerName()); /** - * This 'bit' indicates that a particular <code>KernelArg</code> represents a <code>boolean</code> type (array or primitive). + * This 'bit' indicates that a particular <code>KernelArg</code> represents a <code>boolean</code> type (array or primitive). + * * - * * @see com.amd.aparapi.annotations.UsedByJNICode * @see com.amd.aparapi.KernelRunner.KernelArg * @@ -88,9 +88,9 @@ class KernelRunner{ @UsedByJNICode public static final int ARG_BOOLEAN = 1 << 0; /** - * This 'bit' indicates that a particular <code>KernelArg</code> represents a <code>byte</code> type (array or primitive). + * This 'bit' indicates that a particular <code>KernelArg</code> represents a <code>byte</code> type (array or primitive). + * * - * * @see com.amd.aparapi.annotations.UsedByJNICode * @see com.amd.aparapi.KernelRunner.KernelArg * @@ -99,9 +99,9 @@ class KernelRunner{ @UsedByJNICode public static final int ARG_BYTE = 1 << 1; /** - * This 'bit' indicates that a particular <code>KernelArg</code> represents a <code>float</code> type (array or primitive). + * This 'bit' indicates that a particular <code>KernelArg</code> represents a <code>float</code> type (array or primitive). + * * - * * @see com.amd.aparapi.annotations.UsedByJNICode * @see com.amd.aparapi.KernelRunner.KernelArg * @@ -110,9 +110,9 @@ class KernelRunner{ @UsedByJNICode public static final int ARG_FLOAT = 1 << 2; /** - * This 'bit' indicates that a particular <code>KernelArg</code> represents a <code>int</code> type (array or primitive). + * This 'bit' indicates that a particular <code>KernelArg</code> represents a <code>int</code> type (array or primitive). + * * - * * @see com.amd.aparapi.annotations.UsedByJNICode * @see com.amd.aparapi.KernelRunner.KernelArg * @@ -121,9 +121,9 @@ class KernelRunner{ @UsedByJNICode public static final int ARG_INT = 1 << 3; /** - * This 'bit' indicates that a particular <code>KernelArg</code> represents a <code>double</code> type (array or primitive). + * This 'bit' indicates that a particular <code>KernelArg</code> represents a <code>double</code> type (array or primitive). + * * - * * @see com.amd.aparapi.annotations.UsedByJNICode * @see com.amd.aparapi.KernelRunner.KernelArg * @@ -132,9 +132,9 @@ class KernelRunner{ @UsedByJNICode public static final int ARG_DOUBLE = 1 << 4; /** - * This 'bit' indicates that a particular <code>KernelArg</code> represents a <code>long</code> type (array or primitive). + * This 'bit' indicates that a particular <code>KernelArg</code> represents a <code>long</code> type (array or primitive). + * * - * * @see com.amd.aparapi.annotations.UsedByJNICode * @see com.amd.aparapi.KernelRunner.KernelArg * @@ -154,9 +154,9 @@ class KernelRunner{ /** * This 'bit' indicates that a particular <code>KernelArg</code> represents an array.<br/> - * So <code>ARG_ARRAY|ARG_INT</code> tells us this arg is an array of <code>int</code>. + * So <code>ARG_ARRAY|ARG_INT</code> tells us this arg is an array of <code>int</code>. + * * - * * @see com.amd.aparapi.annotations.UsedByJNICode * @see com.amd.aparapi.KernelRunner.KernelArg * @@ -166,9 +166,9 @@ class KernelRunner{ /** * This 'bit' indicates that a particular <code>KernelArg</code> represents a primitive (non array).<br/> - * So <code>ARG_PRIMITIVE|ARG_INT</code> tells us this arg is a primitive <code>int</code>. + * So <code>ARG_PRIMITIVE|ARG_INT</code> tells us this arg is a primitive <code>int</code>. + * * - * * @see com.amd.aparapi.annotations.UsedByJNICode * @see com.amd.aparapi.KernelRunner.KernelArg * @@ -178,9 +178,9 @@ class KernelRunner{ /** * This 'bit' indicates that a particular <code>KernelArg</code> is read by the Kernel (note from the Kernel's point of view).<br/> - * So <code>ARG_ARRAY|ARG_INT|ARG_READ</code> tells us this arg is an array of int's that are read by the kernel. + * So <code>ARG_ARRAY|ARG_INT|ARG_READ</code> tells us this arg is an array of int's that are read by the kernel. + * * - * * @see com.amd.aparapi.annotations.UsedByJNICode * @see com.amd.aparapi.KernelRunner.KernelArg * @@ -190,9 +190,9 @@ class KernelRunner{ /** * This 'bit' indicates that a particular <code>KernelArg</code> is mutated by the Kernel (note from the Kernel's point of view).<br/> - * So <code>ARG_ARRAY|ARG_INT|ARG_WRITE</code> tells us this arg is an array of int's that we expect the kernel to mutate. + * So <code>ARG_ARRAY|ARG_INT|ARG_WRITE</code> tells us this arg is an array of int's that we expect the kernel to mutate. + * * - * * @see com.amd.aparapi.annotations.UsedByJNICode * @see com.amd.aparapi.KernelRunner.KernelArg * @@ -203,7 +203,7 @@ class KernelRunner{ /** * This 'bit' indicates that a particular <code>KernelArg</code> resides in local memory in the generated OpenCL code.<br/> * - * + * * @see com.amd.aparapi.annotations.UsedByJNICode * @see com.amd.aparapi.annotations.Experimental * @see com.amd.aparapi.KernelRunner.KernelArg @@ -215,7 +215,7 @@ class KernelRunner{ /** * This 'bit' indicates that a particular <code>KernelArg</code> resides in global memory in the generated OpenCL code.<br/> * - * + * * @see com.amd.aparapi.annotations.UsedByJNICode * @see com.amd.aparapi.annotations.Experimental * @see com.amd.aparapi.KernelRunner.KernelArg @@ -307,6 +307,17 @@ class KernelRunner{ */ @UsedByJNICode public static final int ARG_APARAPI_BUF_IS_DIRECT = 1 << 20; + /** + * This 'bit' indicates that a particular <code>KernelArg</code> represents a <code>char</code> type (array or primitive). + * + * + * @see com.amd.aparapi.annotations.UsedByJNICode + * @see com.amd.aparapi.KernelRunner.KernelArg + * + * @author rlamothe + */ + @UsedByJNICode public static final int ARG_CHAR = 1 << 21; + static final String CL_KHR_FP64 = "cl_khr_fp64"; static final String CL_AMD_FP64 = "cl_amd_fp64"; @@ -334,9 +345,9 @@ class KernelRunner{ static final String CL_KHR_GL_SHARING = "cl_khr_gl_sharing"; /** - * This 'bit' indicates that we wish to enable profiling from the JNI code. + * This 'bit' indicates that we wish to enable profiling from the JNI code. + * * - * * @see com.amd.aparapi.annotations.UsedByJNICode * * @author gfrost @@ -344,12 +355,12 @@ class KernelRunner{ @UsedByJNICode public static final int JNI_FLAG_ENABLE_PROFILING = 1 << 0; /** - * This 'bit' indicates that we want to execute on the GPU. + * This 'bit' indicates that we want to execute on the GPU. + * * - * * Be careful changing final constants starting with JNI.<br/> * - * + * * @see com.amd.aparapi.annotations.UsedByJNICode * * @author gfrost @@ -368,40 +379,41 @@ class KernelRunner{ @UsedByJNICode @Annotations.Experimental public static final int JNI_FLAG_ENABLE_VERBOSE_JNI = 1 << 2; /** - * Each field (or captured field in the case of an anonymous inner class) referenced by any bytecode rechable from the users Kernel.run(), will + * Each field (or captured field in the case of an anonymous inner class) referenced by any bytecode reachable from the users Kernel.run(), will * need to be represented as a <code>KernelArg</code>. - * + * * @see com.amd.aparapi.Kernel#execute(int _globalSize) * * @author gfrost - * + * */ static class KernelArg{ /** - * The type of this KernelArg. Created by oring appropriate flags + * The type of this KernelArg. Created by oring appropriate flags * - * @see ARG_BOOLEAN - * @see ARG_BYTE - * @see ARG_FLOAT - * @see ARG_INT - * @see ARG_DOUBLE - * @see ARG_LONG - * @see ARG_SHORT - * @see ARG_ARRAY - * @see ARG_PRIMITIVE - * @see ARG_READ + * @see ARG_BOOLEAN + * @see ARG_BYTE + * @see ARG_CHAR + * @see ARG_FLOAT + * @see ARG_INT + * @see ARG_DOUBLE + * @see ARG_LONG + * @see ARG_SHORT + * @see ARG_ARRAY + * @see ARG_PRIMITIVE + * @see ARG_READ * @see ARG_WRITE - * @see ARG_LOCAL - * @see ARG_GLOBAL - * @see ARG_CONSTANT - * @see ARG_ARRAYLENGTH - * @see ARG_APARAPI_BUF - * @see ARG_EXPLICIT - * @see ARG_EXPLICIT_WRITE - * @see ARG_OBJ_ARRAY_STRUCT - * @see ARG_APARAPI_BUF_HAS_ARRAY - * @see ARG_APARAPI_BUF_IS_DIRECT + * @see ARG_LOCAL + * @see ARG_GLOBAL + * @see ARG_CONSTANT + * @see ARG_ARRAYLENGTH + * @see ARG_APARAPI_BUF + * @see ARG_EXPLICIT + * @see ARG_EXPLICIT_WRITE + * @see ARG_OBJ_ARRAY_STRUCT + * @see ARG_APARAPI_BUF_HAS_ARRAY + * @see ARG_APARAPI_BUF_IS_DIRECT */ @UsedByJNICode public int type; @@ -443,18 +455,17 @@ class KernelRunner{ @UsedByJNICode public Object array; /** - * Field in Kernel class corresponding to this arg + * Field in Kernel class corresponding to this arg */ @UsedByJNICode public Field field; /** - * The byte array for obj conversion passed to opencl + * The byte array for obj conversion passed to opencl */ byte[] objArrayBuffer; /** - * The ByteBuffer fronting the byte array - + * The ByteBuffer fronting the byte array */ ByteBuffer objArrayByteBuffer; @@ -485,7 +496,8 @@ class KernelRunner{ private int argc; /** - * Create a KernelRunner for a specific Kernel instance. + * Create a KernelRunner for a specific Kernel instance. + * * @param _kernel */ KernelRunner(Kernel _kernel) { @@ -505,11 +517,11 @@ class KernelRunner{ } /** - * TODO: - * - * synchronized to avoid race in clGetPlatformIDs() in OpenCL lib problem should fixed in some future OpenCL version - * - * @param _kernel + * TODO: + * + * synchronized to avoid race in clGetPlatformIDs() in OpenCL lib problem should fixed in some future OpenCL version + * + * @param _kernel * @param _flags * @param numProcessors * @param maxJTPLocalSize @@ -540,75 +552,86 @@ class KernelRunner{ private long executionTime = 0; boolean hasFP64Support() { - if (capabilitiesSet == null) + if (capabilitiesSet == null) { throw new IllegalStateException("Capabilities queried before they were initialized"); + } return (capabilitiesSet.contains(CL_KHR_FP64) || capabilitiesSet.contains(CL_AMD_FP64)); } boolean hasSelectFPRoundingModeSupport() { - if (capabilitiesSet == null) + if (capabilitiesSet == null) { throw new IllegalStateException("Capabilities queried before they were initialized"); - + } return capabilitiesSet.contains(CL_KHR_SELECT_FPROUNDING_MODE); } boolean hasGlobalInt32BaseAtomicsSupport() { - if (capabilitiesSet == null) + if (capabilitiesSet == null) { throw new IllegalStateException("Capabilities queried before they were initialized"); + } return capabilitiesSet.contains(CL_KHR_GLOBAL_INT32_BASE_ATOMICS); } boolean hasGlobalInt32ExtendedAtomicsSupport() { - if (capabilitiesSet == null) + if (capabilitiesSet == null) { throw new IllegalStateException("Capabilities queried before they were initialized"); + } return capabilitiesSet.contains(CL_KHR_GLOBAL_INT32_EXTENDED_ATOMICS); } boolean hasLocalInt32BaseAtomicsSupport() { - if (capabilitiesSet == null) + if (capabilitiesSet == null) { throw new IllegalStateException("Capabilities queried before they were initialized"); + } return capabilitiesSet.contains(CL_KHR_LOCAL_INT32_BASE_ATOMICS); } boolean hasLocalInt32ExtendedAtomicsSupport() { - if (capabilitiesSet == null) + if (capabilitiesSet == null) { throw new IllegalStateException("Capabilities queried before they were initialized"); + } return capabilitiesSet.contains(CL_KHR_LOCAL_INT32_EXTENDED_ATOMICS); } boolean hasInt64BaseAtomicsSupport() { - if (capabilitiesSet == null) + if (capabilitiesSet == null) { throw new IllegalStateException("Capabilities queried before they were initialized"); + } return capabilitiesSet.contains(CL_KHR_INT64_BASE_ATOMICS); } boolean hasInt64ExtendedAtomicsSupport() { - if (capabilitiesSet == null) + if (capabilitiesSet == null) { throw new IllegalStateException("Capabilities queried before they were initialized"); + } return capabilitiesSet.contains(CL_KHR_INT64_EXTENDED_ATOMICS); } boolean has3DImageWritesSupport() { - if (capabilitiesSet == null) + if (capabilitiesSet == null) { throw new IllegalStateException("Capabilities queried before they were initialized"); + } return capabilitiesSet.contains(CL_KHR_3D_IMAGE_WRITES); } boolean hasByteAddressableStoreSupport() { - if (capabilitiesSet == null) + if (capabilitiesSet == null) { throw new IllegalStateException("Capabilities queried before they were initialized"); + } return capabilitiesSet.contains(CL_KHR_BYTE_ADDRESSABLE_SUPPORT); } boolean hasFP16Support() { - if (capabilitiesSet == null) + if (capabilitiesSet == null) { throw new IllegalStateException("Capabilities queried before they were initialized"); + } return capabilitiesSet.contains(CL_KHR_FP16); } boolean hasGLSharingSupport() { - if (capabilitiesSet == null) + if (capabilitiesSet == null) { throw new IllegalStateException("Capabilities queried before they were initialized"); + } return capabilitiesSet.contains(CL_KHR_GL_SHARING); } @@ -623,7 +646,8 @@ class KernelRunner{ /** * We need to match OpenCL's algorithm for localsize. * - * @param _globalSize The globalsize requested by the user (via <code>Kernel.execute(globalSize)</code>) + * @param _globalSize + * The globalsize requested by the user (via <code>Kernel.execute(globalSize)</code>) * @return The value we use for JTP execution for localSize */ private static int getJTPLocalSizeForGlobalSize(int _globalSize) { @@ -640,9 +664,12 @@ class KernelRunner{ } /** - * Execute using a Java thread pool. Either because we were explicitly asked to do so, or because we 'fall back' after discovering an OpenCL issue. - * @param _globalSize The globalSize requested by the user (via <code>Kernel.execute(globalSize)</code>) - * @param _passes The # of passes requested by the user (via <code>Kernel.execute(globalSize, passes)</code>). Note this is usually defaulted to 1 via <code>Kernel.execute(globalSize)</code>. + * Execute using a Java thread pool. Either because we were explicitly asked to do so, or because we 'fall back' after discovering an OpenCL issue. + * + * @param _globalSize + * The globalSize requested by the user (via <code>Kernel.execute(globalSize)</code>) + * @param _passes + * The # of passes requested by the user (via <code>Kernel.execute(globalSize, passes)</code>). Note this is usually defaulted to 1 via <code>Kernel.execute(globalSize)</code>. * @return */ private long executeJava(final int _globalSize, final int _passes) { @@ -670,13 +697,13 @@ class KernelRunner{ } else { // note uses of final so we can use in anonymous inner class final int localSize = getJTPLocalSizeForGlobalSize(_globalSize); - // if (localSize == 0) return 0; // should never happen + // if (localSize == 0) return 0; // should never happen final int numGroups = _globalSize / localSize; // compute numThreadSets by multiplying localSize until bigger than numCores final int numThreadSets = localSize >= numCores ? 1 : (numCores + (localSize - 1)) / localSize; final int numThreads = numThreadSets * localSize; - // when dividing to get groupsPerThreadSet, round up + // when dividing to get groupsPerThreadSet, round up final int groupsPerThreadSet = (numGroups + (numThreadSets - 1)) / numThreadSets; if (logger.isLoggable(Level.FINE)) { logger.fine("executeJava: localSize=" + localSize + ", numThreads=" + numThreads + ", numThreadSets=" + numThreadSets @@ -713,8 +740,8 @@ class KernelRunner{ int globalId = (groupId * localSize) + localId; worker.setGroupId(groupId); worker.setGlobalId(globalId); - // System.out.println("running worker with gid=" + globalId + ", lid=" + localId - // + ", groupId=" + groupId + ", threadId=" + threadId); + // System.out.println("running worker with gid=" + globalId + ", lid=" + localId + // + ", groupId=" + groupId + ", threadId=" + threadId); worker.run(); } try { @@ -796,13 +823,13 @@ class KernelRunner{ throw new AparapiException(e); } - assert newRef != null && objArraySize != 0 : "no data"; + assert (newRef != null) && (objArraySize != 0) : "no data"; int totalStructSize = c.getTotalStructSize(); int totalBufferSize = objArraySize * totalStructSize; // allocate ByteBuffer if first time or array changed - if (arg.objArrayBuffer == null || newRef != arg.array) { + if ((arg.objArrayBuffer == null) || (newRef != arg.array)) { ByteBuffer structBuffer = ByteBuffer.allocate(totalBufferSize); arg.objArrayByteBuffer = structBuffer.order(ByteOrder.LITTLE_ENDIAN); arg.objArrayBuffer = arg.objArrayByteBuffer.array(); @@ -917,8 +944,8 @@ class KernelRunner{ assert objArraySize > 0 : "should be > 0"; int totalStructSize = c.getTotalStructSize(); - //int totalBufferSize = objArraySize * totalStructSize; - //assert arg.objArrayBuffer.length == totalBufferSize : "size should match"; + // int totalBufferSize = objArraySize * totalStructSize; + // assert arg.objArrayBuffer.length == totalBufferSize : "size should match"; arg.objArrayByteBuffer.rewind(); @@ -1035,7 +1062,7 @@ class KernelRunner{ arg.numElements = Array.getLength(newArrayRef); arg.sizeInBytes = arg.numElements * arg.primitiveSize; - if ((args[i].type & ARG_EXPLICIT) != 0 && puts.contains(newArrayRef)) { + if (((args[i].type & ARG_EXPLICIT) != 0) && puts.contains(newArrayRef)) { args[i].type |= ARG_EXPLICIT_WRITE; // System.out.println("detected an explicit write " + args[i].name); puts.remove(newArrayRef); @@ -1148,14 +1175,14 @@ class KernelRunner{ return warnFallBackAndExecute(_entrypointName, _globalSize, _passes, exception); } - if (entryPoint != null && !entryPoint.shouldFallback()) { + if ((entryPoint != null) && !entryPoint.shouldFallback()) { int jniFlags = 0; jniFlags |= (Config.enableProfiling ? JNI_FLAG_ENABLE_PROFILING : 0); jniFlags |= (Config.enableVerboseJNI ? JNI_FLAG_ENABLE_VERBOSE_JNI : 0); jniFlags |= (kernel.getExecutionMode().equals(EXECUTION_MODE.GPU) ? JNI_FLAG_USE_GPU : 0); - // Init the device to check capabilities before emitting the + // Init the device to check capabilities before emitting the // code that requires the capabilities. jniContextHandle = initJNI(kernel, jniFlags, Runtime.getRuntime().availableProcessors(), getMaxJTPLocalSize()); if (jniContextHandle == 0) { @@ -1228,7 +1255,7 @@ class KernelRunner{ args[i] = new KernelArg(); args[i].name = field.getName(); args[i].field = field; - args[i].isStatic = (field.getModifiers() & Modifier.STATIC) == Modifier.STATIC; + args[i].isStatic = (field.getModifiers() & Modifier.STATIC) == Modifier.STATIC; Class<?> type = field.getType(); if (type.isArray()) { @@ -1251,6 +1278,8 @@ class KernelRunner{ args[i].type |= type.isAssignableFrom(byte[].class) ? ARG_BYTE : 0; + args[i].type |= type.isAssignableFrom(char[].class) ? ARG_CHAR : 0; + args[i].type |= type.isAssignableFrom(double[].class) ? ARG_DOUBLE : 0; args[i].type |= type.isAssignableFrom(long[].class) ? ARG_LONG : 0; @@ -1287,6 +1316,9 @@ class KernelRunner{ } else if (type.isAssignableFrom(byte.class)) { args[i].type |= ARG_PRIMITIVE; args[i].type |= ARG_BYTE; + } else if (type.isAssignableFrom(char.class)) { + args[i].type |= ARG_PRIMITIVE; + args[i].type |= ARG_CHAR; } else if (type.isAssignableFrom(short.class)) { args[i].type |= ARG_PRIMITIVE; args[i].type |= ARG_SHORT; @@ -1295,10 +1327,11 @@ class KernelRunner{ } catch (IllegalArgumentException e) { e.printStackTrace(); } + args[i].primitiveSize = ((args[i].type & ARG_FLOAT) != 0 ? 4 : (args[i].type & ARG_INT) != 0 ? 4 - : (args[i].type & ARG_BYTE) != 0 ? 1 : (args[i].type & ARG_BOOLEAN) != 0 ? 1 - : (args[i].type & ARG_SHORT) != 0 ? 2 : (args[i].type & ARG_LONG) != 0 ? 8 - : (args[i].type & ARG_DOUBLE) != 0 ? 8 : 0); + : (args[i].type & ARG_BYTE) != 0 ? 1 : (args[i].type & ARG_CHAR) != 0 ? 2 + : (args[i].type & ARG_BOOLEAN) != 0 ? 1 : (args[i].type & ARG_SHORT) != 0 ? 2 + : (args[i].type & ARG_LONG) != 0 ? 8 : (args[i].type & ARG_DOUBLE) != 0 ? 8 : 0); if (logger.isLoggable(Level.FINE)) { logger.fine("arg " + i + ", " + args[i].name + ", type=" + Integer.toHexString(args[i].type) @@ -1353,13 +1386,14 @@ class KernelRunner{ private native int getJNI(long _jniContextHandle, Object _array); /** - * Enqueue a request to return this array from the GPU. This method blocks until the array is available. + * Enqueue a request to return this array from the GPU. This method blocks until the array is available. * <br/> - * Note that <code>Kernel.put(type [])</code> calls will delegate to this call. + * Note that <code>Kernel.put(type [])</code> calls will delegate to this call. * <br/> * Package protected - * - * @param array It is assumed that this parameter is indeed an array (of in, float, short etc). + * + * @param array + * It is assumed that this parameter is indeed an array (of int, float, short etc). * * @see Kernel#get(int[] arr) * @see Kernel#get(short[] arr) @@ -1369,19 +1403,19 @@ class KernelRunner{ */ protected void get(Object array) { if (explicit - && (kernel.getExecutionMode() == Kernel.EXECUTION_MODE.GPU || kernel.getExecutionMode() == Kernel.EXECUTION_MODE.CPU)) { + && ((kernel.getExecutionMode() == Kernel.EXECUTION_MODE.GPU) || (kernel.getExecutionMode() == Kernel.EXECUTION_MODE.CPU))) { // Only makes sense when we are using OpenCL getJNI(jniContextHandle, array); } } /** - * Tag this array so that it is explicitly enqueued before the kernel is executed. - * <br/> - * Note that <code>Kernel.put(type [])</code> calls will delegate to this call. - * <br/> + * Tag this array so that it is explicitly enqueued before the kernel is executed. <br/> + * Note that <code>Kernel.put(type [])</code> calls will delegate to this call. <br/> * Package protected - * @param array It is assumed that this parameter is indeed an array (of in, float, short etc). + * + * @param array + * It is assumed that this parameter is indeed an array (of int, float, short etc). * @see Kernel#put(int[] arr) * @see Kernel#put(short[] arr) * @see Kernel#put(float[] arr) @@ -1391,7 +1425,7 @@ class KernelRunner{ protected void put(Object array) { if (explicit - && (kernel.getExecutionMode() == Kernel.EXECUTION_MODE.GPU || kernel.getExecutionMode() == Kernel.EXECUTION_MODE.CPU)) { + && ((kernel.getExecutionMode() == Kernel.EXECUTION_MODE.GPU) || (kernel.getExecutionMode() == Kernel.EXECUTION_MODE.CPU))) { // Only makes sense when we are using OpenCL puts.add(array); } @@ -1409,6 +1443,7 @@ class KernelRunner{ /** * Determine the time taken to convert bytecode to OpenCL for first Kernel.execute(range) call. + * * @return The time spent preparing the kernel for execution using GPU * */ @@ -1418,6 +1453,7 @@ class KernelRunner{ /** * Determine the execution time of the previous Kernel.execute(range) call. + * * @return The time spent executing the kernel (ms) * */ @@ -1427,6 +1463,7 @@ class KernelRunner{ /** * Determine the accumulated execution time of all previous Kernel.execute(range) calls. + * * @return The accumulated time spent executing this kernel (ms) * */ diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/KernelWriter.java b/com.amd.aparapi/src/java/com/amd/aparapi/KernelWriter.java index 9751d145..7a1886bb 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/KernelWriter.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/KernelWriter.java @@ -34,7 +34,7 @@ to national security controls as identified on the Commerce Control List (curren of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry and Security's website at http://www.bis.doc.gov/. -*/ + */ package com.amd.aparapi; import java.util.ArrayList; @@ -43,10 +43,10 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import com.amd.aparapi.ClassModel.ClassModelField; import com.amd.aparapi.ClassModel.AttributePool.LocalVariableTableEntry; -import com.amd.aparapi.ClassModel.AttributePool.RuntimeAnnotationsEntry; import com.amd.aparapi.ClassModel.AttributePool.LocalVariableTableEntry.LocalVariableInfo; +import com.amd.aparapi.ClassModel.AttributePool.RuntimeAnnotationsEntry; +import com.amd.aparapi.ClassModel.ClassModelField; import com.amd.aparapi.ClassModel.ConstantPool.FieldEntry; import com.amd.aparapi.ClassModel.ConstantPool.MethodEntry; import com.amd.aparapi.InstructionSet.AccessArrayElement; @@ -72,6 +72,10 @@ abstract class KernelWriter extends BlockWriter{ final String cvtByteArrayToCharStar = "char* "; + final String cvtCharToShort = "unsigned short "; + + final String cvtCharArrayToShortStar = "unsigned short* "; + final String cvtIntArrayToIntStar = "int* "; final String cvtFloatArrayToFloatStar = "float* "; @@ -102,10 +106,12 @@ abstract class KernelWriter extends BlockWriter{ /** * These three convert functions are here to perform - * any type conversion that may be required between + * any type conversion that may be required between * Java and OpenCL. - * @param _typeDesc String in the Java JNI notation, [I, etc - * @return Suitably converted string, "char*", etc + * + * @param _typeDesc + * String in the Java JNI notation, [I, etc + * @return Suitably converted string, "char*", etc */ @Override protected String convertType(String _typeDesc, boolean useClassModel) { if (_typeDesc.equals("Z") || _typeDesc.equals("boolean")) { @@ -116,6 +122,10 @@ abstract class KernelWriter extends BlockWriter{ return (cvtByteToChar); } else if (_typeDesc.equals("[B") || _typeDesc.equals("byte[]")) { return (cvtByteArrayToCharStar); + } else if (_typeDesc.equals("C") || _typeDesc.equals("char")) { + return (cvtCharToShort); + } else if (_typeDesc.equals("[C") || _typeDesc.equals("char[]")) { + return (cvtCharArrayToShortStar); } else if (_typeDesc.equals("[I") || _typeDesc.equals("int[]")) { return (cvtIntArrayToIntStar); } else if (_typeDesc.equals("[F") || _typeDesc.equals("float[]")) { @@ -148,8 +158,8 @@ abstract class KernelWriter extends BlockWriter{ String barrierAndGetterMappings = javaToCLIdentifierMap.get(methodName + methodSignature); if (barrierAndGetterMappings != null) { - //this is one of the OpenCL barrier or size getter methods - //write the mapping and exit + // this is one of the OpenCL barrier or size getter methods + // write the mapping and exit write(barrierAndGetterMappings); } else { @@ -175,7 +185,7 @@ abstract class KernelWriter extends BlockWriter{ write("("); - if (intrinsicMapping == null && _methodCall instanceof VirtualMethodCall && (!isIntrinsic)) { + if ((intrinsicMapping == null) && (_methodCall instanceof VirtualMethodCall) && (!isIntrinsic)) { Instruction i = ((VirtualMethodCall) _methodCall).getInstanceReference(); @@ -196,7 +206,7 @@ abstract class KernelWriter extends BlockWriter{ } } for (int arg = 0; arg < argc; arg++) { - if (intrinsicMapping == null && _methodCall instanceof VirtualMethodCall && (!isIntrinsic) || arg != 0) { + if (((intrinsicMapping == null) && (_methodCall instanceof VirtualMethodCall) && (!isIntrinsic)) || (arg != 0)) { write(", "); } writeInstruction(_methodCall.getArg(arg)); @@ -215,13 +225,13 @@ abstract class KernelWriter extends BlockWriter{ List<String> argLines = new ArrayList<String>(); List<String> assigns = new ArrayList<String>(); - // hack + // hack // for (java.lang.reflect.Field f:_entryPoint.getTheClass().getDeclaredFields()){ entryPoint = _entryPoint; for (ClassModelField field : _entryPoint.getReferencedClassModelFields()) { - //Field field = _entryPoint.getClassModel().getField(f.getName()); + // Field field = _entryPoint.getClassModel().getField(f.getName()); StringBuilder thisStructLine = new StringBuilder(); StringBuilder argLine = new StringBuilder(); StringBuilder assignLine = new StringBuilder(); @@ -233,9 +243,9 @@ abstract class KernelWriter extends BlockWriter{ String type = "__global"; if (visibleAnnotations != null) { - //for (AnnotationInfo ai : visibleAnnotations) { - // String typeDescriptor = ai.getTypeDescriptor(); - //} + // for (AnnotationInfo ai : visibleAnnotations) { + // String typeDescriptor = ai.getTypeDescriptor(); + // } } if (signature.startsWith("[")) { @@ -250,9 +260,9 @@ abstract class KernelWriter extends BlockWriter{ if (signature.startsWith("L")) { // Turn Lcom/amd/javalabs/opencl/demo/DummyOOA; into com_amd_javalabs_opencl_demo_DummyOOA for example className = (signature.substring(1, signature.length() - 1)).replace("/", "_"); - //if (logger.isLoggable(Level.FINE)) { - // logger.fine("Examining object parameter: " + signature + " new: " + className); - //} + // if (logger.isLoggable(Level.FINE)) { + // logger.fine("Examining object parameter: " + signature + " new: " + className); + // } argLine.append(className); thisStructLine.append(className); @@ -380,7 +390,7 @@ abstract class KernelWriter extends BlockWriter{ } if (totalStructSize > alignTo) { while (totalSize < totalStructSize) { - //structBuffer.put((byte)-1); + // structBuffer.put((byte)-1); writeln("char _pad_" + totalSize + ";"); totalSize++; } @@ -405,7 +415,7 @@ abstract class KernelWriter extends BlockWriter{ out(); writeln(";"); // out(); - // newLine(); + // newLine(); write("}This;"); newLine(); write("int get_pass_id(This *this){"); @@ -429,37 +439,37 @@ abstract class KernelWriter extends BlockWriter{ } write(convertType(returnType, true)); - write(mm.getName()+"("); + write(mm.getName() + "("); - if(!mm.getMethod().isStatic()) { - if (mm.getMethod().getClassModel() == _entryPoint.getClassModel() - || mm.getMethod().getClassModel().isSuperClass(_entryPoint.getClassModel().getClassWeAreModelling())) { - write("This *this"); - } else { - // Call to an object member or superclass of member - for (ClassModel c : _entryPoint.getObjectArrayFieldsClasses().values()) { - if (mm.getMethod().getClassModel() == c) { - write("__global " + mm.getMethod().getClassModel().getClassWeAreModelling().getName().replace(".", "_") - + " *this"); - break; - } else if (mm.getMethod().getClassModel().isSuperClass(c.getClassWeAreModelling())) { - write("__global " + c.getClassWeAreModelling().getName().replace(".", "_") + " *this"); - break; + if (!mm.getMethod().isStatic()) { + if ((mm.getMethod().getClassModel() == _entryPoint.getClassModel()) + || mm.getMethod().getClassModel().isSuperClass(_entryPoint.getClassModel().getClassWeAreModelling())) { + write("This *this"); + } else { + // Call to an object member or superclass of member + for (ClassModel c : _entryPoint.getObjectArrayFieldsClasses().values()) { + if (mm.getMethod().getClassModel() == c) { + write("__global " + mm.getMethod().getClassModel().getClassWeAreModelling().getName().replace(".", "_") + + " *this"); + break; + } else if (mm.getMethod().getClassModel().isSuperClass(c.getClassWeAreModelling())) { + write("__global " + c.getClassWeAreModelling().getName().replace(".", "_") + " *this"); + break; + } } } } - } - + boolean alreadyHasFirstArg = !mm.getMethod().isStatic(); - + LocalVariableTableEntry lvte = mm.getLocalVariableTableEntry(); for (LocalVariableInfo lvi : lvte) { - if (lvi.getStart() == 0 && (lvi.getVariableIndex() != 0 || mm.getMethod().isStatic())) { // full scope but skip this + if ((lvi.getStart() == 0) && ((lvi.getVariableIndex() != 0) || mm.getMethod().isStatic())) { // full scope but skip this String descriptor = lvi.getVariableDescriptor(); - if(alreadyHasFirstArg) { - write(", "); + if (alreadyHasFirstArg) { + write(", "); } - + // Arrays always map to __global arrays if (descriptor.startsWith("[")) { write(" __global "); @@ -467,7 +477,7 @@ abstract class KernelWriter extends BlockWriter{ write(convertType(descriptor, true)); write(lvi.getVariableName()); - alreadyHasFirstArg=true; + alreadyHasFirstArg = true; } } write(")"); @@ -527,7 +537,7 @@ abstract class KernelWriter extends BlockWriter{ } @Override void writeInstruction(Instruction _instruction) throws CodeGenException { - if (_instruction instanceof I_IUSHR || _instruction instanceof I_LUSHR) { + if ((_instruction instanceof I_IUSHR) || (_instruction instanceof I_LUSHR)) { BinaryOperator binaryInstruction = (BinaryOperator) _instruction; Instruction parent = binaryInstruction.getParentExpr(); boolean needsParenthesis = true; diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/MethodModel.java b/com.amd.aparapi/src/java/com/amd/aparapi/MethodModel.java index 1af511ed..4d590037 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/MethodModel.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/MethodModel.java @@ -34,7 +34,7 @@ to national security controls as identified on the Commerce Control List (curren of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry and Security's website at http://www.bis.doc.gov/. -*/ + */ package com.amd.aparapi; import java.util.ArrayList; @@ -74,19 +74,16 @@ import com.amd.aparapi.InstructionSet.I_AASTORE; import com.amd.aparapi.InstructionSet.I_ARETURN; import com.amd.aparapi.InstructionSet.I_ATHROW; import com.amd.aparapi.InstructionSet.I_BASTORE; -import com.amd.aparapi.InstructionSet.I_CALOAD; import com.amd.aparapi.InstructionSet.I_CASTORE; import com.amd.aparapi.InstructionSet.I_DUP; import com.amd.aparapi.InstructionSet.I_DUP2; import com.amd.aparapi.InstructionSet.I_DUP_X1; import com.amd.aparapi.InstructionSet.I_DUP_X2; -import com.amd.aparapi.InstructionSet.I_GETFIELD; import com.amd.aparapi.InstructionSet.I_GETSTATIC; import com.amd.aparapi.InstructionSet.I_IADD; import com.amd.aparapi.InstructionSet.I_ICONST_1; import com.amd.aparapi.InstructionSet.I_IINC; import com.amd.aparapi.InstructionSet.I_INVOKEINTERFACE; -import com.amd.aparapi.InstructionSet.I_INVOKESTATIC; import com.amd.aparapi.InstructionSet.I_LOOKUPSWITCH; import com.amd.aparapi.InstructionSet.I_MONITORENTER; import com.amd.aparapi.InstructionSet.I_MONITOREXIT; @@ -195,7 +192,7 @@ class MethodModel{ logger.fine("Found D on =" + instruction + " in " + getName()); } } - if (instruction instanceof I_BASTORE || instruction instanceof I_CASTORE /* || instruction instanceof I_SASTORE */) { + if ((instruction instanceof I_BASTORE) || (instruction instanceof I_CASTORE /* || instruction instanceof I_SASTORE */)) { usesByteWrites = true; if (usesByteWrites && logger.isLoggable(Level.FINE)) { logger.fine("Found Byte Addressable Store on =" + instruction + " in " + getName()); @@ -234,57 +231,46 @@ class MethodModel{ int pc = codeReader.getOffset(); Instruction instruction = InstructionSet.ByteCode.create(this, codeReader); - if ((!Config.enablePUTFIELD) && instruction instanceof I_PUTFIELD) { + if ((!Config.enablePUTFIELD) && (instruction instanceof I_PUTFIELD)) { // Special case putfield handling to allow object setter processing // and bail later if necessary //throw new ClassParseException("We don't support putfield instructions"); usesPutfield = true; } - if ((!Config.enableARETURN) && instruction instanceof I_ARETURN) { + if ((!Config.enableARETURN) && (instruction instanceof I_ARETURN)) { throw new ClassParseException(instruction, ClassParseException.TYPE.ARRAY_RETURN); } - if ((!Config.enablePUTSTATIC) && instruction instanceof I_PUTSTATIC) { + if ((!Config.enablePUTSTATIC) && (instruction instanceof I_PUTSTATIC)) { throw new ClassParseException(instruction, ClassParseException.TYPE.PUTFIELD); } - - if ((!Config.enableINVOKEINTERFACE) && instruction instanceof I_INVOKEINTERFACE) { + + if ((!Config.enableINVOKEINTERFACE) && (instruction instanceof I_INVOKEINTERFACE)) { throw new ClassParseException(instruction, ClassParseException.TYPE.INVOKEINTERFACE); } - - if ((!Config.enableGETSTATIC) && instruction instanceof I_GETSTATIC) { + + if ((!Config.enableGETSTATIC) && (instruction instanceof I_GETSTATIC)) { throw new ClassParseException(instruction, ClassParseException.TYPE.GETSTATIC); } - - if ((!Config.enableATHROW) && instruction instanceof I_ATHROW) { + + if ((!Config.enableATHROW) && (instruction instanceof I_ATHROW)) { throw new ClassParseException(instruction, ClassParseException.TYPE.ATHROW); } - + if ((!Config.enableMONITOR) && ((instruction instanceof I_MONITORENTER) || (instruction instanceof I_MONITOREXIT))) { throw new ClassParseException(instruction, ClassParseException.TYPE.SYNCHRONIZE); } - - if ((!Config.enableNEW) && instruction instanceof New) { + + if ((!Config.enableNEW) && (instruction instanceof New)) { throw new ClassParseException(instruction, ClassParseException.TYPE.NEW); } - - if (instruction instanceof I_CALOAD || instruction instanceof I_CASTORE) { - throw new ClassParseException(instruction, ClassParseException.TYPE.CHARARRAY); - } - + if (instruction instanceof I_AASTORE) { throw new ClassParseException(instruction, ClassParseException.TYPE.ARRAYALIAS); } - if (instruction instanceof I_GETFIELD) { - I_GETFIELD getFieldInstr = (I_GETFIELD) instruction; - if (getFieldInstr.getConstantPoolFieldEntry().getNameAndTypeEntry().getDescriptorUTF8Entry().getUTF8().endsWith("C")) { - throw new ClassParseException(instruction, ClassParseException.TYPE.ACCESSTOCHARFIELD); - } - } - - if ((!Config.enableSWITCH) && (instruction instanceof I_LOOKUPSWITCH || instruction instanceof I_TABLESWITCH)) { + if ((!Config.enableSWITCH) && ((instruction instanceof I_LOOKUPSWITCH) || (instruction instanceof I_TABLESWITCH))) { throw new ClassParseException(instruction, ClassParseException.TYPE.SWITCH); } @@ -375,7 +361,7 @@ class MethodModel{ if (branch.isReverse()) { Instruction target = branch.getTarget(); LinkedList<Branch> list = target.getReverseUnconditionalBranches(); - if (list != null && list.size() > 0 && list.get(list.size() - 1) != branch) { + if ((list != null) && (list.size() > 0) && (list.get(list.size() - 1) != branch)) { Branch unconditional = list.get(list.size() - 1).asBranch(); branch.retarget(unconditional); @@ -1289,12 +1275,12 @@ class MethodModel{ * * a=b=c=<exp>; */ - if (_instruction instanceof AssignToLocalVariable && _operandStart.producesStack() - && _operandStart.getNextExpr() instanceof AssignToLocalVariable) { + if ((_instruction instanceof AssignToLocalVariable) && _operandStart.producesStack() + && (_operandStart.getNextExpr() instanceof AssignToLocalVariable)) { Instruction assignFirst = _operandStart.getNextExpr(); Instruction assign = assignFirst; int count = 0; - while (assign != null && assign instanceof AssignToLocalVariable) { + while ((assign != null) && (assign instanceof AssignToLocalVariable)) { assign = assign.getNextExpr(); count++; } @@ -1354,13 +1340,13 @@ class MethodModel{ // Getters should have 3 bcs: aload_0, getfield, ?return if (mightBeSetter) { - if (rawVarNameCandidate != null && pcMap.size() == 3) { + if ((rawVarNameCandidate != null) && (pcMap.size() == 3)) { String firstLetter = rawVarNameCandidate.substring(0, 1).toLowerCase(); String varNameCandidateCamelCased = rawVarNameCandidate.replaceFirst(rawVarNameCandidate.substring(0, 1), firstLetter); String accessedFieldName = null; Instruction instruction = expressionList.getHead(); - if (instruction instanceof Return && (expressionList.getHead() == expressionList.getTail())) { + if ((instruction instanceof Return) && (expressionList.getHead() == expressionList.getTail())) { instruction = instruction.getPrevPC(); if (instruction instanceof AccessInstanceField) { FieldEntry field = ((AccessInstanceField) instruction).getConstantPoolFieldEntry(); @@ -1372,7 +1358,7 @@ class MethodModel{ String returnType = getMethod().getDescriptor().substring(2); //System.out.println( "### field type = " + fieldType ); //System.out.println( "### method args = " + returnType ); - assert fieldType.length() == 1 && returnType.length() == 1 : " can only use basic type getters"; + assert (fieldType.length() == 1) && (returnType.length() == 1) : " can only use basic type getters"; // Allow isFoo style for boolean fields if ((methodName.startsWith("is") && fieldType.equals("Z")) || (methodName.startsWith("get"))) { @@ -1415,7 +1401,7 @@ class MethodModel{ Instruction instruction = expressionList.getHead(); // setters should be aload_0, ?load_1, putfield, return - if (instruction instanceof AssignToInstanceField && expressionList.getTail() instanceof Return && pcMap.size() == 4) { + if ((instruction instanceof AssignToInstanceField) && (expressionList.getTail() instanceof Return) && (pcMap.size() == 4)) { Instruction prev = instruction.getPrevPC(); if (prev instanceof AccessLocalVariable) { FieldEntry field = ((AssignToInstanceField) instruction).getConstantPoolFieldEntry(); @@ -1471,7 +1457,7 @@ class MethodModel{ private void init(ClassModelMethod _method) throws AparapiException { try { method = _method; - this.expressionList = new ExpressionList(this); + expressionList = new ExpressionList(this); // check if we have any exception handlers int exceptionsSize = method.getCodeEntry().getExceptionPoolEntries().size(); @@ -1489,10 +1475,6 @@ class MethodModel{ if (DISALLOWARRAYLOCALVAR && localVariableInfo.getVariableDescriptor().startsWith("[")) { throw new ClassParseException(ClassParseException.TYPE.ARRAYLOCALVARIABLE); } - if (localVariableInfo.getVariableDescriptor().equals("C")) { - throw new ClassParseException(ClassParseException.TYPE.CHARLOCALVARIABLE); - } - } // We are going to make 4 passes. @@ -1535,7 +1517,7 @@ class MethodModel{ } } // Accessor conversion only works on member object arrays - if (entrypoint != null && _method.getClassModel() != entrypoint.getClassModel()) { + if ((entrypoint != null) && (_method.getClassModel() != entrypoint.getClassModel())) { if (logger.isLoggable(Level.FINE)) { logger.fine("Considering accessor call: " + getName()); } @@ -1549,9 +1531,7 @@ class MethodModel{ //} if (logger.isLoggable(Level.FINE)) { - - System.out.println("end \n" + expressionList.dumpDiagram(null)); - + logger.fine("end \n" + expressionList.dumpDiagram(null)); } if (Config.instructionListener != null) { Config.instructionListener.showAndTell("end", expressionList.getHead(), null); -- GitLab