diff c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypePrimitive.java @ 1941:79d04223b8a5

Added caching for resolved types and resolved fields. This is crucial, because the local load elimination will lead to wrong results, if field equality (of two RiField objects with the same object and the same RiType) is not given. The caching makes sure that the default equals implementation is sufficient.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Tue, 28 Dec 2010 18:33:26 +0100
parents 71cd4b9610eb
children 177398c6147d
line wrap: on
line diff
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypePrimitive.java	Mon Dec 27 20:35:47 2010 +0100
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypePrimitive.java	Tue Dec 28 18:33:26 2010 +0100
@@ -28,11 +28,21 @@
  *
  * @author Thomas Wuerthinger, Lukas Stadler
  */
-public class HotSpotTypePrimitive implements HotSpotType {
+public final class HotSpotTypePrimitive implements HotSpotType {
 
     private CiKind kind;
 
-    public HotSpotTypePrimitive(CiKind kind) {
+    public static final HotSpotTypePrimitive Boolean = new HotSpotTypePrimitive(CiKind.Boolean);
+    public static final HotSpotTypePrimitive Char = new HotSpotTypePrimitive(CiKind.Char);
+    public static final HotSpotTypePrimitive Float = new HotSpotTypePrimitive(CiKind.Float);
+    public static final HotSpotTypePrimitive Double = new HotSpotTypePrimitive(CiKind.Double);
+    public static final HotSpotTypePrimitive Byte = new HotSpotTypePrimitive(CiKind.Byte);
+    public static final HotSpotTypePrimitive Short = new HotSpotTypePrimitive(CiKind.Short);
+    public static final HotSpotTypePrimitive Int = new HotSpotTypePrimitive(CiKind.Int);
+    public static final HotSpotTypePrimitive Long = new HotSpotTypePrimitive(CiKind.Long);
+    public static final HotSpotTypePrimitive Void = new HotSpotTypePrimitive(CiKind.Void);
+
+    private HotSpotTypePrimitive(CiKind kind) {
         this.kind = kind;
     }