changeset 22697:848cec401fda

Remove default implementations of LIRKindTool and zapValueForKind.
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 24 Sep 2015 14:29:13 +0200
parents 3c8a7c16c1f9
children d7ebda8d855e
files graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/DefaultHotSpotLIRKindTool.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/DefaultLIRKindTool.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java
diffstat 4 files changed, 27 insertions(+), 153 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java	Thu Sep 24 12:05:43 2015 +0200
+++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java	Thu Sep 24 14:29:13 2015 +0200
@@ -198,6 +198,32 @@
         }
     }
 
+    @Override
+    protected JavaConstant zapValueForKind(PlatformKind kind) {
+        long dead = 0xDEADDEADDEADDEADL;
+        switch ((SPARCKind) kind) {
+            case BYTE:
+                return JavaConstant.forByte((byte) dead);
+            case HWORD:
+                return JavaConstant.forShort((short) dead);
+            case WORD:
+                return JavaConstant.forInt((int) dead);
+            case DWORD:
+                return JavaConstant.forLong(dead);
+            case SINGLE:
+            case V32_BYTE:
+            case V32_HWORD:
+                return JavaConstant.forFloat(Float.intBitsToFloat((int) dead));
+            case DOUBLE:
+            case V64_BYTE:
+            case V64_HWORD:
+            case V64_WORD:
+                return JavaConstant.forDouble(Double.longBitsToDouble(dead));
+            default:
+                throw new IllegalArgumentException(kind.toString());
+        }
+    }
+
     protected LIRInstruction createMove(AllocatableValue dst, Value src) {
         boolean srcIsSlot = isStackSlotValue(src);
         boolean dstIsSlot = isStackSlotValue(dst);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/DefaultHotSpotLIRKindTool.java	Thu Sep 24 12:05:43 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.nodes.type;
-
-import jdk.internal.jvmci.meta.JavaKind;
-import jdk.internal.jvmci.meta.LIRKind;
-import jdk.internal.jvmci.meta.PlatformKind;
-
-import com.oracle.graal.lir.gen.DefaultLIRKindTool;
-
-public class DefaultHotSpotLIRKindTool extends DefaultLIRKindTool implements HotSpotLIRKindTool {
-
-    public DefaultHotSpotLIRKindTool(PlatformKind wordKind) {
-        super(wordKind);
-    }
-
-    public LIRKind getNarrowOopKind() {
-        return LIRKind.reference(JavaKind.Int);
-    }
-
-    public LIRKind getNarrowPointerKind() {
-        return LIRKind.value(JavaKind.Int);
-    }
-}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/DefaultLIRKindTool.java	Thu Sep 24 12:05:43 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.lir.gen;
-
-import jdk.internal.jvmci.common.JVMCIError;
-import jdk.internal.jvmci.meta.JavaKind;
-import jdk.internal.jvmci.meta.LIRKind;
-import jdk.internal.jvmci.meta.PlatformKind;
-
-import com.oracle.graal.compiler.common.spi.LIRKindTool;
-
-/**
- * Default implementation of {@link LIRKindTool}. Returns the normal Java kind for primitive types.
- * Subclasses still have to implement {@link #getObjectKind}.
- */
-public class DefaultLIRKindTool implements LIRKindTool {
-
-    private final PlatformKind wordKind;
-
-    public DefaultLIRKindTool(PlatformKind wordKind) {
-        this.wordKind = wordKind;
-    }
-
-    public LIRKind getIntegerKind(int bits) {
-        if (bits <= 8) {
-            return LIRKind.value(JavaKind.Byte);
-        } else if (bits <= 16) {
-            return LIRKind.value(JavaKind.Short);
-        } else if (bits <= 32) {
-            return LIRKind.value(JavaKind.Int);
-        } else {
-            assert bits <= 64;
-            return LIRKind.value(JavaKind.Long);
-        }
-    }
-
-    public LIRKind getFloatingKind(int bits) {
-        switch (bits) {
-            case 32:
-                return LIRKind.value(JavaKind.Float);
-            case 64:
-                return LIRKind.value(JavaKind.Double);
-            default:
-                throw JVMCIError.shouldNotReachHere();
-        }
-    }
-
-    public LIRKind getObjectKind() {
-        return LIRKind.reference(wordKind);
-    }
-
-    public LIRKind getWordKind() {
-        return LIRKind.value(wordKind);
-    }
-}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java	Thu Sep 24 12:05:43 2015 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java	Thu Sep 24 14:29:13 2015 +0200
@@ -391,31 +391,7 @@
     /**
      * Gets a garbage value for a given kind.
      */
-    protected JavaConstant zapValueForKind(PlatformKind kind) {
-        long dead = 0xDEADDEADDEADDEADL;
-        switch ((JavaKind) kind) {
-            case Boolean:
-                return JavaConstant.FALSE;
-            case Byte:
-                return JavaConstant.forByte((byte) dead);
-            case Char:
-                return JavaConstant.forChar((char) dead);
-            case Short:
-                return JavaConstant.forShort((short) dead);
-            case Int:
-                return JavaConstant.forInt((int) dead);
-            case Double:
-                return JavaConstant.forDouble(Double.longBitsToDouble(dead));
-            case Float:
-                return JavaConstant.forFloat(Float.intBitsToFloat((int) dead));
-            case Long:
-                return JavaConstant.forLong(dead);
-            case Object:
-                return JavaConstant.NULL_POINTER;
-            default:
-                throw new IllegalArgumentException(kind.toString());
-        }
-    }
+    protected abstract JavaConstant zapValueForKind(PlatformKind kind);
 
     public LIRKind getLIRKind(Stamp stamp) {
         return stamp.getLIRKind(lirKindTool);
@@ -431,15 +407,6 @@
         }
     }
 
-    public LIRKind toRegisterKind(LIRKind kind) {
-        JavaKind stackKind = ((JavaKind) kind.getPlatformKind()).getStackKind();
-        if (stackKind != kind.getPlatformKind()) {
-            return kind.changeType(stackKind);
-        } else {
-            return kind;
-        }
-    }
-
     public AbstractBlockBase<?> getCurrentBlock() {
         return currentBlock;
     }