MCPcopy Create free account
hub / github.com/Syncleus/aparapi / getMappedMethodName

Method getMappedMethodName

src/main/java/com/aparapi/Kernel.java:3137–3175  ·  view source on GitHub ↗
(MethodReferenceEntry _methodReferenceEntry)

Source from the content-addressed store, hash-verified

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())

Callers 1

writeMethodMethod · 0.95

Calls 14

areCachesEnabledMethod · 0.95
getPropertyMethod · 0.95
getReturnTypeLetterMethod · 0.95
toSignatureMethod · 0.95
getUTF8Method · 0.80
getNameMethod · 0.65
getNameUTF8EntryMethod · 0.45
getNameAndTypeEntryMethod · 0.45
getOwnerClassModelMethod · 0.45
getReturnTypeMethod · 0.45

Tested by

no test coverage detected