From 71603566cd0c79e5a17ed6139e4c2bfe2cdebcc4 Mon Sep 17 00:00:00 2001 From: Codrut Stancu Date: Thu, 9 Aug 2018 12:12:40 -0700 Subject: [PATCH] Eagerly resolve fields when creating an AnalysisType. --- .../com/oracle/graal/pointsto/meta/AnalysisType.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java index f3d797575058..c9090da0242e 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java @@ -173,6 +173,17 @@ public class AnalysisType implements WrappedJavaType, OriginalClassProvider, Com */ wrapped.getEnclosingType(); + /* + * Eagerly resolve the instance fields. The wrapped type caches the result, so when + * AnalysisType.getInstanceFields(boolean) is called it will use that cached result. We + * cannot call AnalysisType.getInstanceFields(boolean), and create the corresponding + * AnalysisField objects, directly here because that could lead to a deadlock. + */ + for (ResolvedJavaField field : wrapped.getInstanceFields(false)) { + /* Eagerly resolve the field declared type. */ + field.getType(); + } + /* Ensure the super types as well as the component type (for arrays) is created too. */ getSuperclass(); interfaces = convertTypes(wrapped.getInterfaces());