# HG changeset patch # User Bernhard Urban # Date 1371419719 -7200 # Node ID 56fc40ca4ae083720d5dd7c7f5ef09bea5cbc744 # Parent b6dfe12478ff3f471a308598fda263eec7980957 HotSpotResolvedJavaField: don't embed caches of java.lang.{Integer,Long,Boolean} for replacements when compiled in AOT mode (GRAAL-290) diff -r b6dfe12478ff -r 56fc40ca4ae0 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 Mon Jun 17 08:30:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Sun Jun 16 23:55:19 2013 +0200 @@ -32,6 +32,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.options.*; +import com.oracle.graal.phases.*; import com.oracle.graal.replacements.*; /** @@ -76,13 +77,21 @@ } private static final String SystemClassName = MetaUtil.toInternalName(System.class.getName()); + private static final String IntegerCacheClassName = "Ljava/lang/Integer$IntegerCache;"; + private static final String LongCacheClassName = "Ljava/lang/Long$LongCache;"; + private static final String BooleanCacheName = MetaUtil.toInternalName(Boolean.class.getName()); + + private boolean isConstantCache() { + String n = holder.getName(); + return GraalOptions.AOTCompilation.getValue() && n.equals(IntegerCacheClassName) || n.equals(LongCacheClassName) || n.equals(BooleanCacheName); + } @Override public Constant readConstantValue(Constant receiver) { if (receiver == null) { assert Modifier.isStatic(flags); if (constant == null) { - if (holder.isInitialized() && !holder.getName().equals(SystemClassName)) { + if (holder.isInitialized() && !holder.getName().equals(SystemClassName) && !isConstantCache()) { if (Modifier.isFinal(getModifiers())) { constant = readValue(receiver); } diff -r b6dfe12478ff -r 56fc40ca4ae0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerifcationPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerifcationPhase.java Mon Jun 17 08:30:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerifcationPhase.java Sun Jun 16 23:55:19 2013 +0200 @@ -31,7 +31,7 @@ @Override protected boolean verify(StructuredGraph graph) { for (ConstantNode node : graph.getNodes().filter(ConstantNode.class)) { - assert !isOop(node) || isNullReference(node) || isString(node) : "embedded oop: " + node; + assert !isOop(node) || isNullReference(node) || isString(node) : "embedded oop: " + node + ". toString: " + node.asConstant().asObject(); } return true; }