comparison graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java @ 10062:56fc40ca4ae0

HotSpotResolvedJavaField: don't embed caches of java.lang.{Integer,Long,Boolean} for replacements when compiled in AOT mode (GRAAL-290)
author Bernhard Urban <bernhard.urban@jku.at>
date Sun, 16 Jun 2013 23:55:19 +0200
parents f3330a4487eb
children 9e688291fc53
comparison
equal deleted inserted replaced
10061:b6dfe12478ff 10062:56fc40ca4ae0
30 import java.lang.reflect.*; 30 import java.lang.reflect.*;
31 31
32 import com.oracle.graal.api.meta.*; 32 import com.oracle.graal.api.meta.*;
33 import com.oracle.graal.hotspot.*; 33 import com.oracle.graal.hotspot.*;
34 import com.oracle.graal.options.*; 34 import com.oracle.graal.options.*;
35 import com.oracle.graal.phases.*;
35 import com.oracle.graal.replacements.*; 36 import com.oracle.graal.replacements.*;
36 37
37 /** 38 /**
38 * Represents a field in a HotSpot type. 39 * Represents a field in a HotSpot type.
39 */ 40 */
74 public boolean isInternal() { 75 public boolean isInternal() {
75 return (flags & FIELD_INTERNAL_FLAG) != 0; 76 return (flags & FIELD_INTERNAL_FLAG) != 0;
76 } 77 }
77 78
78 private static final String SystemClassName = MetaUtil.toInternalName(System.class.getName()); 79 private static final String SystemClassName = MetaUtil.toInternalName(System.class.getName());
80 private static final String IntegerCacheClassName = "Ljava/lang/Integer$IntegerCache;";
81 private static final String LongCacheClassName = "Ljava/lang/Long$LongCache;";
82 private static final String BooleanCacheName = MetaUtil.toInternalName(Boolean.class.getName());
83
84 private boolean isConstantCache() {
85 String n = holder.getName();
86 return GraalOptions.AOTCompilation.getValue() && n.equals(IntegerCacheClassName) || n.equals(LongCacheClassName) || n.equals(BooleanCacheName);
87 }
79 88
80 @Override 89 @Override
81 public Constant readConstantValue(Constant receiver) { 90 public Constant readConstantValue(Constant receiver) {
82 if (receiver == null) { 91 if (receiver == null) {
83 assert Modifier.isStatic(flags); 92 assert Modifier.isStatic(flags);
84 if (constant == null) { 93 if (constant == null) {
85 if (holder.isInitialized() && !holder.getName().equals(SystemClassName)) { 94 if (holder.isInitialized() && !holder.getName().equals(SystemClassName) && !isConstantCache()) {
86 if (Modifier.isFinal(getModifiers())) { 95 if (Modifier.isFinal(getModifiers())) {
87 constant = readValue(receiver); 96 constant = readValue(receiver);
88 } 97 }
89 } 98 }
90 } 99 }