Mercurial > hg > truffle
changeset 14082:8434ae8c2cdd
improve comment
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Wed, 05 Mar 2014 15:50:35 -0800 |
parents | a5fe04acc81a |
children | 1b84e499127b |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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<ResolvedJavaField> 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")));