diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/BlockWriter.java b/com.amd.aparapi/src/java/com/amd/aparapi/BlockWriter.java index 6ca9d5b1bdc9c235c9fd3081763559db00b1b759..4f4c097b74bffd89176a14d81c3dd6aefa0b1170 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/BlockWriter.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/BlockWriter.java @@ -71,12 +71,12 @@ import com.amd.aparapi.InstructionSet.FieldArrayElementAssign; import com.amd.aparapi.InstructionSet.FieldArrayElementIncrement; import com.amd.aparapi.InstructionSet.I_ALOAD_0; import com.amd.aparapi.InstructionSet.I_ARRAYLENGTH; +import com.amd.aparapi.InstructionSet.I_IFNONNULL; +import com.amd.aparapi.InstructionSet.I_IFNULL; import com.amd.aparapi.InstructionSet.I_IINC; import com.amd.aparapi.InstructionSet.I_POP; import com.amd.aparapi.InstructionSet.If; import com.amd.aparapi.InstructionSet.IfUnary; -import com.amd.aparapi.InstructionSet.I_IFNULL; -import com.amd.aparapi.InstructionSet.I_IFNONNULL; import com.amd.aparapi.InstructionSet.IncrementInstruction; import com.amd.aparapi.InstructionSet.InlineAssignInstruction; import com.amd.aparapi.InstructionSet.MethodCall; diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/ClassModel.java b/com.amd.aparapi/src/java/com/amd/aparapi/ClassModel.java index 8f5fd3ab54624676c95142cfd6b9f834d39db2a0..ea7520bcf89aca66b3a0ac82295554ab3e2c5338 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/ClassModel.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/ClassModel.java @@ -2160,7 +2160,7 @@ class ClassModel{ RuntimeAnnotationsEntry getRuntimeVisibleAnnotationsEntry() { return (runtimeVisibleAnnotationsEntry); } - + RuntimeAnnotationsEntry getBootstrap() { return (runtimeVisibleAnnotationsEntry); } @@ -2552,7 +2552,7 @@ class ClassModel{ totalStructSize = x; } - private Entrypoint getEntrypoint(String _entrypointName, String _descriptor, Object _k) throws AparapiException { + Entrypoint getEntrypoint(String _entrypointName, String _descriptor, Object _k) throws AparapiException { MethodModel method = getMethodModel(_entrypointName, _descriptor); return (new Entrypoint(this, method, _k)); } diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/Config.java b/com.amd.aparapi/src/java/com/amd/aparapi/Config.java index 06d0399360659b0a902d59424ea1917f7bfc2da4..f1e479d3c3eb50f0926a6dd8822c330832673396 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/Config.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/Config.java @@ -90,7 +90,7 @@ class Config{ * */ @UsedByJNICode static final boolean enableVerboseJNI = Boolean.getBoolean(propPkgName + ".enableVerboseJNI"); - + /** * Allows the user to request tracking of opencl resources. * @@ -99,7 +99,9 @@ class Config{ * Usage -Dcom.amd.aparapi.enableOpenCLResourceTracking={true|false} * */ - @UsedByJNICode static final boolean enableVerboseJNIOpenCLResourceTracking = Boolean.getBoolean(propPkgName + ".enableVerboseJNIOpenCLResourceTracking"); + @UsedByJNICode static final boolean enableVerboseJNIOpenCLResourceTracking = Boolean.getBoolean(propPkgName + + ".enableVerboseJNIOpenCLResourceTracking"); + /** * Allows the user to request that the execution mode of each kernel invocation be reported to stdout. * @@ -153,7 +155,9 @@ class Config{ static final boolean enableSWITCH = Boolean.getBoolean(propPkgName + ".enable.SWITCH"); - // static final int JTPLocalSizeMultiplier = Integer.getInteger(propPkgName + ".JTP.localSizeMul", 2); + // Lambda testing requires this because static lambda methods currently do not have localvariabletables. This may change when Java8 if finalized + static final boolean enableAllowMissingLocalVariableTable = Boolean.getBoolean(propPkgName + + ".enableAllowMissingLocalVariableTable"); // Logging setup private static final String logPropName = propPkgName + ".logLevel"; @@ -181,7 +185,6 @@ class Config{ e.printStackTrace(); } - }; public interface InstructionListener{ @@ -189,12 +192,13 @@ class Config{ } static final boolean enableInstructionDecodeViewer = Boolean.getBoolean(propPkgName + ".enableInstructionDecodeViewer"); + static String instructionListenerClassName = System.getProperty(propPkgName + ".instructionListenerClass"); static public InstructionListener instructionListener = null; static { - if (enableInstructionDecodeViewer && (instructionListenerClassName==null || instructionListenerClassName.equals("")) ){ + if (enableInstructionDecodeViewer && (instructionListenerClassName == null || instructionListenerClassName.equals(""))) { instructionListenerClassName = InstructionViewer.class.getName(); } if (instructionListenerClassName != null && !instructionListenerClassName.equals("")) { @@ -213,18 +217,20 @@ class Config{ } } if (dumpFlags) { - - System.out.println(propPkgName+".executionMode{GPU|CPU|JTP|SEQ}="+executionMode); - System.out.println(propPkgName+".logLevel{OFF|FINEST|FINER|FINE|WARNING|SEVERE|ALL}="+logger.getLevel()); - System.out.println(propPkgName+".enableProfiling{true|false}="+enableProfiling); - System.out.println(propPkgName+".enableProfilingCSV{true|false}="+enableProfilingCSV); - System.out.println(propPkgName+".enableVerboseJNI{true|false}="+enableVerboseJNI); - System.out.println(propPkgName+".enableVerboseJNIOpenCLResourceTracking{true|false}="+enableVerboseJNIOpenCLResourceTracking); - System.out.println(propPkgName+".enableShowGeneratedOpenCL{true|false}="+enableShowGeneratedOpenCL); - System.out.println(propPkgName+".enableExecutionModeReporting{true|false}="+enableExecutionModeReporting); - System.out.println(propPkgName+".enableInstructionDecodeViewer{true|false}="+enableInstructionDecodeViewer); - System.out.println(propPkgName+".instructionListenerClassName{<class name which extends com.amd.aparapi.Config.InstructionListener>}="+instructionListenerClassName); - + + System.out.println(propPkgName + ".executionMode{GPU|CPU|JTP|SEQ}=" + executionMode); + System.out.println(propPkgName + ".logLevel{OFF|FINEST|FINER|FINE|WARNING|SEVERE|ALL}=" + logger.getLevel()); + System.out.println(propPkgName + ".enableProfiling{true|false}=" + enableProfiling); + System.out.println(propPkgName + ".enableProfilingCSV{true|false}=" + enableProfilingCSV); + System.out.println(propPkgName + ".enableVerboseJNI{true|false}=" + enableVerboseJNI); + System.out.println(propPkgName + ".enableVerboseJNIOpenCLResourceTracking{true|false}=" + + enableVerboseJNIOpenCLResourceTracking); + System.out.println(propPkgName + ".enableShowGeneratedOpenCL{true|false}=" + enableShowGeneratedOpenCL); + System.out.println(propPkgName + ".enableExecutionModeReporting{true|false}=" + enableExecutionModeReporting); + System.out.println(propPkgName + ".enableInstructionDecodeViewer{true|false}=" + enableInstructionDecodeViewer); + System.out.println(propPkgName + + ".instructionListenerClassName{<class name which extends com.amd.aparapi.Config.InstructionListener>}=" + + instructionListenerClassName); } } diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/ExpressionList.java b/com.amd.aparapi/src/java/com/amd/aparapi/ExpressionList.java index 9b8842203a9959faa1bffc00dedcc935d6effd76..98507fcdfdd8ef99c067422ff7fb1668a151f065 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/ExpressionList.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/ExpressionList.java @@ -757,16 +757,20 @@ class ExpressionList{ // might be end of arbitrary scope LocalVariableTableEntry localVariableTable = methodModel.getMethod().getLocalVariableTableEntry(); int startPc = Short.MAX_VALUE; - for (LocalVariableInfo localVariableInfo : localVariableTable.getPool()) { + if (Config.enableAllowMissingLocalVariableTable && localVariableTable == null) { + logger.warning("class does not contain a LocalVariableTable - but enableAllowMissingLocalVariableTable is set so we are ignoring"); + } else { + for (LocalVariableInfo localVariableInfo : localVariableTable.getPool()) { - if (localVariableInfo.getEnd() == _instruction.getThisPC()) { - logger.fine(localVariableInfo.getVariableName() + " scope " + localVariableInfo.getStart() + " ," - + localVariableInfo.getEnd()); - if (localVariableInfo.getStart() < startPc) { - startPc = localVariableInfo.getStart(); + if (localVariableInfo.getEnd() == _instruction.getThisPC()) { + logger.fine(localVariableInfo.getVariableName() + " scope " + localVariableInfo.getStart() + " ," + + localVariableInfo.getEnd()); + if (localVariableInfo.getStart() < startPc) { + startPc = localVariableInfo.getStart(); + } } - } + } } if (startPc < Short.MAX_VALUE) { logger.fine("Scope block from " + startPc + " to " + (tail.getThisPC() + tail.getLength())); diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/Instruction.java b/com.amd.aparapi/src/java/com/amd/aparapi/Instruction.java index 4f6e1774cf160b458bb0774b20f5b53c1dfb2aa9..296d156ca0998d67d587d61c5bd72f353da25a4e 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/Instruction.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/Instruction.java @@ -162,7 +162,7 @@ abstract class Instruction{ } protected Instruction(MethodModel _method, ByteCode _byteCode, ByteReader _byteReader, boolean _wide) { - this(_method, _byteCode, _wide? _byteReader.getOffset() - 2:_byteReader.getOffset()-1); + this(_method, _byteCode, _wide ? _byteReader.getOffset() - 2 : _byteReader.getOffset() - 1); } // This works for most cases (except calls whose operand count depends upon the signature) so all call instructions therefore override this method diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/InstructionSet.java b/com.amd.aparapi/src/java/com/amd/aparapi/InstructionSet.java index f8a043983df19f1f987026afd4ceefc7193a86db..2ba8b59d051b211d146bc1b01ca6c6427012404a 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/InstructionSet.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/InstructionSet.java @@ -716,7 +716,7 @@ class InstructionSet{ static Instruction create(MethodModel _methodModel, ByteReader _byteReader) { ByteCode byteCode = get(_byteReader.u1()); boolean isWide = false; - if (byteCode.equals(ByteCode.WIDE)){ + if (byteCode.equals(ByteCode.WIDE)) { // handle wide //System.out.println("WIDE"); isWide = true; @@ -1198,7 +1198,8 @@ class InstructionSet{ } static abstract class LocalVariableConstIndexAccessor extends IndexConst implements AccessLocalVariable{ - LocalVariableConstIndexAccessor(MethodModel methodPoolEntry, ByteCode byteCode, ByteReader byteReader, boolean _wide, int index) { + LocalVariableConstIndexAccessor(MethodModel methodPoolEntry, ByteCode byteCode, ByteReader byteReader, boolean _wide, + int index) { super(methodPoolEntry, byteCode, byteReader, _wide, index); } @@ -1223,8 +1224,8 @@ class InstructionSet{ } static abstract class LocalVariableConstIndexStore extends LocalVariableConstIndexAccessor implements AssignToLocalVariable{ - LocalVariableConstIndexStore(MethodModel methodPoolEntry, ByteCode byteCode, ByteReader byteReader, boolean _wide,int index) { - super(methodPoolEntry, byteCode, byteReader, _wide,index); + LocalVariableConstIndexStore(MethodModel methodPoolEntry, ByteCode byteCode, ByteReader byteReader, boolean _wide, int index) { + super(methodPoolEntry, byteCode, byteReader, _wide, index); } @Override public boolean isDeclaration() { @@ -1368,7 +1369,7 @@ class InstructionSet{ static class I_ASTORE_1 extends LocalVariableConstIndexStore{ I_ASTORE_1(MethodModel _methodPoolEntry, ByteReader _byteReader, boolean _wide) { - super(_methodPoolEntry, ByteCode.ASTORE_1, _byteReader, _wide,1); + super(_methodPoolEntry, ByteCode.ASTORE_1, _byteReader, _wide, 1); } @@ -1384,7 +1385,7 @@ class InstructionSet{ static class I_ASTORE_3 extends LocalVariableConstIndexStore{ I_ASTORE_3(MethodModel _methodPoolEntry, ByteReader _byteReader, boolean _wide) { - super(_methodPoolEntry, ByteCode.ASTORE_3, _byteReader, _wide,3); + super(_methodPoolEntry, ByteCode.ASTORE_3, _byteReader, _wide, 3); } @@ -1621,7 +1622,7 @@ class InstructionSet{ static class I_DCONST_1 extends BytecodeEncodedConstant<Double>{ I_DCONST_1(MethodModel _methodPoolEntry, ByteReader _byteReader, boolean _wide) { - super(_methodPoolEntry, ByteCode.DCONST_1, _byteReader, _wide, 1.0); + super(_methodPoolEntry, ByteCode.DCONST_1, _byteReader, _wide, 1.0); } @@ -1757,7 +1758,7 @@ class InstructionSet{ static class I_DSTORE_2 extends LocalVariableConstIndexStore{ I_DSTORE_2(MethodModel _methodPoolEntry, ByteReader _byteReader, boolean _wide) { - super(_methodPoolEntry, ByteCode.DSTORE_2, _byteReader, _wide,2); + super(_methodPoolEntry, ByteCode.DSTORE_2, _byteReader, _wide, 2); } @@ -1765,7 +1766,7 @@ class InstructionSet{ static class I_DSTORE_3 extends LocalVariableConstIndexStore{ I_DSTORE_3(MethodModel _methodPoolEntry, ByteReader _byteReader, boolean _wide) { - super(_methodPoolEntry, ByteCode.DSTORE_3, _byteReader, _wide,3); + super(_methodPoolEntry, ByteCode.DSTORE_3, _byteReader, _wide, 3); } @@ -1960,7 +1961,7 @@ class InstructionSet{ static class I_FCONST_0 extends BytecodeEncodedConstant<Float>{ I_FCONST_0(MethodModel _methodPoolEntry, ByteReader _byteReader, boolean _wide) { - super(_methodPoolEntry, ByteCode.FCONST_0, _byteReader, _wide,0f); + super(_methodPoolEntry, ByteCode.FCONST_0, _byteReader, _wide, 0f); } @@ -1972,7 +1973,7 @@ class InstructionSet{ static class I_FCONST_1 extends BytecodeEncodedConstant<Float>{ I_FCONST_1(MethodModel _methodPoolEntry, ByteReader _byteReader, boolean _wide) { - super(_methodPoolEntry, ByteCode.FCONST_1, _byteReader, _wide, 1f); + super(_methodPoolEntry, ByteCode.FCONST_1, _byteReader, _wide, 1f); } @@ -2024,7 +2025,7 @@ class InstructionSet{ static class I_FLOAD_1 extends LocalVariableConstIndexLoad{ I_FLOAD_1(MethodModel _methodPoolEntry, ByteReader _byteReader, boolean _wide) { - super(_methodPoolEntry, ByteCode.FLOAD_1, _byteReader, _wide, 1); + super(_methodPoolEntry, ByteCode.FLOAD_1, _byteReader, _wide, 1); } @@ -2104,7 +2105,7 @@ class InstructionSet{ static class I_FSTORE_0 extends LocalVariableConstIndexStore{ I_FSTORE_0(MethodModel _methodPoolEntry, ByteReader _byteReader, boolean _wide) { - super(_methodPoolEntry, ByteCode.FSTORE_0, _byteReader, _wide, 0); + super(_methodPoolEntry, ByteCode.FSTORE_0, _byteReader, _wide, 0); } @@ -2128,7 +2129,7 @@ class InstructionSet{ static class I_FSTORE_3 extends LocalVariableConstIndexStore{ I_FSTORE_3(MethodModel _methodPoolEntry, ByteReader _byteReader, boolean _wide) { - super(_methodPoolEntry, ByteCode.FSTORE_3, _byteReader, _wide,3); + super(_methodPoolEntry, ByteCode.FSTORE_3, _byteReader, _wide, 3); } @@ -2639,14 +2640,15 @@ class InstructionSet{ static class I_IINC extends Index08{ private int delta; + private boolean wide; I_IINC(MethodModel _methodPoolEntry, ByteReader _byteReader, boolean _wide) { super(_methodPoolEntry, ByteCode.IINC, _byteReader, _wide); wide = _wide; - if (wide){ + if (wide) { delta = _byteReader.u2(); - }else{ + } else { delta = _byteReader.u1(); } @@ -2674,11 +2676,11 @@ class InstructionSet{ int getAdjust() { int adjust = delta; - if (wide){ + if (wide) { if (adjust > 0x7fff) { adjust = -0x10000 + adjust; } - }else{ + } else { if (adjust > 0x7f) { adjust = -0x100 + adjust; } @@ -3058,7 +3060,7 @@ class InstructionSet{ static class I_ISTORE_1 extends LocalVariableConstIndexStore{ I_ISTORE_1(MethodModel _methodPoolEntry, ByteReader _byteReader, boolean _wide) { - super(_methodPoolEntry, ByteCode.ISTORE_1, _byteReader, _wide, 1); + super(_methodPoolEntry, ByteCode.ISTORE_1, _byteReader, _wide, 1); } @@ -3238,7 +3240,7 @@ class InstructionSet{ static class I_LCONST_0 extends BytecodeEncodedConstant<Long>{ I_LCONST_0(MethodModel _methodPoolEntry, ByteReader _byteReader, boolean _wide) { - super(_methodPoolEntry, ByteCode.LCONST_0, _byteReader, _wide, 0L); + super(_methodPoolEntry, ByteCode.LCONST_0, _byteReader, _wide, 0L); } @@ -3958,9 +3960,9 @@ class InstructionSet{ static abstract class Index08 extends Index{ Index08(MethodModel _methodPoolEntry, ByteCode _byteCode, ByteReader _byteReader, boolean _wide) { super(_methodPoolEntry, _byteCode, _byteReader, _wide); - if (_wide){ - index = _byteReader.u2(); - }else{ + if (_wide) { + index = _byteReader.u2(); + } else { index = _byteReader.u1(); } diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/InstructionViewer.java b/com.amd.aparapi/src/java/com/amd/aparapi/InstructionViewer.java index 5aff7bf8632c882f6a694089f29d93eba302970b..ed9d7b8bf7e96b2275f1b33852da24c3b2a7c295 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/InstructionViewer.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/InstructionViewer.java @@ -267,7 +267,7 @@ public class InstructionViewer implements Config.InstructionListener{ @Check(label = "Collapse All") public boolean collapseAll = false; - /* @Check(label = "Show expressions")*/ public boolean showExpressions = false; + /* @Check(label = "Show expressions")*/public boolean showExpressions = false; } diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/Kernel.java b/com.amd.aparapi/src/java/com/amd/aparapi/Kernel.java index 577cee6ea178788e84ea91d92e9424171107ca6d..267216059861881d56ed210cfd41f6fb143d2973 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/Kernel.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/Kernel.java @@ -40,11 +40,11 @@ package com.amd.aparapi; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.List; -import java.util.LinkedHashSet; import java.util.Arrays; +import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; import java.util.Map; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CyclicBarrier; @@ -363,11 +363,11 @@ public abstract class Kernel implements Cloneable{ static LinkedHashSet<EXECUTION_MODE> getDefaultExecutionModes() { LinkedHashSet<EXECUTION_MODE> defaultExecutionModes = new LinkedHashSet<EXECUTION_MODE>(); - if(OpenCLJNI.getJNI().isOpenCLAvailable()) { - defaultExecutionModes.add(GPU); - defaultExecutionModes.add(JTP); + if (OpenCLJNI.getJNI().isOpenCLAvailable()) { + defaultExecutionModes.add(GPU); + defaultExecutionModes.add(JTP); } else { - defaultExecutionModes.add(JTP); + defaultExecutionModes.add(JTP); } String executionMode = Config.executionMode; if (executionMode != null) { @@ -375,11 +375,10 @@ public abstract class Kernel implements Cloneable{ LinkedHashSet<EXECUTION_MODE> requestedExecutionModes; requestedExecutionModes = EXECUTION_MODE.getExecutionModeFromString(executionMode); logger.fine("requested execution mode ="); - for(EXECUTION_MODE mode : requestedExecutionModes) { - logger.fine(" " + mode); + for (EXECUTION_MODE mode : requestedExecutionModes) { + logger.fine(" " + mode); } - if ((OpenCLJNI.getJNI().isOpenCLAvailable() - && EXECUTION_MODE.anyOpenCL(requestedExecutionModes)) + if ((OpenCLJNI.getJNI().isOpenCLAvailable() && EXECUTION_MODE.anyOpenCL(requestedExecutionModes)) || !EXECUTION_MODE.anyOpenCL(requestedExecutionModes)) { defaultExecutionModes = requestedExecutionModes; } @@ -390,9 +389,8 @@ public abstract class Kernel implements Cloneable{ logger.info("default execution modes = " + defaultExecutionModes); - for(EXECUTION_MODE e : defaultExecutionModes) - { - logger.info("SETTING DEFAULT MODE: " + e.toString()); + for (EXECUTION_MODE e : defaultExecutionModes) { + logger.info("SETTING DEFAULT MODE: " + e.toString()); } return (defaultExecutionModes); @@ -400,8 +398,8 @@ public abstract class Kernel implements Cloneable{ static LinkedHashSet<EXECUTION_MODE> getExecutionModeFromString(String executionMode) { LinkedHashSet<EXECUTION_MODE> executionModes = new LinkedHashSet<EXECUTION_MODE>(); - for(String mode : executionMode.split(",")) { - executionModes.add(valueOf(mode.toUpperCase())); + for (String mode : executionMode.split(",")) { + executionModes.add(valueOf(mode.toUpperCase())); } return executionModes; } @@ -412,10 +410,9 @@ public abstract class Kernel implements Cloneable{ return (defaultFallbackExecutionMode); } - static boolean anyOpenCL(LinkedHashSet<EXECUTION_MODE> _executionModes) { - for(EXECUTION_MODE mode : _executionModes) { - if(mode == GPU || mode== CPU) { + for (EXECUTION_MODE mode : _executionModes) { + if (mode == GPU || mode == CPU) { return true; } } @@ -428,7 +425,6 @@ public abstract class Kernel implements Cloneable{ }; - int[] globalId = new int[] { 0, 0, @@ -2062,19 +2058,19 @@ public abstract class Kernel implements Cloneable{ kernelRunner.put(array); return (this); } - + /** * Tag this array so that it is explicitly enqueued before the kernel is executed * @param array * @return This kernel so that we can use the 'fluent' style API */ - public Kernel put(boolean[] array) { - if (kernelRunner == null) { - kernelRunner = new KernelRunner(this); - } - kernelRunner.put(array); - return (this); - } + public Kernel put(boolean[] array) { + if (kernelRunner == null) { + kernelRunner = new KernelRunner(this); + } + kernelRunner.put(array); + return (this); + } /** * Enqueue a request to return this buffer from the GPU. This method blocks until the array is available. @@ -2159,7 +2155,7 @@ public abstract class Kernel implements Cloneable{ kernelRunner.get(array); return (this); } - + /** * Enqueue a request to return this buffer from the GPU. This method blocks until the array is available. * @param array @@ -2186,7 +2182,9 @@ public abstract class Kernel implements Cloneable{ } private LinkedHashSet<EXECUTION_MODE> executionModes = EXECUTION_MODE.getDefaultExecutionModes(); + private Iterator<EXECUTION_MODE> currentMode = executionModes.iterator(); + private EXECUTION_MODE executionMode = currentMode.next(); /** @@ -2211,7 +2209,7 @@ public abstract class Kernel implements Cloneable{ * try the next execution path in the list if there aren't any more than give up */ public void tryNextExecutionMode() { - if(currentMode.hasNext()) { + if (currentMode.hasNext()) { executionMode = currentMode.next(); } } 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 f2894849d81ce560870e4aa031935e73435d4f65..12beb19250ecf6a439e24aefdca01ade1f447673 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/MethodModel.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/MethodModel.java @@ -1468,10 +1468,15 @@ class MethodModel{ // check if we have any local variables which are arrays. This is an attempt to avoid aliasing field arrays - for (LocalVariableInfo localVariableInfo : method.getLocalVariableTableEntry()) { - final boolean DISALLOWARRAYLOCALVAR = false; - if (DISALLOWARRAYLOCALVAR && localVariableInfo.getVariableDescriptor().startsWith("[")) { - throw new ClassParseException(ClassParseException.TYPE.ARRAYLOCALVARIABLE); + LocalVariableTableEntry localVariableTableEntry = method.getLocalVariableTableEntry(); + if (Config.enableAllowMissingLocalVariableTable && localVariableTableEntry == null) { + logger.warning("class does not contain a LocalVariableTable - but enableAllowMissingLocalVariableTable is set so we are ignoring"); + } else { + for (LocalVariableInfo localVariableInfo : localVariableTableEntry) { + final boolean DISALLOWARRAYLOCALVAR = false; + if (DISALLOWARRAYLOCALVAR && localVariableInfo.getVariableDescriptor().startsWith("[")) { + throw new ClassParseException(ClassParseException.TYPE.ARRAYLOCALVARIABLE); + } } } diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/OpenCLDevice.java b/com.amd.aparapi/src/java/com/amd/aparapi/OpenCLDevice.java index 1813033059698a8d84b83decad7d1a5f81faa3f7..3b09f1510612ebbcfa17e800df2b1117e0e0d44f 100644 --- a/com.amd.aparapi/src/java/com/amd/aparapi/OpenCLDevice.java +++ b/com.amd.aparapi/src/java/com/amd/aparapi/OpenCLDevice.java @@ -350,7 +350,7 @@ public class OpenCLDevice extends Device{ } } - // System.out.println("opencl{\n" + _source + "\n}opencl"); + // System.out.println("opencl{\n" + _source + "\n}opencl"); OpenCLProgram program = createProgram(_source);