(MethodReferenceEntry _methodReferenceEntry)
| 3135 | } |
| 3136 | |
| 3137 | public static String getMappedMethodName(MethodReferenceEntry _methodReferenceEntry) { |
| 3138 | if (CacheEnabler.areCachesEnabled()) |
| 3139 | return getProperty(mappedMethodNamesCache, _methodReferenceEntry, null); |
| 3140 | String mappedName = null; |
| 3141 | final String name = _methodReferenceEntry.getNameAndTypeEntry().getNameUTF8Entry().getUTF8(); |
| 3142 | Class<?> currentClass = _methodReferenceEntry.getOwnerClassModel().getClassWeAreModelling(); |
| 3143 | while (currentClass != Object.class) { |
| 3144 | for (final Method kernelMethod : currentClass.getDeclaredMethods()) { |
| 3145 | if (kernelMethod.isAnnotationPresent(OpenCLMapping.class)) { |
| 3146 | // ultimately, need a way to constrain this based upon signature (to disambiguate abs(float) from abs(int); |
| 3147 | // for Alpha, we will just disambiguate based on the return type |
| 3148 | if (false) { |
| 3149 | System.out.println("kernelMethod is ... " + kernelMethod.toGenericString()); |
| 3150 | System.out.println("returnType = " + kernelMethod.getReturnType()); |
| 3151 | System.out.println("returnTypeLetter = " + getReturnTypeLetter(kernelMethod)); |
| 3152 | System.out.println("kernelMethod getName = " + kernelMethod.getName()); |
| 3153 | System.out.println("methRefName = " + name + " descriptor = " |
| 3154 | + _methodReferenceEntry.getNameAndTypeEntry().getDescriptorUTF8Entry().getUTF8()); |
| 3155 | System.out.println("descToReturnTypeLetter = " |
| 3156 | + descriptorToReturnTypeLetter(_methodReferenceEntry.getNameAndTypeEntry().getDescriptorUTF8Entry() |
| 3157 | .getUTF8())); |
| 3158 | } |
| 3159 | if (toSignature(_methodReferenceEntry).equals(toSignature(kernelMethod))) { |
| 3160 | final OpenCLMapping annotation = kernelMethod.getAnnotation(OpenCLMapping.class); |
| 3161 | final String mapTo = annotation.mapTo(); |
| 3162 | if (!mapTo.equals("")) { |
| 3163 | mappedName = mapTo; |
| 3164 | // System.out.println("mapTo = " + mapTo); |
| 3165 | } |
| 3166 | } |
| 3167 | } |
| 3168 | } |
| 3169 | if (mappedName != null) |
| 3170 | break; |
| 3171 | currentClass = currentClass.getSuperclass(); |
| 3172 | } |
| 3173 | // System.out.println("... in getMappedMethodName, returning = " + mappedName); |
| 3174 | return (mappedName); |
| 3175 | } |
| 3176 | |
| 3177 | public static boolean isMappedMethod(MethodReferenceEntry methodReferenceEntry) { |
| 3178 | if (CacheEnabler.areCachesEnabled()) |
no test coverage detected