|
42 | 42 | import org.graalvm.word.Pointer;
|
43 | 43 |
|
44 | 44 | import com.oracle.svm.configure.ClassNameSupport;
|
| 45 | +import com.oracle.svm.configure.config.ConfigurationMemberInfo; |
| 46 | +import com.oracle.svm.configure.config.ConfigurationType; |
45 | 47 | import com.oracle.svm.core.SubstrateOptions;
|
46 | 48 | import com.oracle.svm.core.Uninterruptible;
|
47 | 49 | import com.oracle.svm.core.heap.Heap;
|
|
53 | 55 | import com.oracle.svm.core.layeredimagesingleton.MultiLayeredImageSingleton;
|
54 | 56 | import com.oracle.svm.core.layeredimagesingleton.UnsavedSingleton;
|
55 | 57 | import com.oracle.svm.core.log.Log;
|
| 58 | +import com.oracle.svm.core.metadata.MetadataTracer; |
56 | 59 | import com.oracle.svm.core.snippets.KnownIntrinsics;
|
57 | 60 | import com.oracle.svm.core.util.ImageHeapMap;
|
58 | 61 | import com.oracle.svm.core.util.Utf8.WrappedAsciiCString;
|
@@ -181,6 +184,9 @@ public static Class<?> getClassObjectByName(CharSequence name) {
|
181 | 184 | JNIAccessibleClass clazz = dictionary.classesByName.get(name);
|
182 | 185 | if (clazz == null && !ClassNameSupport.isValidJNIName(name.toString())) {
|
183 | 186 | clazz = NEGATIVE_CLASS_LOOKUP;
|
| 187 | + } else if (MetadataTracer.Options.MetadataTracingSupport.getValue() && MetadataTracer.singleton().enabled()) { |
| 188 | + // trace if class exists (positive query) or name is valid (negative query) |
| 189 | + MetadataTracer.singleton().traceJNIType(ClassNameSupport.jniNameToTypeName(name.toString())); |
184 | 190 | }
|
185 | 191 | clazz = checkClass(clazz, name.toString());
|
186 | 192 | if (clazz != null) {
|
@@ -274,6 +280,10 @@ private static JNIAccessibleMethod getDeclaredMethod(Class<?> classObject, JNIAc
|
274 | 280 | foundClass = true;
|
275 | 281 | JNIAccessibleMethod method = clazz.getMethod(descriptor);
|
276 | 282 | if (method != null) {
|
| 283 | + if (MetadataTracer.Options.MetadataTracingSupport.getValue() && MetadataTracer.singleton().enabled()) { |
| 284 | + ConfigurationType clazzType = MetadataTracer.singleton().traceJNIType(classObject.getName()); |
| 285 | + clazzType.addMethod(descriptor.getNameConvertToString(), descriptor.getSignatureConvertToString(), ConfigurationMemberInfo.ConfigurationMemberDeclaration.DECLARED); |
| 286 | + } |
277 | 287 | return method;
|
278 | 288 | }
|
279 | 289 | }
|
@@ -329,6 +339,10 @@ private static JNIAccessibleField getDeclaredField(Class<?> classObject, CharSeq
|
329 | 339 | foundClass = true;
|
330 | 340 | JNIAccessibleField field = clazz.getField(name);
|
331 | 341 | if (field != null && (field.isStatic() == isStatic || field.isNegative())) {
|
| 342 | + if (MetadataTracer.Options.MetadataTracingSupport.getValue() && MetadataTracer.singleton().enabled()) { |
| 343 | + ConfigurationType clazzType = MetadataTracer.singleton().traceJNIType(classObject.getName()); |
| 344 | + clazzType.addField(name.toString(), ConfigurationMemberInfo.ConfigurationMemberDeclaration.DECLARED, false); |
| 345 | + } |
332 | 346 | return field;
|
333 | 347 | }
|
334 | 348 | }
|
|
0 commit comments