# HG changeset patch # User Tom Rodriguez # Date 1394063435 28800 # Node ID 8434ae8c2cdd10eadddde89a7c7d1a3fd59e57a0 # Parent a5fe04acc81a20f058e0210c8bc8f657f76740b7 improve comment diff -r a5fe04acc81a -r 8434ae8c2cdd graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Wed Mar 05 23:58:54 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Wed Mar 05 15:50:35 2014 -0800 @@ -119,17 +119,22 @@ return false; } + /** + * Separate out the static initialization to eliminate cycles between clinit and other locks + * that could lead to deadlock. Static code that doesn't call back into type or field machinery + * is probably ok but anything else should be made lazy. + */ static class Embeddable { - // Return true if it's ok to embed the value of a field. + /** + * @return Return true if it's ok to embed the value of {@code field}. + */ public static boolean test(HotSpotResolvedJavaField field) { return !ImmutableCode.getValue() || !fields.contains(field); } private static final List fields = new ArrayList<>(); static { - // Make this initialization lazy so that we don't create cycles between clinit and other - // locks that could lead to deadlock. try { MetaAccessProvider metaAccess = runtime().getHostProviders().getMetaAccess(); fields.add(metaAccess.lookupJavaField(Boolean.class.getDeclaredField("TRUE")));